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, CANetworkChangeCallback netCallback,
35 ca_thread_pool_t handle)
37 OIC_LOG(DEBUG, TAG, "CAInitializeEDR");
39 g_edrReceivedCallback = reqRespCallback;
40 g_threadPoolHandle = handle;
43 CAConnectivityHandler_t handler;
44 memset(&handler, 0, sizeof(CAConnectivityHandler_t));
46 handler.startAdapter = CAStartEDR;
47 handler.startListenServer = CAStartEDRListeningServer;
48 handler.startDiscoveryServer = CAStartEDRDiscoveryServer;
49 handler.sendData = CASendEDRUnicastData;
50 handler.sendDataToAll = CASendEDRMulticastData;
51 handler.GetnetInfo = CAGetEDRInterfaceInformation;
52 handler.readData = CAReadEDRData;
53 handler.stopAdapter = CAStopEDR;
54 handler.terminate = CATerminateEDR;
56 registerCallback(handler, CA_EDR);
61 CAResult_t CAStartEDR()
63 OIC_LOG(DEBUG, TAG, "CAStartEDR");
68 CAResult_t CAStartEDRListeningServer()
70 OIC_LOG(DEBUG, TAG, "CAStartEDRListeningServer");
75 CAResult_t CAStartEDRDiscoveryServer()
77 OIC_LOG(DEBUG, TAG, "CAStartEDRDiscoveryServer");
82 int32_t CASendEDRUnicastData(const CARemoteEndpoint_t *endpoint, const void *data,
85 OIC_LOG(DEBUG, TAG, "CASendEDRUnicastData");
90 int32_t CASendEDRMulticastData(const void *data, uint32_t dataLen)
92 OIC_LOG(DEBUG, TAG, "CASendEDRMulticastData");
97 CAResult_t CAGetEDRInterfaceInformation(CALocalConnectivity_t **info, uint32_t *size)
99 OIC_LOG(DEBUG, TAG, "CAGetEDRInterfaceInformation");
104 CAResult_t CAReadEDRData()
106 OIC_LOG(DEBUG, TAG, "Read EDR Data");
111 CAResult_t CAStopEDR()
113 OIC_LOG(DEBUG, TAG, "CAStopEDR");
118 void CATerminateEDR()
120 OIC_LOG(DEBUG, TAG, "CATerminateEDR");