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 * check whether the devie is bonded or not.
46 * @param[in] env JNI interface pointer.
47 * @param[in] btDevice bluetooth device object.
48 * @return true(bonded) or false(bond none)
50 bool CAManagerIsDeviceBonded(JNIEnv *env, jobject btDevice);
53 * change bluetooth adapter state.
54 * @param[in] env JNI interface pointer.
55 * @param[in] controlFlag true : enable(), false : disable()
56 * @return true or false
58 bool CAManagerControlAdapter(JNIEnv *env, bool controlFlag);
61 * request to get rssi value from bluetooth
62 * @param[in] env JNI interface pointer.
63 * @param[in] bluetoothGatt connected gatt object.
64 * @return ::CA_STATUS_OK or Appropriate error code.
66 CAResult_t CAManagerReadRemoteRssi(JNIEnv *env, jobject bluetoothGatt);
69 * get SharedPreference from context of application.
70 * @param[in] env JNI interface pointer.
71 * @param[in] context Application context interface.
72 * @param[in] prefName preferences name.
73 * @return SharedPreferences object.
75 jobject CAManagerGetSharedPreference(JNIEnv *env, jobject context, jstring prefName);
78 * check whether the device is already put or not.
79 * @param[in] env JNI interface pointer.
80 * @param[in] context Application context interface.
81 * @param[in] address LE address.
82 * @param[in] set set<String> object related to connected list.
83 * @return true or false
85 bool CAManagerIsConnectedDeviceAddress(JNIEnv *env, jobject context,
86 jstring address, jobject set);
89 * get SharedPreferences.Editor object.
90 * @param[in] env JNI interface pointer.
91 * @param[in] context Application context interface.
92 * @return SharedPreferences.Editor object.
94 jobject CAManagerGetPrefStringSet(JNIEnv *env, jobject context);
97 * update SharedPreferences for set<String> object.
98 * @param[in] env JNI interface pointer.
99 * @param[in] context Application context interface.
100 * @param[in] set set<String> object related to connected list.
101 * @return true or false
103 bool CAManagerUpdatePrefStringSet(JNIEnv *env, jobject context, jobject set);
106 * get SharedPreferences for set<String> object.
107 * @param[in] env JNI interface pointer.
108 * @param[in] context Application context interface.
109 * @return set<String> object from SharedPreferences
111 jobject CAManagerGetPrefStringSet(JNIEnv *env, jobject context);
114 * checks whether the preferences contains a preference.
115 * @param[in] env JNI interface pointer.
116 * @param[in] context Application context interface.
117 * @return true or false
119 bool CAManagerContainsPrefStringSet(JNIEnv *env, jobject context);
122 * add connected device into SharedPreference.
123 * @param[in] env JNI interface pointer.
124 * @param[in] context Application context interface.
125 * @param[in] address ble address.
126 * @param[in] set set<String> object related to connected list.
127 * @return true or false
129 bool CAManagerAddConnectedDeviceAddress(JNIEnv *env, jobject context,
130 jstring address, jobject set);
133 * get connected device from SharedPreference.
134 * @param[in] env JNI interface pointer.
135 * @param[in] context Application context interface.
136 * @return LE address of connected device.
138 jobject CAManagerGetConnectedDeviceAddress(JNIEnv *env, jobject context);
141 * remove connected device to SharedPreference.
142 * @param[in] env JNI interface pointer.
143 * @param[in] context Application context interface.
144 * @param[in] address LE address.
145 * @param[in] set set<String> object related to connected list.
146 * @return true or false
148 bool CAManagerRemoveConnectedDeviceAddress(JNIEnv *env, jobject context,
149 jstring address, jobject set);
152 * Vaildate a String bluetooth address.
153 * @param[in] env JNI interface pointer.
154 * @param[in] address LE address.
155 * @return JNI_TRUE or JNI_FALSE
157 jboolean CAManagerCheckBTAddress(JNIEnv *env, jstring address);
160 * create new set<String> object.
161 * @param[in] env JNI interface pointer.
162 * @return set<String> object
164 jobject CAManagerCreateSetString(JNIEnv *env);
167 * remove connected device to SharedPreference.
168 * @param[in] env JNI interface pointer.
169 * @param[in] address LE address.
170 * @param[in] set set<String> object related to connected list.
171 * @param[in] method_type method name to get its ID.
172 * @return true or false
174 bool CAManagerCallFuncSetString(JNIEnv *env, jstring address,
175 jobject set, CASetMethod_t method_type);
181 #endif /* CA_MANAGER_LE_UTILS_H_ */