replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / connectivity / util / src / camanager / bt_le_manager / ios / camanagerdevice.h
1 /* ****************************************************************
2  *
3  * Copyright 2017 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_DEVICE_H_
22 #define CA_MANAGER_DEVICE_H_
23
24 #include "uarraylist.h"
25 #include "octhread.h"
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 /*
33  * Auto Connection Target Device Identity
34  */
35 typedef struct
36 {
37     char address[18];      /**< remote address */
38     bool isAutoConnect;   /**< auto connection flag */
39 } CAManagerACData_t;
40
41 /**
42  * get address from auto connection list.
43  * @param[in]   idx                   index of auto connection data list.
44  * @return  address
45  */
46 char* CAManagerGetLEAddressFromACData(size_t idx);
47
48 /**
49  * create auto connection list.
50  */
51 void CAManagerCreateACDataList();
52
53 /**
54  * initialize mutex.
55  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
56  */
57 CAResult_t CAManagerInitMutexVaraibles();
58
59 /**
60  * terminate mutex.
61  */
62 void CAManagerTerminateMutexVariables();
63
64 /**
65  * check whether target address is already contained in list or not.
66  * @param[in]   address              ble address.
67  * @return  true or false
68  */
69 bool CAManagerIsMatchedACData(const char* address);
70
71 /**
72  * add auto connection data into list.
73  * @param[in]   address              ble address.
74  */
75 void CAManagerAddACData(const char* address);
76
77 /**
78  * remove auto connection data for selected ble address.
79  * @param[in]   env                   JNI interface pointer.
80  * @param[in]   address               ble address.
81  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
82  */
83 CAResult_t CAManagerRemoveData(const char* address);
84
85 /**
86  * remove auto connection data for all devices.
87  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
88  */
89 CAResult_t CAManagerRemoveAllData();
90
91 /**
92  * get current auto connection flag.
93  * @param[in]   address              ble address.
94  * @return  true or false
95  */
96 bool CAManagerGetAutoConnectionFlag(const char* address);
97
98 /**
99  * set auto connection flag.
100  * @param[in]   address              ble address.
101  * @param[in]   flag                  auto connection flag.
102  */
103 void CAManagerSetAutoConnectionFlag(const char* address, bool flag);
104
105 /**
106  * get length of auto connection list.
107  * @return  list size
108  */
109 size_t CAManagerGetACDataLength();
110
111 /**
112  * set BT adapter recovery flag.
113  * @param[in]   flag                  recovery flag.
114  */
115 void CAManagerSetBTRecovery(bool flag);
116
117 /**
118  * get BT adapter recovery flag.
119  * @return  recovery flag.
120  */
121 bool CAManagerIsRecoveryFlagSet();
122
123 #ifdef __cplusplus
124 } /* extern "C" */
125 #endif
126
127 #endif /* CA_MANAGER_DEVICE_H_ */
128