| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
L2CAP_READER_POLL_TIMEOUT) and new L2CAP_RESTART_COUNT_ON_ERROR for testing
L2CAPHandler's read/write will also issue verbose error-out messages in case the instance is still connected,
i.e. not intentionally pulled by another thread.
This is work in progress.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
AdapterStatusListener shall receive adapterSettingsChanged(..) for initial AdapterSettings
Conclude POWERED state change across C++/Java
- DBTAdapter.java must be notified to have isDiscovering and discoveredDevices cleared on !POWERED.
It will additionally react to !POWERED state change, by clearing the mentioned states for robustness.
- DBTAdapter.cpp's stopDiscovery() shall send MgmtEvtDiscovering (-> AdapterStatusListener.discoveryChanged(..))
itself in case of le_enable_scan != SUCCESS, otherwise
- DBTAdapter.cpp's poweredOff():
-- Shall not clearAllMgmtEventCallbacks() on HCI before stopDiscovery() and disconnectAllDevices(),
otherwise stopDiscovery events won't be received and forwarded to AdapterStatusListener.
hci->close() will deal with it afterwards.
It is up to the user (application) to react to POWERED (power on) state change,
i.e. restart discovery!
+++
Newly added AdapterStatusListener shall receive adapterSettingsChanged(..) for initial AdapterSettings.
This is required to have e.g. the DBTAdapter.java instance be aware of its initial state, e.g. isPowered etc.
|
|
|
|
|
|
|
|
|
|
|
| |
PairingModes (C++, Java)
For now, DBTDevice has a NOP implementation, i.e. returning zero length vectors (or arrays in Java)
for supported and required PairingMode.
The pair(String passkey) simply returns HCIStatusCode::INTERNAL_FAILURE;
Intention is to validate the new API entry with our application.
|
|
|
|
|
|
|
|
| |
documentation, leave it out for now.
We may add a developer api doc later on.
Also mention HCIHandler correctly in DBTAdapter and DBTDevice, where it is being used.
|
|
|
|
| |
limitations of cgit's md2html
|
|
|
|
| |
setting (and expose in debug message)
|
|
|
|
|
|
| |
exception, similar to send(..); Remove nullptr == reply in caller.
Add appropriate detailed API doc for GATTHandler::send() and GATTHandler::sendWithReply().
|
|
|
|
| |
and process aborted; Use it.
|
|
|
|
|
|
|
|
|
| |
supported now, see POctets::POctets()
As commit ac2cf3d62bb405b2a25ad5f674925e11b08c6b5e explicitly allows zero POctets via its default ctor,
freeData shall tolerate it, simply doing nothing.
Renamed POctets::malloc(..) to POctets::allocData(..), to match freeData() method and hence pairing intention.
|
|
|
|
|
|
|
|
|
| |
time, rename to toShortString()
The SIGSEGV back then happened due to abusive non-weak backreference back to device,
which already got destroyed at some point.
Since this has been resolved, we rename the method to 'toShortString()' and remove the elaborated comment.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
DUAL in Java)
All global BTMode defaults to LE (only)
- C++ DBTManager: Add MgmtEnv::DEFAULT_BTMODE, env-var 'direct_bt.mgmt.btmode' first, then try 'org.tinyb.btmode'.
- DBTEnv:getProperty(name): Add COND_PRINT(debug,..) for no default value root method as well.
|
|
|
|
|
|
|
|
|
|
|
|
| |
it where applicable
As POctets with explicit given size==0 is now considered an illegal argument,
avoiding wrongdoing or invalid data by accident,
we offer the default ctor to initialize an intentional zero sized instance.
This is used for GATTDescriptor ctor and ManufactureSpecificData ctor.
The caller for the latter will explicitly check whether the EIR data has actual specific data left
in its received EIR data chunk.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
skipped >= GATTService); GATTHandler owned by DBTDevice, always.
GATTService and childs might need access to their GATTHandler, not just DBTDevice.
This relationship always existed, but was skipped.
Also emphasize that GATTHandler is always owned by DBTDevice, hence has a weak back-reference to the same.
Fixed in ATTPDUTypes C++ Direct-BT API doc overview.
Further impact:
- GATTService has a weak back-reference to GATTHandler instead of DBTDevice,
DBTDevice reference will then be picked up from GATTHandler, the usual.
- GATTHandler::discoverPrimaryServices(..), discoverCompletePrimaryServices(..)
needs to receive GATTHandler's shared_ptr from owner and caller to build the back-reference in GATTService
|
|
|
|
|
|
| |
preservice __FILE__, __LINE__ and use macro calling it
This change will preserve the caller __FILE__, __LINE__ information to please error analysis.
|
|
|
|
|
|
|
|
|
|
|
| |
failure, also throw IllegalArgumentException on size <= 0
- Add exception type 'direct_bt::OutOfMemoryError' and wire it in helper_base for C++/JNI interoperability.
- std::malloc may not return nullptr on zero size, but a valid dummy pointer usable by free.
Hence check for malloc(0) and throw IllegalArgumentException
- also throw OutOfMemoryError on nullptr == malloc(size)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(pre-checked)
- *Octets: Add put_*_nc(..) noexcept variants and use it where range has been pre-checked
- ATTPDU: Use noexcept variant for prechecked value range.
- DBTManager/HCIHandler: Use noexcept variant for prechecked value range.
+++
TODO: Bug 4 - *Octets get_[w]ptr(..) methods shall be given a value range for security (exception)
(https://jausoft.com/bugzilla/show_bug.cgi?id=4>
*Octets get_[w]ptr(..) methos with exception should check the intended used range!
Either the range has been pre-checked, then user shall use the noexcept '_nc' variant,
otherwise the intended range shall be checked within the call for safety!
Note: Both variants shall have the range given for compatible signature,
as well as to force the user to determine the range
and then decide whether noexcept applies.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
IRQ_PRINT(.. "Interrupted" ), to clarify class of event.
An interruption might not be an error, but expected behavior - e.g. if a device is powered off.
Use IRQ_ERROR in GattHandler on:
- l2cap write error -> disconnect + exception
- l2cap nullptr reply (sendWithReply) -> disconnect + exception
- l2cap read error (l2capReaderThread) -> disconnect
We might find other occassions where this informal output fits.
|
|
|
|
|
| |
We will include this header file in helper_base.hpp
to accomodate both implementation within rethrow_and_raise_java_exception(..)
|
|
|
|
| |
DBTDevice::getGATTServices()'
|
|
|
|
| |
'noexcept'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
uncond INFO_PRINT(..)
Turns out INFO_PRINT(..) is confusing, as it was not clear that it is conditional on DBTEnv::VERBOSE.
Hence rename it to the short English from for Latin 'verbosus',
and hence hinting it is conditional on DBTEnv::VERBOSE.
INFO_PRINT(..) renamed to WORDY_PRINT(..), using prefix 'Wordy:' (Verbose is just too long)
Add unconditional INFO_PRINT(..) for plain informal messages.
Hope this clears up the confusion.
Hint: I was looking for an INFO_PRINT(..) ouput myself ;-)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
w/ one thread per device
Testing w/ 2 devices in fastest rapid reconnect (using automatic disconnect) on Raspberry-Pi:
(1) Native run-dbt_scanner10.sh -silent_gatt -mac C0:26:DA:01:DA:B1 -mac C0:26:DF:01:E5:CA -disconnect -count 12
(2) Java run-java-scanner10.sh -silent_gatt -mac C0:26:DA:01:DA:B1 -mac C0:26:DF:01:E5:CA -disconnect -count 12
The Java (2) test case disclosed a race condition as follows:
"An application using one thread per device and rapid connect, should either use disconnect() or remove(),
but never issue remove() after disconnect(). Doing so would eventually delete the device being already
in use by another thread due to discovery post disconnect!"
The example code was issuing (1) disconnect and waiting for being diconnected and only then
(2) removing the device. In between the device got discovered already and a new processing thread has started
while the closing previous processing thread is removing the device and hence the underlying DBTDevice.
A user shall either use disconnect() or remove(), period.
|
|
|
|
| |
alphabetical
|
|
|
|
| |
init-list of ctor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'connect' lifecycle
Further:
- L2CAPComm
-- disconnect(): Only lock mtw_write if connected and mark noexcept
-- Added '~L2CAPComm() noexcept' for RAII
-- Removed unsued accessors
- GATTHandler
-- Similar treatment as L2CAPComm
- DBTDevice
-- Remove mtx_gatt and its locks, they were not consistent.
Rely on mtx_connect (connectGATT/getGATTServices/disconnect)
and atomic local GATTHandler copy when using.
-- disconnect GATTHandler directly in disconnect, remove explicit method.
-- pingGATT uses local gattHandler copy to avoid parallel disconnect nullptr,
however, it will fail immediately due to disconnection.
|
|
|
|
|
|
|
| |
.. achieved via unique mutex lock.
Hence perform DBTDevice::remove() within adapter to ensure
disconnect and device reference removal is atomic covered by uniue lock.
|
|
|
|
|
|
| |
Fix order of explicitly removing shared reference: connected-devices, discovered-devices and shared-devices.
Fix disconnect also removes its ref from discovered-devices, besides connected-devices,
but not shared-devices.
|
|
|
|
| |
'direct_bt_debug' if ''direct_bt.debug' wasn't found.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RELEASE Builds w/ -O3: dist-amd64/lib/libdirect_bt.so.2.1.20
pre-opt:
2,131,720
post-opt: 74,424 bytes reduced: 3.5%
2,057,296 commit (this commit)
Besides footprint and natural performance benefits,
mostly quality regarding conscious managing of exception handling
benefitted this last 'noexcept' changeset.
Notable here *Octets and ATTPDU types range checking
has been moved into the ctor to allow member access
w/o range checks and hence avoiding potential exceptions.
|
| |
|
|
|
|
| |
ex-namespace w/o 'using'
|
| |
|
| |
|
|
|
|
| |
We had to keep quite many methods due to 'exception bail out' usage on broken connection.
|
| |
|
| |
|
|
|
|
| |
uintXHexString(..) using ERR_PRINT and abort for internal error
|
|
|
|
|
|
| |
'enum class' type
In case of an internal error, simply ERR_PRINT and abort, usually the toString() implementations.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
range, dropping checks on data usage...
Also
- Fix MgmtEvtNewConnectionParam's offset for getDataOffset() and getDataSize(): 14 -> 16
- HCIHandler: Use new IndexOutOfBoundsException ctor w/o bounds
|
|
|
|
| |
range, dropping checks on data usage.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RELEASE Builds w/ -O3:
pre-opt:
2,131,720 dist-amd64/lib/libdirect_bt.so.2.1.20
noexcept round-1: (added OctetTypes _nc methods, hence offsetting reduction)
2,132,112 dist-amd64/lib/libdirect_bt.so.2.1.20
noexcept round-2: (reductions only) ~20k less
2,111,632 dist-amd64/lib/libdirect_bt.so.2.1.20
|
|
|
|
| |
OctetTypes and use them if allowed.
|
|
|
|
| |
The \example tag referring to the example code file must be added to the actual API (header) files.
|
|
|
|
|
|
| |
depenencies, build, ..); Add \example tag in examples.
For unknown reason, examples are not visible in result.
|