| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- BasicTypes: Align exception names w/ Java.
- BTTypes / EInfoReport: Add getDeviceIDModalias()
- DBTManager: Add getConnectionInfo(..) and setLocalName(..)
- OctetTypes: Fix put_octets(..), removed sizeof(). Adding put/get string methods
+++
DBTTypes:
- Fix Comments
- DBTDevice: Add appearance, getConnectionInfo(), connectGATT(..) and disconnectGATT().
Last two GATT's ease association of GATTHandler w/ device for tinyb binding.
- DBTDevice: Fix defaultConnect(): Differenciate le public/random
- DBTDevice: New getConnectionInfo() - also may issue deviceUpdate callback on rssi/tx_power changes
- DBTAdapter: Add missing DBTAdapterStatusListener list declaration of previous commit.
- DBTAdapter: Add misc information access for tinyb binding.
+++
Java
- DBTAdapter: Adding more tinyb implementation code, sorting methods - ~90% complete
- DBTDevice: Adding more tinyb implementation code, sorting methods - ~70% complete
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bit field mask: Add AdapterSettings , fix EIRDataType -> EIRDataTypeSet
Extend Java BluetoothDeviceStatusListener -> BluetoothAdapterStatusListener and
C++ DBTDeviceStatusListener -> DBTAdapterStatusListener
- BluetoothAdapterStatusListener shall be (ab)used for anything adapter event related,
user may utilize it (optional)
- Added callback method adapterSettingsChanged(..)
in DBTAdapterStatusListener
- An internal listener further produces more detailed callbacks, used on the Java side.
+++
Java enum bit field mask: Add AdapterSettings , fix EIRDataType -> EIRDataTypeSet
- In Java, we cannot have an indivudual enum instance (like in C++) ;-)
- Hence 'enum EIRDataType' -> EIRDataTypeSet.DataType
and having the 'bit mask' implemented in EIRDataTypeSet.
- Adding similar AdapterSettings bit field, utilized in DBTAdapter's
internal BluetoothAdapterStatusListener to produce fine grained callbacks.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
(non-class-member) support
To support on-the-fly lambda non-member functions for callbacks,
we need to bind to same non-member plain functions.
Hence rename ClassFunction -> FunctionDef and add PlainInvocationFunc for this purpose.
Tested via C++ unit test test_basictypes01.cpp
|
|
|
|
|
|
|
|
| |
deleteImpl(): Calls close().
DBTManager::close(): Clear adapterInfos (avoiding re-entry failure), make it functional.
Java deleteImpl(): Calls close(), avoiding same on JVM shutdown.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
for MgmtEvent adapter filtering
Registering a MgmtEventCallback for a specified adapter shall only deliver events circulating for same adapter.
Intermediate MgmtAdapterEventCallback struct associated the adapter dev_id to the MgmtEventCallback,
used to build the MgmtAdapterEventCallbackList.
addMgmtEventCallback(..) passes the desired adapter dev_id, -1 to listen to all adapter events.
Implementation only adds the callback if not yet present, i.e. key = dev_id + opcode + callback.
New 'removeMgmtEventCallback(const int dev_id)' allows removal of all callbacks registered for specified dev_id,
which helps reducing user code when deregistering.
|
|
|
|
|
| |
getAdapterListImpl() JNI code utilizes new convert_vector_to_jobject(..)
with given ctor function defined ad-hoc via lambda.
|
|
|
|
|
|
|
|
|
|
|
|
| |
timeout
Further restructure GATTHandler's send/receiveNext in one call 'sendWithReply(..)', similar to DBTManager.
From here on we are able to detect loss of connected device via read timeout
and send error - within timeout period (default 3s).
The breakup closes resources properly (instead of exception)
and a new gatt connection can be established thereafter.
|
|
|
|
| |
timeoutMS field
|
|
|
|
|
|
|
|
|
|
|
| |
disconnect on l2cap- or send error
Unique SIGINT handler in DBTManager
GATTHandler needs to disconnect l2cap connection to reach clean state
if we have an invalid l2cap state (already closed) or a send error occured.
TODO: Ringbuffer timout handling.
|
|
|
|
|
| |
It has been recognized that our disconnect command will not result in a MgmtEvtDeviceDisconnected
received from the BlueZ Kernel. Hence sending it out ourselves to listening clients.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
AdapterInfo's settings of type MgmtSetting (align semantics and parse)
AdapterInfo will be updated via MgmtEvtLocalNameChanged and MgmtEvtNewSettings,
hence respective fields are mutable.
AdapterInfo's settings are now of type MgmtSetting (align semantics and parse).
DBTManager's use of AdapterInfo shared_ptr is mutable now, removed 'const'.
|
|
|
|
| |
MgmtEvtNewConnectionParam, MgmtEvtLocalNameChanged
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
indices.
Testing w/ two BT adapters showed a reverse order READ_INFO result.
Here we enforce using dev_id as index for our AdapterInfo vector
and testing bounds.
Out new scanning using the manager channel also results in working w/ more adapter,
i.e. the adapter 'BLUE LogiLink V4.0 USB Dongle worked:
Adapter[00:1A:7D:DA:71:08, 'CSR8510 A10', ..].
However, another USB motherboard dongle didn't work and even interfered,
so I had to 'rfkill block' it. The non-working wasn't able to discover LE devices.
|
|
|
|
|
|
|
|
|
|
|
|
| |
DEVICE_WHITELIST_*
MgmtTypes add: MgmtPinCodeReplyCmd, MgmtPinCodeNegativeReplyCmd,
MgmtEvtPinCodeRequest,
DBTManager add MgmtEvtPinCodeRequest callback, remove warnings.
Clarify DEVICE_ADDED/REMOVED -> DEVICE_WHITELIST_*
MgmtEvtDeviceWhitelistAdded, MgmtEvtDeviceWhitelistRemoved
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
discovery; Remove discovery thread (1)
DBTAdapter: Keep alive discovery
DBTDeviceStatusListener (incl Java binding:
- DBTDeviceDiscoveryListener -> DBTDeviceStatusListener to cover more functionality
- Rename deviceAdded -> deviceFound, to match BlueZ event naming
- Rename deviceRemoved -> deviceDisconnected
- Add deviceConnected
HCIComm/DBTAdapter: Use HCIAddressType where applicable for clarity
MgmtEvent: Add timestamp
MgmtEvent: Add MgmtEvtDeviceConnectFailed, MgmtEvtDeviceAdded, MgmtEvtDeviceRemoved, MgmtEvtDeviceUnpaired
+++
DBTAdapter.java remove discovery thread (part 1)
- Use events, no more discovery polling required
- TODO: Same for native DBTAdapter.cpp!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
part probably broken)
We have experienced the following using the official HCI communication channel:
- Lower connect performance with discovery enabled
- Instability with enabled discovery and breaking general BT adapter state
requiring a 'hciconfig hci0 reset'
- Lack of notifications: start/stop discovery/connect/...
- Lack of certain settings in general: pin, ..
This commit implements discovery including listening to all BlueZ kernel events
from the BlueZ Manager channel using DBTManager.
TODO: Figure out how to enforce quick connect!
- EInfoReport (EIR) added: FLAGS, DEVICE_CLASS, APPEARANCE, HASH, RANDOMIZER and DEVICE_ID
- including parsing new segments in read_data(..) and dataSetToString(..) exposure
- DBTManager adds:
- manager-reader thread, putting all command status/completes to its ringbuffer
and sending out all other events to its listener.
- Respecting the chosen BTMode (side-effect to discovery etc)
- add: start/stop discovery
- add: connect/disconnect (incomplete)
- DBTAdapter:
- discoverDevices -> discoverDevicesMgmt is becoming redundant,
now simply waiting for the DeviceFound event.
Will be deleted - TODO!
- mgmtEvDeviceFoundCB shall perform remaining EIR parsing
and enqueing the devices plus issuing respective discovery callbacks!
TODO.
- DBTDevice adds:
- BDAddressType
- HCISession's HCIComm is now no more used (to be deleted!)
- HCIComm adds generic read/write methods, mutex free.
- Remaining HCI 'managment' methods are also subject to deletion!
- GATTHandler / DBTManager: only use a mtx_write for communication,
as reading is performed on their respective threads using a ringbuffer.
Here only concurrent write access needs to be managed.
(DBTManager uses its own HCIComm's mutex.)
- MgmtTypes adds:
- BTMode for dual, BREDR or LE only.
- MgmtRequest -> MgmtCommand
- Unifies the command opcodes to global 'MgmtOpcode',
removing duplicate MgmtCommand::Opcode (which was also incomplete)
- Adding MgmtDisconnectCmd, MgmtEvtDiscovering, MgmtEvtDeviceFound
MgmtEvtDeviceConnected, MgmtEvtDeviceDisconnected
- TOctets adding get_int8(..) and get_eui48(..)
- TOctets adding put_eui48(..)
++++++++++++++
New ClassFunction: Introducing versatile C++ function-method type
used for our DBTManager callbacks.
In contrast to std::function and std::bind, ClassFunction allows
using its specific type (return- and argument types)
and offering the equality operation to test its identity.
The latter is essential to remove a callback ClassFunction
from a list of callbacks.
+++++++++++++++++
Further code cleanup is also included
- Address_T -> BDAddressType(incl string presentation) + HCIAddressType
- ManufactureSpecificData using POctets
- Convenient default param: uint*HexString(.., const bool leading0X=true);
- MgmtTypes's get/put for events and commands use MGMT_HEADER_SIZE offset
- MgmtTypes: Remove doubled 'btohs', as the pdu.get* commands
already perform endian conversion.
- EInfoReport::read_data(..) validate segment size before type conversion
|
|
DBTManager, revert DBTSession -> HCISession
HCIComm thread safety
With the java DBTAdapter, we have introduces multithreading access
to the HCIComm instance: start/stop etc + discovery-thread.
We have experienced a deadlock issuing stopDiscovery()
while the discovery-thread is in progress.
HCIComm and its dd is now locked using a recursive mutex,
which is also being exposed to HCISession allowing
DBTAdapter's discovery to use it as well.
+++
Renaming: MgmtHandler -> DBTManager, revert DBTSession -> HCISession
HCISession is not a major DBT (direct-bt) (java) instance
and actually describing the HCI(Comm) session.
DBTManager is a major DBT java instance, mapped.
Hence also splitting MgmtComm.* -> MgmtTypes.* + DBTManager.*
|