int _bt_hal_set_advertising_data(btgatt_adv_param_setup_t adv_param_setup)
{
uint8_t adv_data[31];
+ char adv_data_str[(31 * 2) + 1];
int index = 0;
GDBusProxy *proxy;
GError *error = NULL;
memset(&adv_data, 0, 31);
/* Service UUID */
- DBG("Service UUID length [%d]", adv_param_setup.service_uuid_len);
if (adv_param_setup.service_uuid_len > 0) {
__bt_hal_parse_uuid(adv_param_setup.service_uuid_len,
adv_param_setup.service_uuid, &adv_data[index], &length, FALSE);
}
/* Solicit UUID */
- DBG("Solicit UUID length [%d]", adv_param_setup.solicit_uuid_len);
if (adv_param_setup.solicit_uuid_len > 0) {
__bt_hal_parse_uuid(adv_param_setup.solicit_uuid_len,
adv_param_setup.solicit_uuid, &adv_data[index], &length, TRUE);
}
/* Service Data UUID*/
- DBG("Service Data length [%d]", adv_param_setup.service_data_len);
if (adv_param_setup.service_data_len > 0) {
adv_data[index] = 1 + adv_param_setup.service_data_len;
adv_data[index+1] = 0x16; /* Fixed */
temp = g_variant_new("ay", builder);
g_variant_builder_unref(builder);
- DBG("####Adv data length [%d] Index [%d]", length, index);
- for (i = 0; i < length; i++)
- DBG("##Data[%d] [0x%x]", i, adv_data[i]);
-
if (adv_param_setup.set_scan_rsp == 0) {
/* Set Advertising data to stack */
ret = g_dbus_proxy_call_sync(proxy, "SetAdvertisingData",
return BT_STATUS_FAIL;
}
- INFO("Set advertising data");
+ for (i = 0; i < length; i++)
+ snprintf(&adv_data_str[i * 2], 3, "%02X", adv_data[i]);
+ INFO("Set adv data. Index [%d] length [%d] Data[%s]", index, length, adv_data_str);
+
if (ret)
g_variant_unref(ret);
static struct hal_gatts_server_register_info_t * bt_hal_gatts_find_server_register_info(int server_if)
{
- DBG("+");
-
GSList *l;
struct hal_gatts_server_register_info_t *info = NULL;
}
if (info->server_if == server_if) {
- DBG("gatt server register found");
return info;
}
}
static struct hal_gatts_server_register_info_t * bt_hal_gatts_add_server_app(bt_uuid_t *app_uuid)
{
- DBG("+");
-
struct hal_gatts_server_register_info_t * server_register_info = NULL;
server_register_info = bt_hal_gatts_find_server_register_info_from_uuid(app_uuid);
return server_register_info;
}
- DBG("adding the gatt server app");
-
server_register_info = g_malloc0(sizeof(struct hal_gatts_server_register_info_t));
server_register_info->server_if = bt_hal_gatts_generate_server_id();
- DBG("amit server_if:[%d]", server_register_info->server_if);
+ DBG("Adding the gatt server app. server_if:[%d]", server_register_info->server_if);
server_register_info->adv_slot_id = -1;
memcpy(&server_register_info->app_uuid, app_uuid, sizeof(bt_uuid_t));
{
int adv_slot_id = -1;
- DBG("gatt server:[%d], adv_slot:[%d]", server_register_info->server_if, server_register_info->adv_slot_id);
-
/* allocate adv slot for gatt server if not assigned */
if (server_register_info->adv_slot_id < 0 ) {
adv_slot_id = _bt_hal_get_available_adv_slot_id(&server_register_info->app_uuid, FALSE);
if (adv_slot_id < 0) {
- DBG("failed to get the adv_slot \n");
+ ERR("failed to get the adv_slot");
return -1;
}
server_register_info->adv_slot_id = adv_slot_id;
}
- DBG("gatt server is assigned with adv_slot [%d]", server_register_info->adv_slot_id);
+ DBG("gatt server:[%d] Assigned adv_slot [%d]", server_register_info->server_if, server_register_info->adv_slot_id);
return 0;
}
server_register_info = bt_hal_gatts_find_server_register_info(server_if);
if (server_register_info == NULL) {
- DBG("failed to get server_register_info");
+ ERR("failed to get server_register_info");
return;
}
- DBG("gatt server:[%d], adv_slot:[%d]", server_register_info->server_if, server_register_info->adv_slot_id);
-
if (server_register_info->adv_slot_id < 0) {
- DBG("adv_slot is not allocated");
+ ERR("adv_slot is not allocated");
return;
}
server_register_info = bt_hal_gatts_find_server_register_info(server_if);
if (server_register_info == NULL) {
- DBG("gatt server is not registered");
+ ERR("gatt server is not registered");
return BT_STATUS_FAIL;
}
DBG("gatt server:[%d], adv_slot:[%d]", server_register_info->server_if, server_register_info->adv_slot_id);
if (server_register_info->adv_slot_id < 0 ) {
- DBG("adv_slot is not assigned to server:[%d] \n", server_if);
+ DBG("adv_slot is not assigned to server:[%d]", server_if);
ret = bt_hal_gatts_allocate_adv_slot(server_register_info);
if (ret < 0) {
- DBG("failed to get adv_slot");
+ ERR("failed to get adv_slot");
return BT_STATUS_FAIL;
}
}
static bt_status_t gatt_server_multi_adv_set_inst_data(btgatt_adv_param_setup_t adv_param_setup)
{
CHECK_BTGATT_INIT();
- DBG("+");
+
/* Send Data to LE Module */
return _bt_hal_set_advertising_data(adv_param_setup);
}
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;
int mtu = -1;
bluetooth_gatt_client_char_prop_info_t param;
- BT_INFO("GATT Client ACQUIRE WRITE recived");
-
sender = (char*)g_dbus_method_invocation_get_sender(context);
__bt_service_get_parameters(in_param1, ¶m,
g_array_append_vals(*out_param1, &mtu, sizeof(int));
if (BLUETOOTH_ERROR_NONE == result)
- BT_INFO("GATT Client: Save Invocation data for characteristic props app[%s] fd[ %d]", sender, fd);
+ BT_DBG("GATT Client: Save Invocation data for characteristic props app[%s] fd[ %d]", sender, fd);
else {
- BT_ERR("Gatt Client Acqure Write");
+ BT_ERR("GATT Client: gatt acquire write failed");
break;
}
_bt_save_invocation_context(context, result, sender,
function_name, (gpointer)addr);
} else {
- BT_INFO("GATT Client: gatt connect failed");
+ BT_ERR("GATT Client: gatt connect failed");
g_array_append_vals(*out_param1, &address,
sizeof(bluetooth_device_address_t));
}
}
case BT_SET_SCAN_PARAMETERS: {
bluetooth_le_scan_params_t scan_params;
+
__bt_service_get_parameters(in_param1, &scan_params,
sizeof(bluetooth_le_scan_params_t));
void _bt_set_new_adv_data(bluetooth_advertising_data_t *adv, int len, int instance)
{
int k;
- BT_DBG("+");
+ BT_DBG("");
bt_service_app_info_t *info = NULL;
for (k = 1; k < MAX_APPS_SUPPORTED; k++) {
info = &numapps[k];
break;
}
}
- BT_DBG("-");
}
void _bt_set_new_scan_rsp_data(bluetooth_scan_resp_data_t *scan, int len, int instance)
{
int k;
- BT_DBG("+");
+ BT_DBG("");
bt_service_app_info_t *info = NULL;
for (k = 1; k < MAX_APPS_SUPPORTED; k++) {
info = &numapps[k];
break;
}
}
- BT_DBG("-");
}
void _bt_get_previous_adv_data(bluetooth_advertising_data_t *adv, int *len, int instance)
{
int k;
- BT_DBG("+");
bt_service_app_info_t *info = NULL;
for (k = 1; k < MAX_APPS_SUPPORTED; k++) {
void _bt_get_previous_scan_rsp_data(bluetooth_scan_resp_data_t *scan, int *len, int instance)
{
int k;
- BT_DBG("+");
+ BT_DBG("");
bt_service_app_info_t *info = NULL;
for (k = 1; k < MAX_APPS_SUPPORTED; k++) {