1 /* ****************************************************************
3 * Copyright 2016 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 ******************************************************************/
21 #include <bluetooth.h>
22 #include <bluetooth_type.h>
23 #include <bluetooth_internal.h>
25 #include "camanagerleinterface.h"
27 #include "camessagehandler.h"
28 #include "caleserver.h"
29 #include "cagattservice.h"
32 #define TAG "OIC_CA_MANAGER_TZ_LE"
34 static CAAdapterStateChangedCB g_adapterStateCB = NULL;
35 static CAConnectionStateChangedCB g_connStateCB = NULL;
37 static void CAManagerAdapterMonitorHandler(const CAEndpoint_t *info, CANetworkStatus_t status);
38 static void CAManagerConnectionMonitorHandler(CATransportAdapter_t adapter,
39 const char *remoteAddress, bool connected);
41 void CASetLENetworkMonitorCallbacks(CAAdapterStateChangedCB adapterStateCB,
42 CAConnectionStateChangedCB connStateCB)
46 OIC_LOG(DEBUG, TAG, "CASetLENetworkMonitorCallbacks");
49 CAResult_t CAManagerLEStartAdvertising()
51 OIC_LOG(DEBUG, TAG, "CAManagerLEStartAdvertising");
53 CAResult_t res = CALEStartAdvertise();
54 if (CA_STATUS_OK != res)
56 OIC_LOG_V(ERROR, TAG, "Failed to start le advertising [%d]", res);
62 CAResult_t CAManagerLEStopAdvertising()
64 OIC_LOG(DEBUG, TAG, "CAManagerLEStopAdvertising");
66 CAResult_t res = CALEStopAdvertise();
67 if (CA_STATUS_OK != res)
69 OIC_LOG_V(ERROR, TAG, "Failed to stop le advertising [%d]", res);
75 CAResult_t CASetLEClientAutoConnectionDeviceInfo(const char * address)
77 OIC_LOG(DEBUG, TAG, "CASetLEClientAutoConnectionDeviceInfo");
79 return CA_NOT_SUPPORTED;
82 CAResult_t CAUnsetLEClientAutoConnectionDeviceInfo(const char * address)
84 OIC_LOG(DEBUG, TAG, "CAUnsetLEClientAutoConnectionDeviceInfo");
86 return CA_NOT_SUPPORTED;
88 #if defined(__TIZEN__) && defined(LE_ADAPTER) && defined(BLE_CUSTOM_ADVERTISE)
89 CAResult_t CAManagerLEServerSetAdvertisementData(const char *data, int length)
92 CAResult_t res = CAsetServerAdvertisementData(data, length);
94 if (CA_STATUS_OK != res)
96 OIC_LOG_V(ERROR, TAG, "Failed to stop le CAManagerLEServerSetAdvertisementData [%d]", res);
101 CAResult_t CAManagerLEServerSetScanResponseData(const char *data, int length)
104 CAResult_t res = CAsetServerSanResponseData(data, length);
106 if (CA_STATUS_OK != res)
108 OIC_LOG_V(ERROR, TAG, "Failed to stop le CAsetServerSanResponseData [%d]", res);