aboutsummaryrefslogtreecommitdiffstats
path: root/java/jni/direct_bt/DBTGattService.cxx
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/jni/direct_bt/DBTGattService.cxx
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/jni/direct_bt/DBTGattService.cxx')
-rw-r--r--java/jni/direct_bt/DBTGattService.cxx4
1 files changed, 2 insertions, 2 deletions
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);