summaryrefslogtreecommitdiffstats
path: root/src/direct_bt/GATTDescriptor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Java: New API Layout: Shorten named [Bluetooth -> BT], [Characteristic -> ↵Sven Gothel2021-01-251-88/+0
| | | | Char] etc (align naming with direct_bt == java; reduce java code footprint and too long code lines)
* Extract common C++ Support Library inclusive Java JNI Binding to sub-project ↵Sven Gothel2020-10-161-1/+3
| | | | jaucpp, namespace jau
* GATT*::toString(): Encapsulate resulting string with '[]'; Examples: Use ↵Sven Gothel2020-09-201-2/+2
| | | | clear type names: CharDef and CharVal
* GATT[Service,...] used a 'toSafeString()' due to unknown SIGSEGV at this ↵Sven Gothel2020-09-201-4/+4
| | | | | | | | | 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.
* Fix GATT* Object relationship incl weak back-reference (GATTHandler was ↵Sven Gothel2020-09-191-0/+4
| | | | | | | | | | | | | | | | | | 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
* C++ noexcept: GATT* Data TypesSven Gothel2020-09-151-2/+2
|
* GATT[Service,Characteristic,Descriptor]: Use new 'toSafeString()' for ↵Sven Gothel2020-07-261-5/+11
| | | | | | | | | | constructing exception message, avoiding virtual function variant. For an unknown reason, using the virtual function 'toString()' while constructing an exception message causes a SIGSEGV. This method represents a non-virtual variation, which also does not call any other virtual function.
* Robustness: Distinguish between get<Type>Checked() and get<Type>Unchecked(): ↵Sven Gothel2020-07-261-13/+11
| | | | Use it accordingly, reducing duplicated code etc.
* Resolve circular references (p1): C++ GATTHandler, GATTService, pp are not ↵Sven Gothel2020-06-291-2/+12
| | | | | | | | | | | | | | | | | | | | owner of their resepctive backreference GATTHandler, GATTService, pp are not owner of their resepctive backreference, hence use std::weak_ptr for backreferences in general and validate on usage (nullptr, if destructed). No DBTDevice has been ever destructed after using GATTHandler and discovering all GATT services. In contrast to Java, C++ has no magic GC and hence shared_ptr use_count gets only increased when emplying circular backreferences - none gets destructed. Current ownership relationship is: DBTAdapter -> DBTDevice -> GATTHandler -> GATTService ... each contains a backreference, now using a weak_ptr. Result is that depending on the use-case, DBTDevice instances are destructed: - Using device->remove(): Immediately - No explicit device->remove(): Adapter keeps sharedDevices, destruction occurs at end.
* GATTService::toString() Don't list all characteristics, just the count; ↵Sven Gothel2020-05-301-2/+2
| | | | GATTDescriptor fix exception message.
* Working GATT Java Side; GATT Types made fully functional for user to avoid ↵Sven Gothel2020-05-171-0/+68
'technical' GATTHandler GATT Types made fully functional for user to avoid 'technical' GATTHandler (C++) > GATTService, GATTCharacteristic, GATTDescriptor -- Reside in their own respective files -- Added semantic methods (readValue(), ..) implemented using DBTDevice -> GATTHandler -- GATTDescriptor owns its value -- GATTHandler setSendIndicationConfirmation(..) defaults to true -- Allow user to cirvumvent using GATTHandler manually completely, device 1--*> services 1--*> characteristics 1--*> descriptor -- C++ GATT types aligned 1:1 to TinyB (Java) > Merged GATTIndicationListener + GATTNotificationListener -> GATTCharacteristicListener -- Simplifying usage, unifying notification and indication -- Now using a list of shared_ptr<GATTCharacteristicListener> allowing multiple actors instead of just a one shot entry. Similar to AdapterStatusListener, we utilize this also on the Java side to implement the TinyB notifications. See dbt_scanner00.cpp: Simplified high-level usage. See dbt_scanner01.cpp: Lower-level technical usage w/ GATTHandler. +++ > Simplified more names > Removed redundancy in listener callbacks, -- don't pass adapter when device is already given. device <*--1> adapter -- don't pass GATT handle explicitly when characteristic is passed > Comparison of all GATT types are done by their respective unique handle Attribute handles are unique for each device (server) (BT Core Spec v5.2: Vol 3, Part F Protocol..: 3.2.2 Attribute Handle) > GATTHandler: Own L2CAPComm instance directly, instead of shared_ptr. > JNIMem: Added JNICriticalArray class for RAII style release ++++ ++++ Working GATT Java Side > All toString() methods return the C++ toString() via JNI for better representation. > DBTDevice.java/JNI: Resolved the odd 'adapter' reference issue: -- Was not passing the jobject of DBTAdapter, but its shared container refeference ;-) > All GATT types receive their GATT handler for equal test and identity @ ctor > GATT read/write Value update the cached value as well as issue the notifyValue on change, including GATTCharacteristic notification/indication listener