X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Finc%2Fcaedrinterface.h;h=45a5afb940dfd8c7ecf7ec9a1b831a5b3fa58901;hb=refs%2Ftags%2Ftizen_4.0.m2_release;hp=517521664a71df0256c99203c9e9cd2eb4c3d209;hpb=d8ae5d4d45753ae6fa74fd02a05a8d20838a45a7;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/inc/caedrinterface.h b/resource/csdk/connectivity/inc/caedrinterface.h index 5175216..45a5afb 100644 --- a/resource/csdk/connectivity/inc/caedrinterface.h +++ b/resource/csdk/connectivity/inc/caedrinterface.h @@ -42,14 +42,17 @@ extern "C" typedef enum { STATE_DISCONNECTED, /**< State is Disconnected. */ - STATE_CONNECTED /**< State is Connected. */ + STATE_CONNECTED /**< State is Connected. */ } CAConnectedState_t; -typedef struct connected_state +typedef struct connected_device { uint8_t address[CA_MACADDR_SIZE]; CAConnectedState_t state; -} state_t; + uint8_t *recvData; + size_t recvDataLen; + size_t totalDataLen; +} CAConnectedDeviceInfo_t; /** * Enum for defining different server types. @@ -67,7 +70,7 @@ typedef enum typedef struct { CAEndpoint_t *remoteEndpoint; /**< Remote Endpoint. */ - void *data; /**< Data to be sent. */ + uint8_t *data; /**< Data to be sent. */ uint32_t dataLen; /**< Length of the data to be sent. */ } CAEDRData; @@ -81,15 +84,16 @@ typedef struct } CAEDRNetworkEvent; /** - * This will be used during the recive of network requests and response. + * 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. + * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). * @pre Callback must be registered using CAEDRSetPacketReceivedCallback(). */ -typedef void (*CAEDRDataReceivedCallback)(const char *remoteAddress, const void *data, - uint32_t dataLength, uint32_t *sentLength); +typedef CAResult_t (*CAEDRDataReceivedCallback)(const char *remoteAddress, const uint8_t *data, + uint32_t dataLength, uint32_t *sentLength); /** * This will be used during change in network status. @@ -100,14 +104,15 @@ typedef void (*CAEDRNetworkStatusCallback)(CANetworkStatus_t status); /** * Callback to notify the error in the EDR adapter. * @param[in] remoteAddress Remote EDR Address. - * @param[in] serviceUUID Service UUID of the device. * @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); /** * Initialize the network monitor module @@ -159,8 +164,9 @@ void CAEDRClientUnsetCallbacks(); /** * Used to initialize the EDR client module where mutex is initialized. + * @return ::CA_STATUS_OK or Appropriate error code. */ -void CAEDRInitializeClient(ca_thread_pool_t handle); +CAResult_t CAEDRClientInitialize(); /** * Destroys the Device list and mutex. @@ -205,7 +211,7 @@ void CAEDRSetErrorHandler(CAEDRErrorHandleCallback errorHandleCallback); * * @return ::CA_STATUS_OK or Appropriate error code. * @retval ::CA_STATUS_OK Successful. - * @retval ::CA_STATUS_INVALID_PARAM Invalid input argumets. + * @retval ::CA_STATUS_INVALID_PARAM Invalid input arguments. * @retval ::CA_STATUS_FAILED Operation failed. * * @see CALocalConnectivity_t @@ -216,30 +222,29 @@ CAResult_t CAEDRGetInterfaceInformation(CAEndpoint_t **info); /** * Start RFCOMM server for given service UUID * - * @param[in] serviceUUID The UUID of service with which RFCOMM server - * needs to be started. - * @param[in] serverFD The RFCOMM server socket file descriptor. - * @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_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(); /** * Stop RFCOMM server * - * @param[in] serverFD 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. */ -CAResult_t CAEDRServerStop(int serverFD); +CAResult_t CAEDRServerStop(); + +/** + * Used to initialize the EDR server module where mutex is initialized. + * @param[in] threadPool Threadpool Handle. + * @return ::CA_STATUS_OK or Appropriate error code. + */ +CAResult_t CAEDRServerInitialize(ca_thread_pool_t handle); /** * Terminate server for EDR. @@ -266,25 +271,22 @@ CAResult_t CAEDRGetAdapterEnableState(bool *state); /** * This function sends data to specified remote bluetooth device. * @param[in] remoteAddress Remote EDR Address. - * @param[in] serviceUUID Service UUID of the device. * @param[in] data Data to be sent. * @param[in] dataLength Length of the data to be sent. - * @param[out] sentLength Length of the actual sent data. * @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); /** * This function sends data to all bluetooth devices running OIC service. - * @param[in] serviceUUID Service UUID of the device. * @param[in] data Data to be sent. * @param[in] dataLength Length of the data to be sent. - * @param[out] sentLength Length of the actual sent data. * @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); /** * This function gets bonded bluetooth device list @@ -292,6 +294,13 @@ CAResult_t CAEDRClientSendMulticastData(const char *serviceUUID, const void *dat */ CAResult_t CAEDRGetBondedDeviceList(); +#ifdef __TIZEN__ +/** + * This function starts device discovery. + */ +CAResult_t CAEDRStartDeviceDiscovery(void); +#endif + #ifdef __cplusplus } /* extern "C" */ #endif