/* Forward declaration for GATT client callbacks */
static void cb_gattc_register_app(int status, int clientIf, bt_uuid_t *app_uuid);
-static void cb_gattc_scan_result(bt_bdaddr_t* bdaddress, int rssi, uint8_t *adv_data);
+static void cb_gattc_scan_result(bt_bdaddr_t* bdaddress, uint8_t addr_type, int rssi,
+ uint8_t *adv_data, int adv_data_len, uint8_t *scan_rsp_data, int scan_rsp_data_len);
static void cb_gattc_connection(int conn_id, int status, int client_if, bt_bdaddr_t* bda);
static void cb_gattc_disconnect(int conn_id, int status, int client_if, bt_bdaddr_t* bda);
static void cb_gattc_search_result(int conn_id, btgatt_srvc_id_t *srvc_id);
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, 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 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,
.write_descriptor_cb = cb_gattc_write_descriptor,
.execute_write_cb = NULL,
.read_remote_rssi_cb = NULL,
- .configure_mtu_cb = NULL,
+ .configure_mtu_cb = cb_gattc_configure_mtu_cmpl,
#ifdef PLATFORM_ANDROID_HAL
.scan_filter_cfg_cb = NULL,
.scan_filter_param_cb = NULL,
return OAL_STATUS_SUCCESS;
}
+oal_status_t gatts_set_filter_policy(int filter_policy)
+{
+ int ret = OAL_STATUS_SUCCESS;
+
+ CHECK_OAL_GATT_ENABLED();
+
+ /* send the filter_policy value to the HAL Layer */
+ ret = gatt_api->server->set_filter_policy(filter_policy);
+
+ if (ret != BT_STATUS_SUCCESS) {
+ BT_ERR("set_filter_policy failed: %d",ret);
+ return convert_to_oal_status(ret);
+ }
+
+ return OAL_STATUS_SUCCESS;
+}
+
oal_status_t gatts_multi_adv_update(int instance_id,
int min_intv, int max_intv,
int adv_type, int chnl_map,
adv_setup.timeout_s = adv_param_setup->timeout_s;
adv_setup.server_if = gatt_servers[instance_id - 1].server_id;
- if (adv_setup.manufacturer_data_len > 0 && adv_setup.manufacturer_data != NULL) {
- BT_INFO("Manufacture data.....\n");
- PRINT_ADV_DATA(adv_setup.manufacturer_data_len, (unsigned char *)adv_setup.manufacturer_data, adv_setup.set_scan_rsp);
- }
-
- if (adv_setup.service_uuid_len > 0 && adv_setup.service_uuid != NULL) {
- BT_INFO("Service uuid.....\n");
- PRINT_ADV_DATA(adv_setup.service_uuid_len, (unsigned char*)adv_setup.service_uuid, FALSE);
- }
-
ret = gatt_api->server->multi_adv_set_inst_data(adv_setup);
-
if (ret != BT_STATUS_SUCCESS) {
BT_ERR("GATT Set Multi advertising data failed: %s", status2string(ret));
gatt_servers[instance_id - 1].state = GATT_INS_DISABLED;
BT_INFO("BTGATT SERVER CONNECTION connnected:%d, conn_id:%d server_if:%d", connected, conn_id, server_if);
event_gatts_conn_t *event = g_new0(event_gatts_conn_t, 1);
- for (ins_id = 1 ; ins_id <= NUM_SERVER_INST ; ins_id++) {
- if ((gatt_servers[ins_id - 1].server_id == server_if)) {
- event->server_inst = ins_id;
- break;
- } else {
- BT_INFO("Server ID:%d recevied server Id:%d\n", gatt_servers[ins_id - 1].server_id, server_if);
+ if (connected == TRUE) {
+ for (ins_id = 1 ; ins_id <= NUM_SERVER_INST ; ins_id++) {
+ if ((gatt_servers[ins_id - 1].server_id == server_if)) {
+ event->server_inst = ins_id;
+ break;
+ } else {
+ BT_INFO("Server ID:%d recevied server Id:%d\n", gatt_servers[ins_id - 1].server_id, server_if);
+ }
}
- }
- if (ins_id == NUM_SERVER_INST+1) {
- BT_WARN("Incorrect Server Interface received: %d\n", server_if);
- g_free(event);
- return;
+ if (ins_id == NUM_SERVER_INST+1) {
+ BT_WARN("Incorrect Server Interface received: %d\n", server_if);
+ g_free(event);
+ return;
+ }
+ } else {
+ /* server_inst is not required in disconnected case */
}
memcpy(event->address.addr, bda->address, BT_ADDRESS_BYTES_NUM);
event->conn_id = conn_id;
char uuid_str[BT_UUID_STRING_MAX];
event_gattc_register_t *event;
- BT_INFO("+");
-
/* Check if GATT client registered for Default GATT client UUID */
uuid_to_string((service_uuid_t *)app_uuid, uuid_str);
- BT_INFO("UUID:%s", uuid_str);
- BT_INFO("BTGATT CLIENT REGISTER APP CB, status:%d, clientIf:%d", status, clientIf);
+ BT_INFO("GATT CLIENT REGISTER APP CB, status:%d, clientIf:%d, %s", status, clientIf, uuid_str);
event = g_new0(event_gattc_register_t, 1);
event->client_if = clientIf;
event->status = (status == 0 ? OAL_STATUS_SUCCESS : OAL_STATUS_INTERNAL_ERROR);
send_event(OAL_EVENT_GATTC_REGISTRATION, event, sizeof(event_gattc_register_t));
}
-static void cb_gattc_scan_result(bt_bdaddr_t* bdaddress, int rssi, uint8_t *adv_data)
+static void cb_gattc_scan_result(bt_bdaddr_t* bdaddress, uint8_t addr_type, int rssi,
+ uint8_t *adv_data, int adv_data_len, uint8_t *scan_rsp_data, int scan_rsp_data_len)
{
event_ble_scan_result_info *event;
event = g_new0(event_ble_scan_result_info, 1);
+ event->addr_type = addr_type;
event->rssi = rssi;
memcpy(event->address.addr, bdaddress->address, BT_ADDRESS_BYTES_NUM);
memcpy(event->adv_data, adv_data, BLE_ADV_DATA_LENGTH);
+ event->adv_data_len = adv_data_len;
+ memcpy(event->scan_rsp_data, scan_rsp_data, BLE_ADV_DATA_LENGTH);
+ event->scan_rsp_data_len = scan_rsp_data_len;
send_event_bda_trace(OAL_EVENT_BLE_REMOTE_DEVICE_FOUND, event,
sizeof(event_ble_scan_result_info), (bt_address_t *)bdaddress);
}
BT_INFO("BTGATT Client Service Search Result cb, conn_id:%d", conn_id);
uuid_to_stringname((oal_uuid_t *)&(srvc_id->id.uuid), uuid_str);
- BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]",
+ BT_INFO("Service=> [%s], Inst_id [%u], Type [%s]",
uuid_str, srvc_id->id.inst_id, srvc_id->is_primary ? "Primary" : "Secondary");
event_gattc_service_result_t *event = g_new0(event_gattc_service_result_t, 1);
char uuid_str1[2*BT_UUID_STRING_MAX];
char uuid_str2[2*BT_UUID_STRING_MAX];
char str[50];
+
BT_INFO("BTGATT Client Get Characteristic Callback, conn_id:%d, status:%d", conn_id, status);
uuid_to_stringname((oal_uuid_t *)&(srvc_id->id.uuid), uuid_str1);
- BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]",
+ BT_INFO("Service=> [%s], Inst_id [%u], Type [%s]",
uuid_str1, srvc_id->id.inst_id, srvc_id->is_primary ? "Primary" : "Secondary");
event_gattc_characteristic_result_t *event = g_new0(event_gattc_characteristic_result_t, 1);
if (status == 0) {
uuid_to_stringname((oal_uuid_t *)&(char_id->uuid), uuid_str2);
- BT_INFO("Charac=> UUID: [%s], Inst_id: [%u], Prop: [%s]",
+ BT_INFO("Charac => [%s], Inst_id [%u], Prop [%s]",
uuid_str2, char_id->inst_id, char_prop_to_string(char_prop, str));
event->char_prop = char_prop;
memcpy(&(event->char_id), char_id, sizeof(oal_gatt_id_t));
BT_INFO("BTGATT Client Get Descriptor Callback, conn_id:%d, status:%d", conn_id, status);
uuid_to_stringname((oal_uuid_t *)&(srvc_id->id.uuid), uuid_str1);
uuid_to_stringname((oal_uuid_t *)&(char_id->uuid), uuid_str2);
- BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]",
+ BT_INFO("Service=> [%s], Inst_id [%u], Type [%s]",
uuid_str1, srvc_id->id.inst_id, srvc_id->is_primary ? "Primary" : "Secondary");
- BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, char_id->inst_id);
+ BT_INFO("Charac => [%s], Inst_id [%u]", uuid_str2, char_id->inst_id);
event_gattc_descriptor_result_t *event = g_new0(event_gattc_descriptor_result_t, 1);
event->conn_status.conn_id = conn_id;
if (status == 0) {
uuid_to_stringname((oal_uuid_t *)&(descr_id->uuid), uuid_str3);
- BT_INFO("Desc=> UUID: [%s], Inst_id: [%u]", uuid_str3, descr_id->inst_id);
+ BT_INFO("Desc => [%s], Inst_id [%u]", uuid_str3, descr_id->inst_id);
memcpy(&(event->descr_id), descr_id, sizeof(oal_gatt_id_t));
}
send_event(OAL_EVENT_GATTC_DESC_SERACH_RESULT, event, sizeof(*event));
}
-static void cb_gattc_register_for_notification(int client_if, int registered, int status, btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id)
+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)
{
char uuid_str1[2*BT_UUID_STRING_MAX];
char uuid_str2[2*BT_UUID_STRING_MAX];
- BT_INFO("BTGATT Client Register For Notification Callback, client_if:%d, status:%d, registered: %s",
- client_if, status, registered == 1 ? "REGISTERED" : "DEREGISTERED");
+ BT_INFO("BTGATT Client Register For Notification Callback, conn_id:%d, status:%d, registered: %s",
+ conn_id, status, registered == 1 ? "REGISTERED" : "DEREGISTERED");
uuid_to_stringname((oal_uuid_t *)&(srvc_id->id.uuid), uuid_str1);
uuid_to_stringname((oal_uuid_t *)&(char_id->uuid), uuid_str2);
- BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]", uuid_str1, srvc_id->id.inst_id, srvc_id->is_primary ? "Primary" : "Secondary");
- BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, char_id->inst_id);
+ BT_INFO("Service=> [%s], Inst_id [%u], Type [%s]", uuid_str1, srvc_id->id.inst_id, srvc_id->is_primary ? "Primary" : "Secondary");
+ BT_INFO("Charac => [%s], Inst_id [%u]", uuid_str2, char_id->inst_id);
event_gattc_regdereg_notify_t *event = g_new0(event_gattc_regdereg_notify_t, 1);
oal_event_t event_type = (registered == 1 ? OAL_EVENT_GATTC_NOTIFICATION_REGISTERED : OAL_EVENT_GATTC_NOTIFICATION_DEREGISTERED);
- event->client_if = client_if;
+ event->conn_id = conn_id;
event->status = convert_to_oal_status(status);
memcpy(&(event->srvc_id), srvc_id, sizeof(oal_gatt_srvc_id_t));
memcpy(&(event->char_id), char_id, sizeof(oal_gatt_id_t));
uuid_to_stringname((oal_uuid_t *)&(p_data->srvc_id.id.uuid), uuid_str1);
uuid_to_stringname((oal_uuid_t *)&(p_data->char_id.uuid), uuid_str2);
- BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]",
+ BT_INFO("Service=> [%s], Inst_id [%u], Type [%s]",
uuid_str1, p_data->srvc_id.id.inst_id, p_data->srvc_id.is_primary ? "Primary" : "Secondary");
- BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, p_data->char_id.inst_id);
+ BT_INFO("Charac => [%s], Inst_id [%u]", uuid_str2, p_data->char_id.inst_id);
if (p_data->len > 0) {
char *data = NULL;
}
}
+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);
+
+ memcpy(event->address.addr, bd_addr->address, 6);
+ 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);
+}
static void cb_gattc_read_characteristic(int conn_id, int status, btgatt_read_params_t *p_data)
{
if (status == 0) {
uuid_to_stringname((oal_uuid_t *)&(p_data->srvc_id.id.uuid), uuid_str1);
uuid_to_stringname((oal_uuid_t *)&(p_data->char_id.uuid), uuid_str2);
- BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]", uuid_str1,
+ BT_INFO("Service=> [%s], Inst_id [%u], Type [%s]", uuid_str1,
p_data->srvc_id.id.inst_id, p_data->srvc_id.is_primary ? "Primary" : "Secondary");
- BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, p_data->char_id.inst_id);
- BT_INFO("Len: %u, value_type: %u", p_data->value.len, p_data->value_type);
+ BT_INFO("Charac => [%s], Inst_id [%u]", uuid_str2, p_data->char_id.inst_id);
+ BT_DBG("Len: %u, value_type: %u", p_data->value.len, p_data->value_type);
if (p_data->value.len > 0 && event->value_type == GATTC_READ_VALUE_TYPE_VALUE) {
char *data = NULL;
data = g_malloc(3*p_data->value.len+1);
return;
}
convert_hex_2_str((unsigned char *)p_data->value.value, p_data->value.len, data);
- BT_INFO("Read Data: [%s]", data);
+ BT_DBG("Read Data: [%s]", data);
event->data_len = p_data->value.len;
memcpy(&(event->data), &(p_data->value.value), event->data_len);
g_free(data);
if (status == 0) {
uuid_to_stringname((oal_uuid_t *)&(p_data->srvc_id.id.uuid), uuid_str1);
uuid_to_stringname((oal_uuid_t *)&(p_data->char_id.uuid), uuid_str2);
- BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]", uuid_str1,
+ BT_INFO("Service=> [%s], Inst_id [%u], Type [%s]", uuid_str1,
p_data->srvc_id.id.inst_id, p_data->srvc_id.is_primary ? "Primary" : "Secondary");
- BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, p_data->char_id.inst_id);
+ BT_INFO("Charac => [%s], Inst_id [%u]", uuid_str2, p_data->char_id.inst_id);
}
send_event(OAL_EVENT_GATTC_WRITE_CHARAC, event, sizeof(*event));
}
uuid_to_stringname((oal_uuid_t *)&(p_data->srvc_id.id.uuid), uuid_str1);
uuid_to_stringname((oal_uuid_t *)&(p_data->char_id.uuid), uuid_str2);
uuid_to_stringname((oal_uuid_t *)&(p_data->descr_id.uuid), uuid_str3);
- BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]", uuid_str1,
+ BT_INFO("Service=> [%s], Inst_id [%u], Type [%s]", uuid_str1,
p_data->srvc_id.id.inst_id, p_data->srvc_id.is_primary ? "Primary" : "Secondary");
- BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, p_data->char_id.inst_id);
- BT_INFO("Desc=> UUID: [%s], Inst_id: [%u]", uuid_str3, p_data->descr_id.inst_id);
+ BT_INFO("Charac => [%s], Inst_id [%u]", uuid_str2, p_data->char_id.inst_id);
+ BT_INFO("Desc => [%s], Inst_id [%u]", uuid_str3, p_data->descr_id.inst_id);
}
send_event(OAL_EVENT_GATTC_WRITE_DESCR, event, sizeof(*event));
}
uuid_to_stringname((oal_uuid_t *)&(p_data->srvc_id.id.uuid), uuid_str1);
uuid_to_stringname((oal_uuid_t *)&(p_data->char_id.uuid), uuid_str2);
uuid_to_stringname((oal_uuid_t *)&(p_data->descr_id.uuid), uuid_str3);
- BT_INFO("Service=> UUID: [%s], Inst_id: [%u], Type: [%s]", uuid_str1,
+ BT_INFO("Service=> [%s], Inst_id [%u], Type [%s]", uuid_str1,
p_data->srvc_id.id.inst_id, p_data->srvc_id.is_primary ? "Primary" : "Secondary");
- BT_INFO("Charac=> UUID: [%s], Inst_id: [%u]", uuid_str2, p_data->char_id.inst_id);
- BT_INFO("Desc=> UUID: [%s], Inst_id: [%u]", uuid_str3, p_data->descr_id.inst_id);
- BT_INFO("Len: %u, value_type: %u", p_data->value.len, p_data->value_type);
+ BT_INFO("Charac => [%s], Inst_id [%u]", uuid_str2, p_data->char_id.inst_id);
+ BT_INFO("Desc => [%s], Inst_id [%u]", uuid_str3, p_data->descr_id.inst_id);
+ BT_DBG("Len: %u, value_type: %u", p_data->value.len, p_data->value_type);
if (p_data->value.len > 0 && event->value_type == GATTC_READ_VALUE_TYPE_VALUE) {
char *data = NULL;
data = g_malloc(3*p_data->value.len+1);
return;
}
convert_hex_2_str((unsigned char *)p_data->value.value, p_data->value.len, data);
- BT_INFO("Read Data: [%s]", data);
+ BT_DBG("Read Data: [%s]", data);
event->data_len = p_data->value.len;
memcpy(&(event->data), &(p_data->value.value), event->data_len);
g_free(data);
return OAL_STATUS_SUCCESS;
}
+
+static void cb_gattc_configure_mtu_cmpl(int conn_id, int status, int mtu)
+{
+ event_gattc_mtu_configured_t *event;
+ BT_INFO("BTGATT Client configure mtu complete Callback, conn_id: %d, status: %d, mtu: %d",
+ conn_id, status, mtu);
+ event = g_new0(event_gattc_mtu_configured_t, 1);
+ event->conn_id = conn_id;
+ event->mtu = mtu;
+ event->status = convert_to_oal_status(status);
+ send_event(OAL_EVENT_GATTC_MTU_EXCHANGE_COMPLETED, event, sizeof(*event));
+}
+
/************************************ GATT Client ***********************************/
oal_status_t gattc_register(oal_uuid_t* client_uuid)
{
return OAL_STATUS_SUCCESS;
}
-oal_status_t gattc_register_for_notification(int client_id, bt_address_t * address,
+oal_status_t gattc_register_for_notification(int conn_id, bt_address_t * address,
oal_gatt_srvc_id_t *srvc_id, oal_gatt_id_t *char_id) {
int ret = OAL_STATUS_SUCCESS;
char uuid_str1[2*BT_UUID_STRING_MAX];
uuid_to_stringname(&(char_id->uuid), uuid_str2);
API_TRACE("Client Register Notification: [%s], Service_uuid: [%s], Char_uuid: [%s]", bdt_bd2str(address, &bdstr), uuid_str1, uuid_str2);
CHECK_OAL_GATT_ENABLED();
- CHECK_CLIENT_REGISTRATION(client_id);
+ CHECK_CLIENT_CONNECTION(conn_id);
- ret = gatt_api->client->register_for_notification(client_id, (bt_bdaddr_t *)address, (btgatt_srvc_id_t *)srvc_id, (btgatt_gatt_id_t *)char_id);
+ ret = gatt_api->client->register_for_notification(conn_id, (bt_bdaddr_t *)address, (btgatt_srvc_id_t *)srvc_id, (btgatt_gatt_id_t *)char_id);
if (ret != BT_STATUS_SUCCESS) {
BT_ERR("GATT client register notification failed: %s", status2string(ret));
return convert_to_oal_status(ret);
return OAL_STATUS_SUCCESS;
}
-oal_status_t gattc_deregister_for_notification(int client_id, bt_address_t * address,
+oal_status_t gattc_deregister_for_notification(int conn_id, bt_address_t * address,
oal_gatt_srvc_id_t *srvc_id, oal_gatt_id_t *char_id) {
int ret = OAL_STATUS_SUCCESS;
char uuid_str1[2*BT_UUID_STRING_MAX];
uuid_to_stringname(&(char_id->uuid), uuid_str2);
API_TRACE("Client Deregister Notification: [%s], Service_uuid: [%s], Char_uuid: [%s]", bdt_bd2str(address, &bdstr), uuid_str1, uuid_str2);
CHECK_OAL_GATT_ENABLED();
- CHECK_CLIENT_REGISTRATION(client_id);
+ CHECK_CLIENT_CONNECTION(conn_id);
- ret = gatt_api->client->deregister_for_notification(client_id, (bt_bdaddr_t *)address, (btgatt_srvc_id_t *)srvc_id, (btgatt_gatt_id_t *)char_id);
+ ret = gatt_api->client->deregister_for_notification(conn_id, (bt_bdaddr_t *)address, (btgatt_srvc_id_t *)srvc_id, (btgatt_gatt_id_t *)char_id);
if (ret != BT_STATUS_SUCCESS) {
BT_ERR("GATT client deregister notification failed: %s", status2string(ret));
return convert_to_oal_status(ret);
return OAL_STATUS_SUCCESS;
}
+oal_status_t gattc_enable_scan_filter(int client_if)
+{
+ int ret;
+
+ API_TRACE("");
+ CHECK_OAL_GATT_ENABLED();
+
+ BT_INFO("Enable Scan filter. Client If: %d", client_if);
+
+ ret = gatt_api->client->scan_filter_enable(client_if, TRUE);
+ if (ret != BT_STATUS_SUCCESS) {
+ BT_ERR("error: %s", status2string(ret));
+ return convert_to_oal_status(ret);
+ }
+ return OAL_STATUS_SUCCESS;
+}
+
+oal_status_t gattc_disable_scan_filter(int client_if)
+{
+ int ret;
+
+ API_TRACE("");
+ CHECK_OAL_GATT_ENABLED();
+
+ BT_INFO("Disable Scan filter. Client If: %d", client_if);
+
+ ret = gatt_api->client->scan_filter_enable(client_if, FALSE);
+ if (ret != BT_STATUS_SUCCESS) {
+ BT_ERR("error: %s", status2string(ret));
+ return convert_to_oal_status(ret);
+ }
+ return OAL_STATUS_SUCCESS;
+}
+
oal_status_t gattc_register_scan_filter(oal_ble_scan_filter_t* filter_data)
{
int ret;
return convert_to_oal_status(ret);
}
- feature_selection |= OAL_BLE_SCAN_FILTER_FEATURE_DEVICE_ADDRESS;
+ feature_selection |= OAL_BLE_SCAN_FILTER_FEATURE_DEVICE_NAME;
}
if (filter_data->added_features & OAL_BLE_SCAN_FILTER_FEATURE_SERVICE_UUID){
BT_INFO("OAL_BLE_SCAN_FILTER_FEATURE_SERVICE_UUID is being added");
return convert_to_oal_status(ret);
}
- feature_selection |= OAL_BLE_SCAN_FILTER_FEATURE_DEVICE_ADDRESS;
+ feature_selection |= OAL_BLE_SCAN_FILTER_FEATURE_SERVICE_UUID;
}
if (filter_data->added_features & OAL_BLE_SCAN_FILTER_FEATURE_SERVICE_SOLICITATION_UUID){
BT_INFO("OAL_BLE_SCAN_FILTER_FEATURE_SERVICE_SOLICITATION_UUID is being added");
return convert_to_oal_status(ret);
}
- feature_selection |= OAL_BLE_SCAN_FILTER_FEATURE_DEVICE_ADDRESS;
+ feature_selection |= OAL_BLE_SCAN_FILTER_FEATURE_SERVICE_SOLICITATION_UUID;
}
if (filter_data->added_features & OAL_BLE_SCAN_FILTER_FEATURE_SERVICE_DATA){
ret = gatt_api->client->scan_filter_add_remove(client_info,
return convert_to_oal_status(ret);
}
- feature_selection |= OAL_BLE_SCAN_FILTER_FEATURE_DEVICE_ADDRESS;
+ feature_selection |= OAL_BLE_SCAN_FILTER_FEATURE_SERVICE_DATA;
}
if (filter_data->added_features & OAL_BLE_SCAN_FILTER_FEATURE_MANUFACTURER_DATA){
ret = gatt_api->client->scan_filter_add_remove(client_info,
return convert_to_oal_status(ret);
}
- feature_selection |= OAL_BLE_SCAN_FILTER_FEATURE_DEVICE_ADDRESS;
+ feature_selection |= OAL_BLE_SCAN_FILTER_FEATURE_MANUFACTURER_DATA;
}
BT_DBG("Filter selection 0x%.2x", feature_selection);
}
return OAL_STATUS_SUCCESS;
}
+
+oal_status_t gattc_configure_mtu(int conn_id, int mtu)
+{
+ int ret;
+
+ API_TRACE("Configure MTU Size: [%d]", mtu);
+ CHECK_OAL_GATT_ENABLED();
+ CHECK_CLIENT_CONNECTION(conn_id);
+
+ /* To prevent crash in case other libraries not support this api */
+ if (gatt_api->client->configure_mtu == NULL) {
+ BT_WARN("configure_mtu is NULL");
+ return OAL_STATUS_NOT_SUPPORT;
+ }
+
+ ret = gatt_api->client->configure_mtu(conn_id, mtu);
+ if (ret != BT_STATUS_SUCCESS) {
+ BT_ERR("Gatt client configure_mtu error: %s", status2string(ret));
+ return convert_to_oal_status(ret);
+ }
+ 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;
+}
+