Implemented enable and disable Gatt watch notification
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / bluez_hal / src / bt-hal-gatt.c
index 92c46f3..ec529ee 100644 (file)
@@ -83,6 +83,7 @@ static void __bt_handle_gatt_client_read_charac(void *buf, uint16_t len);
 static void __bt_handle_gatt_client_read_desc(void *buf, uint16_t len);
 static void __bt_handle_gatt_client_write_char(void *buf, uint16_t len);
 static void __bt_handle_gatt_client_write_desc(void *buf, uint16_t len);
+static void __bt_handle_gatt_client_watch_notification(void *buf, uint16_t len);
 /*****************************************************************************************************/
 
 static bool interface_ready(void)
@@ -359,6 +360,10 @@ static void __bt_hal_gatt_events(int message, void *buf, uint16_t len)
                __bt_handle_gatt_client_write_desc(buf, len);
                break;
        }
+       case HAL_EV_GATT_CLIENT_WATCH_NOTIFICATION: {
+               __bt_handle_gatt_client_watch_notification(buf, len);
+               break;
+       }
        default:
                DBG("Event Currently not handled!!");
                break;
@@ -564,6 +569,24 @@ static void __bt_handle_gatt_client_write_desc(void *buf, uint16_t len)
                                        ev->status, &desc_write_parm);
 }
 
+static void __bt_handle_gatt_client_watch_notification(void *buf, uint16_t len)
+{
+       struct hal_ev_gatt_client_watch_notification *ev = buf;
+       btgatt_srvc_id_t gatt_srvc_id;
+       btgatt_gatt_id_t gatt_char_id;
+
+       gatt_srvc_id.is_primary = ev->is_primary;
+       gatt_srvc_id.id.inst_id = ev->inst_id;
+       memcpy(gatt_srvc_id.id.uuid.uu, ev->svc_uuid, 16);
+
+       memcpy(gatt_char_id.uuid.uu, ev->char_uuid, 16);
+       gatt_char_id.inst_id = ev->inst_id;
+
+       if (bt_gatt_callbacks->client->register_for_notification_cb)
+               bt_gatt_callbacks->client->register_for_notification_cb(ev->client_if,
+                               ev->registered, ev->status, &gatt_srvc_id, &gatt_char_id);
+}
+
 static bt_hal_le_adv_info_t *__bt_hal_get_adv_ind_info(char *addr)
 {
        GSList *l;