Imported Upstream version 0.9.1
[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     memset(&handler, 0, sizeof(CAConnectivityHandler_t));
45
46     handler.startAdapter = CAStartLE;
47     handler.startListenServer = CAStartLEListeningServer;
48     handler.startDiscoveryServer = CAStartLEDiscoveryServer;
49     handler.sendData = CASendLEUnicastData;
50     handler.sendDataToAll = CASendLEMulticastData;
51     handler.GetnetInfo = CAGetLEInterfaceInformation;
52     handler.readData = CAReadLEData;
53     handler.stopAdapter = CAStopLE;
54     handler.terminate = CATerminateLE;
55
56     registerCallback(handler, CA_LE);
57
58     return CA_STATUS_OK;
59 }
60
61 CAResult_t CAStartLE()
62 {
63     OIC_LOG(DEBUG, TAG, "CAStartLE");
64
65     return CA_STATUS_OK;
66 }
67
68 CAResult_t CAStartLEListeningServer()
69 {
70     OIC_LOG(DEBUG, TAG, "CAStartLEListeningServer");
71
72     return CA_STATUS_OK;
73 }
74
75 CAResult_t CAStartLEDiscoveryServer()
76 {
77     OIC_LOG(DEBUG, TAG, "CAStartLEDiscoveryServer");
78
79     return CA_STATUS_OK;
80 }
81
82 int32_t CASendLEUnicastData(const CARemoteEndpoint_t *endpoint, const void *data, uint32_t dataLen)
83 {
84     OIC_LOG(DEBUG, TAG, "CASendLEUnicastData");
85
86     return -1;
87 }
88
89 int32_t CASendLEMulticastData(const void *data, uint32_t dataLen)
90 {
91     OIC_LOG(DEBUG, TAG, "CASendLEMulticastData");
92
93     return -1;
94 }
95
96 CAResult_t CAGetLEInterfaceInformation(CALocalConnectivity_t **info, uint32_t *size)
97 {
98     OIC_LOG(DEBUG, TAG, "CAGetLEInterfaceInformation");
99
100     return CA_STATUS_OK;
101 }
102
103 CAResult_t CAReadLEData()
104 {
105     OIC_LOG(DEBUG, TAG, "Read LE Data");
106
107     return CA_STATUS_OK;
108 }
109
110 CAResult_t CAStopLE()
111 {
112     OIC_LOG(DEBUG, TAG, "CAStopLE");
113
114     return CA_STATUS_OK;
115 }
116
117 void CATerminateLE()
118 {
119     OIC_LOG(DEBUG, TAG, "TerminatLE");
120 }
121