Merge "[CONPRO-1483] Implementation of API for setting scanfilter UUIDs" into tizen
[platform/upstream/iotivity.git] / resource / csdk / connectivity / util / inc / camanagerleinterface.h
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 #ifndef CA_MANAGER_LE_INF_H_
22 #define CA_MANAGER_LE_INF_H_
23
24 #include "cacommon.h"
25 #include "cautilinterface.h"
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 /**
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.
37  */
38 void CASetLENetworkMonitorCallbacks(CAAdapterStateChangedCB adapterStateCB,
39                                     CAConnectionStateChangedCB connStateCB);
40
41 /**
42  * Set device information for auto connection.
43  */
44 CAResult_t CASetLEClientAutoConnectionDeviceInfo();
45
46 /**
47  * Unset device information to stop auto connection.
48  */
49 CAResult_t CAUnsetLEClientAutoConnectionDeviceInfo();
50
51 //custom advertisement data
52 #if defined(__TIZEN__) && defined(LE_ADAPTER) && defined(BLE_CUSTOM_ADVERTISE)
53 /**
54  * Set custom bluetooth advertisement data.
55  * @param[in]   data      Array of bluetooth advertisement data.
56  * @param[in]   length    Length of data array.
57  */
58 CAResult_t CAManagerLEServerSetAdvertisementData(const char* data, int length);
59
60 /**
61  * Set custom bluetooth advertisement data getter callback.
62  * @param[in]   getter    Custom bluetooth advertisement data getter callback.
63  */
64 void CAManagerLEServerSetAdvertisementDataGetter(CAAdvertisementDataGetterCB getter);
65
66 /**
67  * Set auto advertisement enabling flag.
68  * @param[in]   autoAdvertisement   Boolean flag to turn autoadvertisement on or off.
69  */
70 void CAManagerLEServerSetAutoAdverisement(bool autoAdvertisement);
71
72 /**
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.
76  */
77 CAResult_t CAManagerLEServerSetScanResponseData(const char* data, int length);
78 #endif
79
80 #if defined(__APPLE__) && defined(LE_ADAPTER)
81 /**
82  * initialize client connection manager
83  *
84  * @return  ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
85  */
86 CAResult_t CAManagerLEClientInitialize();
87
88 /**
89  * terminate client connection manager
90  *
91  * @return  ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
92  */
93 CAResult_t CAManagerLEClientTerminate();
94
95 /**
96  * stop BLE scan.
97  */
98 void CAManagerLEStopScan();
99
100 /**
101  * start BLE scan.
102  */
103 void CAManagerLEStartScan();
104
105 /**
106  * Disconnect from peripheral
107  */
108 void CAManagerLEDisconnect();
109
110 #endif
111
112 #if defined(__ANDROID__) && defined(LE_ADAPTER)
113 /**
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.
117  */
118 void CASetScanUuid(char* uuid, int uuid_type);
119
120 /**
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.
125  *
126  * @return  ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
127  */
128 CAResult_t CAManagerLEClientInitialize(JNIEnv *env, JavaVM *jvm, jobject context);
129
130 /**
131  * terminate client connection manager
132  * @param[in]   env                   JNI interface pointer.
133  *
134  * @return  ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
135  */
136 CAResult_t CAManagerLEClientTerminate(JNIEnv *env);
137
138 /**
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.
142  */
143 void CAManagerLESetScanInterval(jint intervalTime, jint workingCount);
144
145 /**
146  * stop BLE scan.
147  */
148 void CAManagerLEStopScan();
149 #endif
150
151 /**
152  * start BLE advertising.
153  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
154  */
155 CAResult_t CAManagerLEStartAdvertising();
156
157 /**
158  * stop BLE advertising.
159  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
160  */
161 CAResult_t CAManagerLEStopAdvertising();
162
163
164 /**
165  * set CAUtilConfig_t configure.
166  * @param[in]  config       ::CAUtilConfig_t value
167  */
168 void CAManagerSetConfigure(CAUtilConfig_t config);
169
170 #ifdef __cplusplus
171 } /* extern "C" */
172 #endif
173
174 #endif /* CA_MANAGER_LE_INF_H_ */
175