private native static void caLeStateChangedCallback(int state);
// bond state
- private native static void caLeBondStateChangedCallback(String address);
+ private native static void caLeBondStateChangedCallback(String address, boolean connected);
// Callback
private static BluetoothAdapter.LeScanCallback mLeScanCallback =
BluetoothDevice device = intent
.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
- caLeBondStateChangedCallback(device.getAddress());
+ caLeBondStateChangedCallback(device.getAddress(), false);
}
}
}
typedef void (*CALEDeviceStateChangedCallback)(CAAdapterState_t adapter_state);
/**
+ * This will be used to notify device connection state changes to the LE adapter layer.
+ * @param[in] adapter Transport type information.
+ * @param[in] remoteAddress Endpoint object from which the connection status is changed.
+ * @param[in] connected State of connection.
+ */
+typedef void (*CALEConnectionStateChangedCallback)(CATransportAdapter_t adapter,
+ const char *remoteAddress, bool connected);
+
+/**
* Notify the adapter layer that a packet was received from the GATT
* peer.
*
CAResult_t CASetLEAdapterStateChangedCb(CALEDeviceStateChangedCallback callback);
/**
+ * Set the callback for the device connection state changes.
+ *
+ * @param[in] callback Callback to notify the Device connection state change to
+ * the CA Layer
+ *
+ * @return ::CA_STATUS_OK or Appropriate error code
+ * @retval ::CA_STATUS_OK Successful
+ * @retval ::CA_STATUS_INVALID_PARAM Invalid input arguments
+ * @retval ::CA_STATUS_FAILED Operation failed
+ */
+CAResult_t CASetLENWConnectionStateChangedCb(CALEConnectionStateChangedCallback callback);
+
+/**
* Provides the MAC address of the local Bluetooth adapter.
*
* @param[out] local_address Pointer to the location where bd address
void CASetLEClientThreadPoolHandle(ca_thread_pool_t handle);
/**
- * Unset the callback of adapter connection state change.
+ * Unset the callback of adapter state change.
*
* @return ::CA_STATUS_OK or Appropriate error code.
* @retval ::CA_STATUS_OK Successful.
CAResult_t CAUnSetLEAdapterStateChangedCb();
/**
+ * Unset the callback of adapter connection state change.
+ *
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK Successful.
+ * @retval ::CA_STATUS_INVALID_PARAM Invalid input arguments.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ */
+CAResult_t CAUnSetLENWConnectionStateChangedCb();
+
+/**
* This will be used to notify errors in BLE adapter.
*
* @param[in] remoteAddress Remote endpoint Address
VERIFY_NON_NULL_VOID(obj, TAG, "obj is null");
VERIFY_NON_NULL_VOID(gatt, TAG, "gatt is null");
- jboolean isCopy;
- char* wroteData = (char*) (*env)->GetByteArrayElements(env, data, &isCopy);
-
- OIC_LOG_V(DEBUG, TAG, "CALeGattCharacteristicWriteCallback - write data : %s", wroteData);
-
// send success & signal
jstring jni_address = CALEClientGetAddressFromGattObj(env, gatt);
if (!jni_address)
#include "camutex.h"
#include "org_iotivity_ca_CaLeClientInterface.h"
+#include "org_iotivity_ca_CaLeServerInterface.h"
#define TAG PCF("OIC_CA_LE_MONITOR")
static JavaVM *g_jvm;
/**
- * @var gCALEDeviceStateChangedCallback
+ * @var g_bleDeviceStateChangedCallback
* @brief Maintains the callback to be notified on device state changed.
*/
-static CALEDeviceStateChangedCallback gCALEDeviceStateChangedCallback = NULL;
+static CALEDeviceStateChangedCallback g_bleDeviceStateChangedCallback = NULL;
/**
- * @var gCALEDeviceStateChangedCbMutex
+ * @var g_bleConnectionStateChangedCallback
+ * @brief Maintains the callback to be notified on device state changed.
+ */
+static CALEConnectionStateChangedCallback g_bleConnectionStateChangedCallback = NULL;
+
+/**
+ * @var g_bleDeviceStateChangedCbMutex
* @brief Mutex to synchronize access to the deviceStateChanged Callback when the state
* of the LE adapter gets change.
*/
-static ca_mutex gCALEDeviceStateChangedCbMutex = NULL;
+static ca_mutex g_bleDeviceStateChangedCbMutex = NULL;
+
+/**
+ * @var g_bleConnectionStateChangedCbMutex
+ * @brief Mutex to synchronize access to the LE ConnectionStateChanged Callback when the state
+ * of the LE adapter gets change.
+ */
+static ca_mutex g_bleConnectionStateChangedCbMutex = NULL;
//getting context
void CALENetworkMonitorJNISetContext()
g_jvm = CANativeJNIGetJavaVM();
}
-void CALESetNetStateCallback(CALEDeviceStateChangedCallback callback)
+void CALESetAdapterStateCallback(CALEDeviceStateChangedCallback callback)
{
- OIC_LOG(DEBUG, TAG, "CALESetNetStateCallback");
- gCALEDeviceStateChangedCallback = callback;
+ OIC_LOG(DEBUG, TAG, "CALESetAdapterStateCallback");
+ g_bleDeviceStateChangedCallback = callback;
}
CAResult_t CAInitializeLEAdapter(const ca_thread_pool_t threadPool)
CAResult_t CAInitLENwkMonitorMutexVaraibles()
{
OIC_LOG(DEBUG, TAG, "IN");
- if (NULL == gCALEDeviceStateChangedCbMutex)
+ if (NULL == g_bleDeviceStateChangedCbMutex)
{
- gCALEDeviceStateChangedCbMutex = ca_mutex_new();
- if (NULL == gCALEDeviceStateChangedCbMutex)
+ g_bleDeviceStateChangedCbMutex = ca_mutex_new();
+ if (NULL == g_bleDeviceStateChangedCbMutex)
{
OIC_LOG(ERROR, TAG, "ca_mutex_new has failed");
return CA_STATUS_FAILED;
}
}
+ if (NULL == g_bleConnectionStateChangedCbMutex)
+ {
+ g_bleConnectionStateChangedCbMutex = ca_mutex_new();
+ if (NULL == g_bleConnectionStateChangedCbMutex)
+ {
+ OIC_LOG(ERROR, TAG, "ca_mutex_new has failed");
+ ca_mutex_free(g_bleDeviceStateChangedCbMutex);
+ return CA_STATUS_FAILED;
+ }
+ }
+
OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
-
}
void CATerminateLENwkMonitorMutexVaraibles()
{
OIC_LOG(DEBUG, TAG, "IN");
- ca_mutex_free(gCALEDeviceStateChangedCbMutex);
- gCALEDeviceStateChangedCbMutex = NULL;
+ ca_mutex_free(g_bleDeviceStateChangedCbMutex);
+ g_bleDeviceStateChangedCbMutex = NULL;
+
+ ca_mutex_free(g_bleConnectionStateChangedCbMutex);
+ g_bleConnectionStateChangedCbMutex = NULL;
OIC_LOG(DEBUG, TAG, "OUT");
}
OIC_LOG(DEBUG, TAG, "Setting CALEDeviceStateChangedCallback");
- ca_mutex_lock(gCALEDeviceStateChangedCbMutex);
- CALESetNetStateCallback(callback);
- ca_mutex_unlock(gCALEDeviceStateChangedCbMutex);
+ ca_mutex_lock(g_bleDeviceStateChangedCbMutex);
+ CALESetAdapterStateCallback(callback);
+ ca_mutex_unlock(g_bleDeviceStateChangedCbMutex);
OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
return CA_STATUS_OK;
}
+CAResult_t CASetLENWConnectionStateChangedCb(CALEConnectionStateChangedCallback callback)
+{
+ OIC_LOG(DEBUG, TAG, "IN");
+ ca_mutex_lock(g_bleConnectionStateChangedCbMutex);
+ g_bleConnectionStateChangedCallback = callback;
+ ca_mutex_unlock(g_bleConnectionStateChangedCbMutex);
+ OIC_LOG(DEBUG, TAG, "OUT");
+ return CA_STATUS_OK;
+}
+
+CAResult_t CAUnsetLENWConnectionStateChangedCb()
+{
+ OIC_LOG(DEBUG, TAG, "IN");
+ ca_mutex_lock(g_bleConnectionStateChangedCbMutex);
+ g_bleConnectionStateChangedCallback = NULL;
+ ca_mutex_unlock(g_bleConnectionStateChangedCbMutex);
+ OIC_LOG(DEBUG, TAG, "OUT");
+ return CA_STATUS_OK;
+}
+
JNIEXPORT void JNICALL
Java_org_iotivity_ca_CaLeClientInterface_caLeStateChangedCallback(JNIEnv *env, jobject obj,
jint status)
OIC_LOG_V(DEBUG, TAG, "CaLeClientInterface - Network State Changed : status(%d)", status);
- if (!gCALEDeviceStateChangedCallback)
+ if (!g_bleDeviceStateChangedCallback)
{
OIC_LOG(ERROR, TAG, "gNetworkChangeCb is null");
return;
CALEClientCreateDeviceList();
CALEServerCreateCachedDeviceList();
- gCALEDeviceStateChangedCallback(newStatus);
+ g_bleDeviceStateChangedCallback(newStatus);
}
else if (state_turning_off == status) // BT_STATE_TURNING_OFF:13
{
CALEClientSetScanFlag(false);
CANetworkStatus_t newStatus = CA_INTERFACE_DOWN;
- gCALEDeviceStateChangedCallback(newStatus);
+ g_bleDeviceStateChangedCallback(newStatus);
}
}
JNIEXPORT void JNICALL
Java_org_iotivity_ca_CaLeClientInterface_caLeBondStateChangedCallback(JNIEnv *env, jobject obj,
- jstring addr)
+ jstring jaddr, jboolean jconnected)
{
OIC_LOG(DEBUG, TAG, "CaLeClientInterface - Bond State Changed");
VERIFY_NON_NULL_VOID(env, TAG, "env is null");
VERIFY_NON_NULL_VOID(obj, TAG, "obj is null");
- VERIFY_NON_NULL_VOID(addr, TAG, "addr is null");
+ VERIFY_NON_NULL_VOID(jaddr, TAG, "jaddr is null");
// geneally 'addr' parameter will be not ble address, if you didn't bond for BLE.
// below logics will be needed when ble pairing is set.
- CAResult_t res = CALEClientDisconnectforAddress(env, addr);
+ CAResult_t res = CALEClientDisconnectforAddress(env, jaddr);
if (CA_STATUS_OK != res)
{
OIC_LOG(ERROR, TAG, "CALEClientDisconnectforAddress has failed");
}
// remove obj for client
- res = CALEClientRemoveGattObjForAddr(env, addr);
+ res = CALEClientRemoveGattObjForAddr(env, jaddr);
if (CA_STATUS_OK != res)
{
OIC_LOG(ERROR, TAG, "CANativeRemoveGattObjForAddr has failed");
}
- res = CALEClientRemoveDeviceInScanDeviceList(env, addr);
+ res = CALEClientRemoveDeviceInScanDeviceList(env, jaddr);
if (CA_STATUS_OK != res)
{
OIC_LOG(ERROR, TAG, "CALEClientRemoveDeviceInScanDeviceList has failed");
}
// remove obej for server
- res = CALEServerRemoveDevice(env, addr);
+ res = CALEServerRemoveDevice(env, jaddr);
if (CA_STATUS_OK != res)
{
OIC_LOG(ERROR, TAG, "CALEServerRemoveDevice has failed");
}
+ const char* address = (*env)->GetStringUTFChars(env, jaddr, NULL);
+ if (!address)
+ {
+ OIC_LOG(ERROR, TAG, "address is null");
+ return;
+ }
+
+ g_bleConnectionStateChangedCallback(CA_ADAPTER_GATT_BTLE, address, (bool)jconnected);
}
* @param[in] callback Callback to be notified on reception of BT state information.
*/
-void CALESetNetStateCallback(CALEDeviceStateChangedCallback callback);
+void CALESetAdapterStateCallback(CALEDeviceStateChangedCallback callback);
#ifdef __cplusplus
} /* extern "C" */
/*
* Class: org_iotivity_ca_caLeClientInterface
* Method: caLeBondStateChangedCallback
- * Signature: (I)V
+ * Signature: (Ljava/lang/String;Z)V
*/
JNIEXPORT void JNICALL
Java_org_iotivity_ca_caLeClientInterface_caLeBondStateChangedCallback
-(JNIEnv *, jobject, jstring);
+(JNIEnv *, jobject, jstring, jboolean);
#ifdef __cplusplus
}
}
+CAResult_t CASetLENWConnectionStateChangedCb(CALEConnectionStateChangedCallback callback)
+{
+ //TODO
+ return CA_STATUS_OK;
+}
static void CASetLEAdapterThreadPoolHandle(ca_thread_pool_t handle);
/**
- * Call the callback to the upper layer when the device state gets
+ * Call the callback to the upper layer when the adapter state gets
* changed.
*
* @param[in] adapter_state New state of the adapter to be notified to
static void CALEDeviceStateChangedCb(CAAdapterState_t adapter_state);
/**
+ * Call the callback to the upper layer when the device connection state gets
+ * changed.
+ *
+ * @param[in] address LE address of the device to be notified to the upper layer.
+ * @param[in] isConnected whether connection state is connected or not.
+ */
+static void CALEConnectionStateChangedCb(CATransportAdapter_t adapter, const char* address,
+ bool isConnected);
+
+/**
* Used to initialize all required mutex variable for LE Adapter
* implementation.
*
*
* @param[in] remoteAddress Remote address of the device from where
* data is received.
- * @param[in] data Actual data recevied from the remote
+ * @param[in] data Actual data received from the remote
* device.
* @param[in] dataLength Length of the data received from the
* remote device.
{
OIC_LOG(ERROR, CALEADAPTER_TAG, "CASetLEAdapterStateChangedCb failed!");
}
+
+ res = CASetLENWConnectionStateChangedCb(CALEConnectionStateChangedCb);
+ if (CA_STATUS_OK != res)
+ {
+ OIC_LOG(ERROR, CALEADAPTER_TAG, "CALEConnectionStateChangedCb failed!");
+ }
}
else
{
return res;
}
+static void CALEConnectionStateChangedCb(CATransportAdapter_t adapter, const char* address,
+ bool isConnected)
+{
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "IN - CALEConnectionStateChangedCb");
+
+ VERIFY_NON_NULL_VOID(address, CALEADAPTER_TAG, "address");
+
+#ifdef __TIZEN__
+ ca_mutex_lock(g_bleIsServerMutex);
+ switch (g_adapterType)
+ {
+ case ADAPTER_SERVER:
+ CALEGattServerConnectionStateChanged(isConnected, address);
+ break;
+ case ADAPTER_CLIENT:
+ CALEGattConnectionStateChanged(isConnected, address);
+ break;
+ case ADAPTER_BOTH_CLIENT_SERVER:
+ CALEGattConnectionStateChanged(isConnected, address);
+ CALEGattServerConnectionStateChanged(isConnected, address);
+ break;
+ default:
+ break;
+ }
+ ca_mutex_unlock(g_bleIsServerMutex);
+#endif
+
+ if(!isConnected)
+ {
+#ifndef SINGLE_THREAD
+ if(g_bleClientSenderInfo)
+ {
+ CABLESenderInfo_t *senderInfo = NULL;
+ uint32_t senderIndex = 0;
+
+ if(CA_STATUS_OK == CALEGetSenderInfo(address, g_bleClientSenderInfo, &senderInfo,
+ &senderIndex))
+ {
+ u_arraylist_remove(g_bleClientSenderInfo, senderIndex);
+ OICFree(senderInfo->defragData);
+ OICFree(senderInfo->remoteEndpoint);
+ OICFree(senderInfo);
+
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "SenderInfo is removed for disconnection");
+ }
+ else
+ {
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "SenderInfo doesn't exist");
+ }
+ }
+
+ if(g_bleServerSenderInfo)
+ {
+ CABLESenderInfo_t *senderInfo = NULL;
+ uint32_t senderIndex = 0;
+
+ if(CA_STATUS_OK == CALEGetSenderInfo(address, g_bleServerSenderInfo, &senderInfo,
+ &senderIndex))
+ {
+ u_arraylist_remove(g_bleServerSenderInfo, senderIndex);
+ OICFree(senderInfo->defragData);
+ OICFree(senderInfo->remoteEndpoint);
+ OICFree(senderInfo);
+
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "SenderInfo is removed for disconnection");
+ }
+ else
+ {
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "SenderInfo doesn't exist");
+ }
+ }
+#endif
+ }
+
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "OUT");
+}
+
static void CALEDeviceStateChangedCb(CAAdapterState_t adapter_state)
{
OIC_LOG(DEBUG, CALEADAPTER_TAG, "IN - CALEDeviceStateChangedCb");
return CA_STATUS_OK;
}
+CAResult_t CASetLENWConnectionStateChangedCb(CALEConnectionStateChangedCallback callback)
+{
+ //TODO
+ return CA_STATUS_OK;
+}
+
CAResult_t CAGetLEAddress(char **local_address)
{
OIC_LOG(DEBUG, TAG, "Get Linux BLE local device information.");
OIC_LOG(DEBUG, TAG, "OUT ");
}
-void CALEGattConnectionStateChangedCb(int result, bool connected,
- const char *remoteAddress, void *userData)
+void CALEGattConnectionStateChanged(bool connected, const char *remoteAddress)
{
OIC_LOG(DEBUG, TAG, "IN ");
{
OIC_LOG(DEBUG, TAG, "IN");
- int ret = bt_gatt_set_connection_state_changed_cb(CALEGattConnectionStateChangedCb, NULL);
- if (BT_ERROR_NONE != ret)
- {
- OIC_LOG_V(ERROR, TAG,
- "bt_gatt_set_connection_state_changed_cb Failed with return as [%s ]",
- CALEGetErrorMsg(ret));
- return CA_STATUS_FAILED;
- }
-
OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
* This is the callback which will be called whenever there is change in gatt connection
* with server(Connected/Disconnected)
*
- * @param[in] result The result of connection state change.
* @param[in] connected State of connection
* @param[in] remoteAddress Mac address of the remote device in which we made connection.
- * @param[in] userData The user data passed from the request function
*/
-void CALEGattConnectionStateChangedCb(int result, bool connected,
- const char *remoteAddress,void *userData);
+void CALEGattConnectionStateChanged(bool connected, const char *remoteAddress);
/**
* This is the callback which will be called when LE advertisement is found.
static CALEDeviceStateChangedCallback g_bleDeviceStateChangedCallback = NULL;
/**
+ * Maintains the callback to be notified on device state changed.
+ */
+static CALEConnectionStateChangedCallback g_bleConnectionStateChangedCallback = NULL;
+
+/**
* Mutex to synchronize access to the deviceStateChanged Callback when the state
* of the LE adapter gets change.
*/
static ca_mutex g_bleDeviceStateChangedCbMutex = NULL;
/**
+ * Mutex to synchronize access to the ConnectionStateChanged Callback when the state
+ * of the LE adapter gets change.
+ */
+static ca_mutex g_bleConnectionStateChangedCbMutex = NULL;
+
+/**
* This is the callback which will be called when the adapter state gets changed.
*
* @param result [IN] Result of the query done to the platform.
* @return None.
*/
void CALEAdapterStateChangedCb(int result, bt_adapter_state_e adapter_state,
- void *user_data);
+ void *user_data);
+
+/**
+* This is the callback which will be called when the connection state gets changed.
+*
+* @param result [IN] Result of the query done to the platform.
+* @param connected [IN] State of connection.
+* @param remoteAddress [IN] LE address of the device to be notified.
+* @param user_data [IN] Any user_data passed by the caller when querying for the state changed cb.
+*
+* @return None.
+*/
+void CALENWConnectionStateChangedCb(int result, bool connected,
+ const char *remoteAddress, void *userData);
void CALEMainLoopThread(void *param)
{
return CA_STATUS_FAILED;
}
}
+
+ if (NULL == g_bleConnectionStateChangedCbMutex)
+ {
+ g_bleConnectionStateChangedCbMutex = ca_mutex_new();
+ if (NULL == g_bleConnectionStateChangedCbMutex)
+ {
+ OIC_LOG(ERROR, TAG, "ca_mutex_new failed");
+ ca_mutex_free(g_bleDeviceStateChangedCbMutex);
+ return CA_STATUS_FAILED;
+ }
+ }
OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
ca_mutex_free(g_bleDeviceStateChangedCbMutex);
g_bleDeviceStateChangedCbMutex = NULL;
+ ca_mutex_free(g_bleConnectionStateChangedCbMutex);
+ g_bleConnectionStateChangedCbMutex = NULL;
OIC_LOG(DEBUG, TAG, "OUT");
}
return CA_STATUS_FAILED;
}
+ ret = bt_gatt_set_connection_state_changed_cb(CALENWConnectionStateChangedCb, NULL);
+ if (BT_ERROR_NONE != ret)
+ {
+ OIC_LOG_V(ERROR, TAG,
+ "bt_gatt_set_connection_state_changed_cb has failed");
+ return CA_STATUS_FAILED;
+ }
+
OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
return CA_STATUS_OK;
}
+CAResult_t CASetLENWConnectionStateChangedCb(CALEConnectionStateChangedCallback callback)
+{
+ OIC_LOG(DEBUG, TAG, "IN");
+ ca_mutex_lock(g_bleConnectionStateChangedCbMutex);
+ g_bleConnectionStateChangedCallback = callback;
+ ca_mutex_unlock(g_bleConnectionStateChangedCbMutex);
+ OIC_LOG(DEBUG, TAG, "OUT");
+ return CA_STATUS_OK;
+}
+
+CAResult_t CAUnsetLENWConnectionStateChangedCb()
+{
+ OIC_LOG(DEBUG, TAG, "IN");
+ ca_mutex_lock(g_bleConnectionStateChangedCbMutex);
+ g_bleConnectionStateChangedCallback = NULL;
+ ca_mutex_unlock(g_bleConnectionStateChangedCbMutex);
+ OIC_LOG(DEBUG, TAG, "OUT");
+ return CA_STATUS_OK;
+}
+
void CALEAdapterStateChangedCb(int result, bt_adapter_state_e adapter_state,
void *user_data)
{
OIC_LOG(DEBUG, TAG, "OUT");
}
+
+void CALENWConnectionStateChangedCb(int result, bool connected,
+ const char *remoteAddress, void *userData)
+{
+ OIC_LOG(DEBUG, TAG, "IN ");
+
+ VERIFY_NON_NULL_VOID(remoteAddress, TAG, "remote address is NULL");
+
+ if (!connected)
+ {
+ OIC_LOG_V(DEBUG, TAG, "disconnected [%s] ", remoteAddress);
+ ca_mutex_lock(g_bleConnectionStateChangedCbMutex);
+ const char *addr = OICStrdup(remoteAddress);
+ g_bleConnectionStateChangedCallback(CA_ADAPTER_GATT_BTLE, addr, connected);
+ ca_mutex_unlock(g_bleConnectionStateChangedCbMutex);
+ }
+ else
+ {
+ OIC_LOG_V(DEBUG, TAG, "connected [%s] ", remoteAddress);
+ }
+
+ OIC_LOG(DEBUG, TAG, "OUT");
+}
g_connStateCb = connStateCb;
}
-void CALEGattServerConnectionStateChangedCb(int result, bool connected,
- const char *remoteAddress, void *userData)
+void CALEGattServerConnectionStateChanged(bool connected, const char *remoteAddress)
{
VERIFY_NON_NULL_VOID(remoteAddress, TAG, "remote address");
- OIC_LOG_V(DEBUG, TAG, "CABleGattConnectionStateChangedCb result[%d]", result);
-
if (connected)
{
OIC_LOG_V(DEBUG, TAG, "Connected to [%s]", remoteAddress);
return;
}
- int res = bt_gatt_set_connection_state_changed_cb(CALEGattServerConnectionStateChangedCb,
- NULL);
- if (BT_ERROR_NONE != res)
- {
- OIC_LOG_V(ERROR, TAG,
- "bt_gatt_set_connection_state_changed_cb Failed with return as [%s]",
- CALEGetErrorMsg(res));
- return;
- }
-
ret = CALEStartAdvertise(serviceUUID);
if (CA_STATUS_OK != ret)
{
* This is the callback which will be called whenever there is change in gatt connection
* with Client(Connected/Disconnected).
*
- * @param[in] result The result of discovering.
* @param[in] connected State of connection.
* @param[in] remoteAddress Mac address of the remote device in which we made connection.
- * @param[in] userData The user data passed from the request function.
*/
-void CALEGattServerConnectionStateChangedCb(int result, bool connected,
- const char *remoteAddress, void *userData);
-
-/**
- * Callback function type for network status changes delivery from CA common logic.
- * @param[in] adapter Transport type information.
- * @param[in] remoteAddress Endpoint object from which the connection status is changed.
- * @param[in] connected State of connection.
- */
-typedef void (*CALEConnectionStateChangedCallback)(CATransportAdapter_t adapter,
- const char *remoteAddress, bool connected);
+void CALEGattServerConnectionStateChanged(bool connected, const char *remoteAddress);
/**
* Setting the connection state changed callback.