summaryrefslogtreecommitdiffstats
path: root/java/jau/direct_bt/DBTDevice.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-11-08 01:45:59 +0100
committerSven Gothel <[email protected]>2021-11-08 01:45:59 +0100
commit297fbcf0376522cd38ce919aa324e28cf7f5dcc2 (patch)
treee0f61e6a36ac4ab285155f2a362e8ca06df37da1 /java/jau/direct_bt/DBTDevice.java
parenta669ab16d8408ce0b309061df079faeb83d8b2c1 (diff)
Add BTDevice::findGattChar(char_uuid), i.e. w/o service_uuid (Java/C++): Less efficient, but might be desired by user
Diffstat (limited to 'java/jau/direct_bt/DBTDevice.java')
-rw-r--r--java/jau/direct_bt/DBTDevice.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/java/jau/direct_bt/DBTDevice.java b/java/jau/direct_bt/DBTDevice.java
index c4241cce..4bf191f7 100644
--- a/java/jau/direct_bt/DBTDevice.java
+++ b/java/jau/direct_bt/DBTDevice.java
@@ -213,6 +213,27 @@ public class DBTDevice extends DBTObject implements BTDevice
return s.findGattChar(char_uuid);
}
+ @Override
+ public BTGattChar findGattChar(final String char_uuid) {
+ synchronized(serviceCache) {
+ if( !checkServiceCache(true) ) {
+ return null;
+ }
+ for(int srvIdx = serviceCache.size() - 1; srvIdx >= 0; srvIdx-- ) {
+ final DBTGattService s = serviceCache.get(srvIdx).get();
+ if( null == s ) {
+ serviceCache.remove(srvIdx); // remove dead ref
+ continue; // cont w/ next service
+ }
+ final BTGattChar c = s.findGattChar(char_uuid);
+ if( null != c ) {
+ return c;
+ }
+ }
+ return null;
+ }
+ }
+
/* internal */
private native void initImpl();