Implementation of connectivity abstraction feature Release v0.3
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / caedradapter.h
index 4e64b09..f454611 100644 (file)
@@ -37,99 +37,146 @@ extern "C"
 #endif
 
 /**
- * @brief Initialize EDR connectivity interface.
- * @param registerCallback [IN] To register EDR interfaces to Connectivity Abstraction Layer
- * @param reqRespCallback [IN] sending responses and discovery messages from unicast , multicast servers
- * @param netCallback [IN] Intimate the network additions to Connectivity Abstraction Layer.
- * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
+ * @fn  CAInitializeEDR
+ * @brief  Initialize EDR connectivity interface.
+ *
+ * @param[in]  registerCallback  To register EDR interfaces to Connectivity Abstraction Layer
+ * @param[in]  reqRespCallback  Callback to be notified on receival of request/responses from
+ *                                          peer bluetooth devices.
+ * @param[in]  netCallback  Callback to be notified when network adapter state changes.
+ * @param[in]  threadPool  Thread pool for handling asynchronous tasks.
+ *
+ * @return  #CA_STATUS_OK or #CA_ADAPTER_NOT_ENABLED on success otherwise proper error code.
+ * @retval  #CA_STATUS_OK  Successful
+ * @retval  #CA_STATUS_INVALID_PARAM  Invalid input parameters
+ * @retval  #CA_ADAPTER_NOT_ENABLED Initialization is successful, but bluetooth adapter is
+ *                                                      not enabled
+ * @retval  #CA_STATUS_FAILED Operation failed
  */
 CAResult_t CAInitializeEDR(CARegisterConnectivityCallback registerCallback,
-                           CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback,
+                           CANetworkPacketReceivedCallback reqRespCallback,
+                           CANetworkChangeCallback netCallback,
                            u_thread_pool_t handle);
 
 /**
- * @brief Starting EDR connectivity adapters .As its peer to peer it doesnot require to start any servers
- * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
+ * @fn  CAStartEDR
+ * @brief  Starting EDR connectivity adapters. As its peer to peer it doesnot require to start
+ *           any servers.
+ *
+ * @return  #CA_STATUS_OK on success otherwise proper error code.
+ * @retval  #CA_STATUS_OK  Successful
+ * @retval  #CA_ADAPTER_NOT_ENABLED Bluetooth adapter is not enabled
+ * @retval  #CA_STATUS_FAILED Operation failed
+ *
  */
 CAResult_t CAStartEDR();
 
 /**
- * @brief Starting listening server for receiving multicast search requests
- * Transport Specific Behavior:
- *   EDR  Starts RFCOMM Server with prefixed UUID as per specification.
- * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
+ * @fn  CAStartEDRListeningServer
+ * @brief  Starting listening server for receiving multicast search requests.
+ *            Starts RFCOMM Server with prefixed UUID as per OIC specification.
+ *
+ * @return  #CA_STATUS_OK on success otherwise proper error code.
+ * @retval  #CA_STATUS_OK  Successful
+ * @retval  #CA_SERVER_STARTED_ALREADY  Server is already started and running for the predefined
+ *                                                            service UUID
+ * @retval  #CA_STATUS_FAILED Operation failed
+ *
  */
 CAResult_t CAStartEDRListeningServer();
 
 /**
- * @brief for starting discovery servers for receiving multicast advertisements
- * Transport Specific Behavior:
- *   EDR Starts RFCOMM server with prefixed UUID as per OIC Specification.
- * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
+ * @fn  CAStartEDRDiscoveryServer
+ * @brief  Starting discovery server for receiving multicast advertisements.
+ *            Starts RFCOMM Server with prefixed UUID as per OIC specification.
+ *
+ * @return  #CA_STATUS_OK on success otherwise proper error code.
+ * @retval  #CA_STATUS_OK  Successful
+ * @retval  #CA_SERVER_STARTED_ALREADY  Server is already started and running for the predefined
+ *                                                            service UUID
+ * @retval  #CA_STATUS_FAILED Operation failed
+ *
  */
 CAResult_t CAStartEDRDiscoveryServer();
 
 /**
- * @brief Sends data to the endpoint using the adapter connectivity.
- * Note: length must be > 0.
- * @param   endpoint    [IN]    Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
- *                              which the unicast data has to be sent.
- * @param   data        [IN]    Data which required to be sent.
- * @param   dataLen     [IN]    Size of data to be sent.
- * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
- */
-uint32_t CASendEDRUnicastData(const CARemoteEndpoint_t *endpoint, void *data, uint32_t dataLen);
-
-/**
- * @brief Sends Multicast data to the endpoint using the EDR connectivity.
- * Note: length must be > 0.
- * @param   data        [IN]    Data which required to be sent.
- * @param   dataLen     [IN]    Size of data to be sent.
- * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
- */
-uint32_t CASendEDRMulticastData(void *data, uint32_t dataLen);
-
-/**
- * @brief Starts notification server on EDR adapters.
- * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
+ * @fn  CASendEDRUnicastData
+ * @brief  Sends data to the peer bluetooth OIC device using the adapter connectivity.
+ *
+ * @param[in]  remoteEndpoint  Information about peer device to which data needs to be send.
+ * @param[in]  data  Data which needs to be send to peer OIC device.
+ * @param[in]  dataLength  Length of data in bytes.
+ *
+ * @return  Number of bytes sent on the network. 0 indicates failed to send data.
+ *
  */
