HF-TMC51x0 Driver (TMC5130 & TMC5160) 0.1.0-dev
Hardware Agnostic C++ Driver for the TMC51x0 (TMC5130 & TMC5160)
Loading...
Searching...
No Matches
espnow_receiver.hpp
Go to the documentation of this file.
1
12#pragma once
13
14#include "espnow_protocol.hpp"
15#include "espnow_security.hpp"
16#include "freertos/FreeRTOS.h"
17#include "freertos/queue.h"
18
19namespace EspNowReceiver {
20
33bool init(QueueHandle_t event_queue);
34
40bool send_config_response(const Settings& s);
41
48bool send_config_ack(bool ok, uint8_t err_code = 0);
49
54bool send_start_ack();
55
60bool send_pause_ack();
61
66bool send_resume_ack();
67
72bool send_stop_ack();
73
81bool send_status_update(uint32_t cycle, TestState state, uint8_t err_code = 0, uint8_t bounds_valid = 255);
82
89bool send_error(uint8_t err_code, uint32_t at_cycle);
90
96
108bool send_bounds_result(uint8_t ok,
109 uint8_t bounded,
110 uint8_t cancelled,
111 float min_deg_from_center,
112 float max_deg_from_center,
113 float global_min_deg,
114 float global_max_deg);
115
116// ============================================================================
117// PAIRING FUNCTIONS
118// ============================================================================
119
129void enter_pairing_mode(uint32_t timeout_sec = PAIRING_MODE_TIMEOUT_SEC);
130
134void exit_pairing_mode();
135
140bool is_in_pairing_mode();
141
150
161bool add_approved_peer(const uint8_t mac[6], DeviceType type, const char* name);
162
169bool remove_approved_peer(const uint8_t mac[6]);
170
176
177} // namespace EspNowReceiver
ESP-NOW communication protocol for fatigue tester.
TestState
Protocol-visible test states encoded in STATUS_UPDATE.
Definition espnow_protocol.hpp:90
ESP-NOW security and pairing protocol definitions.
static constexpr uint32_t PAIRING_MODE_TIMEOUT_SEC
Pairing mode timeout in seconds (default)
Definition espnow_security.hpp:123
DeviceType
Device type identifiers for mutual verification.
Definition espnow_security.hpp:140
Definition espnow_receiver.hpp:19
bool send_error(uint8_t err_code, uint32_t at_cycle)
Send ERROR message.
Definition espnow_receiver.cpp:321
bool send_config_ack(bool ok, uint8_t err_code=0)
Send CONFIG_ACK for a CONFIG_SET request.
Definition espnow_receiver.cpp:283
void enter_pairing_mode(uint32_t timeout_sec=PAIRING_MODE_TIMEOUT_SEC)
Enter pairing mode for the specified duration.
Definition espnow_receiver.cpp:358
bool send_test_complete()
Send TEST_COMPLETE message.
Definition espnow_receiver.cpp:329
bool send_status_update(uint32_t cycle, TestState state, uint8_t err_code=0, uint8_t bounds_valid=255)
Send STATUS_UPDATE with cycle count and state.
Definition espnow_receiver.cpp:311
bool send_pause_ack()
Send PAUSE_ACK (acknowledge PAUSE receipt).
Definition espnow_receiver.cpp:296
bool send_resume_ack()
Send RESUME_ACK (acknowledge RESUME receipt).
Definition espnow_receiver.cpp:301
bool send_stop_ack()
Send STOP_ACK (acknowledge STOP receipt).
Definition espnow_receiver.cpp:306
bool remove_approved_peer(const uint8_t mac[6])
Remove a peer from the approved list.
Definition espnow_receiver.cpp:406
bool init(QueueHandle_t event_queue)
Initialize ESP-NOW (WiFi STA + ESP-NOW) and start the receive task.
Definition espnow_receiver.cpp:127
SecuritySettings & get_security_settings()
Get access to the security settings for peer management.
Definition espnow_receiver.cpp:392
bool is_in_pairing_mode()
Check if device is currently in pairing mode.
Definition espnow_receiver.cpp:379
size_t get_approved_peer_count()
Get the number of approved peers.
Definition espnow_receiver.cpp:411
bool add_approved_peer(const uint8_t mac[6], DeviceType type, const char *name)
Manually add a peer as approved (bypasses pairing).
Definition espnow_receiver.cpp:397
bool send_config_response(const Settings &s)
Send CONFIG_RESPONSE containing the current settings.
Definition espnow_receiver.cpp:267
bool send_bounds_result(uint8_t ok, uint8_t bounded, uint8_t cancelled, float min_deg_from_center, float max_deg_from_center, float global_min_deg, float global_max_deg)
Send BOUNDS_RESULT message.
Definition espnow_receiver.cpp:334
void exit_pairing_mode()
Exit pairing mode immediately.
Definition espnow_receiver.cpp:370
bool send_start_ack()
Send START_ACK (acknowledge START receipt).
Definition espnow_receiver.cpp:291
Security settings stored in NVS.
Definition espnow_security.hpp:251
Complete settings structure containing both test unit and UI settings.
Definition espnow_protocol.hpp:290