replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / caleinterface.h
index b1701a1..c354ee3 100644 (file)
@@ -72,12 +72,39 @@ typedef struct
 } CALEData_t;
 
 /**
+ * The MTU supported for BLE adapter
+ */
+#ifdef __APPLE__
+#define CA_DEFAULT_BLE_MTU_SIZE  152
+#else
+#define CA_DEFAULT_BLE_MTU_SIZE  20
+#endif
+/**
+ * The MTU supported for BLE spec
+ */
+#define CA_SUPPORTED_BLE_MTU_SIZE  517
+
+/**
+ * The Header of the MTU supported for BLE spec
+ */
+#define CA_BLE_MTU_HEADER_SIZE  5
+
+/**
  * This will be used to notify device status changes to the LE adapter layer.
  * @param[in]  adapter_state State of the adapter.
  */
 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.
  *
@@ -106,7 +133,7 @@ typedef CAResult_t (*CABLEDataReceivedCallback)(const char *remoteAddress,
  * @retval ::CA_STATUS_INVALID_PARAM  Invalid input arguments
  * @retval ::CA_STATUS_FAILED Operation failed
  */
-CAResult_t CAInitializeLEAdapter(const ca_thread_pool_t threadPool);
+CAResult_t CAInitializeLEAdapter();
 
 /**
  * Start the LE adapter layer.
@@ -177,6 +204,19 @@ void CATerminateLENetworkMonitor();
 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
@@ -374,7 +414,7 @@ void CASetLEServerThreadPoolHandle(ca_thread_pool_t handle);
 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.
@@ -384,6 +424,16 @@ void CASetLEClientThreadPoolHandle(ca_thread_pool_t handle);
 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
@@ -412,6 +462,24 @@ void CASetBLEClientErrorHandleCallback(CABLEErrorHandleCallback callback);
  */
 void CASetBLEServerErrorHandleCallback(CABLEErrorHandleCallback callback);
 
+/**
+ * This is the callback which will be called whenever there is change in gatt connection
+ * with Client(Connected/Disconnected).
+ *
+ * @param[in]  connected      State of connection.
+ * @param[in]  remoteAddress  Mac address of the remote device in which we made connection.
+ */
+void CALEGattServerConnectionStateChanged(bool connected, const char *remoteAddress);
+
+/**
+ * This is the callback which will be called whenever there is change in gatt connection
+ * with server(Connected/Disconnected)
+ *
+ * @param[in]  connected     State of connection
+ * @param[in]  remoteAddress Mac address of the remote device in which we made connection.
+ */
+void CALEGattConnectionStateChanged(bool connected, const char *remoteAddress);
+
 #ifdef __cplusplus
 }
 #endif