cb(_bt_get_error_code(param->result), TRUE, device_addr,
bt_event_slot_container[event_index].user_data);
- /*HRP Server*/
- __bt_hrp_le_connection_state_changed_cb(param->result, device_addr, TRUE);
-
g_free(device_addr);
device_addr = NULL;
break;
cb(_bt_get_error_code(param->result), FALSE, device_addr,
bt_event_slot_container[event_index].user_data);
- /*HRP Server*/
- __bt_hrp_le_connection_state_changed_cb(param->result, device_addr, FALSE);
-
g_free(device_addr);
device_addr = NULL;
break;
}
}
+ /*HRP Server*/
+ __bt_hrp_le_connection_state_changed_cb(param->result, device_addr, TRUE);
+
if (event_index >= 0)
cb = bt_event_slot_container[event_index].callback;
if (cb)
/* Mark services not discovered */
client_s->services_discovered = false;
}
+
+
+ /*HRP Server*/
+ __bt_hrp_le_connection_state_changed_cb(param->result, device_addr, FALSE);
+
if (event_index >= 0)
cb = bt_event_slot_container[event_index].callback;
if (cb)
bt_hrp_collector_bsl_read_completed_cb bsl_read_cb;
} bt_hrp_collector_s;
-static const char * const bsl_str_enum[] = {
- "other",
- "chest",
- "wrist",
- "finger",
- "hand",
- "earlobe",
- "foot",
-};
-
GSList *hrp_collector_list;
static bt_adapter_le_scan_result_cb scan_cb; //le scan application callback
static bt_hrp_collector_s *_bt_hrp_collector_find(const char *remote_address);
bt_gatt_server_h server, bt_gatt_h gatt_handle,
int offset, void *user_data)
{
- char *bsl_str_loc = g_strdup(bsl_str_enum[hrp_server_info_s.body_sensor_location]);
+ char bsl_str_loc = hrp_server_info_s.body_sensor_location;
BT_INFO("[HR] __bt_gatt_server_read_value_requested_cb");
BT_INFO("[HR] remote_address %s", remote_address);
/* Send Cached response*/
bt_gatt_server_send_response(request_id,
BT_GATT_REQUEST_TYPE_READ, offset,
- BT_ATT_ERROR_NONE, bsl_str_loc, strlen(bsl_str_loc));
-
-
- g_free(bsl_str_loc);
+ BT_ATT_ERROR_NONE, &bsl_str_loc, 1);
}
BT_CHECK_INIT_STATUS();
int error_code = BT_ERROR_NOT_INITIALIZED;
-
if (NULL == hrp_server_info_s.hrp_sensor) {
BT_ERR("[HR Sensor START] Call Create First !!\n");
return error_code;
}
/*To do :Extract value in to uint and send*/
- unsigned short hr_value = *value;
+ unsigned short hr_value = value[1];
- if (collector_s && collector_s->char_update_cb)
+ if (collector_s && collector_s->hr_chr_notify_h && collector_s->char_update_cb)
collector_s->char_update_cb(characteristic, hr_value, user_data);
}
, BT_UNIT_TEST_FUNCTION_HR_SENSOR_SET_CONTACT_VALUE},
{"[sensor]Set Device Name"
, BT_UNIT_TEST_FUNCTION_HR_SENSOR_SET_DEVICE_NAME},
- {"[sensor]Set Notification Callback"
- , BT_UNIT_TEST_FUNCTION_HR_SENSOR_SET_READ_CB},
- {"[sensor]Set Send Notification Callback"
- , BT_UNIT_TEST_FUNCTION_HR_SENSOR_SET_SEND_NOTIF_CB},
- {"HR Sensor Create Instance"
+ {"[sensor] Create Sensor"
, BT_UNIT_TEST_FUNCTION_HR_SENSOR_CREATE},
- {"HR Sensor Notify"
+ {"[sensor] Notify Collector"
, BT_UNIT_TEST_FUNCTION_HR_SENSOR_NOTIFY},
- {"HR Sensor Destroy"
+ {"[sensor] Destroy Sensor"
, BT_UNIT_TEST_FUNCTION_HR_SENSOR_DESTORY},
{NULL , 0x0000},
};
tc_table_t tc_hr_collector[] = {
{"BACK"
, BT_UNIT_TEST_FUNCTION_BACK},
- {"[collector]HR collector set notification"
+ {"[collector]Set Connection State callback"
+ , BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_CONNECTION_STATE_CALLBACK},
+ {"[collector]Set/Unset Notification"
, BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_SET_NOTIFICATION},
- {"[collector]HR collector start scan"
+ {"[collector]Start Scan"
, BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_START_SCAN},
- {"[collector]HR collector stop scan"
+ {"[collector]Stop Scan"
, BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_STOP_SCAN},
- {"[collector]HR collector connect"
+ {"[collector]Connect Sensor"
, BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_CONNECT},
- {"[collector]HR collector disconnect"
+ {"[collector]Disconnect Sensor"
, BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_DISCONNECT},
- {"[collector]HR collector create"
+ {"[collector]Create Collector"
, BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_CREATE},
- {"[collector]HR collector destroy"
+ {"[collector]Destroy Collector"
, BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_DESTROY},
- {"[collector]HR collector connection state callback"
- , BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_CONNECTION_STATE_CALLBACK},
- {"[collector]HR collector read bsl value "
+ {"[collector]Read Body Sensor Location"
, BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_GET_BSL_LOC},
{NULL , 0x0000},
};
TC_PRT("HR COLLECTOR DESTROY\n");
ret = bt_hrp_collector_destory(collector);
TC_PRT("returns %s\n", __bt_get_error_message(ret));
+ collector = NULL;
break;
}
default:
BT_UNIT_TEST_FUNCTION_HR_SENSOR_SET_LOC_VALUE = 1,
BT_UNIT_TEST_FUNCTION_HR_SENSOR_SET_CONTACT_VALUE,
BT_UNIT_TEST_FUNCTION_HR_SENSOR_SET_DEVICE_NAME,
- BT_UNIT_TEST_FUNCTION_HR_SENSOR_SET_READ_CB,
- BT_UNIT_TEST_FUNCTION_HR_SENSOR_SET_SEND_NOTIF_CB,
BT_UNIT_TEST_FUNCTION_HR_SENSOR_CREATE,
BT_UNIT_TEST_FUNCTION_HR_SENSOR_NOTIFY,
BT_UNIT_TEST_FUNCTION_HR_SENSOR_DESTORY,
/*HR-Collector*/
- BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_SET_NOTIFICATION = 1,
+ BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_CONNECTION_STATE_CALLBACK = 1,
+ BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_SET_NOTIFICATION,
BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_START_SCAN,
BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_STOP_SCAN,
BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_CONNECT,
BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_DISCONNECT,
BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_CREATE,
BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_DESTROY,
- BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_CONNECTION_STATE_CALLBACK,
BT_UNIT_TEST_FUNCTION_HR_COLLECTOR_GET_BSL_LOC,
BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS = 0XFF,