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 */
.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,
}
}
+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)
{
}
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;
+}
+