-CAResult_t CAStartEDRNotifyServer();
+uint32_t CASendEDRUnicastData(const CARemoteEndpoint_t *remoteEndpoint, void *data, uint32_t dataLength);
 
 /**
- * @brief Send notification information.
- * Note: length must be > 0.
- * @param   endpoint    [IN]    Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
- *                              which the unicast data has to be sent.
- * @param   data        [IN]    Data which required to be sent.
- * @param   dataLen     [IN]    Size of data to be sent.
- * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
+ * @fn  CASendEDRMulticastData
+ * @brief  Sends multicast data to all discovered bluetooth OIC devices using the adapter
+ *           connectivity.
+ *
+ * @param[in]  data  Data which needs to be send to all discovered bluetooth OIC device.
+ * @param[in]  dataLength  Length of data in bytes.
+ *
+ * @return  Number of bytes sent on the network. 0 indicates failed to send data.
+ *
  */
-uint32_t CASendEDRNotification(const CARemoteEndpoint_t *endpoint, void *data, uint32_t dataLen);
+uint32_t CASendEDRMulticastData(void *data, uint32_t dataLength);
 
 /**
- * @brief Get EDR Connectivity network information
- * @param   info        [OUT]   Local connectivity information structures
- * @param   size        [OUT]   Number of local connectivity structures.
- * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
+ *            Starts RFCOMM Server with prefixed UUID as per OIC specification.
+ *
+ * @return  #CA_STATUS_OK on success otherwise proper error code.
+ * @retval  #CA_STATUS_OK  Successful
+ * @retval  #CA_SERVER_STARTED_ALREADY  Server is already started and running for the predefined
+ *                                                            service UUID
+ * @retval  #CA_STATUS_FAILED Operation failed
+ *
+ * @return  Number of bytes sent on the network. 0 indicates failed to send data.
+ *
+ * @fn  CAGetEDRInterfaceInformation
+ * @brief  Get EDR Connectivity network information.
+ *
+ * @param[out]  info  Array of local connectivity information structures.
+ * @param[out]  size  Size of the array @info.
+ *
+ * @return  #CA_STATUS_OK on success otherwise proper error code.
+ * @retval  #CA_STATUS_OK  Successful
+ * @retval  #CA_STATUS_INVALID_PARAM  Invalid input parameters
+ * @retval  #CA_MEMORY_ALLOC_FAILED  Failed to allocate memory
+ * @retval  #CA_STATUS_FAILED Operation failed
+ *
  */
 CAResult_t CAGetEDRInterfaceInformation(CALocalConnectivity_t **info, uint32_t *size);
 
 /**
- * @brief Read Synchronous API callback.
- * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
+ * @fn  CAReadEDRData
+ * @brief  Read Synchronous API callback.
+ *
+ * @return  #CA_STATUS_OK on success otherwise proper error code.
+ * @retval  #CA_STATUS_OK  Successful
+ * @retval  #CA_STATUS_FAILED Operation failed
+ *
  */
 CAResult_t CAReadEDRData();
 
 /**
- * @brief Stopping the adapters and close socket connections
- *   EDR Stops all RFCOMM servers and close sockets.
- * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
+ * @fn  CAStopEDR
+ * @brief  Stopping the adapters and close socket connections
+ *           EDR Stops all RFCOMM servers and close sockets.
+ *
+ * @return  #CA_STATUS_OK on success
+ *
  */
 CAResult_t CAStopEDR();
 
 /**
- * @brief Terminate the EDR connectivity adapter.
- * Configuration information will be deleted from further use
+ * @fn  CATerminateEDR
+ * @brief  Terminate the EDR connectivity adapter.
+ *           Configuration information will be deleted from further use.
+ *
  */
 void CATerminateEDR();