HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
espnow_peer_store.hpp
Go to the documentation of this file.
1
9#pragma once
10
11#include "espnow_security.hpp"
12#include <cstdint>
13
14namespace PeerStore {
15
25void Init(SecuritySettings& sec,
26 const uint8_t* preconfigured_mac = nullptr,
27 DeviceType preconfigured_type = DeviceType::Unknown,
28 const char* preconfigured_name = nullptr) noexcept;
29
41bool AddPeer(SecuritySettings& sec, const uint8_t mac[6],
42 DeviceType type, const char* name) noexcept;
43
51bool RemovePeer(SecuritySettings& sec, const uint8_t mac[6]) noexcept;
52
60bool IsPeerApproved(const SecuritySettings& sec, const uint8_t mac[6]) noexcept;
61
69const ApprovedPeer* GetPeer(const SecuritySettings& sec, const uint8_t mac[6]) noexcept;
70
82 uint8_t mac_out[6]) noexcept;
83
92void Save(const SecuritySettings& sec) noexcept;
93
100size_t GetPeerCount(const SecuritySettings& sec) noexcept;
101
107void ClearAll(SecuritySettings& sec) noexcept;
108
114void LogPeers(const SecuritySettings& sec) noexcept;
115
116} // namespace PeerStore
117
ESP-NOW security and pairing protocol definitions.
DeviceType
Device type identifiers for mutual verification.
Definition espnow_security.hpp:140
Definition espnow_peer_store.hpp:14
void ClearAll(SecuritySettings &sec) noexcept
Clear all approved peers (factory reset).
Definition espnow_peer_store.cpp:279
void Save(const SecuritySettings &sec) noexcept
Save the current peer list to NVS.
Definition espnow_peer_store.cpp:230
bool IsPeerApproved(const SecuritySettings &sec, const uint8_t mac[6]) noexcept
Check if a MAC address is in the approved peer list.
Definition espnow_peer_store.cpp:173
bool RemovePeer(SecuritySettings &sec, const uint8_t mac[6]) noexcept
Remove a peer by MAC address.
Definition espnow_peer_store.cpp:158
size_t GetPeerCount(const SecuritySettings &sec) noexcept
Get the number of valid approved peers.
Definition espnow_peer_store.cpp:262
bool GetFirstPeerOfType(const SecuritySettings &sec, DeviceType type, uint8_t mac_out[6]) noexcept
Get the first valid peer MAC of a specific device type.
Definition espnow_peer_store.cpp:210
const ApprovedPeer * GetPeer(const SecuritySettings &sec, const uint8_t mac[6]) noexcept
Get peer information by MAC address.
Definition espnow_peer_store.cpp:194
void LogPeers(const SecuritySettings &sec) noexcept
Log all approved peers (for debugging).
Definition espnow_peer_store.cpp:289
void Init(SecuritySettings &sec, const uint8_t *preconfigured_mac=nullptr, DeviceType preconfigured_type=DeviceType::Unknown, const char *preconfigured_name=nullptr) noexcept
Initialize peer storage and load approved peers from NVS.
Definition espnow_peer_store.cpp:32
bool AddPeer(SecuritySettings &sec, const uint8_t mac[6], DeviceType type, const char *name) noexcept
Add a new approved peer to storage.
Definition espnow_peer_store.cpp:110
Information about an approved (paired) peer.
Definition espnow_security.hpp:240
Security settings stored in NVS.
Definition espnow_security.hpp:251