IPSP : Tie connected info and Interface Info 49/83349/6 accepted/tizen/common/20160812.141000 accepted/tizen/ivi/20160812.065435 accepted/tizen/mobile/20160812.065418 accepted/tizen/tv/20160812.065430 accepted/tizen/wearable/20160812.065424 submit/tizen/20160812.010225
authorTaejin Woo <tt.woo@samsung.com>
Thu, 11 Aug 2016 05:03:05 +0000 (14:03 +0900)
committerTaejin Woo <tt.woo@samsung.com>
Thu, 11 Aug 2016 05:16:35 +0000 (14:16 +0900)
When connected between two device, they already know Interface info

Change-Id: I53800bb80868d69159f4291eaf4a462e3a7433c4
Signed-off-by: Taejin Woo <tt.woo@samsung.com>
src/device.c

index 50baf24..998c3eb 100644 (file)
@@ -4022,6 +4022,8 @@ static const GDBusSignalTable device_signals[] = {
                                { "max_tx_time", "q" },
                                { "max_rx_octets", "q"},
                                { "max_rx_time", "q"})) },
+       { GDBUS_SIGNAL("IpspStateChanged",
+                       GDBUS_ARGS({"connected","b"},{"if_name","s"}))},
 };
 #endif
 
@@ -7061,6 +7063,8 @@ gboolean device_is_ipsp_connected(struct btd_device * device)
 void device_set_ipsp_connected(struct btd_device *device, gboolean connected,
                                        const unsigned char *ifname)
 {
+       char *iface_name = NULL;
+
        if (device == NULL) {
                error("device is NULL");
                return;
@@ -7073,15 +7077,18 @@ void device_set_ipsp_connected(struct btd_device *device, gboolean connected,
 
        memset(device->if_name, 0, sizeof(device->if_name));
        memcpy(device->if_name, ifname, 16);
+       iface_name = device->if_name;
 
        DBG("ipsp_connected %d", connected);
-       DBG("ipsp_iface: %s is Up !", device->if_name);
+       DBG("ipsp_iface: %s is Up !", iface_name);
 
-       g_dbus_emit_property_changed(dbus_conn, device->path,
-                       DEVICE_INTERFACE, "IpspConnected");
-       g_dbus_emit_property_changed(dbus_conn, device->path,
-                       DEVICE_INTERFACE, "IpspBtInterfaceInfo");
+       g_dbus_emit_signal(dbus_conn, device->path,
+                       DEVICE_INTERFACE, "IpspStateChanged",
+                       DBUS_TYPE_BOOLEAN, &connected,
+                       DBUS_TYPE_STRING, &iface_name,
+                       DBUS_TYPE_INVALID);
 }
+
 void device_le_data_length_changed(struct btd_device *device, uint16_t max_tx_octets,
                uint16_t max_tx_time, uint16_t max_rx_octets,uint16_t max_rx_time)
 {