IPSP : Handle BT interface info event or property emitted from bluez 98/58198/3 accepted/tizen/common/20160609.145517 accepted/tizen/ivi/20160609.090242 accepted/tizen/mobile/20160609.090201 accepted/tizen/tv/20160609.090308 accepted/tizen/wearable/20160609.090231 submit/tizen/20160608.051814
authorparas.kumar <paras.kumar@samsung.com>
Thu, 28 Jan 2016 08:42:45 +0000 (14:12 +0530)
committerTaejin Woo <tt.woo@samsung.com>
Wed, 8 Jun 2016 02:18:50 +0000 (11:18 +0900)
This patch is to handle the property emitted from bluez for BT interface
info after IPSP connection. Add bluetooth event for the same.

Change-Id: Ib38a6b0a7f12442a693b84507edf3f8ef8037f9a
Signed-off-by: paras.kumar <paras.kumar@samsung.com>
bt-api/bt-event-handler.c [changed mode: 0755->0644]
bt-service/bt-service-event-receiver.c
bt-service/bt-service-event-sender.c [changed mode: 0755->0644]
include/bluetooth-api.h
include/bt-internal-types.h

old mode 100755 (executable)
new mode 100644 (file)
index 8aeed56..3f23efb
@@ -1020,6 +1020,21 @@ void __bt_device_event_filter(GDBusConnection *connection,
                _bt_common_event_cb(BLUETOOTH_EVENT_IPSP_DISCONNECTED,
                                result, &dev_address,
                                event_info->cb, event_info->user_data);
+       } else if (strcasecmp(signal_name, BT_IPSP_BT_INTERFACE_INFO) == 0) {
+               const char *address = NULL;
+               const char *if_name = NULL;
+               bt_ipsp_interface_info_t ipsp_iface_info;
+               memset(&ipsp_iface_info, 0, sizeof(ipsp_iface_info));
+
+               BT_DBG("BT_IPSP_BT_INTERFACE_INFO");
+               g_variant_get(parameters, "(i&s&s)", &result, &address, &if_name);
+
+               _bt_convert_addr_string_to_type(ipsp_iface_info.btaddr.addr, address);
+               memcpy(ipsp_iface_info.if_name, if_name, 16);
+
+               _bt_common_event_cb(BLUETOOTH_EVENT_IPSP_BT_INTERFACE_INFO,
+                               result, &ipsp_iface_info,
+                               event_info->cb, event_info->user_data);
        } else if (strcasecmp(signal_name, BT_LE_DATA_LENGTH_CHANGED) == 0) {
                const char *address = NULL;
                bluetooth_device_address_t dev_address = { {0} };
index 81cba0d7dbde345df88e3458997063e9eb1f07da..5ffc0abe8d31f3d8f94b078679ac87f47e6b8b02 100644 (file)
@@ -1114,6 +1114,24 @@ static void __bt_device_property_changed_event(GVariant *msg, const char *path)
                                        event,
                                        param);
                        g_free(address);
+               } else if (strcasecmp(property, "IpspBtInterfaceInfo") == 0) {
+                       char *ifname = NULL;
+
+                       g_variant_get(val, "s", &ifname);
+
+                       address = g_malloc0(BT_ADDRESS_STRING_SIZE);
+
+                       _bt_convert_device_path_to_address(path, address);
+
+                       BT_DBG("Ipsp BT Interface Name: %s", ifname);
+                       BT_DBG("address: %s", address);
+                       param = g_variant_new("(iss)", result, address, ifname);
+
+                       /* Send event to application */
+                       _bt_send_event(BT_DEVICE_EVENT,
+                                       BLUETOOTH_EVENT_IPSP_BT_INTERFACE_INFO,
+                                       param);
+                       g_free(address);
                }
        }
        BT_DBG("-");
old mode 100755 (executable)
new mode 100644 (file)
index 1bd632c..f539589
@@ -395,6 +395,9 @@ int _bt_send_event(int event_type, int event, GVariant *param)
        case BLUETOOTH_EVENT_IPSP_DISCONNECTED:
                signal = BT_IPSP_DISCONNECTED;
                break;
+       case BLUETOOTH_EVENT_IPSP_BT_INTERFACE_INFO:
+               signal = BT_IPSP_BT_INTERFACE_INFO;
+               break;
        case BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED:
                signal = BT_GATT_CHAR_VAL_CHANGED;
                break;
index 9fd0d404a88ebbd105bfedb4870664cecf89ce31..cf1f23077243ccd5a6c06a4035c3501224145f09 100644 (file)
@@ -633,6 +633,7 @@ typedef enum {
        BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED = BLUETOOTH_EVENT_IPSP_BASE, /**<IPSP init event*/
        BLUETOOTH_EVENT_IPSP_CONNECTED, /**< IPSP connected event  */
        BLUETOOTH_EVENT_IPSP_DISCONNECTED, /**< IPSP Disconnected event */
+       BLUETOOTH_EVENT_IPSP_BT_INTERFACE_INFO, /** IPSP BT Interface Info after connection */
        BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED,  /** LE data length values changed */
 } bluetooth_event_type_t;
 
@@ -1621,6 +1622,14 @@ typedef struct {
        char uuids[BLUETOOTH_MAX_DPM_LIST][BLUETOOTH_UUID_STRING_MAX];
 } bt_dpm_uuids_list_t;
 
+/**
+ * Structure for IPSP Interface Info
+ */
+typedef struct {
+       bluetooth_device_address_t btaddr;
+       char if_name[16];
+} bt_ipsp_interface_info_t;
+
 /**
  * Callback pointer type
  */
index 2fa871fcde8ba675fe3254757a10588e6ecf886e..936f73bc4501fc8d37122fe9f85efe4c435e3dcb 100644 (file)
@@ -489,6 +489,7 @@ typedef struct {
 #define BT_IPSP_INITIALIZED "IpspInitStateChanged"
 #define BT_IPSP_CONNECTED "IpspConnected"
 #define BT_IPSP_DISCONNECTED "IpspDisconnected"
+#define BT_IPSP_BT_INTERFACE_INFO "IpspBtInterfaceInfo"
 #define BT_LE_DATA_LENGTH_CHANGED "LEDataLengthChanged"
 
 #ifdef __cplusplus