BLE Client support for Tizen 2.4
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / bt_le_adapter / tizen / caleserver.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 <bluetooth.h>
22 #include <bluetooth_type.h>
23
24 #include "caleserver.h"
25 #include <pthread.h>
26 #include "cacommon.h"
27 #include "caadapterutils.h"
28 #include <gio/gio.h>
29 #include "camutex.h"
30 #include "caqueueingthread.h"
31 #include "caadapterutils.h"
32 #include "cafragmentation.h"
33 #include "cagattservice.h"
34 #include "caleutil.h"
35 #include "oic_string.h"
36 #include "oic_malloc.h"
37
38 /**
39  * @def TZ_BLE_SERVER_TAG
40  * @brief Logging tag for module name
41  */
42 #define TZ_BLE_SERVER_TAG "OIC_CA_LE_SERVER"
43
44 void CABleGattServerConnectionStateChangedCb(int result, bool connected,
45                                              const char *remoteAddress, void *userData)
46 {
47     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
48
49     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
50 }
51
52 CAResult_t CAStartLEGattServer()
53 {
54     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
55     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
56     return CA_STATUS_OK;
57 }
58
59 void CAStartBleGattServerThread(void *data)
60 {
61     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
62
63     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
64 }
65
66 CAResult_t CAStopLEGattServer()
67 {
68     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
69
70     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
71     return CA_STATUS_OK;
72 }
73
74 void CATerminateLEGattServer()
75 {
76     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
77
78     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
79 }
80
81 CAResult_t CAInitializeLEGattServer()
82 {
83     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
84
85     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
86     return CA_STATUS_OK;
87 }
88
89 CAResult_t CAInitBleGattService()
90 {
91     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
92
93     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
94     return CA_STATUS_OK;
95 }
96
97 CAResult_t CADeInitBleGattService()
98 {
99     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
100
101     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
102     return CA_STATUS_OK;
103 }
104
105 void CASetLEServerThreadPoolHandle(ca_thread_pool_t handle)
106 {
107     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
108     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
109 }
110
111 CAResult_t CAAddNewBleServiceInGattServer(const char *serviceUUID)
112 {
113     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
114     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
115     return CA_STATUS_OK;
116 }
117
118 CAResult_t CARemoveBleServiceFromGattServer(const char *svcPath)
119 {
120     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
121     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
122     return CA_STATUS_OK;
123 }
124
125 CAResult_t CARemoveAllBleServicesFromGattServer()
126 {
127     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
128     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
129     return CA_STATUS_OK;
130 }
131
132 void CABleGattRemoteCharacteristicWriteCb(char *charPath,
133                                           unsigned char *charValue,
134                                           int charValueLen,
135                                           const char *remoteAddress,
136                                           void *userData)
137 {
138     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
139     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
140 }
141
142 CAResult_t CARegisterBleServicewithGattServer(const char *svcPath)
143 {
144     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
145     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
146     return CA_STATUS_OK;
147 }
148
149 CAResult_t CAAddNewCharacteristicsToGattServer(const char *svcPath, const char *charUUID,
150         const uint8_t *charValue, int charValueLen, bool read)
151 {
152
153     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
154     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
155     return CA_STATUS_OK;
156 }
157
158 CAResult_t CARemoveCharacteristicsFromGattServer(const char *charPath)
159 {
160     ///TODO: There is no api provided in bluetooth.h for removing characteristics.
161     return CA_STATUS_OK;
162 }
163
164 CAResult_t CAUpdateCharacteristicsToGattClient(const char *address,
165                                                const uint8_t *charValue,
166                                                uint32_t charValueLen)
167 {
168     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
169
170     OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "OUT");
171     return CA_STATUS_OK;
172 }
173
174 CAResult_t CAUpdateCharacteristicsToAllGattClients(const uint8_t *charValue, uint32_t charValueLen)
175 {
176     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
177
178     OIC_LOG(ERROR, TZ_BLE_SERVER_TAG, "OUT");
179     return CA_STATUS_OK;
180 }
181
182 void CASetLEReqRespServerCallback(CABLEDataReceivedCallback callback)
183 {
184     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
185
186     OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
187 }
188
189 void CASetBLEServerErrorHandleCallback(CABLEErrorHandleCallback callback)
190 {
191
192 }