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 #ifndef CA_MANAGER_LE_INF_H_
22 #define CA_MANAGER_LE_INF_H_
25 #include "cautilinterface.h"
33 * Register network monitor callbacks.
34 * Adapter state changes and network state changes are delivered these callbacks.
35 * @param[in] adapterStateCB Adapter state changed callback.
36 * @param[in] connStateCB Connection state changed callback.
38 void CASetLENetworkMonitorCallbacks(CAAdapterStateChangedCB adapterStateCB,
39 CAConnectionStateChangedCB connStateCB);
42 * Set device information for auto connection.
44 CAResult_t CASetLEClientAutoConnectionDeviceInfo();
47 * Unset device information to stop auto connection.
49 CAResult_t CAUnsetLEClientAutoConnectionDeviceInfo();
51 //custom advertisement data
52 #if defined(__TIZEN__) && defined(LE_ADAPTER) && defined(BLE_CUSTOM_ADVERTISE)
54 * Set custom bluetooth advertisement data.
55 * @param[in] data Array of bluetooth advertisement data.
56 * @param[in] length Length of data array.
58 CAResult_t CAManagerLEServerSetAdvertisementData(const char* data, int length);
61 * Set custom bluetooth advertisement data getter callback.
62 * @param[in] getter Custom bluetooth advertisement data getter callback.
64 void CAManagerLEServerSetAdvertisementDataGetter(CAAdvertisementDataGetterCB getter);
67 * Set auto advertisement enabling flag.
68 * @param[in] autoAdvertisement Boolean flag to turn autoadvertisement on or off.
70 void CAManagerLEServerSetAutoAdverisement(bool autoAdvertisement);
73 * Scan custom bluetooth advertisement data and write it to broadcaster.
74 * @param[in] data Array of bluetooth advertisement data.
75 * @param[in] length Lenght of data array.
77 CAResult_t CAManagerLEServerSetScanResponseData(const char* data, int length);
80 #if defined(__APPLE__) && defined(LE_ADAPTER)
82 * initialize client connection manager
84 * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
86 CAResult_t CAManagerLEClientInitialize();
89 * terminate client connection manager
91 * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
93 CAResult_t CAManagerLEClientTerminate();
98 void CAManagerLEStopScan();
103 void CAManagerLEStartScan();
106 * Disconnect from peripheral
108 void CAManagerLEDisconnect();
112 #if defined(__ANDROID__) && defined(LE_ADAPTER)
114 * set UUID for setting scanfilter
115 * @param[in] uuid service UUID string or manufacture data.
116 * @param[in] uuid_type Type of scanfilter to be set i.e. service UUID based or manufacture data based.
118 void CASetScanUuid(char* uuid, int uuid_type);
121 * initialize client connection manager
122 * @param[in] env JNI interface pointer.
123 * @param[in] jvm invocation inferface for JAVA virtual machine.
124 * @param[in] context application context.
126 * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
128 CAResult_t CAManagerLEClientInitialize(JNIEnv *env, JavaVM *jvm, jobject context);
131 * terminate client connection manager
132 * @param[in] env JNI interface pointer.
134 * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
136 CAResult_t CAManagerLEClientTerminate(JNIEnv *env);
139 * set BLE scan interval time and working count.
140 * @param[in] intervalTime interval time(Seconds).
141 * @param[in] workingCount working count for selected interval time.
143 void CAManagerLESetScanInterval(jint intervalTime, jint workingCount);
148 void CAManagerLEStopScan();
152 * start BLE advertising.
153 * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
155 CAResult_t CAManagerLEStartAdvertising();
158 * stop BLE advertising.
159 * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
161 CAResult_t CAManagerLEStopAdvertising();
165 * set CAUtilConfig_t configure.
166 * @param[in] config ::CAUtilConfig_t value
168 void CAManagerSetConfigure(CAUtilConfig_t config);
174 #endif /* CA_MANAGER_LE_INF_H_ */