summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-05-15 12:09:59 +0200
committerSven Gothel <[email protected]>2020-05-15 12:09:59 +0200
commitb12a3e3adf8159a0c252cee67beae35e1b5b879f (patch)
treeb8fc2970fed0b23179dfe6bc5607204787236eae /java
parent768169322ff9652cbb9b080a8049fe2db10a8adc (diff)
GATT Cleanup of method + field names; GATT discoverDescriptors: Use more reasonable and efficient traversal...
GATT Cleanup of method + field names - the service and characteristic uuid's specify types, hence name field *type* being of value-type uuid_t. - use short and clear names like 'Characteristic' and simply 'Descriptor' for 'Characteristic Descriptor'. - etc etc GATT discoverDescriptors: Use more reasonable and efficient traversal through Charactecteristics - Previous we traversed through all handle of services for Descriptors, only to find the matching Charactecteristic to attach to. The latter was done via another loop through all Charactecteristic and hence even reduced performance by one magnitude. Further, not all handles reflect Descriptors ;-) - Simply iterate through all Charactecteristic and find their Descriptors within their value handle range as per BT spec. Also read the Descriptor value right away.
Diffstat (limited to 'java')
-rw-r--r--java/jni/direct_bt/DBTDevice.cxx2
-rw-r--r--java/jni/direct_bt/DBTGattService.cxx4
2 files changed, 3 insertions, 3 deletions
diff --git a/java/jni/direct_bt/DBTDevice.cxx b/java/jni/direct_bt/DBTDevice.cxx
index c9a60258..9d5d9e1f 100644
--- a/java/jni/direct_bt/DBTDevice.cxx
+++ b/java/jni/direct_bt/DBTDevice.cxx
@@ -176,7 +176,7 @@ jobject Java_direct_1bt_tinyb_DBTDevice_getServices(JNIEnv *env, jobject obj) {
JavaGlobalObj::check(service->device->getJavaObject(), E_FILE_LINE);
jobject jdevice = JavaGlobalObj::GetObject(service->device->getJavaObject());
const jboolean isPrimary = service->isPrimary;
- const jstring uuid = from_string_to_jstring(env, service->declaration.uuid->toString());
+ const jstring uuid = from_string_to_jstring(env, service->type->toString());
if( java_exception_check(env, E_FILE_LINE) ) { return nullptr; }
jobject jservice = env->NewObject(clazz, clazz_ctor, (jlong)service, jdevice, isPrimary, uuid);
diff --git a/java/jni/direct_bt/DBTGattService.cxx b/java/jni/direct_bt/DBTGattService.cxx
index 0e893031..3361a44c 100644
--- a/java/jni/direct_bt/DBTGattService.cxx
+++ b/java/jni/direct_bt/DBTGattService.cxx
@@ -55,7 +55,7 @@ jobject Java_direct_1bt_tinyb_DBTGattService_getCharacteristics(JNIEnv *env, job
GATTService *service = getInstance<GATTService>(env, obj);
JavaGlobalObj::check(service->getJavaObject(), E_FILE_LINE);
- std::vector<std::shared_ptr<GATTCharacteristic>> & characteristics = service->characteristicDeclList;
+ std::vector<std::shared_ptr<GATTCharacteristic>> & characteristics = service->characteristicList;
// DBTGattCharacteristic(final long nativeInstance, final BluetoothGattService service, final String[] properties, final String uuid)
@@ -78,7 +78,7 @@ jobject Java_direct_1bt_tinyb_DBTGattService_getCharacteristics(JNIEnv *env, job
}
if( java_exception_check(env, E_FILE_LINE) ) { return nullptr; }
- const jstring uuid = from_string_to_jstring(env, characteristic->uuid->toString());
+ const jstring uuid = from_string_to_jstring(env, characteristic->value_type->toString());
if( java_exception_check(env, E_FILE_LINE) ) { return nullptr; }
jobject jchar = env->NewObject(clazz, clazz_ctor, (jlong)characteristic, jservice, jproperties, uuid);