| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
DIRECTBT_CHARACTERISTIC_VALUE_CACHE_NOTIFICATION_COMPAT
GATTCharacteristic (Java/C++): Add enableNotificationOrIndication(..) and use it as default for BLE active addCharacteristicListener(..).
It is recommended to utilize notification over indication, as its link-layer handshake
and higher potential bandwidth may deliver material higher performance.
+++
Add setting BluetoothFactory.DIRECTBT_CHARACTERISTIC_VALUE_CACHE_NOTIFICATION_COMPAT
(and also document DEBUG and VERBOSE).
DIRECTBT_CHARACTERISTIC_VALUE_CACHE_NOTIFICATION_COMPAT
Have direct_bt provide compatibility to TinyB's BluetoothGattCharacteristic
API: BluetoothGattCharacteristic#getValue() value cache and
BluetoothGattCharacteristic#enableValueNotifications(BluetoothNotification) value notification.
DBTGattCharacteristic benefits from _disabled_ compatibility (and DEBUG)
performance wise, as no listener nor cache needs to be added in this case!
|
|
|
|
| |
deleted native instance @ disable
|
|
|
|
| |
clear valueNotificationCB
|
|
|
|
| |
configNotificationIndication(..)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Aligned all related C++ and Java API doc entries and made sure it matches implementation.
- Renaming SpecificGATTCharacteristicListener to AssociatedGATTCharacteristicListener,
as we refer to the associate GATTCharacteristic of a GATTCharacteristicListener
AssociatedGATTCharacteristicListener is a specialization knowing its
associated GATTCharacteristic to be used for match().
- Renamed 'configIndicationNotification(..)' to 'configNotificationIndication(..)',
matching order of arguments and the returned enabledState array.
- Exposed 'configNotificationIndication(..)' incl enabledState array to Java
- Clarified the 'add listener' and 'configNotificationIndication(..)' semantic in API doc
and implementation. Added new API entries to distinguish them.
- DBTGattCharacteristic.java skips adding its 'TinyB API compatibility' GATTCharacteristicListener
in case neither notify nor indicate property exist.
Also skip the native configNotificationIndication(..) in such case.
This reduces the overall listener load to GattHandler by factor 5!
- General: Add new method 'removeAllAssociatedCharacteristicListener(GATTCharacteristic)',
allowing removal of all GATTCharacteristic associated listener.
This is usefull to complete the GATTCharacteristic C++ dtor or Java close() operation.
- DBTDevice: Add GATTCharacteristicListener methods to align with Java API
and allow user not to deal with GATTHandler directly.
Convenience and validates the C++/Java API alignement.
- C++ JNICriticalArray: Added 2nd template typename for the java-array-type,
enabling it for other than jbyteArray. Here used for a jbooleanArray.
- The GATTCharacteristicListener Java to C++ native holding specialization JNICharacteristicListener
keeps a new global reference to the Java GATTCharacteristicListener
and the optional associated GATTCharacteristic.
This ensures the instances won't get garbage collected and hence ensures proper
object lifecycle even when passing 'throw away' listener object created just
for the add*Listener call.
- Removal and hence destruction of the listeners is always guaranteed at:
-- Device / GATTHandler disconnect
-- GattCharacteristic dtor or close
|
|
|
|
|
|
|
| |
accessing BluetoothFactory
BluetoothFactory static init will set its VERBOSE and DEBUG field as read from properties,
hence we need to postpone its access.
|
|
|
|
|
|
|
|
|
|
|
| |
disable it (self disable)
The temp discovery enabling kick-off simply ensures that discovery allows new devices to be found,
no need to disable it @ pingGATT.
Further startDiscovery commands will be ignored if in process,
may only change the keepAlive state.
This reduces the overall workload.
|
|
|
|
| |
its existence if adapter.isValid()
|
| |
|
|
|
|
|
|
|
|
|
| |
native dtor (deleteImpl) cleans up.
Shortcut of 'close' take-down @ JVM shutdown, avoiding any potential deadlocks.
However, all device's and adapter's deleteImpl() gets issued,
allowing the native adapter's destructor to be called for orderly device cleanup.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'keepDiscoveringAlive' even if still in discovery
Hence adding locking mtx_discovery in mgmtEvDeviceDiscoveringMgmt due to multiple state changes
and updating keepDiscoveringAlive even if not initiating discovery (still running).
Further all calls to startDiscovery(..) (C++ and Java) shall clear the list of discovered devices
to end up in the same state, regardless of an alread running discovery or not.
Note: We might have to observe this behavior in more detail, but as we usually utilize the
status listener model, this list is of less interest.
The Java implementation simply always calls down to native code,
ensuring same 'keepAlive' behavior.
It hence also always clears the list of discovered devices.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
directly (e.g. whitelisted devices)
HCIConnection:
- Clarify identity using address _and_ addressType
- Make members private for immutable access only, except handle.
HCIHandler:
- Track all incoming connections, i.e. events.
Earlier we initiated tracking only via user connect calls,
now we allow any incoming connection being tracked (e.g. whitelisted devices).
- Correctly identify devices with address _and_ addressType
- or - the connection handle using HCIConnection etc.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
lifecycle)
Since HCIHandler is being used to track all connections (direct or whitelisted),
it is essential to have it running over the whole adapter lifecycle.
openHCI() is now being performed within validateDevInfo(),
hence also sets adapter's valid state.
Call newly added checkValid() in user API on most 'action' methods,
throws exception if adapter is in invalid state.
|
|
|
|
|
|
|
|
|
| |
connect must be performed (not a performance issue)
Our earlier code used the manager's implicit whitelist feature to connect.
The earlier performance lag was due to slow scanning parameter,
not the fact that no connection has been made.
|
|
|
|
| |
connection status in connectGATT(..)
|
| |
|
|
|
|
| |
new HCIHandler
|
|
|
|
| |
Add uuid for non-native-valid instance's impl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
services; Add findGATTService(..)
Note: We might want to add more find(..) functionality, similar to the TinyB Java API.
|
|
|
|
| |
changed within a running implementation...
|
|
|
|
| |
getBluetoothManager(..) using fq BluetoothManager implementation class name
|
| |
|
|
|
|
| |
native libs commonly exposed in Java via BluetoothUtils.cxx JNI
|
| |
|
|
|
|
| |
remark: .. debug facility
|
|
|
|
|
| |
Concluding commit 22e3abf3661d7de42b3e6c738d8167718e3ca218,
having all DBTDevice lookups (find) in DBTAdapter using the BDAddressType as well.
|
|
|
|
|
|
|
| |
BDAddressType
The BDAddressType is the magic 49th bit of the EUI48 address,
as it specifies the semantics of its 2-high bits.
|
|
|
|
|
|
|
|
|
|
| |
BLERandomAddressType related to the BDAddressType.
We validated the BLERandomAddressType in DBTDevice.java,
but created an invalid value in DBTDevice.cpp regardless of BDAddressType.
Resolved!
We also perform the validate in DBTDevice.cpp now.
|
|
|
|
| |
See commit 6f67d72923b31dd5db32227a0a8f46c11bc9a9f3
|
|
|
|
| |
statusListener (remove @ takedown)
|
| |
|
|
|
|
|
|
|
|
|
| |
exchange (MTU)
Certain devices might require more time for their first GATT response,
which usually shall lie within 500ms.
This patch tolerates 1500ms.
|
| |
|
|
|
|
| |
userspace daemon
|
|
|
|
| |
Original commit by Xerxes Rånby <[email protected]>
|
|
|
|
| |
and procedured WIP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RANDOM; L2CAPComm uses device->getAddressType()
Map BLERandomAddressType::STATIC_PUBLIC -> HCILEPeerAddressType::RANDOM
This only works for a static random address not changing at all,
i.e. between power-cycles - hence a temporary hack.
We need to use 'resolving list' and/or LE Set Privacy Mode (HCI) for all devices.
+++
L2CAPComm uses device->getAddressType(), i.e. no need for a (wrong) public argument flag.
|
|
|
|
| |
HCILEPeerAddressType/HCILEOwnAddressType String representation + API doc
|
|
|
|
|
| |
# Conflicts:
# api/direct_bt/linux_kernel_types.hpp
|
|
|
|
| |
changed DBTDevice.java ctor, added getBLERandomAddressType()
|
|
|
|
|
| |
DefaultAdapterIndex is user given via property 'org.tinyb.default_adapter',
hence a range check is appropriate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
HCIAddressType..., Move EUI48 into direct_bt namespace
Add BLERandomAddressType
Exposed in DBTDevice and BluetoothDevice C++ and Java.
See "BT Core Spec v5.2: Vol 6 LE, Part B Link Layer Specification: 1.3.2 Random device Address"
+++
Distinguish HCIAddressType -> HCILEPeerAddressType + HCILEOwnAddressType
As used for HCIHandler::le_create_conn(..)
See "BT Core Spec v5.2: Vol 4, Part E Host Controller Interface (HCI) Functionality: 7.8.12: LE Create Connection command"
DBTDevice::connectLE(..) translates its own BDAddressType -> HCILEPeerAddressType
using BLERandomAddressType (BDAddressType, address).
Currently only HCILEPeerAddressType::STATIC_PUBLIC is allowed
and passed through.
+++
Move EUI48 into direct_bt namespace
|
|
|
|
|
|
| |
Used 32bit machine: Raspbian 10.4 'buster', armv7l (armhf), g++ 8.3.0, OpenJDK 11.0.7
Note that main development occurs on GNU/Linux Debian 11 'bullseye', amd64, g++ 9.3.0, OpenJDK 11.0.7
|
|
|
|
| |
optionally seeding defaultAdapterIndex other than 0
|
| |
|
|
|
|
|
|
|
|
|
| |
(drop final qualifier, add volatile)
On rare occasions (?) it may happen that the device discovery didn't include the device's name
when reported via deviceFound(..) callback etc.
Therefor allow updating of the name, using the C++ DBTDevice::getName().
|
|
|
|
| |
'take down' and ensure valueNotificationCB ref is nulled
|
|
|
|
| |
address and perform nullptr checks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
being called back from deleteNativeJavaObject(..)
Regression introduced with commit 83e0c7f75b4206701c1b9c62ebd4282f50f92a31
DBTNativeDownlink.delete() calls DBTNativeDownlink.deleteNativeJavaObject(..),
which by itself now calls back using DBTNativeDownlink.notifyDeleted() and purges isValid and nativeInstance.
Therefor, DBTNativeDownlink.delete() needs to cache the nativeInstance reference and pass it
down to DBTNativeDownlink.deleteImpl(long) as argument.
Further refine synchronization, using a local Object and isValid being an AtomicBoolean
to allow isValid() return the current state.
|