Hi All,
Here's the code attached
DBUS_NETWORK_MANAGER_SYSYEM_SERVICE_NAME,
m_strDhcp4Config.toAscii().data(),
DBUS_NETWORK_MANAGER_SYSTEM_PROPERTIES_INTERFACE,
QDBusReply< QVariantMap > result = busInterface.call(GETALL,
DBUS_NETWORK_MANAGER_SYSTEM_ACTIVE_DHCP4CONFIG_INTERFACE);
if(result.isValid())
{
qDebug() << "Success";
QVariantMap propertiesMap = result.value();
QDBusArgument optionsArgument
= qvariant_cast<QDBusArgument>
(propertiesMap.
value("Options"));
propertiesMap.clear();
optionsArgument.beginArray();
while ( !optionsArgument.atEnd() ) {
optionsArgument.beginMapEntry();
optionsArgument >> key >> value;
optionsArgument.endMapEntry();
propertiesMap.insert( key, value);
}
optionsArgument.endArray();
}
QDBusInterface busInterface(
DBUS_NETWORK_MANAGER_SYSYEM_SERVICE_NAME,
m_strDhcp4Config.toAscii().data(),
DBUS_NETWORK_MANAGER_SYSTEM_PROPERTIES_INTERFACE,
QDBusConnection::systemBus());
QDBusReply< QVariantMap > result = busInterface.call(GETALL,
DBUS_NETWORK_MANAGER_SYSTEM_ACTIVE_DHCP4CONFIG_INTERFACE);
if(result.isValid())
{
qDebug() << "Success";
QVariantMap propertiesMap = result.value();
QDBusArgument optionsArgument = qvariant_cast<QDBusArgument>(propertiesMap.value("Options"));
propertiesMap.clear();
optionsArgument.beginArray();
while ( !optionsArgument.atEnd() ) {
QVariant key;
QVariant value;
optionsArgument.beginMapEntry();
optionsArgument >> key >> value;
optionsArgument.endMapEntry();
propertiesMap.insert( key, value);
}
optionsArgument.endArray();
}
To copy to clipboard, switch view to plain text mode
I get this error "QDBusArgument: write from a read-only object" on the lines "optionsArgument.beginMapEntry();" and "optionsArgument.endMapEntry();"
The response I'm looking to parse is
"{u'broadcast_address': u'10.244.10.255',
u'dhcp_lease_time': u'691200',
u'dhcp_message_type': u'5',
u'dhcp_rebinding_time': u'604800',
u'dhcp_renewal_time': u'345600',
u'dhcp_server_identifier': u'10.244.0.99',
u'domain_name': u'persistent.co.in',
u'domain_name_servers': u'10.244.0.100 10.244.0.99',
u'expiry': u'1363079647',
u'filename': u'smsboot\\x86\\wdsnbp.com',
u'ip_address': u'10.244.10.232',
u'netbios_name_servers': u'10.244.0.100',
u'network_number': u'10.244.10.0',
u'routers': u'10.244.10.1',
u'subnet_mask': u'255.255.255.0'}"
Kindly suggest how can I parse this value appropriately..
Thanks,
Volcano
Bookmarks