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 ******************************************************************/
25 #include "caedradapter.h"
30 static CANetworkPacketReceivedCallback g_edrReceivedCallback = NULL;
31 static ca_thread_pool_t g_threadPoolHandle = NULL;
33 CAResult_t CAInitializeEDR(CARegisterConnectivityCallback registerCallback,
34 CANetworkPacketReceivedCallback reqRespCallback,
35 CANetworkChangeCallback networkStateChangeCallback,
36 CAErrorHandleCallback errorCallback, ca_thread_pool_t handle)
38 (void)networkStateChangeCallback;
40 OIC_LOG(DEBUG, TAG, "CAInitializeEDR");
42 g_edrReceivedCallback = reqRespCallback;
43 g_threadPoolHandle = handle;
46 CAConnectivityHandler_t handler = {
47 .startAdapter = CAStartEDR,
48 .startListenServer = CAStartEDRListeningServer,
49 .stopListenServer = CAStopEDRListeningServer,
50 .startDiscoveryServer = CAStartEDRDiscoveryServer,
51 .sendData = CASendEDRUnicastData,
52 .sendDataToAll = CASendEDRMulticastData,
53 .GetnetInfo = CAGetEDRInterfaceInformation,
54 .readData = CAReadEDRData,
55 .stopAdapter = CAStopEDR,
56 .terminate = CATerminateEDR
59 registerCallback(handler, CA_ADAPTER_RFCOMM_BTEDR);
64 CAResult_t CAStartEDR()
66 OIC_LOG(DEBUG, TAG, "CAStartEDR");
71 CAResult_t CAStartEDRListeningServer()
73 OIC_LOG(DEBUG, TAG, "CAStartEDRListeningServer");
78 CAResult_t CAStopEDRListeningServer()
80 OIC_LOG(DEBUG, TAG, "CAStopEDRListeningServer");
85 CAResult_t CAStartEDRDiscoveryServer()
87 OIC_LOG(DEBUG, TAG, "CAStartEDRDiscoveryServer");
92 int32_t CASendEDRUnicastData(const CAEndpoint_t *endpoint, const void *data,
98 OIC_LOG(DEBUG, TAG, "CASendEDRUnicastData");
103 int32_t CASendEDRMulticastData(const CAEndpoint_t *endpoint, const void *data, uint32_t dataLen)
108 OIC_LOG(DEBUG, TAG, "CASendEDRMulticastData");
113 CAResult_t CAGetEDRInterfaceInformation(CAEndpoint_t **info, uint32_t *size)
117 OIC_LOG(DEBUG, TAG, "CAGetEDRInterfaceInformation");
122 CAResult_t CAReadEDRData()
124 OIC_LOG(DEBUG, TAG, "Read EDR Data");
129 CAResult_t CAStopEDR()
131 OIC_LOG(DEBUG, TAG, "CAStopEDR");
136 void CATerminateEDR()
138 OIC_LOG(DEBUG, TAG, "CATerminateEDR");