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_DEVICE_H_
22 #define CA_MANAGER_DEVICE_H_
25 #include "uarraylist.h"
34 * Auto Connection Target Device Identity
38 jstring address; /**< remote address */
39 bool isAutoConnecting; /**< whether GATT connection has been in progress */
43 * get address from auto connection list.
44 * @param[in] env JNI interface pointer.
45 * @param[in] idx index of auto connection data list.
48 jstring CAManagerGetLEAddressFromACData(JNIEnv *env, size_t idx);
51 * create auto connection list.
53 void CAManagerCreateACDataList();
56 * Destroy auto connection list.
58 void CAManagerDestroyACDataList();
62 * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
64 CAResult_t CAManagerInitMutexVaraibles();
69 void CAManagerTerminateMutexVariables();
72 * check whether target address is already contained in ACData list or not.
73 * @param[in] env JNI interface pointer.
74 * @param[in] jaddress ble address.
76 bool CAManagerIsInACDataList(JNIEnv *env, jstring jaddress);
79 * add auto connection data into list.
80 * @param[in] env JNI interface pointer.
81 * @param[in] jaddress ble address.
83 void CAManagerAddACData(JNIEnv *env, jstring jaddress);
86 * remove auto connection data from ACData list for selected ble address.
87 * @param[in] env JNI interface pointer.
88 * @param[in] jaddress ble address.
89 * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
91 CAResult_t CAManagerRemoveACData(JNIEnv *env, jstring jaddress);
94 * remove auto connection data from ACData list for all devices.
95 * @param[in] env JNI interface pointer.
96 * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
98 CAResult_t CAManagerRemoveAllACData(JNIEnv *env);
101 * get isAutoConnecting flag for the address.
102 * @param[in] env JNI interface pointer.
103 * @param[in] jaddress ble address.
104 * @param[out] flag isAutoConnecting flag
105 * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
107 CAResult_t CAManagerGetAutoConnectingFlag(JNIEnv *env, jstring jaddress, bool *flag);
110 * set isAutoConnecting flag for the address.
111 * @param[in] env JNI interface pointer.
112 * @param[in] jaddress ble address.
113 * @param[in] flag isAutoConnecting flag.
114 * @return true or false
116 bool CAManagerSetAutoConnectingFlag(JNIEnv *env, jstring jaddress, bool flag);
119 * get length of auto connection list.
122 size_t CAManagerGetACDataLength();
125 * set BT adapter recovery flag.
126 * @param[in] flag recovery flag.
128 void CAManagerSetBTRecovery(bool flag);
131 * get BT adapter recovery flag.
132 * @return recovery flag.
134 bool CAManagerIsRecoveryFlagSet();
140 #endif /* CA_MANAGER_DEVICE_H_ */