Message PropertiesAdaptor::Get(const CallMessage &call) { MessageIter ri = call.reader(); std::string iface_name; std::string property_name; ri >> iface_name >> property_name; debug_log("requesting property %s on interface %s", property_name.c_str(), iface_name.c_str()); InterfaceAdaptor *interface = (InterfaceAdaptor *) find_interface(iface_name); if (!interface) throw ErrorFailed("requested interface not found"); Variant *value = interface->get_property(property_name); if (!value) throw ErrorFailed("requested property not found"); on_get_property(*interface, property_name, *value); ReturnMessage reply(call); MessageIter wi = reply.writer(); wi << *value; return reply; }
Message PropertiesAdaptor::Set(const CallMessage &call) { MessageIter ri = call.reader(); std::string iface_name; std::string property_name; Variant value; ri >> iface_name >> property_name >> value; InterfaceAdaptor *interface = (InterfaceAdaptor *) find_interface(iface_name); if (!interface) throw ErrorFailed("requested interface not found"); on_set_property(*interface, property_name, value); interface->set_property(property_name, value); ReturnMessage reply(call); return reply; }