Imported Upstream version 0.9.2
[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     OIC_LOG(DEBUG, TAG, "CAInitializeEDR");
39
40     g_edrReceivedCallback = reqRespCallback;
41     g_threadPoolHandle = handle;
42
43     // register handlers
44     CAConnectivityHandler_t handler = {};
45
46     handler.startAdapter = CAStartEDR;
47     handler.startListenServer = CAStartEDRListeningServer;
48     handler.startDiscoveryServer = CAStartEDRDiscoveryServer;
49     handler.sendData = CASendEDRUnicastData;
50     handler.sendDataToAll = CASendEDRMulticastData;
51     handler.GetnetInfo = CAGetEDRInterfaceInformation;
52     handler.readData = CAReadEDRData;
53     handler.stopAdapter = CAStopEDR;
54     handler.terminate = CATerminateEDR;
55
56     registerCallback(handler, CA_ADAPTER_RFCOMM_BTEDR);
57
58     return CA_STATUS_OK;
59 }
60
61 CAResult_t CAStartEDR()
62 {
63     OIC_LOG(DEBUG, TAG, "CAStartEDR");
64
65     return CA_STATUS_OK;
66 }
67
68 CAResult_t CAStartEDRListeningServer()
69 {
70     OIC_LOG(DEBUG, TAG, "CAStartEDRListeningServer");
71
72     return CA_STATUS_OK;
73 }
74
75 CAResult_t CAStartEDRDiscoveryServer()
76 {
77     OIC_LOG(DEBUG, TAG, "CAStartEDRDiscoveryServer");
78
79     return CA_STATUS_OK;
80 }
81
82 int32_t CASendEDRUnicastData(const CAEndpoint_t *endpoint, const void *data,
83     uint32_t dataLen)
84 {
85     OIC_LOG(DEBUG, TAG, "CASendEDRUnicastData");
86
87     return -1;
88 }
89
90 int32_t CASendEDRMulticastData(const CAEndpoint_t *endpoint, const void *data, uint32_t dataLen)
91 {
92     OIC_LOG(DEBUG, TAG, "CASendEDRMulticastData");
93
94     return -1;
95 }
96
97 CAResult_t CAGetEDRInterfaceInformation(CAEndpoint_t **info, uint32_t *size)
98 {
99     OIC_LOG(DEBUG, TAG, "CAGetEDRInterfaceInformation");
100
101     return CA_STATUS_OK;
102 }
103
104 CAResult_t CAReadEDRData()
105 {
106     OIC_LOG(DEBUG, TAG, "Read EDR Data");
107
108     return CA_STATUS_OK;
109 }
110
111 CAResult_t CAStopEDR()
112 {
113     OIC_LOG(DEBUG, TAG, "CAStopEDR");
114
115     return CA_STATUS_OK;
116 }
117
118 void CATerminateEDR()
119 {
120     OIC_LOG(DEBUG, TAG, "CATerminateEDR");
121 }
122