Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / caedrinterface.h
index cbf26e9..6944270 100644 (file)
@@ -1,4 +1,4 @@
-/******************************************************************
+/* ****************************************************************
  *
  * Copyright 2014 Samsung Electronics All Rights Reserved.
  *
@@ -41,8 +41,8 @@ extern "C"
 
 typedef enum
 {
-    STATE_DISCONNECTED, /**< State is Disconnected */
-    STATE_CONNECTED /**< State is Connected */
+    STATE_DISCONNECTED, /**< State is Disconnected. */
+    STATE_CONNECTED     /**< State is Connected. */
 } CAConnectedState_t;
 
 typedef struct connected_state
@@ -52,253 +52,235 @@ typedef struct connected_state
 } state_t;
 
 /**
- * @enum  CAAdapterServerType_t
- * @brief Enum for defining different server types.
+ * Enum for defining different server types.
  */
 typedef enum
 {
-    CA_UNICAST_SERVER = 0,    /**< Unicast Server */
-    CA_MULTICAST_SERVER,      /**< Multicast Server */
-    CA_SECURED_UNICAST_SERVER /**< Secured Unicast Server */
+    CA_UNICAST_SERVER = 0,    /**< Unicast Server. */
+    CA_MULTICAST_SERVER,      /**< Multicast Server. */
+    CA_SECURED_UNICAST_SERVER /**< Secured Unicast Server. */
 } CAAdapterServerType_t;
 
 /**
- * @struct CAEDRData
- * @brief  Structure to maintain the information of data in message queue.
+ * Structure to maintain the information of data in message queue.
  */
 typedef struct
 {
-    CAEndpoint_t *remoteEndpoint;       /**< Remote Endpoint */
-    void *data;                         /**< Data to be sent */
-    uint32_t dataLen;                   /**< Length of the data to be sent */
+    CAEndpoint_t *remoteEndpoint;       /**< Remote Endpoint. */
+    uint8_t *data;                      /**< Data to be sent. */
+    uint32_t dataLen;                   /**< Length of the data to be sent. */
 } CAEDRData;
 
 /**
- * @struct CAEDRNetworkEvent
- * @brief  Structure to maintain the adapter information and its status.
+ * Structure to maintain the adapter information and its status.
  */
 typedef struct
 {
-    CAEndpoint_t *info;          /**< Local Connectivity Information */
-    CANetworkStatus_t status;    /**< Network Status */
+    CAEndpoint_t *info;          /**< Local Connectivity Information. */
+    CANetworkStatus_t status;    /**< Network Status. */
 } CAEDRNetworkEvent;
 
 /**
- * @brief This will be used during the recive of network requests and response.
- * @param remoteAddress [IN] EDR address of remote OIC device from which data received.
- * @param data          [IN] Data received
- * @param dataLength    [IN] Length of the Data received
- * @param sentLength    [OUT] Length of the sent data
- * @return NONE
- * @pre Callback must be registered using CAEDRSetPacketReceivedCallback()
+ * This will be used during the Receiver of network requests and response.
+ * @param[in] remoteAddress EDR address of remote OIC device from which data received.
+ * @param[in] data          Data received.
+ * @param[in] dataLength    Length of the Data received.
+ * @param[out] sentLength    Length of the sent data.
+ * @pre Callback must be registered using CAEDRSetPacketReceivedCallback().
  */
