1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
21 * @file caedradapter.h
22 * @brief This file contains the APIs for EDR adapters to be implemented
24 #ifndef __CA_EDRADAPTER_H_
25 #define __CA_EDRADAPTER_H_
31 #include "caadapterinterface.h"
38 #ifndef BLUETOOTH_ADAPTER_TAG
39 #define BLUETOOTH_ADAPTER_TAG "CA_EDR"
40 #endif //BLUETOOTH_ADAPTER_TAG
42 * @brief Initialize EDR connectivity interface.
43 * @param registerCallback [IN] To register EDR interfaces to Connectivity Abstraction Layer
44 * @param reqRespCallback [IN] sending responses and discovery messages from unicast , multicast servers
45 * @param netCallback [IN] Intimate the network additions to Connectivity Abstraction Layer.
46 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
48 CAResult_t CAInitializeEDR(CARegisterConnectivityCallback registerCallback,
49 CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback);
52 * @brief Starting EDR connectivity adapters .As its peer to peer it doesnot require to start any servers
53 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
55 CAResult_t CAStartEDR();
58 * @brief Starting listening server for receiving multicast search requests
59 * Transport Specific Behavior:
60 * EDR Starts RFCOMM Server with prefixed UUID as per specification.
61 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
63 CAResult_t CAStartEDRListeningServer();
66 * @brief for starting discovery servers for receiving multicast advertisements
67 * Transport Specific Behavior:
68 * EDR Starts RFCOMM server with prefixed UUID as per OIC Specification.
69 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
71 CAResult_t CAStartEDRDiscoveryServer();
74 * @brief Sends data to the endpoint using the adapter connectivity.
75 * Note: length must be > 0.
76 * @param endpoint [IN] Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
77 * which the unicast data has to be sent.
78 * @param data [IN] Data which required to be sent.
79 * @param dataLen [IN] Size of data to be sent.
80 * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
82 uint32_t CASendEDRUnicastData(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
85 * @brief Sends Multicast data to the endpoint using the EDR connectivity.
86 * Note: length must be > 0.
87 * @param data [IN] Data which required to be sent.
88 * @param dataLen [IN] Size of data to be sent.
89 * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
91 uint32_t CASendEDRMulticastData(void* data, uint32_t dataLen);
94 * @brief Starts notification server on EDR adapters.
95 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
97 CAResult_t CAStartEDRNotifyServer();
100 * @brief Send notification information.
101 * Note: length must be > 0.
102 * @param endpoint [IN] Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
103 * which the unicast data has to be sent.
104 * @param data [IN] Data which required to be sent.
105 * @param dataLen [IN] Size of data to be sent.
106 * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
108 uint32_t CASendEDRNotification(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen);
111 * @brief Get EDR Connectivity network information
112 * @param info [OUT] Local connectivity information structures
113 * @param size [OUT] Number of local connectivity structures.
114 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
116 CAResult_t CAGetEDRInterfaceInformation(CALocalConnectivityt_t** info, uint32_t* size);
119 * @brief Read Synchronous API callback.
120 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
122 CAResult_t CAReadEDRData();
125 * @brief Stopping the adapters and close socket connections
126 * EDR Stops all RFCOMM servers and close sockets.
127 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
129 CAResult_t CAStopEDR();
132 * @brief Terminate the EDR connectivity adapter.
133 * Configuration information will be deleted from further use
135 void CATerminateEDR();
141 #endif //__CA_EDRADAPTER_H_