Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / bt_edr_adapter / linux / caedradapter.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 "caedradapter.h"
26 #include "logger.h"
27
28 #define TAG PCF("CA")
29
30 static CANetworkPacketReceivedCallback g_edrReceivedCallback = NULL;
31 static ca_thread_pool_t g_threadPoolHandle = NULL;
32
33 CAResult_t CAInitializeEDR(CARegisterConnectivityCallback registerCallback,
34                            CANetworkPacketReceivedCallback reqRespCallback,
35                            CANetworkChangeCallback networkStateChangeCallback,
36                            CAErrorHandleCallback errorCallback, ca_thread_pool_t handle)
37 {
38     (void)networkStateChangeCallback;
39     (void)errorCallback;
40     OIC_LOG(DEBUG, TAG, "CAInitializeEDR");
41
42     g_edrReceivedCallback = reqRespCallback;
43     g_threadPoolHandle = handle;
44
45     // register handlers
46     CAConnectivityHandler_t handler = {
47         .startAdapter = CAStartEDR,
48         .startListenServer = CAStartEDRListeningServer,
49         .stopListenServer = CAStopEDRListeningServer,
50         .startDiscoveryServer = CAStartEDRDiscoveryServer,
51         .sendData = CASendEDRUnicastData,
52         .sendDataToAll = CASendEDRMulticastData,
53         .GetnetInfo = CAGetEDRInterfaceInformation,
54         .readData = CAReadEDRData,
55         .stopAdapter = CAStopEDR,
56         .terminate = CATerminateEDR
57     };
58
59     registerCallback(handler, CA_ADAPTER_RFCOMM_BTEDR);
60
61     return CA_STATUS_OK;
62 }
63
64 CAResult_t CAStartEDR()
65 {
66     OIC_LOG(DEBUG, TAG, "CAStartEDR");
67
68     return CA_STATUS_OK;
69 }
70
71 CAResult_t CAStartEDRListeningServer()
72 {
73     OIC_LOG(DEBUG, TAG, "CAStartEDRListeningServer");
74
75     return CA_STATUS_OK;
76 }
77
78 CAResult_t CAStopEDRListeningServer()
79 {
80     OIC_LOG(DEBUG, TAG, "CAStopEDRListeningServer");
81
82     return CA_STATUS_OK;
83 }
84
85 CAResult_t CAStartEDRDiscoveryServer()
86 {
87     OIC_LOG(DEBUG, TAG, "CAStartEDRDiscoveryServer");
88
89     return CA_STATUS_OK;
90 }
91
92 int32_t CASendEDRUnicastData(const CAEndpoint_t *endpoint, const void *data,
93     uint32_t dataLen)
94 {
95     (void)endpoint;
96     (void)data;
97     (void)dataLen;
98     OIC_LOG(DEBUG, TAG, "CASendEDRUnicastData");
99
100     return -1;
101 }
102
103 int32_t CASendEDRMulticastData(const CAEndpoint_t *endpoint, const void *data, uint32_t dataLen)
104 {
105     (void)endpoint;
106     (void)data;
107     (void)dataLen;
108     OIC_LOG(DEBUG, TAG, "CASendEDRMulticastData");
109
110     return -1;
111 }
112
113 CAResult_t CAGetEDRInterfaceInformation(CAEndpoint_t **info, uint32_t *size)
114 {
115     (void)info;
116     (void)size;
117     OIC_LOG(DEBUG, TAG, "CAGetEDRInterfaceInformation");
118
119     return CA_STATUS_OK;
120 }
121
122 CAResult_t CAReadEDRData()
123 {
124     OIC_LOG(DEBUG, TAG, "Read EDR Data");
125
126     return CA_STATUS_OK;
127 }
128
129 CAResult_t CAStopEDR()
130 {
131     OIC_LOG(DEBUG, TAG, "CAStopEDR");
132
133     return CA_STATUS_OK;
134 }
135
136 void CATerminateEDR()
137 {
138     OIC_LOG(DEBUG, TAG, "CATerminateEDR");
139 }
140