From 3b549cf1fc916775a6a0c712e8dba8f155377e61 Mon Sep 17 00:00:00 2001 From: samanway-dey Date: Wed, 19 Dec 2018 20:00:25 +0530 Subject: [PATCH] Implementation of Filtered Scan for BLE android client https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/550/commits/122fb3ee9a1ad66d5bbeeeeb6410f9f10e1977a6 (cherry-picked from 122fb3ee9a1ad66d5bbeeeeb6410f9f10e1977a6) Change-Id: I537661ef606540fd36a8c352330ef831b96ed732 Signed-off-by: samanway-dey Signed-off-by: Sudipto --- .../java/org/iotivity/ca/CaLeClientInterface.java | 10 +- resource/csdk/connectivity/inc/cagattservice.h | 9 + .../src/bt_le_adapter/android/caleclient.c | 263 ++++++++++++++++++++- .../src/bt_le_adapter/android/caleutils.c | 27 +++ .../src/bt_le_adapter/android/caleutils.h | 11 + 5 files changed, 314 insertions(+), 6 deletions(-) diff --git a/android/android_api/base/src/main/java/org/iotivity/ca/CaLeClientInterface.java b/android/android_api/base/src/main/java/org/iotivity/ca/CaLeClientInterface.java index 75dde18..9b7c8ad 100755 --- a/android/android_api/base/src/main/java/org/iotivity/ca/CaLeClientInterface.java +++ b/android/android_api/base/src/main/java/org/iotivity/ca/CaLeClientInterface.java @@ -74,11 +74,11 @@ public class CaLeClientInterface { } public static void getLeScanCallback() { -// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { -// caLeRegisterLeScanCallbackForV21(mLeScanCallbackForV21); -// } else { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + caLeRegisterLeScanCallbackForV21(mLeScanCallbackForV21); + } else { caLeRegisterLeScanCallback(mLeScanCallback); -// } + } } public static void getLeGattCallback() { @@ -217,6 +217,7 @@ public class CaLeClientInterface { try { List uuids = getUuids(scanRecord); for (UUID uuid : uuids) { + Log.d(TAG,"UUID is "+ uuid.toString()); if(uuid.toString().contains(SERVICE_UUID.toLowerCase())) { caLeScanCallback(device); } else if(uuid.toString().contains(CUSTOM_UUID.toLowerCase()) || @@ -351,6 +352,7 @@ public class CaLeClientInterface { public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { super.onDescriptorWrite(gatt, descriptor, status); + Log.d(TAG,"Descriptor status is "+ status); caLeGattDescriptorWriteCallback(gatt, status); caLeGattNWDescriptorWriteCallback(gatt, status); diff --git a/resource/csdk/connectivity/inc/cagattservice.h b/resource/csdk/connectivity/inc/cagattservice.h index b587218..349adb4 100644 --- a/resource/csdk/connectivity/inc/cagattservice.h +++ b/resource/csdk/connectivity/inc/cagattservice.h @@ -30,6 +30,15 @@ /// OIC Transport Profile GATT service UUID. #define CA_GATT_SERVICE_UUID "ADE3D529-C784-4F63-A987-EB69F70EE816" +/// OIC Transport Profile first GATT custom UUID. +#define CA_GATT_CUSTOM_UUID "75004209" + +/// OIC Transport Profile second GATT custom UUID. +#define CA_GATT_CUSTOM_UUID2 "75004204" + +/// OIC Transport Profile third GATT custom UUID. +#define CA_GATT_CUSTOM_UUID3 "7500420C" + /// OIC Transport Profile GATT request characteristic UUID. #define CA_GATT_REQUEST_CHRC_UUID "AD7B334F-4637-4B86-90B6-9D787F03D218" diff --git a/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.c b/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.c index 9977465..83ed0ae 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.c @@ -57,9 +57,10 @@ #define GATT_WRITE_NOT_PERMITTED 3 // samsung -#define BLE_SCAN_API_LEVEL (100) //(21) +#define BLE_SCAN_API_LEVEL (21) //(21) #define BLE_MIN_API_LEVEL (18) #define HIDDEN_API +#define MANUFACTURE_ID 117 static ca_thread_pool_t g_threadPoolHandle = NULL; @@ -118,7 +119,7 @@ static CABLEDataReceivedCallback g_CABLEClientDataReceivedCallback = NULL; static int32_t g_jniIntSdk = -1; static bool g_setHighQoS = true; -static bool g_setFullScanFlag = true; +static bool g_setFullScanFlag = false; jclass g_LEInterface = NULL; /** * check if retry logic for connection routine has to be stopped or not. @@ -1431,6 +1432,10 @@ CAResult_t CALEClientStartScan() return CA_STATUS_FAILED; } + if(g_jniIntSdk < BLE_SCAN_API_LEVEL) + { + g_setFullScanFlag = true; + } bool isAttached = false; JNIEnv* env = NULL; jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6); @@ -1456,11 +1461,13 @@ CAResult_t CALEClientStartScan() if (!g_setFullScanFlag) { //new uuid scan with callback + OIC_LOG(DEBUG, TAG, "CALEClientStartScanWithUUIDImplForV21 will be called"); ret = CALEClientStartScanWithUUIDImplForV21(env, g_uuidList, g_leScanCallback); } else { //new full scan with callback + OIC_LOG(DEBUG, TAG, "CALEClientStartScanImplForV21 will be called"); ret = CALEClientStartScanImplForV21(env, g_leScanCallback); } } @@ -1468,10 +1475,12 @@ CAResult_t CALEClientStartScan() { if (!g_setFullScanFlag) { + OIC_LOG(DEBUG, TAG, "CALEClientStartScanWithUUIDImpl will be called"); ret = CALEClientStartScanWithUUIDImpl(env, g_uuidList, g_leScanCallback); } else { + OIC_LOG(DEBUG, TAG, "CALEClientStartScanImpl will be called"); ret = CALEClientStartScanImpl(env, g_leScanCallback); } } @@ -1822,6 +1831,45 @@ CAResult_t CALEClientStartScanWithUUIDImplForV21(JNIEnv *env, jobjectArray uuids return CA_STATUS_FAILED; } + // call scanfilter.Builder() + jobject jni_obj_scanfilterBuilder2 = (*env)->NewObject(env, jni_cid_scanfilterBuilder, + jni_mid_scanfilterBuilderCtor); + if (!jni_obj_scanfilterBuilder2) + { + OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_scanfilterBuilder2 is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_cid_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder); + return CA_STATUS_FAILED; + } + + // call scanfilter.Builder() + jobject jni_obj_scanfilterBuilder3 = (*env)->NewObject(env, jni_cid_scanfilterBuilder, + jni_mid_scanfilterBuilderCtor); + if (!jni_obj_scanfilterBuilder3) + { + OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_scanfilterBuilder3 is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_cid_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + return CA_STATUS_FAILED; + } + + // call scanfilter.Builder() + jobject jni_obj_scanfilterBuilder4 = (*env)->NewObject(env, jni_cid_scanfilterBuilder, + jni_mid_scanfilterBuilderCtor); + if (!jni_obj_scanfilterBuilder4) + { + OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_scanfilterBuilder4 is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_cid_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + return CA_STATUS_FAILED; + } + // get scanfilter.Builder.setServiceUuid method id jmethodID jni_mid_setServiceUuid = (*env)->GetMethodID(env, jni_cid_scanfilterBuilder, "setServiceUuid", @@ -1833,9 +1881,28 @@ CAResult_t CALEClientStartScanWithUUIDImplForV21(JNIEnv *env, jobjectArray uuids CACheckJNIException(env); (*env)->DeleteLocalRef(env, jni_cid_scanfilterBuilder); (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); return CA_STATUS_FAILED; } + // get scanfilter.Builder.setManufacturerData method id + jmethodID jni_mid_setManufacturerData = (*env)->GetMethodID(env, jni_cid_scanfilterBuilder, + "setManufacturerData", + "(I[B)Landroid/" + "bluetooth/le/ScanFilter$Builder;"); + if (!jni_mid_setManufacturerData) + { + OIC_LOG(ERROR, TAG, "scanfilter: jni_mid_setManufacturerData is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_cid_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + return CA_STATUS_FAILED; + } // get scanfilter.Builder.build method id jmethodID jni_mid_build_scanfilterBuilder = (*env)->GetMethodID(env, jni_cid_scanfilterBuilder, @@ -1848,6 +1915,9 @@ CAResult_t CALEClientStartScanWithUUIDImplForV21(JNIEnv *env, jobjectArray uuids CACheckJNIException(env); (*env)->DeleteLocalRef(env, jni_cid_scanfilterBuilder); (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); return CA_STATUS_FAILED; } (*env)->DeleteLocalRef(env, jni_cid_scanfilterBuilder); @@ -1859,6 +1929,9 @@ CAResult_t CALEClientStartScanWithUUIDImplForV21(JNIEnv *env, jobjectArray uuids OIC_LOG(ERROR, TAG, "scanSettings: jni_obj_parcelUuid is null"); CACheckJNIException(env); (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); return CA_STATUS_FAILED; } @@ -1872,6 +1945,9 @@ CAResult_t CALEClientStartScanWithUUIDImplForV21(JNIEnv *env, jobjectArray uuids OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_setServiceUuid is null"); CACheckJNIException(env); (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); (*env)->DeleteLocalRef(env, jni_obj_parcelUuid); return CA_STATUS_FAILED; } @@ -1887,10 +1963,152 @@ CAResult_t CALEClientStartScanWithUUIDImplForV21(JNIEnv *env, jobjectArray uuids OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_scanfilter is null"); CACheckJNIException(env); (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); return CA_STATUS_FAILED; } (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder); + OIC_LOG(DEBUG, TAG, "Service UUID scanfilter set"); + + jint jni_int_manId; + jbyteArray jni_byte_manData; + // set manufactererId + jni_int_manId = MANUFACTURE_ID; + + // call utility function to set manufacturerData + jni_byte_manData = CALEGetManufacturerData(env, OIC_GATT_CUSTOM_UUID); + if(!jni_byte_manData) + { + OIC_LOG(ERROR, TAG, "scanSettings: jni_byte_manData is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + return CA_STATUS_FAILED; + } + + // call set(uuid) + jobject jni_obj_setManufacturerData = (*env)->CallObjectMethod(env, + jni_obj_scanfilterBuilder2, + jni_mid_setManufacturerData, + jni_int_manId, + jni_byte_manData); + if (!jni_obj_setManufacturerData) + { + OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_setManufacturerData is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + return CA_STATUS_FAILED; + } + (*env)->DeleteLocalRef(env, jni_byte_manData); + (*env)->DeleteLocalRef(env, jni_obj_setManufacturerData); + + // call build() + jobject jni_obj_scanfilter2 = (*env)->CallObjectMethod(env, + jni_obj_scanfilterBuilder2, + jni_mid_build_scanfilterBuilder); + if (!jni_obj_scanfilter2) + { + OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_scanfilter2 is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + return CA_STATUS_FAILED; + } + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder2); + + OIC_LOG(DEBUG, TAG, "First custom UUID scanfilter set"); + + // call utility function to set manufacturerData + jni_byte_manData = CALEGetManufacturerData(env, OIC_GATT_CUSTOM_UUID2); + if(!jni_byte_manData) + { + OIC_LOG(ERROR, TAG, "scanSettings: jni_byte_manData is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + return CA_STATUS_FAILED; + } + + // call set(uuid) + jni_obj_setManufacturerData = (*env)->CallObjectMethod(env, + jni_obj_scanfilterBuilder3, + jni_mid_setManufacturerData, + jni_int_manId, + jni_byte_manData); + + if (!jni_obj_setManufacturerData) + { + OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_setManufacturerData is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + return CA_STATUS_FAILED; + } + (*env)->DeleteLocalRef(env, jni_byte_manData); + (*env)->DeleteLocalRef(env, jni_obj_setManufacturerData); + + // call build() + jobject jni_obj_scanfilter3 = (*env)->CallObjectMethod(env, + jni_obj_scanfilterBuilder3, + jni_mid_build_scanfilterBuilder); + if (!jni_obj_scanfilter3) + { + OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_scanfilter3 is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + return CA_STATUS_FAILED; + } + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder3); + OIC_LOG(DEBUG, TAG, "Second custom UUID scanfilter set"); + + // call utility function to set manufacturerData + jni_byte_manData = CALEGetManufacturerData(env, OIC_GATT_CUSTOM_UUID3); + if(!jni_byte_manData) + { + OIC_LOG(ERROR, TAG, "scanSettings: jni_byte_manData is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + return CA_STATUS_FAILED; + } + + // call set(uuid) + jni_obj_setManufacturerData = (*env)->CallObjectMethod(env, + jni_obj_scanfilterBuilder4, + jni_mid_setManufacturerData, + jni_int_manId, + jni_byte_manData); + + if (!jni_obj_setManufacturerData) + { + OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_setManufacturerData is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + return CA_STATUS_FAILED; + } + (*env)->DeleteLocalRef(env, jni_byte_manData); + (*env)->DeleteLocalRef(env, jni_obj_setManufacturerData); + + // call build() + jobject jni_obj_scanfilter4 = (*env)->CallObjectMethod(env, + jni_obj_scanfilterBuilder4, + jni_mid_build_scanfilterBuilder); + if (!jni_obj_scanfilter4) + { + OIC_LOG(ERROR, TAG, "scanfilter: jni_obj_scanfilter4 is null"); + CACheckJNIException(env); + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + return CA_STATUS_FAILED; + } + (*env)->DeleteLocalRef(env, jni_obj_scanfilterBuilder4); + OIC_LOG(DEBUG, TAG, "Third custom UUID scanfilter set"); + // get scanSettings.Builder class id jclass jni_cid_scanSettingsBuilder = (*env)->FindClass(env, "android/bluetooth/le/" @@ -2014,6 +2232,46 @@ CAResult_t CALEClientStartScanWithUUIDImplForV21(JNIEnv *env, jobjectArray uuids } (*env)->DeleteLocalRef(env, jni_obj_scanfilter); + jni_bool_arrayListIsAdded = (*env)->CallBooleanMethod(env, jni_obj_filterList, + jni_mid_arrayListAdd, + jni_obj_scanfilter2); + if (!jni_bool_arrayListIsAdded) + { + OIC_LOG(ERROR, TAG, "ArrayList: jni_bool_arrayListIsAdded is null"); + (*env)->DeleteLocalRef(env, jni_obj_filterList); + (*env)->DeleteLocalRef(env, jni_obj_scanfilter2); + (*env)->DeleteLocalRef(env, jni_obj_scanSettingBuilder); + return CA_STATUS_FAILED; + } + (*env)->DeleteLocalRef(env, jni_obj_scanfilter2); + + jni_bool_arrayListIsAdded = (*env)->CallBooleanMethod(env, jni_obj_filterList, + jni_mid_arrayListAdd, + jni_obj_scanfilter3); + if (!jni_bool_arrayListIsAdded) + { + OIC_LOG(ERROR, TAG, "ArrayList: jni_bool_arrayListIsAdded is null"); + (*env)->DeleteLocalRef(env, jni_obj_filterList); + (*env)->DeleteLocalRef(env, jni_obj_scanfilter3); + (*env)->DeleteLocalRef(env, jni_obj_scanSettingBuilder); + return CA_STATUS_FAILED; + } + (*env)->DeleteLocalRef(env, jni_obj_scanfilter3); + + jni_bool_arrayListIsAdded = (*env)->CallBooleanMethod(env, jni_obj_filterList, + jni_mid_arrayListAdd, + jni_obj_scanfilter4); + if (!jni_bool_arrayListIsAdded) + { + OIC_LOG(ERROR, TAG, "ArrayList: jni_bool_arrayListIsAdded is null"); + (*env)->DeleteLocalRef(env, jni_obj_filterList); + (*env)->DeleteLocalRef(env, jni_obj_scanfilter4); + (*env)->DeleteLocalRef(env, jni_obj_scanSettingBuilder); + return CA_STATUS_FAILED; + } + (*env)->DeleteLocalRef(env, jni_obj_scanfilter4); + + OIC_LOG(INFO, TAG, "ScanFilters Added"); // get ScanSettings.SCAN_MODE_BALANCED jint value jint jni_int_scanBalancedMode = CALEGetConstantsValue(env, CLASSPATH_LE_SCANSETTINGS, "SCAN_MODE_BALANCED"); @@ -2045,6 +2303,7 @@ CAResult_t CALEClientStartScanWithUUIDImplForV21(JNIEnv *env, jobjectArray uuids (*env)->DeleteLocalRef(env, jni_obj_scanSettingBuilder); CAResult_t res = CA_STATUS_FAILED; + // get default bt adapter class jclass jni_cid_BTAdapter = (*env)->FindClass(env, CLASSPATH_BT_ADAPTER); if (!jni_cid_BTAdapter) diff --git a/resource/csdk/connectivity/src/bt_le_adapter/android/caleutils.c b/resource/csdk/connectivity/src/bt_le_adapter/android/caleutils.c index 04c5f8b..ca3091b 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/android/caleutils.c +++ b/resource/csdk/connectivity/src/bt_le_adapter/android/caleutils.c @@ -150,6 +150,33 @@ error_exit: return NULL; } +jbyteArray CALEGetManufacturerData(JNIEnv *env, const char* uuid) +{ + VERIFY_NON_NULL_RET(env, TAG, "env is null", NULL); + VERIFY_NON_NULL_RET(uuid, TAG, "uuid is null", NULL); + + jbyteArray jni_byte_Data = (*env)->NewByteArray(env, 2); + uint8_t data_array[2]; + if(uuid[7] == '9') + { + // OIC_GATT_CUSTOM_UUID + data_array[0] = 66, data_array[1] = 9; + } + else if(uuid[7] == '4') + { + // OIC_GATT_CUSTOM_UUID2 + data_array[0] = 66, data_array[1] = 4; + } + else + { + // OIC_GATT_CUSTOM_UUID3 + data_array[0] = 66, data_array[1] = 12; + } + (*env)->SetByteArrayRegion(env, jni_byte_Data, 0, 2, data_array); + return jni_byte_Data; + +} + bool CALEIsBondedDevice(JNIEnv *env, jobject bluetoothDevice) { VERIFY_NON_NULL_RET(env, TAG, "env is null", false); diff --git a/resource/csdk/connectivity/src/bt_le_adapter/android/caleutils.h b/resource/csdk/connectivity/src/bt_le_adapter/android/caleutils.h index fef040f..1a5013a 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/android/caleutils.h +++ b/resource/csdk/connectivity/src/bt_le_adapter/android/caleutils.h @@ -43,6 +43,9 @@ extern "C" /* Service UUID */ static const char OIC_GATT_SERVICE_UUID[] = CA_GATT_SERVICE_UUID; +static const char OIC_GATT_CUSTOM_UUID[] = CA_GATT_CUSTOM_UUID; +static const char OIC_GATT_CUSTOM_UUID2[] = CA_GATT_CUSTOM_UUID2; +static const char OIC_GATT_CUSTOM_UUID3[] = CA_GATT_CUSTOM_UUID3; static const char OIC_GATT_CHARACTERISTIC_REQUEST_UUID[] = CA_GATT_REQUEST_CHRC_UUID; static const char OIC_GATT_CHARACTERISTIC_RESPONSE_UUID[] = CA_GATT_RESPONSE_CHRC_UUID; static const char OIC_GATT_CHARACTERISTIC_CONFIG_UUID[] = "00002902-0000-1000-8000-00805f9b34fb"; @@ -104,6 +107,14 @@ jobject CALEGetParcelUuid(JNIEnv *env, jobject uuid); jobject CALEGetParcelUuidFromString(JNIEnv *env, const char* uuid); /** + * get manufactererData jbyteArray from uuid string value. + * @param[in] env JNI interface pointer. + * @param[in] uuid uuid (const char*). + * @return manufactererData jbyteArray. + */ +jbyteArray CALEGetManufacturerData(JNIEnv *env, const char* uuid); + +/** * get address from a local device. * @param[in] env JNI interface pointer. * @return local address. -- 2.7.4