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_singlethread.h
22 * @brief This file contains the APIs for single threaded EDR adapters.
24 #ifndef __CA_EDRADAPTER_SINGLETHREAD_H_
25 #define __CA_EDRADAPTER_SINGLETHREAD_H_
31 #include "caadapterinterface.h"
38 #ifndef BLUETOOTH_ADAPTER_TAG
39 #define BLUETOOTH_ADAPTER_TAG "CA_EDR"
40 #endif //BLUETOOTH_ADAPTER_TAG
42 #define OIC_BT_SERVICE_ID "12341234-1C25-481F-9DFB-59193D238280"
45 * @brief Initialize EDR connectivity interface.
46 * @param registerCallback [IN] To register EDR interfaces to Connectivity Abstraction Layer
47 * @param reqRespCallback [IN] sending responses and discovery messages from unicast , multicast servers
48 * @param netCallback [IN] Intimate the network additions to Connectivity Abstraction Layer.
49 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
51 CAResult_t CAInitializeEDR(CARegisterConnectivityCallback registerCallback,
52 CANetworkPacketReceivedCallback reqRespCallback,
53 CANetworkChangeCallback netCallback);
55 * @brief Starting EDR connectivity adapters .As its peer to peer it doesnot require to start any servers
56 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
58 CAResult_t CAStartEDR();
61 * @brief Starting listening server for receiving multicast search requests
62 * Transport Specific Behavior:
63 * EDR Starts RFCOMM Server with prefixed UUID as per specification.
64 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
66 CAResult_t CAStartEDRListeningServer();
69 * @brief for starting discovery servers for receiving multicast advertisements
70 * Transport Specific Behavior:
71 * EDR Starts RFCOMM server with prefixed UUID as per OIC Specification.
72 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
74 CAResult_t CAStartEDRDiscoveryServer();
77 * @brief Sends data to the endpoint using the adapter connectivity.
78 * Note: length must be > 0.
79 * @param endpoint [IN] Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
80 * which the unicast data has to be sent.
81 * @param data [IN] Data which required to be sent.
82 * @param dataLen [IN] Size of data to be sent.
83 * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
85 uint32_t CASendEDRUnicastData(const CARemoteEndpoint_t *endpoint, void *data,
89 * @brief Sends Multicast data to the endpoint using the EDR connectivity.
90 * Note: length must be > 0.
91 * @param data [IN] Data which required to be sent.
92 * @param dataLen [IN] Size of data to be sent.
93 * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
95 uint32_t CASendEDRMulticastData(void *data, uint32_t dataLen);
98 * @brief Starts notification server on EDR adapters.
99 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
101 CAResult_t CAStartEDRNotifyServer();
104 * @brief Send notification information.
105 * Note: length must be > 0.
106 * @param endpoint [IN] Remote Endpoint information (like ipaddress , port, reference uri and connectivity type) to
107 * which the unicast data has to be sent.
108 * @param data [IN] Data which required to be sent.
109 * @param dataLen [IN] Size of data to be sent.
110 * @return - The number of bytes sent on the network. Return value equal to zero indicates error.
112 uint32_t CASendEDRNotification(const CARemoteEndpoint_t *endpoint, void *data,
116 * @brief Get EDR Connectivity network information
117 * @param info [OUT] Local connectivity information structures
118 * @param size [OUT] Number of local connectivity structures.
119 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
121 CAResult_t CAGetEDRInterfaceInformation(CALocalConnectivity_t **info, uint32_t *size);
124 * @brief Read Synchronous API callback.
125 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
127 CAResult_t CAReadEDRData();
130 * @brief Stopping the adapters and close socket connections
131 * EDR Stops all RFCOMM servers and close sockets.
132 * @return CA_STATUS_OK or ERROR CODES ( CAResult_t error codes in cacommon.h)
134 CAResult_t CAStopEDR();
137 * @brief Terminate the EDR connectivity adapter.
138 * Configuration information will be deleted from further use
140 void CATerminateEDR();
146 #endif //__CA_EDRADAPTER_H_