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 "caleadapter.h"
30 static CANetworkPacketReceivedCallback g_leReceivedCallback = NULL;
31 static ca_thread_pool_t g_threadPoolHandle = NULL;
33 CAResult_t CAInitializeLE(CARegisterConnectivityCallback registerCallback,
34 CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback,
35 ca_thread_pool_t handle)
37 OIC_LOG(DEBUG, TAG, "CAInitializeLE");
39 g_leReceivedCallback = reqRespCallback;
40 g_threadPoolHandle = handle;
43 CAConnectivityHandler_t handler = {};
45 handler.startAdapter = CAStartLE;
46 handler.startListenServer = CAStartLEListeningServer;
47 handler.startDiscoveryServer = CAStartLEDiscoveryServer;
48 handler.sendData = CASendLEUnicastData;
49 handler.sendDataToAll = CASendLEMulticastData;
50 handler.GetnetInfo = CAGetLEInterfaceInformation;
51 handler.readData = CAReadLEData;
52 handler.stopAdapter = CAStopLE;
53 handler.terminate = CATerminateLE;
55 registerCallback(handler, CA_LE);
60 CAResult_t CAStartLE()
62 OIC_LOG(DEBUG, TAG, "CAStartLE");
67 CAResult_t CAStartLEListeningServer()
69 OIC_LOG(DEBUG, TAG, "CAStartLEListeningServer");
74 CAResult_t CAStartLEDiscoveryServer()
76 OIC_LOG(DEBUG, TAG, "CAStartLEDiscoveryServer");
81 int32_t CASendLEUnicastData(const CARemoteEndpoint_t *endpoint, const void *data, uint32_t dataLen)
83 OIC_LOG(DEBUG, TAG, "CASendLEUnicastData");
88 int32_t CASendLEMulticastData(const void *data, uint32_t dataLen)
90 OIC_LOG(DEBUG, TAG, "CASendLEMulticastData");
95 CAResult_t CAGetLEInterfaceInformation(CALocalConnectivity_t **info, uint32_t *size)
97 OIC_LOG(DEBUG, TAG, "CAGetLEInterfaceInformation");
102 CAResult_t CAReadLEData()
104 OIC_LOG(DEBUG, TAG, "Read LE Data");
109 CAResult_t CAStopLE()
111 OIC_LOG(DEBUG, TAG, "CAStopLE");
118 OIC_LOG(DEBUG, TAG, "TerminatLE");