9#include <Settings/NamespaceSettings.hpp>
21 explicit operator bool()
const {
return conn != 0xFFFF; }
23#if __cplusplus < 201402L
34#if __cplusplus < 201402L
43 const uint8_t *
data =
nullptr;
45 explicit operator bool()
const {
return length > 0; }
47#if __cplusplus < 201402L
77 explicit operator bool()
const {
return instance; }
82 template <
class T,
class... Args>
104 static constexpr size_t capacity = 4 *
sizeof(
void *) -
sizeof(Iface *);
BLEDataType
Describes a byte buffer containing (part of) a BLE packet.
@ None
No buffers available.
@ Continuation
Buffer contains a chunk of a BLE packet.
@ Packet
Buffer contains the start of a BLE packet.
BLEDataLifetime
Should a buffer of BLEData be consumed immediately inside of the callback, or can we hold on to it an...
@ ConsumeImmediately
Buffer is valid only during the callback. Do not keep any pointers to it.
@ Managed
Buffer is valid for as long as the owning BLEDataGenerator is not resumed or destroyed.
#define BEGIN_CS_NAMESPACE
Callable that returns the next chunk of data from a BLE packet when called.
BLEDataGenerator(compat::in_place_type_t< T >, Args &&...args)
Store a callable of type T and initialize it by args.
BLEDataGenerator & operator=(BLEDataGenerator &&other) noexcept
BLEDataGenerator(BLEDataGenerator &&other) noexcept
BLEDataGenerator()=default
Create an empty BLEDataGenerator.
BLEDataGenerator & operator=(const BLEDataGenerator &)=delete
static constexpr size_t capacity
Size of the buffer to allocate the underlying data generator.
BLEDataGenerator(compat::in_place_t, T &&t)
Store a callable of type T (with cv qualifiers and references removed) and initialize it by forwardin...
void clear()
Release the resources of the underlying data generator.
max_align_t buffer_align_t
Alignment of the buffer to allocate the underlying data generator.
compat::byte storage[capacity]
Buffer used for allocation of the underlying data generator.
BLEDataView operator()()
Get the next chunk of data from the BLE packet.
BLEDataGenerator(const BLEDataGenerator &)=delete
Defines the interface for callback functions registered by the low-level BLE code.
virtual void handleData(BLEConnectionHandle conn_handle, BLEDataGenerator &&data, BLEDataLifetime lifetime)=0
Called by the BLE stack when the central writes data to the MIDI GATT characteristic.
virtual void handleConnect(BLEConnectionHandle conn_handle)=0
Called by the BLE stack when a connection is established.
virtual void handleSubscribe(BLEConnectionHandle conn_handle, BLECharacteristicHandle char_handle, bool notify)=0
Called by the BLE stack when the central subscribes to receive notifications for the MIDI GATT charac...
virtual ~MIDIBLEInstance()=default
virtual void handleDisconnect(BLEConnectionHandle conn_handle)=0
Called by the BLE stack when a connection is terminated.
virtual void handleMTU(BLEConnectionHandle conn_handle, uint16_t mtu)=0
Called by the BLE stack when the maximum transmission unit for the connection changes.
Represents a handle to a local GATT characteristic.
BLECharacteristicHandle(uint16_t characteristic)
BLECharacteristicHandle()=default
Represents a handle to the connection to another device.
BLEConnectionHandle()=default
BLEConnectionHandle(uint16_t conn)
Specific class that implements the type-erased interface, wrapping the type T.
Non-owning, std::span-style read-only view of BLE data.
BLEDataView(const uint8_t *data, uint16_t length)
Configuration options for the low-level BLE code.
struct BLESettings::@4 connection_interval
Connection intervals as multiples of 1.25 milliseconds (e.g.0x000C = 15 ms).
const char * device_name
Device name (used for advertising)
bool initiate_security
Set to true if you want the Arduino to always initiate the Bluetooth bonding or secure connection.