summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChengyi Zhao <chengyi1.zhao@archermind.com>2013-07-23 17:45:31 +0800
committerZhang zhengguang <zhengguang.zhang@intel.com>2013-07-26 11:27:11 +0800
commit580510032c2769cec5aefcbac729de6c65b8c94f (patch)
treeae049b8404278ad9875006972aa885ad44affb3a /src
parentfa01dee18f0a7d117250713ac3129516639dc8d0 (diff)
downloadconnman-580510032c2769cec5aefcbac729de6c65b8c94f.tar.gz
connman-580510032c2769cec5aefcbac729de6c65b8c94f.tar.bz2
connman-580510032c2769cec5aefcbac729de6c65b8c94f.zip
Tethering: Optimize the interface between connman and mobileap-agent
Diffstat (limited to 'src')
-rw-r--r--src/technology.c10
-rw-r--r--src/tethering.c37
2 files changed, 19 insertions, 28 deletions
diff --git a/src/technology.c b/src/technology.c
index 041e43e1..be28661a 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -1073,9 +1073,15 @@ static const GDBusSignalTable technology_signals[] = {
{ GDBUS_SIGNAL("PropertyChanged",
GDBUS_ARGS({ "name", "s" }, { "value", "v" })) },
{ GDBUS_SIGNAL("DhcpConnected",
- GDBUS_ARGS({ "name", "s" })) },
+ GDBUS_ARGS({ "aptype", "s" },
+ { "ipaddr", "s" },
+ { "macaddr", "s" },
+ { "hostname", "s" })) },
{ GDBUS_SIGNAL("DhcpLeaseDeleted",
- GDBUS_ARGS({ "name", "s" })) },
+ GDBUS_ARGS({ "aptype", "s" },
+ { "ipaddr", "s" },
+ { "macaddr", "s" },
+ { "hostname", "s" })) },
{ },
};
diff --git a/src/tethering.c b/src/tethering.c
index 95dbe99f..ef5fd7af 100644
--- a/src/tethering.c
+++ b/src/tethering.c
@@ -91,42 +91,27 @@ struct connman_station_info {
};
static void emit_station_signal(char *action_str,
- const struct connman_station_info *station_info)
+ const struct connman_station_info *station_info)
{
- DBusMessage *message;
- DBusMessageIter iter;
char *ip, *mac, *hostname;
if (station_info->path == NULL || station_info->type == NULL
- || station_info->ip == NULL || station_info->mac == NULL
- || station_info->hostname == NULL)
+ || station_info->ip == NULL || station_info->mac == NULL
+ || station_info->hostname == NULL)
return;
ip = g_strdup(station_info->ip);
mac = g_strdup(station_info->mac);
hostname = g_strdup(station_info->hostname);
- message = dbus_message_new_signal(station_info->path,
- CONNMAN_TECHNOLOGY_INTERFACE,
- action_str);
- if (message == NULL) {
- g_free(ip);
- g_free(mac);
- g_free(hostname);
- return;
- }
-
- dbus_message_iter_init_append(message, &iter);
+ g_dbus_emit_signal(connection, station_info->path,
+ CONNMAN_TECHNOLOGY_INTERFACE, action_str,
+ DBUS_TYPE_STRING, &station_info->type,
+ DBUS_TYPE_STRING, &ip,
+ DBUS_TYPE_STRING, &mac,
+ DBUS_TYPE_STRING, &hostname,
+ DBUS_TYPE_INVALID);
- if (dbus_message_iter_append_basic
- (&iter, DBUS_TYPE_STRING, &station_info->type)
- && dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &ip)
- && dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &mac)
- && dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
- &hostname))
- dbus_connection_send(connection, message, NULL);
-
- dbus_message_unref(message);
g_free(ip);
g_free(mac);
g_free(hostname);
@@ -164,7 +149,7 @@ static void save_dhcp_ack_lease_info(char *hostname,
snprintf(sta_mac, CONNMAN_STATION_MAC_INFO_LEN,
"%02x:%02x:%02x:%02x:%02x:%02x",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
- lower_mac = g_ascii_strdown(mac, -1);
+ lower_mac = g_ascii_strdown(sta_mac, -1);
info_found = g_hash_table_lookup(sta_hash, lower_mac);
if (info_found == NULL) {