char *address_str = NULL;
char *name = NULL;
- g_variant_get(parameters, "(i&s&s)", &change.change_type, &address_str, &change.uuid);
+ g_variant_get(parameters, "(ii&s&s)", &change.inst_id, &change.change_type, &address_str, &change.uuid);
_bt_convert_addr_string_to_type(change.device_addr.addr, address_str);
bluetooth_get_uuid_name(change.uuid, &name);
#define HAL_EV_GATT_CLIENT_SERVICE_CHANGED 0xCF
struct hal_ev_gatt_client_service_changed {
int32_t conn_id;
+ int32_t inst_id;
uint8_t bdaddr[6];
uint8_t change_type;
uint8_t uuid[16];
/* Send GATT Client service changed event */
ev.change_type = is_added;
ev.conn_id = server_info->conn_id;
+ ev.inst_id = server_info->inst_id;
event_cb(HAL_EV_GATT_CLIENT_SERVICE_CHANGED, (void *)&ev, sizeof(ev));
}
DBG("GATT Client service changed event received");
if (bt_gatt_callbacks->client->service_changed_cb)
- bt_gatt_callbacks->client->service_changed_cb((bt_bdaddr_t *)ev->bdaddr, ev->change_type, ev->uuid, ev->conn_id);
+ bt_gatt_callbacks->client->service_changed_cb((bt_bdaddr_t *)ev->bdaddr,
+ ev->change_type, ev->uuid, ev->conn_id, ev->inst_id);
}
static bt_hal_le_adv_info_t *__bt_hal_get_adv_ind_info(char *addr)
typedef void (*notify_callback)(int conn_id, btgatt_notify_params_t *p_data);
/** Registers service changed callback operation */
-typedef void (*service_changed_callback)(bt_bdaddr_t *bd_addr, int change_type, uint8_t *uuid, int conn_id);
+typedef void (*service_changed_callback)(bt_bdaddr_t *bd_addr, int change_type, uint8_t *uuid, int conn_id, int inst_id);
/** Reports result of a GATT read operation */
typedef void (*read_characteristic_callback)(int conn_id, int status,
uint8_t change_type;
oal_uuid_t uuid;
int conn_id;
+ int inst_id;
} event_gattc_service_changed_data;
typedef struct {
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, int conn_id);
+static void cb_gattc_service_changed(bt_bdaddr_t *bd_addr, int change_type, uint8_t *uuid, int conn_id, int inst_id);
static void cb_gattc_configure_mtu_cmpl(int conn_id, int status, int mtu);
/*TODO GATT CLient callbacks will be implemented in subsequent patches */
}
}
-static void cb_gattc_service_changed(bt_bdaddr_t *bd_addr, int change_type, uint8_t *uuid, int conn_id)
+static void cb_gattc_service_changed(bt_bdaddr_t *bd_addr, int change_type, uint8_t *uuid, int conn_id, int inst_id)
{
event_gattc_service_changed_data *event = g_new0(event_gattc_service_changed_data, 1);
event->change_type = change_type;
memcpy(event->uuid.uuid, uuid, sizeof(event->uuid.uuid));
event->conn_id = conn_id;
+ event->inst_id = inst_id;
send_event_bda_trace(OAL_EVENT_GATTC_SERVICE_CHANGED_IND, event, sizeof(*event), (bt_address_t *)bd_addr);
}
char *address_str = NULL;
char *uuid_str = NULL;
- if (event_data->change_type == 0) {
- svc_info_list = __bt_get_service_info_list(event_data->conn_id);
- if (svc_info_list == NULL) {
- BT_ERR("svc_info_list is NULL");
- return;
- }
+ svc_info_list = __bt_get_service_info_list(event_data->conn_id);
+ if (svc_info_list == NULL) {
+ BT_ERR("svc_info_list is NULL");
+ return;
+ }
+ if (event_data->change_type) {
+ /* Add service UUID in list */
+ svc_info = g_malloc0(sizeof(bt_gatt_service_info_t));
+ memcpy(svc_info->uuid, event_data->uuid.uuid, BLUETOOTH_UUID_HEX_MAX_LEN);
+ svc_info->inst_id = event_data->inst_id;
+ svc_info->is_primary = 1; // TODO: Need to check is_primary is required or not
+ svc_info_list->services = g_slist_append(svc_info_list->services, svc_info);
+ BT_DBG("Service created and added in Svc info list or connection ID %d", event_data->conn_id);
+ } else {
/* Remove service UUID in list */
for (l = svc_info_list->services; l != NULL; l = g_slist_next(l)) {
svc_info = (bt_gatt_service_info_t *)l->data;
_bt_convert_addr_type_to_string(address_str, event_data->address.addr);
_bt_uuid_to_string(&event_data->uuid, uuid_str);
- param = g_variant_new("(iss)", event_data->change_type, address_str, uuid_str);
+ param = g_variant_new("(iiss)", event_data->inst_id, event_data->change_type, address_str, uuid_str);
_bt_send_event(BT_GATT_CLIENT_EVENT,
BLUETOOTH_EVENT_GATT_CLIENT_SERVICE_CHANGED,
char *svc_path;
bluetooth_gatt_service_change_type_t change_type;
#ifdef TIZEN_GATT_CLIENT
+ int inst_id;
char *uuid;
#endif
} bt_gatt_service_change_t;