-typedef void (*CAEDRDataReceivedCallback)(const char *remoteAddress, const void *data,
+typedef void (*CAEDRDataReceivedCallback)(const char *remoteAddress, const uint8_t *data,
                                           uint32_t dataLength, uint32_t *sentLength);
 
 /**
- * @brief This will be used during change in network status.
- * @param status        [IN] Network Status of the adapter
- * @return NONE
+ * This will be used during change in network status.
+ * @param[in] status        Network Status of the adapter.
  */
 typedef void (*CAEDRNetworkStatusCallback)(CANetworkStatus_t status);
 
 /**
- * @brief Callback to notify the error in the EDR adapter
- * @param  remoteAddress   [IN] Remote EDR Address
- * @param  serviceUUID     [IN] Service UUID of the device
- * @param  data            [IN] data containing token, uri and coap data
- * @param  dataLength      [IN] length of data
- * @param  result          [IN] error code as defined in CAResult_t
- * @return NONE
- * @pre Callback must be registered using CAEDRSetPacketReceivedCallback()
+ * Callback to notify the error in the EDR adapter.
+ * @param[in]  remoteAddress   Remote EDR Address.
+ * @param[in]  data            data containing token, uri and coap data.
+ * @param[in]  dataLength      length of data.
+ * @param[in]  result          error code as defined in ::CAResult_t.
+ * @pre Callback must be registered using CAEDRSetPacketReceivedCallback().
  */
-typedef void (*CAEDRErrorHandleCallback)(const char *remoteAddress, const char *serviceUUID,
-                                         const void *data, uint32_t dataLength, CAResult_t result);
+typedef void (*CAEDRErrorHandleCallback)(const char *remoteAddress,
+                                         const uint8_t *data,
+                                         uint32_t dataLength,
+                                         CAResult_t result);
 
 /**
- * @brief  Initialize the network monitor module
- * @param  threadPool   [IN] Threadpool Handle
- * @return #CA_STATUS_OK or Appropriate error code
- * @retval #CA_STATUS_OK  Successful
- * @retval #CA_ADAPTER_NOT_ENABLED Initialization is successful, but bluetooth adapter is
- *                                 not enabled.
- * @retval #CA_STATUS_FAILED Operation failed
- * @see  CAEDRTerminateNetworkMonitor()
+ * Initialize the network monitor module
+ * @param[in]  threadPool   Threadpool Handle.
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_ADAPTER_NOT_ENABLED Initialization is successful, but
+ * bluetooth adapter is not enabled.
+ * @retval ::CA_STATUS_FAILED Operation failed.
+ * @see  CAEDRTerminateNetworkMonitor().
  */
 CAResult_t CAEDRInitializeNetworkMonitor(const ca_thread_pool_t threadPool);
 
 /**
- * @brief  Deinitialize with bluetooth adapter.
- * @return NONE
- * @pre    CAEDRInitializeNetworkMonitor() should be invoked before using this API.
- * @see    CAEDRInitializeNetworkMonitor()
+ * Deinitialize with bluetooth adapter.
+ * @pre    CAEDRInitializeNetworkMonitor() should be invoked before using
+ * this API.
+ * @see    CAEDRInitializeNetworkMonitor().
  */
 void CAEDRTerminateNetworkMonitor();
 
 /**
- * @brief  Start Network Monitoring Process
- * @return #CA_STATUS_OK or Appropriate error code
+ * Start Network Monitoring Process.
+ * @return ::CA_STATUS_OK or Appropriate error code.
  */
 CAResult_t CAEDRStartNetworkMonitor();
 
 /**
- * @brief  Stop Network Monitoring Process
- * @return #CA_STATUS_OK or Appropriate error code
+ * Stop Network Monitoring Process.
+ * @return ::CA_STATUS_OK or Appropriate error code.
  */
 CAResult_t CAEDRStopNetworkMonitor();
 
 /**
- * @brief  Sets the callback and Starts discovery for nearby OIC bluetooth devices.
+ * Sets the callback and Starts discovery for nearby OIC bluetooth devices.
  *
- * @return #CA_STATUS_OK or Appropriate error code
- * @retval #CA_STATUS_OK  Successful
- * @retval #CA_STATUS_FAILED Operation failed
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_FAILED Operation failed.
  */
 CAResult_t CAEDRClientSetCallbacks();
 
 /**
- * @brief  Resetting callbacks with bluetooth framework and stop OIC device discovery.
- * @return NONE
+ * Resetting callbacks with bluetooth framework and stop OIC device discovery.
  * @pre    CAEDRClientSetCallbacks() should be invoked before using this API.
- * @see    CAEDRClientSetCallbacks()
+ * @see    CAEDRClientSetCallbacks().
  */
 void CAEDRClientUnsetCallbacks();
 
 /**
- * @brief  Used to initialize the EDR client module where mutex is initialized
- * @return NONE
+ * Used to initialize the EDR client module where mutex is initialized.
  */
 void CAEDRInitializeClient(ca_thread_pool_t handle);
 
 /**
- * @brief  Destroys the Device list and mutex.
- * @return NONE
+ * Destroys the Device list and mutex.
  */
 void CAEDRClientTerminate();
 
 /**
- * @brief  Closes all the client connection to peer bluetooth devices.
- * @return NONE
+ * Closes all the client connection to peer bluetooth devices.
  */
 void CAEDRClientDisconnectAll();
 
 /**
- * @brief  Register callback to send the received packets from remote bluetooth device to BTAdapter.
+ * Register callback to send the received packets from remote bluetooth
+ * device to BTAdapter.
  *
- * @param  packetReceivedCallback [IN] Callback function to register for sending network
- *                                     packets to EDR Adapter.
- * @return NONE
+ * @param[in]  packetReceivedCallback Callback function to register for
+ * sending network packets to EDR Adapter.
  */
 void CAEDRSetPacketReceivedCallback(CAEDRDataReceivedCallback packetReceivedCallback);
 
 /**
- * @brief  Register callback for receiving local bluetooth adapter state.
+ * Register callback for receiving local bluetooth adapter state.
  *
- * @param  networkStateChangeCallback [IN] Callback function to register for receiving local
- *                                         bluetooth adapter status.
- * @return NONE
+ * @param[in]  networkStateChangeCallback Callback function to register
+ * for receiving local bluetooth adapter status.
  */
 void CAEDRSetNetworkChangeCallback(CAEDRNetworkStatusCallback networkStateChangeCallback);
 
 /**
- * @brief  set error callback to notify error in EDR adapter
+ * set error callback to notify error in EDR adapter.
  *
- * @param  errorHandleCallback [IN] Callback function to notify the error in the EDR adapter
- * @return NONE
+ * @param[in]  errorHandleCallback Callback function to notify the error
+ * in the EDR adapter.
  */
 void CAEDRSetErrorHandler(CAEDRErrorHandleCallback errorHandleCallback);
 
 
 /**
- * @brief  Get the local bluetooth adapter information.
+ * Get the local bluetooth adapter information.
  *
- * @param  info [OUT] Local bluetooth adapter information
+ * @param[out]  info Local bluetooth adapter information.
  *
- * @return #CA_STATUS_OK or Appropriate error code
- * @retval #CA_STATUS_OK  Successful
- * @retval #CA_STATUS_INVALID_PARAM  Invalid input argumets
- * @retval #CA_STATUS_FAILED Operation failed
+ * @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.
  *
- * @see #CALocalConnectivity_t
+ * @see CALocalConnectivity_t
  *
  */
 CAResult_t CAEDRGetInterfaceInformation(CAEndpoint_t **info);
 
 /**
- * @brief  Start RFCOMM server for given service UUID
+ * Start RFCOMM server for given service UUID
  *
- * @param  serviceUUID  [IN] The UUID of service with which RFCOMM server needs to be started.
- * @param  serverFD     [IN] The RFCOMM server socket file descriptor.
- * @param  handle       [IN] Threadpool Handle
+ * @param[in]  handle       Threadpool Handle.
  *
- * @return #CA_STATUS_OK or Appropriate error code
- * @retval #CA_STATUS_OK  Successful
- * @retval #CA_STATUS_INVALID_PARAM  Invalid input argumets
- * @retval #CA_STATUS_FAILED Operation failed
+ * @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 CAEDRServerStart(const char *serviceUUID, int *serverFD, ca_thread_pool_t handle);
+CAResult_t CAEDRServerStart(ca_thread_pool_t handle);
 
 /**
- * @brief  Stop RFCOMM server
+ * Stop RFCOMM server
  *
- * @param  serverFD [IN] The RFCOMM server socket file descriptor which needs to be stopped.
- *
- * @return #CA_STATUS_OK or Appropriate error code
- * @retval #CA_STATUS_OK  Successful
- * @retval #CA_STATUS_FAILED Operation failed
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_FAILED Operation failed.
  */
-CAResult_t CAEDRServerStop(int serverFD);
+CAResult_t CAEDRServerStop();
 
 /**
- * @brief   Terminate server for EDR
- * @return  None
+ * Terminate server for EDR.
  */
 void CAEDRServerTerminate();
 
 /**
- * @brief  All received data will be notified to upper layer.
+ * All received data will be notified to upper layer.
  *
- * @return #CA_STATUS_OK or Appropriate error code
- * @retval #CA_STATUS_OK  Successful
- * @retval #CA_STATUS_FAILED Operation failed
+ * @return ::CA_STATUS_OK or Appropriate error code.
+ * @retval ::CA_STATUS_OK  Successful.
+ * @retval ::CA_STATUS_FAILED Operation failed.
  *
  */
 CAResult_t CAEDRManagerReadData();
 
 /**
- * @brief  This function gets bluetooth adapter enable state.
- * @param  state    [OUT] State of the Adapter.
- * @return #CA_STATUS_OK or Appropriate error code
+ * This function gets bluetooth adapter enable state.
+ * @param[out]  state    State of the Adapter.
+ * @return ::CA_STATUS_OK or Appropriate error code.
  */
 CAResult_t CAEDRGetAdapterEnableState(bool *state);
 
 /**
- * @brief  This function sends data to specified remote bluetooth device.
- * @param  remoteAddress   [IN] Remote EDR Address
- * @param  serviceUUID     [IN] Service UUID of the device
- * @param  data            [IN] Data to be sent
- * @param  dataLength      [IN] Length of the data to be sent
- * @param  sentLength      [OUT] Length of the actual sent data
- * @return #CA_STATUS_OK or Appropriate error code
+ * This function sends data to specified remote bluetooth device.
+ * @param[in]  remoteAddress   Remote EDR Address.
+ * @param[in]  data            Data to be sent.
+ * @param[in]  dataLength      Length of the data to be sent.
+ * @return ::CA_STATUS_OK or Appropriate error code.
  */
-CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress, const char *serviceUUID,
-                                      const void *data, uint32_t dataLength, uint32_t *sentLength);
+CAResult_t CAEDRClientSendUnicastData(const char *remoteAddress,
+                                      const uint8_t *data,
+                                      uint32_t dataLength);
 
 /**
- * @brief  This function sends data to all bluetooth devices running OIC service.
- * @param  serviceUUID     [IN] Service UUID of the device
- * @param  data            [IN] Data to be sent
- * @param  dataLength      [IN] Length of the data to be sent
- * @param  sentLength      [OUT] Length of the actual sent data
- * @return #CA_STATUS_OK or Appropriate error code
+ * This function sends data to all bluetooth devices running OIC service.
+ * @param[in]  data            Data to be sent.
+ * @param[in]  dataLength      Length of the data to be sent.
+ * @return ::CA_STATUS_OK or Appropriate error code.
  */
-CAResult_t CAEDRClientSendMulticastData(const char *serviceUUID, const void *data,
-                                        uint32_t dataLength, uint32_t *sentLength);
+CAResult_t CAEDRClientSendMulticastData(const uint8_t *data,
+                                        uint32_t dataLength);
 
 /**
- * @brief This function gets bonded bluetooth device list
- * @return #CA_STATUS_OK or Appropriate error code
+ * This function gets bonded bluetooth device list
+ * @return ::CA_STATUS_OK or Appropriate error code.
  */
 CAResult_t CAEDRGetBondedDeviceList();
 
@@ -307,4 +289,3 @@ CAResult_t CAEDRGetBondedDeviceList();
 #endif
 
 #endif /* CA_EDR_INTERFACE_H_ */
-