GVariant* AbstractDBusInterface::getProperty(GDBusConnection* connection, const gchar* sender, const gchar* objectPath, const gchar* interfaceName, const gchar* propertyName, GError** error, gpointer userData) { if(DebugOut::getDebugThreshhold() >= 6) { DebugOut(6)<<"DBus GetProperty call from: "<<sender<< " pid: " <<getPid(sender)<< " interface: "<<interfaceName<<" property: "<<propertyName<<endl; DebugOut(6)<<"DBus GetProperty call path: "<<objectPath<<endl; } std::string pn = propertyName; if(pn == "Time") { if(objectMap.find(objectPath) == objectMap.end()) { DebugOut(DebugOut::Error)<<objectPath<<" is not a valid object path."<<endl; return nullptr; } double time = objectMap[objectPath]->time(); GVariant* value = g_variant_new("d", time); return value; } else if(boost::ends_with(pn, "Sequence")) { AbstractDBusInterface* t = static_cast<AbstractDBusInterface*>(userData); int pos = pn.find("Sequence"); std::string p = pn.substr(0,pos); VariantType * theProperty = t->property(p); if(!theProperty) { DebugOut(DebugOut::Error)<<"Invalid Sequence property: "<<p<<endl; return nullptr; } int sequence = theProperty->sequence(); GVariant* value = g_variant_new("i", sequence); return value; } else if(boost::ends_with(pn, "ValueQuality")) { AbstractDBusInterface* t = static_cast<AbstractDBusInterface*>(userData); int pos = pn.find("ValueQuality"); std::string p = pn.substr(0, pos); VariantType * theProperty = t->property(p); if(!theProperty) { DebugOut(DebugOut::Error)<<"Invalid ValueQuality property: "<<p<<endl; return nullptr; } int quality = theProperty->value()->valueQuality; GVariant* value = g_variant_new("i", quality); return value; } else if(boost::ends_with(pn, "UpdateFrequency")) { AbstractDBusInterface* t = static_cast<AbstractDBusInterface*>(userData); int pos = pn.find("UpdateFrequency"); std::string p = pn.substr(0, pos); VariantType * theProperty = t->property(p); if(!theProperty) { DebugOut(DebugOut::Error)<<"Invalid UpdateFrequency property: "<<p<<endl; return nullptr; } int freq = theProperty->updateFrequency(); GVariant* value = g_variant_new("i", freq); return value; } else if(pn == "Zone") { if(objectMap.find(objectPath) == objectMap.end()) { DebugOut(DebugOut::Error)<<objectPath<<" is not a valid object path."<<endl; return nullptr; } Zone::Type zone = objectMap[objectPath]->zone(); GVariant* value = g_variant_new("i",(int)zone); return value; } if(objectMap.count(objectPath)) { GVariant* value = objectMap[objectPath]->getProperty(propertyName); DebugOut(6) << "Returning value for: " << propertyName << endl; return value; } DebugOut(DebugOut::Error)<<"No interface for" << interfaceName <<endl; return nullptr; }