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_UTILS_H_
22 #define CA_MANAGER_LE_UTILS_H_
37 * get bluetooth device object from bluetooth adapter.
38 * @param[in] env JNI interface pointer.
39 * @param[in] remote_address remote address.
40 * @return bluetooth device object.
42 jobject CAManagerGetRemoteDevice(JNIEnv *env, jstring address);
45 * get address from gatt profile object.
46 * @param[in] env JNI interface pointer.
47 * @param[in] gatt gatt profile object.
50 jstring CAManagerGetAddressFromGatt(JNIEnv *env, jobject gatt);
53 * check whether the devie is bonded or not.
54 * @param[in] env JNI interface pointer.
55 * @param[in] btDevice bluetooth device object.
56 * @return true(bonded) or false(bond none)
58 bool CAManagerIsDeviceBonded(JNIEnv *env, jobject btDevice);
61 * change bluetooth adapter state.
62 * @param[in] env JNI interface pointer.
63 * @param[in] controlFlag true : enable(), false : disable()
64 * @return true or false
66 bool CAManagerControlAdapter(JNIEnv *env, bool controlFlag);
69 * request to get rssi value from bluetooth
70 * @param[in] env JNI interface pointer.
71 * @param[in] bluetoothGatt connected gatt object.
72 * @return ::CA_STATUS_OK or Appropriate error code.
74 CAResult_t CAManagerReadRemoteRssi(JNIEnv *env, jobject bluetoothGatt);
77 * get SharedPreference from context of application.
78 * @param[in] env JNI interface pointer.
79 * @param[in] context Application context interface.
80 * @param[in] prefName preferences name.
81 * @return SharedPreferences object.
83 jobject CAManagerGetSharedPreference(JNIEnv *env, jobject context, jstring prefName);
86 * check whether the device is already put or not.
87 * @param[in] env JNI interface pointer.
88 * @param[in] context Application context interface.
89 * @param[in] address LE address.
90 * @param[in] set set<String> object related to connected list.
91 * @return true or false
93 bool CAManagerIsConnectedDeviceAddress(JNIEnv *env, jobject context,
94 jstring address, jobject set);
97 * get SharedPreferences.Editor object.
98 * @param[in] env JNI interface pointer.
99 * @param[in] context Application context interface.
100 * @return SharedPreferences.Editor object.
102 jobject CAManagerGetPrefStringSet(JNIEnv *env, jobject context);
105 * update SharedPreferences for set<String> object.
106 * @param[in] env JNI interface pointer.
107 * @param[in] context Application context interface.
108 * @param[in] set set<String> object related to connected list.
109 * @return true or false
111 bool CAManagerUpdatePrefStringSet(JNIEnv *env, jobject context, jobject set);
114 * get SharedPreferences for set<String> object.
115 * @param[in] env JNI interface pointer.
116 * @param[in] context Application context interface.
117 * @return set<String> object from SharedPreferences
119 jobject CAManagerGetPrefStringSet(JNIEnv *env, jobject context);
122 * checks whether the preferences contains a preference.
123 * @param[in] env JNI interface pointer.
124 * @param[in] context Application context interface.
125 * @return true or false
127 bool CAManagerContainsPrefStringSet(JNIEnv *env, jobject context);
130 * add connected device into SharedPreference.
131 * @param[in] env JNI interface pointer.
132 * @param[in] context Application context interface.
133 * @param[in] address ble address.
134 * @param[in] set set<String> object related to connected list.
135 * @return true or false
137 bool CAManagerAddConnectedDeviceAddress(JNIEnv *env, jobject context,
138 jstring address, jobject set);
141 * get connected device from SharedPreference.
142 * @param[in] env JNI interface pointer.
143 * @param[in] context Application context interface.
144 * @return LE address of connected device.
146 jobject CAManagerGetConnectedDeviceAddress(JNIEnv *env, jobject context);
149 * remove connected device to SharedPreference.
150 * @param[in] env JNI interface pointer.
151 * @param[in] context Application context interface.
152 * @param[in] address LE address.
153 * @param[in] set set<String> object related to connected list.
154 * @return true or false
156 bool CAManagerRemoveConnectedDeviceAddress(JNIEnv *env, jobject context,
157 jstring address, jobject set);
160 * Vaildate a String bluetooth address.
161 * @param[in] env JNI interface pointer.
162 * @param[in] address LE address.
163 * @return JNI_TRUE or JNI_FALSE
165 jboolean CAManagerCheckBTAddress(JNIEnv *env, jstring address);
168 * create new set<String> object.
169 * @param[in] env JNI interface pointer.
170 * @return set<String> object
172 jobject CAManagerCreateSetString(JNIEnv *env);
175 * remove connected device to SharedPreference.
176 * @param[in] env JNI interface pointer.
177 * @param[in] address LE address.
178 * @param[in] set set<String> object related to connected list.
179 * @param[in] method_type method name to get its ID.
180 * @return true or false
182 bool CAManagerCallFuncSetString(JNIEnv *env, jstring address,
183 jobject set, CASetMethod_t method_type);
189 #endif /* CA_MANAGER_LE_UTILS_H_ */