From 94de77a7568dcd267b5b5e47206a40d1bbfc0f92 Mon Sep 17 00:00:00 2001 From: Taejin Woo Date: Thu, 11 Aug 2016 14:03:05 +0900 Subject: [PATCH] IPSP : Tie connected info and Interface Info When connected between two device, they already know Interface info Change-Id: I53800bb80868d69159f4291eaf4a462e3a7433c4 Signed-off-by: Taejin Woo --- src/device.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/device.c b/src/device.c index 50baf24..998c3eb 100644 --- a/src/device.c +++ b/src/device.c @@ -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) { -- 2.7.4