X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Finc%2Fcaedradapter_singlethread.h;h=5648726b8a0876aff32fbe2ee268dec31ca0b3d4;hb=b9a68b536d7c85115f36e913c9e0e279cdb92f42;hp=71a13cb9c2d6dcc25375dcb67117169ca7fd41ba;hpb=88df85f0c20992acba7c96a85a1007916923b448;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/inc/caedradapter_singlethread.h b/resource/csdk/connectivity/inc/caedradapter_singlethread.h index 71a13cb..5648726 100644 --- a/resource/csdk/connectivity/inc/caedradapter_singlethread.h +++ b/resource/csdk/connectivity/inc/caedradapter_singlethread.h @@ -1,4 +1,4 @@ -/****************************************************************** +/* **************************************************************** * * Copyright 2014 Samsung Electronics All Rights Reserved. * @@ -17,15 +17,18 @@ * limitations under the License. * ******************************************************************/ + /** - * @file caedradapter_singlethread.h - * @brief This file contains the APIs for single threaded EDR adapters. + * @file + * + * This file contains the APIs for EDR adapters to be implemented. */ + #ifndef __CA_EDRADAPTER_SINGLETHREAD_H_ #define __CA_EDRADAPTER_SINGLETHREAD_H_ /** - * BT Interface AP + * EDR Interface AP **/ #include "cacommon.h" #include "caadapterinterface.h" @@ -35,104 +38,110 @@ extern "C" { #endif -#ifndef BLUETOOTH_ADAPTER_TAG -#define BLUETOOTH_ADAPTER_TAG "CA_EDR" -#endif //BLUETOOTH_ADAPTER_TAG - -#define OIC_BT_SERVICE_ID "12341234-1C25-481F-9DFB-59193D238280" - /** - * @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) + * @brief Initialize EDR Interface. + * @param registerCallback [IN] Callback to register EDR interface to Connectivity + * Abstraction Layer + * @param reqRespCallback [IN] Callback to notify request and response messages from server(s) + * started at Connectivity Abstraction Layer. + * @param netCallback [IN] Callback to notify the network additions to Connectivity + * Abstraction Layer. + * @return #CA_STATUS_OK or Appropriate 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); + /** - * @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) + * @brief Starting EDR connectivity adapters. As its peer to peer it doesnot require to start + * any servers. + * @return #CA_STATUS_OK or Appropriate 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) + * @brief Starts listening server for receiving multicast search requests. + * Starts RFCOMM Server with prefixed UUID as per OIC specification. + * @return #CA_STATUS_OK or Appropriate 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) + * @brief Starts discovery server for receiving multicast advertisements. + * Starts RFCOMM Server with prefixed UUID as per OIC specification. + * @return #CA_STATUS_OK or Appropriate 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. + * @brief Sends data to the peer bluetooth OIC device using the adapter connectivity. + * @param remoteEndpoint [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 to be sent. + * @param dataLength [IN] Size of data to be sent. + * @return Number of bytes sent on the network. Returns -1 on error. */ -uint32_t CASendEDRUnicastData(const CARemoteEndpoint_t *endpoint, void *data, uint32_t dataLen); +int32_t CASendEDRUnicastData(const CARemoteEndpoint_t *remoteEndpoint, const void *data, + uint32_t dataLength); /** - * @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. + * @brief Sends multicast data to all discovered bluetooth OIC devices using the adapter + * connectivity. + * @param data [IN] Data which needs to be sent to all discovered bluetooth OIC device. + * @param dataLength [IN] Length of data in bytes. + * @return Number of bytes sent on the network. Returns -1 on error. */ -uint32_t CASendEDRMulticastData(void *data, uint32_t dataLen); +int32_t CASendEDRMulticastData(const void *data, uint32_t dataLength); /** - * @brief Starts notification server on EDR adapters. - * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h) - */ -CAResult_t CAStartEDRNotifyServer(); - -/** - * @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. - */ -uint32_t CASendEDRNotification(const CARemoteEndpoint_t *endpoint, void *data, uint32_t dataLen); - -/** - * @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) + * @brief Get EDR Connectivity network information. + * + * @param info [OUT] Array of local connectivity information structures. + * @param size [OUT] Size of the array @info. + * + * @return #CA_STATUS_OK or Appropriate 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 + * @remarks info is allocated in this API and should be freed by the caller. */ 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) + * @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) + * @brief EDR Stops all RFCOMM servers and close sockets. + * @return #CA_STATUS_OK or Appropriate error code */ CAResult_t CAStopEDR(); /** - * @brief Terminate the EDR connectivity adapter. - * Configuration information will be deleted from further use + * @brief Terminate the EDR connectivity adapter. + * Configuration information will be deleted from further use. + * @return NONE */ void CATerminateEDR(); @@ -140,4 +149,5 @@ void CATerminateEDR(); } /* extern "C" */ #endif -#endif //__CA_EDRADAPTER_H_ +#endif //__CA_EDRADAPTER_SINGLETHREAD_H_ +