Merge "Implementation of connectivity abstraction feature release v0.2" into connecti...
[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 gLEReceivedCallback = NULL;
31 static u_thread_pool_t gThreadPoolHandle = NULL;
32
33 CAResult_t CAInitializeLE(CARegisterConnectivityCallback registerCallback,
34         CANetworkPacketReceivedCallback reqRespCallback, CANetworkChangeCallback netCallback,
35         u_thread_pool_t handle)
36 {
37     OIC_LOG_V(DEBUG, TAG, "CAInitializeLE");
38
39     gLEReceivedCallback = reqRespCallback;
40     gThreadPoolHandle = 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.startDiscoverServer = CAStartLEDiscoveryServer;
49     handler.sendData = CASendLEUnicastData;
50     handler.sendDataToAll = CASendLEMulticastData;
51     handler.startNotifyServer = CAStartLENotifyServer;
52     handler.sendNotification = CASendLENotification;
53     handler.GetnetInfo = CAGetLEInterfaceInformation;
54     handler.readData = CAReadLEData;
55     handler.stopAdapter = CAStopLE;
56     handler.terminate = CATerminateLE;
57
58     registerCallback(handler, CA_LE);
59
60     return CA_STATUS_OK;
61 }
62
63 CAResult_t CAStartLE()
64 {
65     OIC_LOG_V(DEBUG, TAG, "CAStartLE");
66
67     return CA_STATUS_OK;
68 }
69
70 CAResult_t CAStartLEListeningServer()
71 {
72     OIC_LOG_V(DEBUG, TAG, "CAStartLEListeningServer");
73
74     return CA_STATUS_OK;
75 }
76
77 CAResult_t CAStartLEDiscoveryServer()
78 {
79     OIC_LOG_V(DEBUG, TAG, "CAStartLEDiscoveryServer");
80
81     return CA_STATUS_OK;
82 }
83
84 uint32_t CASendLEUnicastData(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen)
85 {
86     OIC_LOG_V(DEBUG, TAG, "CASendLEUnicastData");
87
88     return 0;
89 }
90
91 uint32_t CASendLEMulticastData(void* data, uint32_t dataLen)
92 {
93     OIC_LOG_V(DEBUG, TAG, "CASendLEMulticastData");
94
95     return 0;
96 }
97
98 CAResult_t CAStartLENotifyServer()
99 {
100     OIC_LOG_V(DEBUG, TAG, "CAStartLENotifyServer");
101
102     return CA_STATUS_OK;
103 }
104
105 uint32_t CASendLENotification(const CARemoteEndpoint_t* endpoint, void* data, uint32_t dataLen)
106 {
107     OIC_LOG_V(DEBUG, TAG, "CASendLENotification");
108
109     return 0;
110 }
111
112 CAResult_t CAGetLEInterfaceInformation(CALocalConnectivity_t** info, uint32_t* size)
113 {
114     OIC_LOG_V(DEBUG, TAG, "CAGetLEInterfaceInformation");
115
116     return CA_STATUS_OK;
117 }
118
119 CAResult_t CAReadLEData()
120 {
121     OIC_LOG_V(DEBUG, TAG, "Read LE Data");
122
123     return CA_STATUS_OK;
124 }
125
126 CAResult_t CAStopLE()
127 {
128     OIC_LOG_V(DEBUG, TAG, "CAStopLE");
129
130     return CA_STATUS_OK;
131 }
132
133 void CATerminateLE()
134 {
135     OIC_LOG_V(DEBUG, TAG, "TerminatLE");
136 }