diff options
author | Sven Gothel <[email protected]> | 2020-04-25 20:37:17 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-04-25 20:37:17 +0200 |
commit | 3460be939b76ef3a1895e27afe2dcfa53ff21b3f (patch) | |
tree | 5d7e48c78788413eebf781bf65564c354a5af0f6 /java | |
parent | cd0fbb59946a0d9ca0fd0bf1fc27228bc3d90f91 (diff) |
Use Kernel BlueZ Manager for Discovery, Connect, etc. (Initial Commit - Java 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
Diffstat (limited to 'java')
-rw-r--r-- | java/jni/direct_bt/DBTManager.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/java/jni/direct_bt/DBTManager.cxx b/java/jni/direct_bt/DBTManager.cxx index 8c7182c5..4d4864a4 100644 --- a/java/jni/direct_bt/DBTManager.cxx +++ b/java/jni/direct_bt/DBTManager.cxx @@ -39,7 +39,7 @@ using namespace direct_bt; void Java_direct_1bt_tinyb_DBTManager_initImpl(JNIEnv *env, jobject obj) { try { - DBTManager *manager = &DBTManager::get(); // special: static singleton + DBTManager *manager = &DBTManager::get(BTMode::BT_MODE_LE); // special: static singleton setInstance<DBTManager>(env, obj, manager); if( java_exception_check(env, E_FILE_LINE) ) { return; } manager->setJavaObject( std::shared_ptr<JavaAnonObj>( new JavaGlobalObj(obj) ) ); |