Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds manufacturer-independent infrastructure for a BLE-based connection protocol, and OpenLCB's implemnentation classes and constants. - Adds abstract classes for defining BLE Advertisements and Services. - Adds concrete implementation of these with encoding the specific advertisements for GATT-based central and peripheral for OpenLCB, including the necessary UUID constants. - Adds a Port implementation for DirectHub for sending text data (e.g. gridconnect frames) over BLE. Since this is all manufacturer-independent, there are no external dependencies involved, but it also means that in itself, this basic infrastructure does not work. A significant amount of additional code is needed to tie this together with a specific manufacturer's BLE stack. Misc changes: - Makes SimpleStack be able to expose the PIP bytes via a direct API - Fixes a compiler warning on LinkedDataBuffer === * Initial commit of BLE support. * Add some BLE tests. * Move from std::string to std::vector container. * Add scan data tests. * Add more tests. * Fill in update() API logic. * Move advertisements to use std::basic_string. * Test advertisement updates. * Add helpers for grabbing out specific advertisement payload fields. * Fix include path. * Add start of OpenLCB BLE advertisement definition. * Fix trivial comment. * Fix math bug. * Add OpenLCB BLE advertisement tests. * OpenLCB specific BLE definitions. * Remove redundant parentheses scope. * Add PIP API to SimpleStack. * Small updates to openlcb::BLEService. * Update BLE definitions. * Add include guards. * Update the openlcb::BLEService attributes table. * Add comment. * Only append name if non-null and length > 0. * Add simple BLE connections management structures. * Add OpenLCB BLE Gatt Client manager. * Adds more convenient read API to databuffer. * Fix uninitialized variable warning. * Adds skeleton of BLE hub port base class. * Adds hub port to the client object. Changes the client objects to be constant in memory address instead of being moved around. * Adds an abstract class for BLE protocol engines. This is needed for proper ownership of objects when BLE client / connections get removed. * Updates the HUbPOrt to derive from the proper abstract base class for ownership by the client object. Refactors the send function to be an std::function instead of a subclass. * Removes misguided attempt to implement the sending inside this class. Adds accessor for an abstract protocol engine instead. * Adds fuzz test to data buffer. Rewrites conditions in move read pointer forward, because it was incorrect. * Adds accessor to lookup client by connection and output handle. * Ensures that try_append_to will always complete for an empty data buffer. * Adds implementation for input data for BLEHubPort. * Adds more fuzz testing capability to the data buffer test. * Fix some crashing cornercases. * Adds utility function to find clients by the inbound handle. * Adds more fuzz test debugging. * Expands the cases where try_append_from succeeds. - Handles the case when the src or dst buffer is empty. - Detects when the append happens exactly at a buffer boundary and the buffers are already linked buffer. - Adds a parameter that makes this work even when the link is not there yet * Adds a debugging facility that verifies that data buffer unrefs are correct. * Finishes fuzz tests. * Rewrite data read advance to be much simpler. This fixes a buffer refcount bug when a buffer ended up with a zero length and too few refs. * Fixes crashes in the duffer append code. * Add API for getting the current active connection count. * Bump task stack for TWAI watchdog task. * Ensure we are using the ESP32's logging facility for ESP_PLATFORM. * Fix bugs that caused data loss over BLE: - MTU < 500. - do_write needs to be repeated, so we call it via the executor. * Fix bug when we take bytes from an appendable data buffer. We took over o.free_ but this makes the current buffer appendable, which is wrong. * Fixes bug in tracking pending bytes in the queue. * Releases the notifiable of the first buffer faster. * Fixes bug in counting pending bytes. * Fix bug that might be the cause of the disconnect crash. Keeping iterators in a vector is not allowed when erase is used. * Fix comment. --------- Co-authored-by: Balazs Racz <[email protected]>
- Loading branch information