aboutsummaryrefslogtreecommitdiffstats
path: root/src/direct_bt/GATTNumbers.cpp
Commit message (Collapse)AuthorAgeFilesLines
* GATTNumbers: GATT_SERVICES ..: Use jau::make_darray<..>(..) to avoid ↵Sven Gothel2021-10-241-130/+162
| | | | | | | | | | | | copy-ctor; Disable its compilation and preserve resources. GATT_SERVICES .. etc were merely created as a proof of concept to compile a complex static structure representing detailed GATT services with its characteristics etc. Its usage has been fixed to avoid std::initialize_list and copy-ctor. One can enable its compilation and linkage by defining `DIRECTBT_BUILDIN_GATT_SERVICE_CHARACTERISTIC_SPEC`.
* Adopt to jaulib v0.4.9; Fixes BTSecurityRegistry::getStartOf(..)Sven Gothel2021-10-051-5/+5
|
* Silence g++ warnings via prelim nullptr and `pointer overflow` checks ↵Sven Gothel2021-09-191-1/+12
| | | | (redundant in all these cases though)
* Moved EUI48, EUI48Sub (C++/Java) and uuid_t, *Octets (C++) to jaulib for ↵Sven Gothel2021-09-181-7/+7
| | | | | | | | | general use. Notable, the java classes EUI48, EUI48Sub and BasicTypes are included in direct_bt's jar file to avoid any inconvenience. Hence BTUtils's byte[s]HexString(..) simply uses jaulib's BasicTypes s' implementation.
* API String Conversion Simplification: get.*String() -> ↵Sven Gothel2021-02-101-5/+5
| | | | | | | | | | | | | | 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
* Adapt to jau::bytesHexString(..)/<type>HexString(..): Removed leading0X ↵Sven Gothel2021-02-061-4/+4
| | | | argument: Unifying output.
* Java: New API Layout: Shorten named [Bluetooth -> BT], [Characteristic -> ↵Sven Gothel2021-01-251-1/+1
| | | | Char] etc (align naming with direct_bt == java; reduce java code footprint and too long code lines)
* Replace std::vector w/ jau::darray and jau::cow_vector with jau::cow_darray ↵Sven Gothel2021-01-111-2/+2
| | | | | | | | | | | | | | | | | | | | | (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
* smart_ptr-5: Use std::make_shared<T>(..) where possible, reducing two memory ↵Sven Gothel2020-12-141-3/+3
| | | | | | | | | allocations to one smart_ptr change series, commit #5 This series started with commit cafd8d1f3689135eae36854a9cca4def690045fd, see for details.
* Small footprint compromise: Use jau::nsize_t and jau::snsize_t where appropriateSven Gothel2020-10-201-5/+5
| | | | | | | | | | | | | | | | | | Revises commit 1f6e924fe05ed45bfa4d0d901af2c4df6c1abab5 Use jau::nsize_t and jau::snsize_t where appropriate - OctetTypes.hpp: TROOctets* - ATTPDUTypes.hpp: AttPDUMsg* - HCITypes.hpp: HCIPacket* - HCIComm.hpp: HCIComm - L2CAPComm.hpp: L2CAPComm - MgmtTypes.hpp: MgmtCommand*, MgmtEvent* - UUID.hpp: uuid_t - DBTManager, GATTHandler, HCIHandler - HCIComm.hpp: HCIComm - BTTypes.hpp - DBTTypes.hpp
* Normalize: Use size_t where appropriate; timestamp is uint64_tSven Gothel2020-10-201-5/+5
| | | | | | | | | | | | | | | | | | | timestamp is uint64_t - AttPDUMsg Use size_t where appropriate - OctetTypes.hpp: TROOctets* - ATTPDUTypes.hpp: AttPDUMsg* - HCITypes.hpp: HCIPacket* - HCIComm.hpp: HCIComm - L2CAPComm.hpp: L2CAPComm - MgmtTypes.hpp: MgmtCommand*, MgmtEvent* - UUID.hpp: uuid_t - DBTManager, GATTHandler, HCIHandler - HCIComm.hpp: HCIComm - BTTypes.hpp - DBTTypes.hpp
* Extract common C++ Support Library inclusive Java JNI Binding to sub-project ↵Sven Gothel2020-10-161-7/+7
| | | | jaucpp, namespace jau
* GATTNumbers: Concluding review: API doc, better naming, have optional data ↵Sven Gothel2020-09-241-12/+35
| | | | and erroneous missing data handle nicely (no crash)
* C++ *Octet noexcept, add/use more [get|put]_*_nc(..) where applicable ↵Sven Gothel2020-09-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | (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.
* C++ noexcept: GATT* Data TypesSven Gothel2020-09-151-19/+19
|
* Introduce HCITypes + HCIHandler: Providing C++ basics for full HCI support; ↵Sven Gothel2020-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Misc.. Introduce HCITypes + HCIHandler: Providing C++ basics for full HCI support ============================================================================ - HCITypes defines the HCI command and event data structures, similar to MgmtTypes and ATTPDUTypes. For more coding efficiency we use template command and event classes, allowing to reuse the HCIIoctl struct types being wrapped in the C++ classes for flow and lifecycle control. HCITypes further includes all essential 'enum class' command opcodes, event types etc, ensuring type safety. - HCIHandler defines the command/event workflow similar to GATTHandler and DBTManager. One HCIHandler per DBTAdapter is being used, each HCIHandler using its event reader thread and ringbuffer. Socket event filtering and manual le-meta filtering ensures reduced workload (DoS safety). Similar to HCITypes, we use template function to utilize the template command and event classes, reuising the HCIIoctl struct types... HCIHandler can be extended for more functionality as well as used to implement our own DBTManager, i.e. Reducing HCIEvents to MgmtEvents with callback support. At least this is a viable option now, if so desired (non-linux, etc). - HCIComm: Contains the core I/O functionality only, dropped all semantic HCI code. The latter resides in HCIHandler now. - DBTAdapter now uses HCIHander instead of HCIComm, renamed field to simply 'hci' Misc.. ======= - reduced all ringbuffer capacity to 128 from 256 - Moved Mgmt*EventCallback from DBTManager to MgmtTypes, as we might want to reuse the MgmtTypes incl callbacks for alternative DBTManager implementations. - Added 'enum class' to underlying number type conversion pattern: <NumberType> number('enum class type') Avoiding the many static_cast<NumberType>(..) directives. - align all Type -> String method names: 'get<Type>String(Type)' - BasicTypes: Add safe uint32_t bitfield mask helper
* Fixating certain enums -> 'enum class' (localizing enum scope avoiding ↵Sven Gothel2020-05-271-1/+2
| | | | | | | | | | | | | | duplicates) Localizing enum scope avoiding duplicates also helps fixating type safety. This is especially important for short enums w/o a type prefix. +++ Fixes: - MgmtEvent::getSpecialized(..): Reading actual uint16_t Opcode instead of just peeking uint8_t! (Duh!) - MgmtEvent* *string* ops: Converting uint16_t Opcode instead of uint8_t to string.
* Use AppearanceCat type in DBTDevice, EIR and GenericAccessSven Gothel2020-05-251-69/+1
| | | | as well as using its string representation in respective toString() methods.
* Initial working Java binding for the direct_bt C++ moduleSven Gothel2020-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example ScannerTinyB01 demonstrates efficient scanning devices using the new BluetoothDeviceDiscoveryListener interface. The C++ HCIObject extends JavaUplink, which handles the java object references via 'std::shared_ptr<JavaAnonObj>', where JavaAnonObj relies on later polymorph specialization. JavaAnonObj gets derived in the java/jni of direct_bt, where the JNI header + libraries are available. +++ The java inplementing NativeDownlink implementations store the nativeInstance to the C++ instances as well as handle their java references within the native instances. The C++ JavaUplink and Java NativeDownlink interfaces are complete the cross referencing java <-> native. +++ Native libraries are now split into pairs: - tinyb + javatinyb - direct_bt + javadirect_bt TODO: BluetoothFactory must chose the proper bundle! +++ The Java Adapter received a BluetoothDeviceDiscoveryListener hook, matching C++ Adapter's HCIDeviceDiscoveryListener. Since the Java Adapter implements its own discovery thread, using the BluetoothDeviceDiscoveryListener is more efficient then polling over a list of Devices fetched. ++++ TODO: Align Java and C++ class names, foremost in the C++ direct_bt space. TODO: Bind the whole C++ GATT functionality More testing.
* Implement direct_bt: Direct Bluetooth access via Linux's Kernel BlueZ ↵Sven Gothel2020-04-091-0/+507
protocol stack w/o D-Bus bluetoothd. By dropping BlueZ userspace D-Bus bluetoothd, we target high-performance reliable bluetooth support with least dependencies for embedded device configurations. See COPYING, describing which Linux Kernel BlueZ IOCTL information has been included in the source tree. We claim Linus Torvalds's Linux Kernel license exception regarding kernel syscalls (ioctl): <https://github.com/torvalds/linux/blob/master/LICENSES/exceptions/Linux-syscall-note> and hence maintain this project's license. The new direct_bt feature set is organized as follows - include/cppunit - api/direct_bt - api/ieee11073 - src/direct_bt - examples/direct_bt Note that the C++ direct_bt layer is not backward compatible to tinyb. Since the Java layer still needs to be completed, it has to be seen whether we will achieve compatibility or drop the original D-Bus tinyb module altogether in favor of a more streamlined API and implementation. Current state allows scanning for LE devices, connecting and parsing GATT plus receiving notifications and indications. See examples/direct_bt_scanner/dbt_scanner.cpp. The Linux Kernel BlueZ is configured via module MgmtComm.[hpp/cpp]