80bd1c9f20
- Auto-set enableOnBoot=true when BT is enabled or device is paired,
so board restarts with BT on and can reconnect
- Make RADIO_STATE_ON handler non-exclusive: scan for HID Host,
start HID Device, SPP and MIDI all independently (was else-if)
- Improve HID Host auto-connect for RPA: direct addr match, name-match
fallback, and direct connect to stored identity using resolving list
- Persist addrType in PairedDevice file for more reliable reconnection
- Add verbose logging for loadAll/save to debug missing files
Fixes issue where board restart did not reconnect to previously
connected BT devices. Also preserves f94cc160 fullscreen flag feature.
33 lines
798 B
C++
33 lines
798 B
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace tt::bluetooth::settings {
|
|
|
|
struct PairedDevice {
|
|
std::string name;
|
|
std::array<uint8_t, 6> addr;
|
|
bool autoConnect = false;
|
|
/** Profile used to pair (BtProfileId value). Defaults to BT_PROFILE_SPP=2. */
|
|
int profileId = 2;
|
|
/** BLE address type (0=PUBLIC, 1=RANDOM, etc). Defaults to PUBLIC for backward compat. */
|
|
uint8_t addrType = 0;
|
|
};
|
|
|
|
std::string addrToHex(const std::array<uint8_t, 6>& addr);
|
|
|
|
bool hasFileForDevice(const std::string& addr_hex);
|
|
|
|
bool load(const std::string& addr_hex, PairedDevice& device);
|
|
|
|
bool save(const PairedDevice& device);
|
|
|
|
bool remove(const std::string& addr_hex);
|
|
|
|
std::vector<PairedDevice> loadAll();
|
|
|
|
} // namespace tt::bluetooth::settings
|