[Adapt: OAL]Add OAL APIs to get remote conn status 33/87733/1
authorAtul Rai <a.rai@samsung.com>
Mon, 1 Aug 2016 09:14:04 +0000 (14:44 +0530)
committerAtul Rai <a.rai@samsung.com>
Wed, 31 Aug 2016 04:24:23 +0000 (09:54 +0530)
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 <a.rai@samsung.com>
bt-oal/include/oal-device-mgr.h
bt-oal/oal-device-mgr.c
packaging/bluetooth-frwk.spec

index ec3ccb5..a9d9dc8 100755 (executable)
@@ -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 */
index b1d7116..15b7d34 100755 (executable)
@@ -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)
 {
index 41acfb2..286341d 100644 (file)
@@ -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