1 /******************************************************************
3 * Copyright 2014 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 ******************************************************************/
23 * @brief This file contains the APIs for BT LE communications.
25 #ifndef CA_LE_UTILS_H_
26 #define CA_LE_UTILS_H_
29 #include "cathreadpool.h"
30 #include "uarraylist.h"
39 static const char OIC_GATT_SERVICE_UUID[] = "713d0000-503e-4c75-ba94-3148f18d941e";
40 static const char OIC_GATT_CHARACTERISTIC_RESPONSE_UUID[] = "713d0002-503e-4c75-ba94-3148f18d941e";
41 static const char OIC_GATT_CHARACTERISTIC_REQUEST_UUID[] = "713d0003-503e-4c75-ba94-3148f18d941e";
42 static const char OIC_GATT_CHARACTERISTIC_CONFIG_UUID[] = "00002902-0000-1000-8000-00805f9b34fb";
44 static const uint32_t GATT_SUCCESS = 0;
46 static const uint32_t BOND_BONDED = 12;
47 static const uint32_t BOND_BONDING = 11;
48 static const uint32_t BOND_NONE = 10;
51 * @brief get uuid(jni object) from uuid(character)
52 * @param env [IN] JNI interface pointer
53 * @param uuid [IN] uuid(character)
54 * @return uuid(jni object)
56 jobject CALEGetUuidFromString(JNIEnv *env, const char* uuid);
59 * @brief get parcel uuid object
60 * @param env [IN] JNI interface pointer
61 * @param uuid [IN] uuid (jni object)
62 * @return parcel uuid object
64 jobject CALEGetParcelUuid(JNIEnv *env, jobject uuid);
67 * @brief get address from a local device
68 * @param env [IN] JNI interface pointer
69 * @return local address
71 jstring CALEGetLocalDeviceAddress(JNIEnv *env);
74 * @brief get bonded list
75 * @param env [IN] JNI interface pointer
78 jobjectArray CALEGetBondedDevices(JNIEnv *env);
81 * @brief get constants information of bluetooth state-on
82 * @param env [IN] JNI interface pointer
83 * @return constants information of bluetooth state-on
85 jint CALEGetBTStateOnInfo(JNIEnv *env);
88 * @brief check this device can be supported as BLE client or server
89 * @param env [IN] JNI interface pointer
90 * @param level [IN] Android API Level to support
91 * @return CA_STATUS_OK or ERROR CODES (CAResult_t error codes in cacommon.h)
93 CAResult_t CALECheckPlatformVersion(JNIEnv *env, uint16_t level);
96 * @brief get constants information of android.os.Build.VERSION.SDK_INT
97 * @param env [IN] JNI interface pointer
98 * @return constants information of android.os.Build.VERSION.SDK_INT
100 jint CALEGetBuildVersion(JNIEnv *env);
103 * @brief get constants information of android.os.Build.VERSION_CODES.[VersionName]
104 * @param env [IN] JNI interface pointer
105 * @param versionName [IN] version name (.., KITKAT, LOLLIPOP, ..)
106 * @return constants information of android.os.Build.VERSION_CODES.[VersionName]
108 jint CALEGetBuildVersionCodeForName(JNIEnv *env, const char* versionName);
111 * @brief get bluetooth adapter state information
112 * @param env [IN] JNI interface pointer
113 * @return JNI_TRUE if the local adapter is turned on
115 jboolean CALEIsEnableBTAdapter(JNIEnv *env);
118 * @brief get address from remote device
119 * @param env [IN] JNI interface pointer
120 * @param bluetoothDevice [IN] bluetooth device object
121 * @return remote address
123 jstring CALEGetAddressFromBTDevice(JNIEnv *env, jobject bluetoothDevice);
129 #endif /* CA_LE_UTILS_H_ */