From: Henrique Dante de Almeida Date: Fri, 18 May 2012 20:30:06 +0000 (-0300) Subject: Convert GDBus methods and signals to use macro helpers X-Git-Tag: 1.1~56 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0bb3ef14d109f12fbb629e623b5c460915425e70;p=platform%2Fupstream%2Fconnman.git Convert GDBus methods and signals to use macro helpers With these macro helpers we can separate in/out arguments and use their own vector. --- diff --git a/plugins/nmcompat.c b/plugins/nmcompat.c index 6299c34..680cdf8 100644 --- a/plugins/nmcompat.c +++ b/plugins/nmcompat.c @@ -221,13 +221,17 @@ static DBusMessage *property_get(DBusConnection *conn, } static const GDBusMethodTable methods[] = { - { "Get", "ss", "v", property_get }, + { _GDBUS_METHOD("Get", "ss", "v", + GDBUS_ARGS({ "interface", "s" }, { "key", "s" }), + GDBUS_ARGS({ "property", "v" }), property_get) }, { }, }; static const GDBusSignalTable signals[] = { - { "PropertiesChanged", "a{sv}" }, - { "StateChanged", "u" }, + { _GDBUS_SIGNAL("PropertiesChanged", "a{sv}", + GDBUS_ARGS({ "properties", "a{sv}" })) }, + { _GDBUS_SIGNAL("StateChanged", "u", + GDBUS_ARGS({ "state", "u" })) }, { }, }; diff --git a/src/clock.c b/src/clock.c index 41e431f..5562e52 100644 --- a/src/clock.c +++ b/src/clock.c @@ -309,13 +309,18 @@ static DBusMessage *set_property(DBusConnection *conn, } static const GDBusMethodTable clock_methods[] = { - { "GetProperties", "", "a{sv}", get_properties }, - { "SetProperty", "sv", "", set_property }, + { _GDBUS_METHOD("GetProperties", "", "a{sv}", + NULL, GDBUS_ARGS({ "properties", "a{sv}" }), + get_properties) }, + { _GDBUS_METHOD("SetProperty", "sv", "", + GDBUS_ARGS({ "name", "s" }, { "value", "v" }), NULL, + set_property) }, { }, }; static const GDBusSignalTable clock_signals[] = { - { "PropertyChanged", "sv" }, + { _GDBUS_SIGNAL("PropertyChanged", "sv", + GDBUS_ARGS({ "name", "s" }, { "value", "v" })) }, { }, }; diff --git a/src/manager.c b/src/manager.c index b448185..33b50e2 100644 --- a/src/manager.c +++ b/src/manager.c @@ -394,33 +394,68 @@ static DBusMessage *release_private_network(DBusConnection *conn, } static const GDBusMethodTable manager_methods[] = { - { "GetProperties", "", "a{sv}", get_properties }, - { "SetProperty", "sv", "", set_property, - G_DBUS_METHOD_FLAG_ASYNC }, - { "GetTechnologies", "", "a(oa{sv})", get_technologies }, - { "RemoveProvider", "o", "", remove_provider }, - { "GetServices", "", "a(oa{sv})", get_services }, - { "ConnectProvider", "a{sv}", "o", connect_provider, - G_DBUS_METHOD_FLAG_ASYNC }, - { "RegisterAgent", "o", "", register_agent }, - { "UnregisterAgent", "o", "", unregister_agent }, - { "RegisterCounter", "ouu", "", register_counter }, - { "UnregisterCounter", "o", "", unregister_counter }, - { "CreateSession", "a{sv}o", "o", create_session }, - { "DestroySession", "o", "", destroy_session }, - { "RequestPrivateNetwork", "", "oa{sv}h", - request_private_network, - G_DBUS_METHOD_FLAG_ASYNC }, - { "ReleasePrivateNetwork", "o", "", - release_private_network }, + { _GDBUS_METHOD("GetProperties", "", "a{sv}", + NULL, GDBUS_ARGS({ "properties", "a{sv}" }), + get_properties) }, + { _GDBUS_ASYNC_METHOD("SetProperty", "sv", "", + GDBUS_ARGS({ "properties", "a{sv}" }), NULL, + set_property) }, + { _GDBUS_METHOD("GetTechnologies", "", "a(oa{sv})", + NULL, GDBUS_ARGS({ "technologies", "a(oa{sv})" }), + get_technologies) }, + { _GDBUS_METHOD("RemoveProvider", "o", "", + GDBUS_ARGS({ "provider", "o" }), NULL, + remove_provider) }, + { _GDBUS_METHOD("GetServices", "", "a(oa{sv})", + NULL, GDBUS_ARGS({ "services", "a(oa{sv})" }), + get_services) }, + { _GDBUS_ASYNC_METHOD("ConnectProvider", "a{sv}", "o", + GDBUS_ARGS({ "provider", "a{sv}" }), + GDBUS_ARGS({ "path", "o" }), + connect_provider) }, + { _GDBUS_METHOD("RegisterAgent", "o", "", + GDBUS_ARGS({ "path", "o" }), NULL, + register_agent) }, + { _GDBUS_METHOD("UnregisterAgent", "o", "", + GDBUS_ARGS({ "path", "o" }), NULL, + unregister_agent) }, + { _GDBUS_METHOD("RegisterCounter", "ouu", "", + GDBUS_ARGS({ "path", "o" }, { "accuracy", "u" }, + { "period", "u" }), + NULL, register_counter) }, + { _GDBUS_METHOD("UnregisterCounter", "o", "", + GDBUS_ARGS({ "path", "o" }), NULL, + unregister_counter) }, + { _GDBUS_METHOD("CreateSession", "a{sv}o", "o", + GDBUS_ARGS({ "settings", "a{sv}" }, + { "notifier", "o" }), + GDBUS_ARGS({ "session", "o" }), + create_session) }, + { _GDBUS_METHOD("DestroySession", "o", "", + GDBUS_ARGS({ "session", "o" }), NULL, + destroy_session) }, + { _GDBUS_ASYNC_METHOD("RequestPrivateNetwork", "", "oa{sv}h", + NULL, GDBUS_ARGS({ "path", "o" }, + { "settings", "a{sv}" }, + { "socket", "h" }), + request_private_network) }, + { _GDBUS_METHOD("ReleasePrivateNetwork", "o", "", + GDBUS_ARGS({ "path", "o" }), NULL, + release_private_network) }, { }, }; static const GDBusSignalTable manager_signals[] = { - { "PropertyChanged", "sv" }, - { "TechnologyAdded", "oa{sv}" }, - { "TechnologyRemoved", "o" }, - { "ServicesChanged", "a(oa{sv})ao" }, + { _GDBUS_SIGNAL("PropertyChanged", "sv", + GDBUS_ARGS({ "name", "s" }, { "value", "v" })) }, + { _GDBUS_SIGNAL("TechnologyAdded", "oa{sv}", + GDBUS_ARGS({ "path", "o" }, + { "properties", "a{sv}" })) }, + { _GDBUS_SIGNAL("TechnologyRemoved", "o", + GDBUS_ARGS({ "path", "o" })) }, + { _GDBUS_SIGNAL("ServicesChanged", "a(oa{sv})ao", + GDBUS_ARGS({ "services_changed", "a(oa{sv})" }, + { "services_removed", "ao" })) }, { }, }; diff --git a/src/service.c b/src/service.c index 595a377..84a1124 100644 --- a/src/service.c +++ b/src/service.c @@ -3812,22 +3812,33 @@ static void service_schedule_removed(struct connman_service *service) } static const GDBusMethodTable service_methods[] = { - { "GetProperties", "", "a{sv}", get_properties, - G_DBUS_METHOD_FLAG_DEPRECATED }, - { "SetProperty", "sv", "", set_property }, - { "ClearProperty", "s", "", clear_property }, - { "Connect", "", "", connect_service, - G_DBUS_METHOD_FLAG_ASYNC }, - { "Disconnect", "", "", disconnect_service }, - { "Remove", "", "", remove_service }, - { "MoveBefore", "o", "", move_before }, - { "MoveAfter", "o", "", move_after }, - { "ResetCounters", "", "", reset_counters }, + { _GDBUS_DEPRECATED_METHOD("GetProperties", "", "a{sv}", + NULL, GDBUS_ARGS({ "properties", "a{sv}" }), + get_properties) }, + { _GDBUS_METHOD("SetProperty", "sv", "", + GDBUS_ARGS({ "name", "s" }, { "value", "v" }), + NULL, set_property) }, + { _GDBUS_METHOD("ClearProperty", "s", "", + GDBUS_ARGS({ "name", "s" }), NULL, + clear_property) }, + { _GDBUS_ASYNC_METHOD("Connect", "", "", NULL, NULL, + connect_service) }, + { _GDBUS_METHOD("Disconnect", "", "", NULL, NULL, + disconnect_service) }, + { _GDBUS_METHOD("Remove", "", "", NULL, NULL, remove_service) }, + { _GDBUS_METHOD("MoveBefore", "o", "", + GDBUS_ARGS({ "service", "o" }), NULL, + move_before) }, + { _GDBUS_METHOD("MoveAfter", "o", "", + GDBUS_ARGS({ "service", "o" }), NULL, + move_after) }, + { _GDBUS_METHOD("ResetCounters", "", "", NULL, NULL, reset_counters) }, { }, }; static const GDBusSignalTable service_signals[] = { - { "PropertyChanged", "sv" }, + { _GDBUS_SIGNAL("PropertyChanged", "sv", + GDBUS_ARGS({ "name", "s" }, { "value", "v" })) }, { }, }; diff --git a/src/session.c b/src/session.c index 50f6061..c73db63 100644 --- a/src/session.c +++ b/src/session.c @@ -1556,10 +1556,13 @@ static DBusMessage *destroy_session(DBusConnection *conn, } static const GDBusMethodTable session_methods[] = { - { "Destroy", "", "", destroy_session }, - { "Connect", "", "", connect_session }, - { "Disconnect", "", "", disconnect_session }, - { "Change", "sv", "", change_session }, + { _GDBUS_METHOD("Destroy", "", "", NULL, NULL, destroy_session) }, + { _GDBUS_METHOD("Connect", "", "", NULL, NULL, connect_session) }, + { _GDBUS_METHOD("Disconnect", "", "", NULL, NULL, + disconnect_session ) }, + { _GDBUS_METHOD("Change", "sv", "", + GDBUS_ARGS({ "name", "s" }, { "value", "v" }), + NULL, change_session) }, { }, }; diff --git a/src/technology.c b/src/technology.c index 30a9f4d..5cb6ddb 100644 --- a/src/technology.c +++ b/src/technology.c @@ -859,16 +859,19 @@ static DBusMessage *scan(DBusConnection *conn, DBusMessage *msg, void *data) } static const GDBusMethodTable technology_methods[] = { - { "GetProperties", "", "a{sv}", get_properties, - G_DBUS_METHOD_FLAG_DEPRECATED }, - { "SetProperty", "sv", "", set_property }, - { "Scan", "", "", scan, - G_DBUS_METHOD_FLAG_ASYNC }, + { _GDBUS_DEPRECATED_METHOD("GetProperties", "", "a{sv}", + NULL, GDBUS_ARGS({ "properties", "a{sv}" }), + get_properties) }, + { _GDBUS_METHOD("SetProperty", "sv", "", + GDBUS_ARGS({ "name", "s" }, { "value", "v" }), + NULL, set_property) }, + { _GDBUS_ASYNC_METHOD("Scan", "", "", NULL, NULL, scan) }, { }, }; static const GDBusSignalTable technology_signals[] = { - { "PropertyChanged", "sv" }, + { _GDBUS_SIGNAL("PropertyChanged", "sv", + GDBUS_ARGS({ "name", "s" }, { "value", "v" })) }, { }, }; diff --git a/unit/session-api.c b/unit/session-api.c index c5b7b6c..27ca2c7 100644 --- a/unit/session-api.c +++ b/unit/session-api.c @@ -286,8 +286,10 @@ static DBusMessage *notify_update(DBusConnection *conn, } static const GDBusMethodTable notify_methods[] = { - { "Release", "", "", notify_release }, - { "Update", "a{sv}", "", notify_update }, + { _GDBUS_METHOD("Release", "", "", NULL, NULL, notify_release) }, + { _GDBUS_METHOD("Update", "a{sv}", "", + GDBUS_ARGS({ "settings", "a{sv}" }), NULL, + notify_update) }, { }, };