Fix svace issue
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / oal-gatt.c
index d925520..400f662 100644 (file)
@@ -213,6 +213,7 @@ static void cb_gattc_write_descriptor(int conn_id, int status, btgatt_write_para
 static void cb_gattc_register_for_notification(int conn_id, int registered, int status,
                        btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id);
 static void cb_gattc_notify(int conn_id, btgatt_notify_params_t *p_data);
+static void cb_gattc_service_changed(bt_bdaddr_t *bd_addr, int change_type, uint8_t *uuid);
 static void cb_gattc_configure_mtu_cmpl(int conn_id, int status, int mtu);
 
 /*TODO GATT CLient callbacks will be implemented in subsequent patches */
@@ -228,6 +229,7 @@ static const btgatt_client_callbacks_t btgatt_client_callbacks = {
        .get_included_service_cb = NULL,
        .register_for_notification_cb = cb_gattc_register_for_notification,
        .notify_cb = cb_gattc_notify,
+       .service_changed_cb = cb_gattc_service_changed,
        .read_characteristic_cb = cb_gattc_read_characteristic,
        .write_characteristic_cb = cb_gattc_write_characteristic,
        .read_descriptor_cb = cb_gattc_read_descriptor,
@@ -1617,6 +1619,16 @@ static void cb_gattc_notify(int conn_id, btgatt_notify_params_t *p_data)
        }
 }
 
+static void cb_gattc_service_changed(bt_bdaddr_t *bd_addr, int change_type, uint8_t *uuid)
+{
+       event_gattc_service_changed_data *event = g_new0(event_gattc_service_changed_data, 1);
+
+       memcpy(event->address.addr, bd_addr->address, 6);
+       event->change_type = change_type;
+       memcpy(event->uuid.uuid, uuid, sizeof(event->uuid.uuid));
+
+       send_event_bda_trace(OAL_EVENT_GATTC_SERVICE_CHANGED_IND, event, sizeof(*event), (bt_address_t *)bd_addr);
+}
 
 static void cb_gattc_read_characteristic(int conn_id, int status, btgatt_read_params_t *p_data)
 {
@@ -2462,3 +2474,23 @@ oal_status_t gattc_configure_mtu(int conn_id, int mtu)
        }
        return OAL_STATUS_SUCCESS;
 }
+
+oal_status_t gattc_add_connection_info(bt_address_t *device_address, int conn_id, int server_inst_id)
+{
+       int ret = OAL_STATUS_SUCCESS;
+       bdstr_t bdstr;
+
+       OAL_CHECK_PARAMETER(device_address, return);
+       API_TRACE("Add connection info: [%s]", bdt_bd2str(device_address, &bdstr));
+       CHECK_OAL_GATT_ENABLED();
+       CHECK_SERVER_INSTANCE(server_inst_id);
+       CHECK_SERVER_REGISTRATION(server_inst_id);
+
+       ret = gatt_api->client->add_connection_info((bt_bdaddr_t *)device_address, conn_id, server_inst_id);
+       if (ret != BT_STATUS_SUCCESS) {
+               BT_ERR("GATT connection info add failed: %s", status2string(ret));
+               return convert_to_oal_status(ret);
+       }
+       return OAL_STATUS_SUCCESS;
+}
+