IP address plumbing changes to support IPv6
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / bt_le_adapter / linux / caleadapter.c
1 /******************************************************************
2  *
3  * Copyright 2014 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  ******************************************************************/
20
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24
25 #include "caleadapter.h"
26 #include "logger.h"
27
28 #define TAG PCF("CA")
29
30 static CANetworkPacketReceivedCallback g_leReceivedCallback = NULL;
31 static ca_thread_pool_t g_threadPoolHandle = NULL;
32
33 CAResult_t CAInitializeLE(CARegisterConnectivityCallback registerCallback,
34                           CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback,
35                           ca_thread_pool_t handle)
36 {
37     OIC_LOG(DEBUG, TAG, "CAInitializeLE");
38
39     g_leReceivedCallback = reqRespCallback;
40     g_threadPoolHandle = handle;
41
42     // register handlers
43     CAConnectivityHandler_t handler = {};
44
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;
54
55     registerCallback(handler, CA_ADAPTER_GATT_BTLE);
56
57     return CA_STATUS_OK;
58 }
59
60 CAResult_t CAStartLE()
61 {
62     OIC_LOG(DEBUG, TAG, "CAStartLE");
63
64     return CA_STATUS_OK;
65 }
66
67 CAResult_t CAStartLEListeningServer()
68 {
69     OIC_LOG(DEBUG, TAG, "CAStartLEListeningServer");
70
71     return CA_STATUS_OK;
72 }
73
74 CAResult_t CAStartLEDiscoveryServer()
75 {
76     OIC_LOG(DEBUG, TAG, "CAStartLEDiscoveryServer");
77
78     return CA_STATUS_OK;
79 }
80
81 int32_t CASendLEUnicastData(const CAEndpoint_t *endpoint, const void *data, uint32_t dataLen)
82 {
83     OIC_LOG(DEBUG, TAG, "CASendLEUnicastData");
84
85     return -1;
86 }
87
88 int32_t CASendLEMulticastData(const CAEndpoint_t *endpoint, const void *data, uint32_t dataLen)
89 {
90     OIC_LOG(DEBUG, TAG, "CASendLEMulticastData");
91
92     return -1;
93 }
94
95 CAResult_t CAGetLEInterfaceInformation(CAEndpoint_t **info, uint32_t *size)
96 {
97     OIC_LOG(DEBUG, TAG, "CAGetLEInterfaceInformation");
98
99     return CA_STATUS_OK;
100 }
101
102 CAResult_t CAReadLEData()
103 {
104     OIC_LOG(DEBUG, TAG, "Read LE Data");
105
106     return CA_STATUS_OK;
107 }
108
109 CAResult_t CAStopLE()
110 {
111     OIC_LOG(DEBUG, TAG, "CAStopLE");
112
113     return CA_STATUS_OK;
114 }
115
116 void CATerminateLE()
117 {
118     OIC_LOG(DEBUG, TAG, "TerminatLE");
119 }
120