summaryrefslogtreecommitdiff
path: root/src/bluetooth-common.c
diff options
context:
space:
mode:
authorGowtham Anandha Babu <gowtham.ab@samsung.com>2017-05-02 21:28:21 +0530
committerGowtham Anandha Babu <gowtham.ab@samsung.com>2017-05-03 11:28:36 +0530
commita372492ec8cbcbcdfe98f235d73d44e525d8a096 (patch)
tree575df842acfd6aa8bd1394fc53f638e0d239c65e /src/bluetooth-common.c
parent1e0524a5cfa3b4204ff4759e483b487774576957 (diff)
downloadbluetooth-a372492ec8cbcbcdfe98f235d73d44e525d8a096.tar.gz
bluetooth-a372492ec8cbcbcdfe98f235d73d44e525d8a096.tar.bz2
bluetooth-a372492ec8cbcbcdfe98f235d73d44e525d8a096.zip
[Bluetooth][OTP-Client] Expose OTP client APIs
Exposed below mentioned APIs for OTP client: 1) Create client 2) Destroy client 3) Set client connection state changed callback 4) Unset client connection state changed callback 5) Client connect 6) Client disconnect Change-Id: Ief69c8838d096fa8d98514e54ecf8674310641b8 Signed-off-by: Gowtham Anandha Babu <gowtham.ab@samsung.com>
Diffstat (limited to 'src/bluetooth-common.c')
-rw-r--r--src/bluetooth-common.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c
index 08e4a0f..5e3c5c1 100644
--- a/src/bluetooth-common.c
+++ b/src/bluetooth-common.c
@@ -1053,6 +1053,8 @@ static bool __bt_need_to_handle(int event)
case BLUETOOTH_EVENT_TDS_ACTIVATION_RESULT:
case BLUETOOTH_EVENT_TDS_CONTROL_POINT_ENABLED:
case BLUETOOTH_EVENT_TDS_ACTIVATION_INDICATION:
+ case BLUETOOTH_EVENT_OTP_READ_CHAR_VAL:
+ case BLUETOOTH_EVENT_OTP_NOTIFICATION_ENABLED:
return true;
default:
break;
@@ -1992,6 +1994,9 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
/* TDS Seeker */
_bt_tds_update_seeker_connection_state_changed(param->result, device_addr, TRUE);
+ /* OTP Client */
+ _bt_otp_client_connection_state_changed(param->result, device_addr, TRUE);
+
g_free(device_addr);
device_addr = NULL;
break;
@@ -2019,6 +2024,9 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
/* TDS Seeker */
_bt_tds_update_seeker_connection_state_changed(param->result, device_addr, FALSE);
+ /* OTP Client */
+ _bt_otp_client_connection_state_changed(param->result, device_addr, FALSE);
+
g_free(device_addr);
device_addr = NULL;
break;
@@ -2918,7 +2926,8 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
if (device_addr != NULL)
free(device_addr); /* LCOV_EXCL_STOP */
break;
- } case BLUETOOTH_EVENT_OTP_SERVER_STATE_CHANGED: {
+ }
+ case BLUETOOTH_EVENT_OTP_SERVER_STATE_CHANGED: {
bt_otp_server_state_changed_cb cb = bt_event_slot_container[event_index].callback;
bool *status = (bool *)(param->param_data);
@@ -2927,6 +2936,31 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
cb(_bt_get_error_code(param->result), *status ? true : false);
break;
}
+ case BLUETOOTH_EVENT_OTP_READ_CHAR_VAL: {
+ BT_DBG("BLUETOOTH_EVENT_OTP_READ_CHAR_VAL"); /* LCOV_EXCL_LINE */
+ bluetooth_otp_resp_info_t *info = NULL;
+ char *handle = NULL;
+
+ if (_bt_get_error_code(param->result) == BT_ERROR_NONE) {
+ info = (bluetooth_otp_resp_info_t *)(param->param_data);
+ BT_ERR("Read Success Handle [%s]", info->handle);
+ _bt_otp_client_read_value_response(_bt_get_error_code(param->result),
+ info->handle, info->data, info->data_length);
+ } else {
+ handle = (char *)(param->param_data);
+ BT_ERR("Read Fail Handle [%s]", handle);
+ _bt_otp_client_read_value_response(_bt_get_error_code(param->result),
+ handle, NULL, 0);
+ }
+ break;
+ }
+ case BLUETOOTH_EVENT_OTP_NOTIFICATION_ENABLED: {
+ BT_DBG("BLUETOOTH_EVENT_OTP_NOTIFICATION_ENABLED"); /* LCOV_EXCL_LINE */
+ char *handle = (char *)(param->param_data);
+ BT_ERR("Handle [%s]", handle);
+ _bt_otp_client_notification_enabled(_bt_get_error_code(param->result), handle);
+ break;
+ }
default:
BT_INFO("Unknown function");
break;