diff options
author | Sven Gothel <[email protected]> | 2020-07-17 06:37:09 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-07-17 06:37:09 +0200 |
commit | 01f42a0665a86558c5c7029ea1cf853a3c95f6c1 (patch) | |
tree | 6981d05d3d72593c83837248a04e6aeebdf0a975 /java/tinyb/dbus/DBusGattCharacteristic.java | |
parent | 3b877bc716d431bbe432d08978e915ecc8016c21 (diff) |
Direct-BT Java: Implement find(..) in manager, adapter, device, service and characteristic
In contrast to the dbus implementation, where all find(..) is being funnelled through
manager's native find(..) vehicle, direct-bt goes the opposite direction
reusing the existing cached data within the objects.
Manager, adapter, device, service and characteristic object implement findInCache(..),
which compares the uuid and/or name *case-sensitive* of its direct childs (if approriate)
and traverses through its children's findInCache(..) if required.
Note to *case-sensitive* comparison:
- EUI48 (mac) address string use capital hex-letters
- UUID uses lower-case hex-letters
Since service and characteristic object already stores its UUID no extra caching is required here.
For device, an extra WeakReference cache of the services has been added when retrieved via getServices().
This cache is used for device's findInCache(..).
service and characteristic always check whether their WeakReference uplink is still valid,
i.e. no resources pulled (GC'ed) - as well as whether device's cached services exist.
This detail is implemented via each object's 'checkServiceCache()'.
device's 'checkServiceCache(true)' also will retrieve the services if not done yet
within 'findInCache(..)'.
This also ensures services has been retrieved for manager and adapter traversing through device
via 'findInCache(..)'.
Notable, manager's generic find(..) method is *not* implemented:
Due to generic type erasure, we cannot determine the matching BluetoothType for the return parameter,
hence this orig TinyB API method is rather misleading than useful.
Diffstat (limited to 'java/tinyb/dbus/DBusGattCharacteristic.java')
0 files changed, 0 insertions, 0 deletions