Update snapshot(2017-12-14)
[platform/upstream/iotivity.git] / resource / csdk / connectivity / util / src / camanager / bt_le_manager / tizen / caleconnectionmanager.c
1 /* ****************************************************************
2  *
3  * Copyright 2016 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 #include <bluetooth_internal.h>
24
25 #include "camanagerleinterface.h"
26 #include "cacommon.h"
27 #include "camessagehandler.h"
28 #include "caleserver.h"
29 #include "cagattservice.h"
30 #include "logger.h"
31
32 #define TAG "OIC_CA_MANAGER_TZ_LE"
33
34 void CASetLENetworkMonitorCallbacks(CAAdapterStateChangedCB adapterStateCB,
35                                     CAConnectionStateChangedCB connStateCB)
36 {
37     (void)adapterStateCB;
38     (void)connStateCB;
39     OIC_LOG(DEBUG, TAG, "CASetLENetworkMonitorCallbacks");
40 }
41
42 CAResult_t CAManagerLEStartAdvertising()
43 {
44     OIC_LOG(DEBUG, TAG, "CAManagerLEStartAdvertising");
45
46     CAResult_t res = CALEStartAdvertise();
47     if (CA_STATUS_OK != res)
48     {
49         OIC_LOG_V(ERROR, TAG, "Failed to start le advertising [%d]", res);
50         return res;
51     }
52     return res;
53 }
54
55 CAResult_t CAManagerLEStopAdvertising()
56 {
57     OIC_LOG(DEBUG, TAG, "CAManagerLEStopAdvertising");
58
59     CAResult_t res = CALEStopAdvertise();
60     if (CA_STATUS_OK != res)
61     {
62         OIC_LOG_V(ERROR, TAG, "Failed to stop le advertising [%d]", res);
63         return res;
64     }
65     return res;
66 }
67
68 CAResult_t CASetLEClientAutoConnectionDeviceInfo(const char * address)
69 {
70     OIC_LOG(DEBUG, TAG, "CASetLEClientAutoConnectionDeviceInfo");
71     (void)address;
72     return CA_NOT_SUPPORTED;
73 }
74
75 CAResult_t CAUnsetLEClientAutoConnectionDeviceInfo(const char * address)
76 {
77     OIC_LOG(DEBUG, TAG, "CAUnsetLEClientAutoConnectionDeviceInfo");
78     (void)address;
79     return CA_NOT_SUPPORTED;
80 }
81 #if defined(__TIZEN__) && defined(LE_ADAPTER) && defined(BLE_CUSTOM_ADVERTISE)
82 CAResult_t CAManagerLEServerSetAdvertisementData(const char *data, int length)
83 {
84
85     CAResult_t res =  CAsetServerAdvertisementData(data, length);
86
87     if (CA_STATUS_OK != res)
88     {
89         OIC_LOG_V(ERROR, TAG, "Failed to stop le CAManagerLEServerSetAdvertisementData [%d]", res);
90         return;
91     }
92 }
93
94 CAResult_t CAManagerLEServerSetScanResponseData(const char *data, int length)
95 {
96
97     CAResult_t res =  CAsetServerSanResponseData(data, length);
98
99     if (CA_STATUS_OK != res)
100     {
101         OIC_LOG_V(ERROR, TAG, "Failed to stop le CAsetServerSanResponseData [%d]", res);
102         return;
103     }
104 }
105 #endif