aboutsummaryrefslogtreecommitdiffstats
path: root/src/direct_bt/BTGattChar.cpp
Commit message (Collapse)AuthorAgeFilesLines
* clang-tidy fixes part-3 / 4, adding Check `performance-*`Sven Gothel2022-11-281-1/+1
| | | | | | | | | | | | | | See also jaulib commit 9160f9a4b74f5e5ae07f715025ea4d3aafdf6ab3 Details: - Using 'const T&' as method argument type where applicable, i.e. not when required to pass value off-thread. - Notable: Can also hold a default value! - Using `const T&` in range-loop where applicable - Drop std::move for trivial types - ...
* clang-tidy fixes part-1Sven Gothel2022-11-271-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* JNI Lifecycle Fix: BTGattCharListener: Adopt full Java/Native link via ↵Sven Gothel2022-05-101-76/+18
| | | | | | | | | | | | | | | | | | | | | | | | DBTNativeDownlink and JavaUplink like AdapterStatusListener change, clean listener API + impl. AdapterStatusListener adopted fully linked via DBTNativeDownlink (java->native) and JavaUplink (native->java). This allows intrinsic lifecycle management. Native destruction leads to its reference removal from the java object and destruction of the java object removes its reference from the native object. Both reference removals may lead to their destruction if reaching zero. (was commit 9c5f25ccd1637728d6e79592279e4b38ecd32f59) Same applies to BTGattCharListener: - This removed BTGattChar::Listener, simply use BTGattCharListener - Using private BTGattHandler::GattCharListenerPair struct for BTGattChar mapping - No more manual or exposed BTGattChar mapping - Java: An added BTGattCharListener instance can be used for removal now, no more wrapper object magic returned. Further: - moved removed `namespace impl`, moved StatusListenerPair into private BTAdapter - have all add/remove*Listener methods noexcept Unit tests validating BTGattCharListener add and remove.
* noexcept: BTGattChar + BTGattDescSven Gothel2022-04-231-38/+52
|
* Cleanup Gatt numbers: Merge GattTypes.hpp into GattNumbers.hpp, remove ↵Sven Gothel2022-04-111-0/+1
| | | | redundant and unrelated BTGattDesc::Type
* BTGattChar::toString(): Place 'value' at the end, descriptor string is not ↵Sven Gothel2021-11-091-2/+3
| | | | part of the value
* Move BTGattChar::PropertyBitVal to_string() out of class and add free ↵Sven Gothel2021-10-141-19/+6
| | | | standing bit and equality operations
* [BT|DB]GattChar::toString(): Add UTF8 user-description if availableSven Gothel2021-10-131-3/+16
|
* BTGattChar::getPropertyBitValStr(): Shorten WriteNoAck; WriteWithAck: Add '-ack'Sven Gothel2021-10-131-2/+2
|
* BTGattService: Clarify fields; BTGatt*::toString(): Add type prefixSven Gothel2021-10-031-4/+4
|
* BTGattChar: Remove redundant service_handle (reference to service is held), ↵Sven Gothel2021-10-021-25/+24
| | | | | | | | | cleanup & reduce string representation. Inspired by fix of BTGattHandler::discoverCharacteristics(..), where we actually have passed the char-handle but service-handle was required (bug). Dropping service_handle altogether, hence.
* Fix BTGattChar::removeCharListener(..): Polymorph BTGattCharListener ↵Sven Gothel2021-09-291-2/+44
| | | | | | | | | | | | derivations require a RTTI alike typeid to cast and compare. We utilize jau::type_name_cue for this task, providing simple access and provision of a typename string representation at compile time like RTTI. Note: We don't require RTTI to be included. The jau::type_name_cue idea is inspired by clang's (???) previous fast RTTI replacement.
* Add BTGattChar::removeCharListener() and add convenience ↵Sven Gothel2021-09-241-5/+13
| | | | | | | | | | | | | | | BTGattChar::disableIndicationNotification(); On the Java .. On the Java side the implementation had to be a little different. The wrapping BTGattCharListener from addCharListener() can't be repeated as it holds the native instance handle. Here addCharListener() needs to return the wrapping BTGattCharListener object, which the user shall reference if intending a later BTGattChar::removeCharListener(). This avoid maintaining a map(BTGattChar::Listener -> BTGattCharListener ) and hence the user takes the costs if desired only.
* Add BTGattChar::findGattDesc() (C++ and Java) - Aligned find* methods across ↵Sven Gothel2021-09-181-0/+11
| | | | Java/C++
* API Change C++/Java: BTGattChar::addCharListener(..): Use naive ↵v2.2.13Sven Gothel2021-08-281-13/+39
| | | | | | | | | | | | | | | | | | | BTGattChar::Listener and have implementation handle the BTGattChar association match for notifications Turns out previous API and code moved the burden to user to only have the calling BTGattChar object to be matched, which is not only not intuitive, but also a potential source of issues. Now we provide a naive interface BTGattChar::Listener to be passed and BTGattChar::addCharListener(..) wraps its instance in a BTGattCharListener to be delegated. BTGattChar::removeCharListener(..) has been removed due to high implementation burden on the Java side. This shall not cause harm to the user, as it isn't useful in a user application. BTGattChar::removeAllAssociatedCharListener(..) is available on the C++ and Java side, i.e. fixed API in C++ where we had BTGattChar::removeAllCharListener(..). Tested and demonstrated in dbt_scanner10.cpp and DBTScanner10.java, as usual. Both examples also print the service, characteristic and declaration in a more readable fashion.
* Fix warning (=error) clang 11.0.1: Different comparison types: Must ↵Sven Gothel2021-07-281-10/+10
| | | | explicitly declare enum class name
* API String Conversion Simplification: get.*String() -> ↵Sven Gothel2021-02-101-9/+9
| | | | | | | | | | | | | | direct_bt::to_string() Patch [2/2] This goes along with jaulib's 'hex and decimal string conversion'. API schema for to string conversion: 1 - free function: to_string(type) 2 - main member function: toString() 3 - sub-type member function: getTypeString(Type) 3 avoid overload collision w/ potential virtual toString() method. Additional, 1 is provided for 3 as well
* C++ direct_bt files: Cleanup includes, order and type mixed-up during ↵Sven Gothel2021-02-021-3/+3
| | | | refactoring with Eclipse
* Java: New API Layout: Shorten named [Bluetooth -> BT], [Characteristic -> ↵Sven Gothel2021-01-251-0/+308
Char] etc (align naming with direct_bt == java; reduce java code footprint and too long code lines)