| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Details
- Use 'size_type' instead of 'int',
propagate same 'size_type' into 'darray' etc.
- Use 'std::make_shared', 'std::make_unique'
- Use range-based for loops
- Remove redundant 'virtual', use 'override' in derived classes
- Use 'nullptr'
- Use default impl for dtor, ctor (incomplete)
- Use copy and std::move (incomplete)
- Explcitly catch std::bad_alloc in 'new' in 'noexcept' -> 'abort'
- 'abort' was issued implicitly in noexcept methods
- L2CAPServer, L2CAPClient, NopGattServerHandler,
DBGattServerHandler, FwdGattServerHandler
- Use local close_impl(), usable in virtual destructor
- L2CAPClient::read, HCIComm::read
- preset 'poll' result 'n', avoid garbage comparison
- BTAdapter::enableListening
- loop through addMgmtEventCallback() result
- JNI code
- explicit size_type is cast to jsize or jint w/o check
- unchanged semantics
|
| |
|
|
|
|
| |
out-of-loop absolute timeout_time, avoiding deadlocks
|
| |
|
|
|
|
| |
read() and caller; If INTERRUPTED -> service_runner.set_shall_stop() if not set (external irq)
|
| |
|
|
|
|
| |
err_res to be returned; Have caller also reuse this state.
|
| |
|
|
|
|
| |
get_boolean_callback_t, set_interupt() -> set_interrupted_query()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
complete interrupted() query; At tear down, first stop service_runner, then close the comm instance; Minor method renaming.
Covering [L2CAP, HCI]Comm and service_runner usage in BTManager, HCIHandler, GattHandler and BTAdapter.
- Hold external interrupted delegate from service_runner for complete interrupted() query
- This ensures service_runner stop will work on blocking comm calls like read and accept
- At tear down, first stop service_runner, then close the comm instance; Minor method renaming.
- Naturally, first stop the background thread using the comm instance (read, accept),
then close the comm instance.
Lack of proper delegation of interrupted was found by analyzing BTAdapter's l2cap_att_srv L2CAPServer socket,
which gets start- and stopped w/o closing in between operations and didn't close the instance at close.
This patch completes the introduction of service_runner, using its interrupted signal (shall_stop) for the comm instances.
|
| |
|
|
|
|
| |
of adapter association
|
|
|
|
|
|
| |
from new common L2CAPClientServer
This is a preparation to utilize common setBTSecurityLevelImpl(..) for L2CAPServer w/o code duplication.
|
|
|
|
| |
analysis; Also 'static constexpr const -> inline constexpr const' for global constants
|
|
|
|
|
|
|
|
|
|
|
| |
thread_local jau::call_on_release notify_all()
In certain (system) shutdown cases, it might occure that we encounter an uncontrolled/undefined behavior.
Limit time to wait for the reader thread to close to 8s (safe).
Also have the thread_local jau::call_on_release notify_all(),
which was missing.
|
|
|
|
|
|
|
| |
wait() thread
Holding the same lock @ notify_all as the waiting thread, would lead to waking up the waiting thread,
which only would be blocked again as it attempts to re-acquire the lock.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
interrupt) else { DBG_ for ETIMEDOUT else IRQ_ } _PRINT
The ETIMEDOUT == errno case might need more deliberation.
For now we still expect the disconnect comming from the adapter
or at least a different BlueZ/Kernel errno value like (lost or diconnected device)
in case of a real connection loss.
Therefor, we ignore timeout and continue processing on L2CAP::read()
and the default timeout value of 10s shall have no impact.
Caller of L2CAP::read(), i.e. BTGattHandler and SMPHandler follow this scheme.
They further accept 0==len result as no error.
L2CAP::write() implements the 'errout:',
however, the caller will recognize a failure even with timeout.
Hence the 10s default timeout is more than generous.
Here too, we would expect the underlying BlueZ/Kernel to
provide a meanigful connection loss reporting.
|
| |
|
|
|
|
| |
interrupting read (error w/ errno==ETIMEDOUT, or len=0)
|
|
|
|
| |
len is valid!
|
|
|
|
|
|
| |
out: Add getStateString(..) to expose errno. Fix send()..
Fix send() messages: Use proper jau::snsize_t (%d) etc ..
|
|
|
|
| |
failed); read(..)/write(..) properly return len>=0 or ExitCode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BTAdapter::get[Address->AddressAndType]() using BDAddressAndType, preparing for random address
Thoroughly changes
- 'EUI48 AdapterInfo::address' -> 'BDAddressAndType AdapterInfo::addressAndType'
- BTAdapter C++
- BTAdapter and its DBTAdapter/DBusAdapter implementations (Java)
Motivation:
- The adapter's address as initially reported by the system is always its public address, i.e. BDAddressType::BDADDR_LE_PUBLIC
- The adapter's visible BDAddressAndType might be set to BDAddressType::BDADDR_LE_RANDOM before scanning / discovery mode (TODO).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
enhancements
'enum' -> 'enum class' w/ all bells and whistles: L2CAP_PSM, L2CAP_CID, AD_Type_Const
BTAddress.hpp: Add 'constexpr uint8_t number(..)'
constexpr:
- equality- and bit-operations on different types:
EIRDataType, ManufactureSpecificData
- isEIRDataTypeSet(), setEIRDataTypeSet(), setAdapterSettingMaskBit()
HCIACLData Cleanup
- Use L2CAP_PSM and L2CAP_CID types
- Convenient queries if SMP or GATT type
- Add toString(..) w/ l2cap_data ptr
L2CAPComm: Use L2CAP_PSM and L2CAP_CID types
|
|
|
|
| |
refactoring with Eclipse
|
|
|
|
| |
Char] etc (align naming with direct_bt == java; reduce java code footprint and too long code lines)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(performance and CoW correctness)
Merging jaulib's darray and cow_darray into direct_bt.
As explained in jaulib, motivation behing darray + cow_darray
is to allow fine grained controll over the CoW's storage
to have certain guarantess on its operation.
Iterator and push_back() enhancments are a few of these.
Fixes performed while replacing:
- DBTDevice getGATTServices(): Take the copy as it will be returned.
- GATTHandler removeAllAssociatedCharacteristicListener(): Try to delete all matching!
Don't stop loop after found and erased first, continue.
Also return number of erased elements, not just true.
- DBTManager ctor: Don't work on CoW snapshot, work on CoW
- Simplified many loops / iterations
|
|
|
|
| |
const_iterator w/ jau::for_each and maybe jau::for_each_fidelity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
instead of shared_ptr; Callbacks use 'const <T> &' now.
smart_ptr change series, commit #2
This series started with commit cafd8d1f3689135eae36854a9cca4def690045fd,
see for details.
Refined MgmtMsg clone template and added same to HCIPacket and SMPPDUMsg.
Notable: To have this clone template to work, the default copy-constructor
should not be deleted. Hence removing the const qualifier from timestamp
and manual default/deleted directives.
+++
At this point, all high frequent objects (ATT, HCI w/ SMP, Mgmt events)
use std::unique_ptr and therefor reduce a certain overhead.
Further, this constraint also removes a potential 'build in' leaks,
in case a callback method keeps the shared_ptr instance.
Now, callbacks only received the const reference and if so desired,
need to create a copy themselves.
|
|
|
|
| |
See commit bc9d1c0d2942ce24019b432198f2d4c0d00aee19
|
|
|
|
| |
[set|get]SecurityLevel() using BTSecurityLevel, overriding auto-determined mode.
|
|
|
|
| |
executeOffThread(..) editing; SMPHandler: Avoid unused arguments
|
|
|
|
|
|
|
|
|
|
| |
L2CAPComm::setBTSecurityLevel() for DBTDevice::processL2CAPSetup()
sec_level > BT_SECURITY_LOW is now required to start security negotiation (not just > 0), matching BT_SECURITY API.
This change aligns the tentative SMPHandler and conditionally disabled code with current state.
SMPHandler::establishSecurity(..) needs to be implemented for non BlueZ platforms or when SMP is accessible under BlueZ.
|
|
|
|
|
|
|
|
| |
re-establish l2cap channel on changed security/encryption
- DBTDevice
-- Aggregating L2CAPComm instance, open/close and passing to GATTHandler
-- add LEFeatures le_features field, incl notify update hook
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Opcode)]; Mark Opcode linux-version and TODO/FIXME; ...
Further
- Update opcodes up until linux 5.9
- Add MgmtEvtControllerError
- Add MgmtSetDiscoverableCmd
- Sort all MgmtCommand + MgmtEvent in Opcode order
- MgmtEvent::getSpecialized(): Sort by Opcode order, add MgmtEvtControllerError
- SMPHandler.hpp: Add macro definition USE_LINUX_BT_SECURITY [0|1]
- DBTManager::setMode() produces usable DBG_PRINT, drop setAdapterMode(..)
- DBTManager::setDiscoverableCmd(): Added using MgmtSetDiscoverableCmd, used for DUAL | BREDR only
- MgmtEvtCmdComplete::getCurrentSettings() added
- DBTManager::setMode() + setDiscoverableCmd() updated given AdapterSetting current_setting on SUCCESS,
using MgmtEvtCmdComplete::getCurrentSettings()
- DBTManager::initAdapter() uses updated AdapterSetting current_setting if valid instead of
refetching AdapterInfo via READ_INFO.
|
|
supported)
On our current target platform Linux/BlueZ,
access to the existing SMP implementation via L2CAP (socket) is sadly prohibited.
Linux/BlueZ currently only allows L2CAP sockets for LE devices for the ATT protocol,
determined by L2CAP_CID_ATT.
Therefor we have to use Linux/BlueZ manager control channel's
API to access the SMP implementation.
However, the SMPHandler and used SMPPDUMsg types may be used on other platforms.
Hence implementation shall be completed for these later on.
|