replace : iotivity -> iotivity-sec
[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 CAResult_t CAManagerLEServerSetAdvertisementData(const char* data, int length);
54 CAResult_t CAManagerLEServerSetScanResponseData(const char* data, int length);
55 #endif
56
57 #if defined(__APPLE__) && defined(LE_ADAPTER)
58 /**
59  * initialize client connection manager
60  *
61  * @return  ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
62  */
63 CAResult_t CAManagerLEClientInitialize();
64
65 /**
66  * terminate client connection manager
67  *
68  * @return  ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
69  */
70 CAResult_t CAManagerLEClientTerminate();
71
72 /**
73  * stop BLE scan.
74  */
75 void CAManagerLEStopScan();
76
77 /**
78  * start BLE scan.
79  */
80 void CAManagerLEStartScan();
81
82 /**
83  * Disconnect from peripheral
84  */
85 void CAManagerLEDisconnect();
86
87 #endif
88
89 #if defined(__ANDROID__) && defined(LE_ADAPTER)
90 /**
91  * initialize client connection manager
92  * @param[in]   env                   JNI interface pointer.
93  * @param[in]   jvm                   invocation inferface for JAVA virtual machine.
94  * @param[in]   context               application context.
95  *
96  * @return  ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
97  */
98 CAResult_t CAManagerLEClientInitialize(JNIEnv *env, JavaVM *jvm, jobject context);
99
100 /**
101  * terminate client connection manager
102  * @param[in]   env                   JNI interface pointer.
103  *
104  * @return  ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
105  */
106 CAResult_t CAManagerLEClientTerminate(JNIEnv *env);
107
108 /**
109  * set BLE scan interval time and working count.
110  * @param[in]  intervalTime         interval time(Seconds).
111  * @param[in]  workingCount         working count for selected interval time.
112  */
113 void CAManagerLESetScanInterval(jint intervalTime, jint workingCount);
114
115 /**
116  * stop BLE scan.
117  */
118 void CAManagerLEStopScan();
119 #endif
120
121 /**
122  * start BLE advertising.
123  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
124  */
125 CAResult_t CAManagerLEStartAdvertising();
126
127 /**
128  * stop BLE advertising.
129  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
130  */
131 CAResult_t CAManagerLEStopAdvertising();
132
133
134 /**
135  * set CAUtilConfig_t configure.
136  * @param[in]  config       ::CAUtilConfig_t value
137  */
138 void CAManagerSetConfigure(CAUtilConfig_t config);
139
140 #ifdef __cplusplus
141 } /* extern "C" */
142 #endif
143
144 #endif /* CA_MANAGER_LE_INF_H_ */
145