From ab477efae7cf5c9266d2c962b7fa899acb43751d Mon Sep 17 00:00:00 2001 From: Atul Rai Date: Mon, 1 Aug 2016 14:44:04 +0530 Subject: [PATCH] [Adapt: OAL]Add OAL APIs to get remote conn status This patch add below APIs in OAL to retrive remote device connection status: 1/ device_get_acl_conn_state() 2/ device_get_svc_conn_state() Change-Id: I48c6e85e7c7515644f73a6a257c83b9abfeb326a Signed-off-by: Atul Rai --- bt-oal/include/oal-device-mgr.h | 27 +++++++++++++++++++++++++++ bt-oal/oal-device-mgr.c | 37 +++++++++++++++++++++++++++++++++++++ packaging/bluetooth-frwk.spec | 4 ++-- 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/bt-oal/include/oal-device-mgr.h b/bt-oal/include/oal-device-mgr.h index ec3ccb5..a9d9dc8 100755 --- a/bt-oal/include/oal-device-mgr.h +++ b/bt-oal/include/oal-device-mgr.h @@ -264,6 +264,33 @@ oal_status_t device_reply_auth_request(bt_address_t * addr, oal_service_t servic */ oal_status_t device_set_authorized(bt_address_t * addr, int authorize); +/** + * @brief Get ACL connection state for remote device + * + * @details This API is to check whether ACL connection is established with the remote device + * + * @param[in] addr: Remote device address. + * + * @return TRUE if ACL connection is established with the remote device and FALSE otherwise. + * + * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED + */ +gboolean device_get_acl_conn_state(bt_address_t * addr); + +/** + * @brief Get PROFILE connection state for remote device + * + * @details This API is to check whether requested profile connection is established with the remote device + * + * @param[in] addr: Remote device address. + * @param[in] svc_id: Profile Id to be checked for connection status. + * + * @return TRUE if ACL connection is established with the remote device and FALSE otherwise. + * + * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED + */ +gboolean device_get_svc_conn_state(bt_address_t * addr, oal_service_t svc_id); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/bt-oal/oal-device-mgr.c b/bt-oal/oal-device-mgr.c index b1d7116..15b7d34 100755 --- a/bt-oal/oal-device-mgr.c +++ b/bt-oal/oal-device-mgr.c @@ -348,6 +348,43 @@ oal_status_t device_set_authorized(bt_address_t * addr, int authorize) return OAL_STATUS_SUCCESS; } +gboolean device_get_acl_conn_state(bt_address_t * addr) +{ + int res; + bdstr_t bdstr; + + CHECK_OAL_INITIALIZED(); + OAL_CHECK_PARAMETER(addr, return); + + API_TRACE("[%s]", bdt_bd2str(addr, &bdstr)); + + res = blued_api->get_connection_state((bt_bdaddr_t *)addr); + BT_ERR("get_connection_state returned: [%s]", res ? "TRUE" : "FALSE"); + + return res; +} + +gboolean device_get_svc_conn_state(bt_address_t * addr, oal_service_t svc_id) +{ + int res; + bdstr_t bdstr; + + CHECK_OAL_INITIALIZED(); + OAL_CHECK_PARAMETER(addr, return); + + API_TRACE("[%s] %d", bdt_bd2str(addr, &bdstr), svc_id); + +#ifdef TIZEN_BT_HAL + res = blued_api->get_service_connection_state((bt_bdaddr_t *)addr, svc_id); +#else + BT_ERR("Not supported"); + res = FALSE; +#endif + BT_ERR("get_service_connection_state returned: [%s]", res ? "TRUE" : "FALSE"); + + return res; +} + void cb_device_properties(bt_status_t status, bt_bdaddr_t *bd_addr, int num_properties, bt_property_t *properties) { diff --git a/packaging/bluetooth-frwk.spec b/packaging/bluetooth-frwk.spec index 41acfb2..286341d 100644 --- a/packaging/bluetooth-frwk.spec +++ b/packaging/bluetooth-frwk.spec @@ -129,7 +129,7 @@ cp %{SOURCE1001} . %build -export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE -DTIZEN_BT_HAL" +export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" @@ -166,7 +166,7 @@ export LDFLAGS="$CFLAGS -pie" %endif %if %{bt_hal} == ENABLED -export CFLAGS="$CFLAGS -URFCOMM_DIRECT" +export CFLAGS="$CFLAGS -URFCOMM_DIRECT -DTIZEN_BT_HAL" %else export CFLAGS="$CFLAGS -DRFCOMM_DIRECT" %endif -- 2.7.4