Reorder ext IDs, add board ID to ResponseInfo, fix CRLF translation

This commit is contained in:
Ian Gulliver
2026-04-04 15:09:16 +09:00
parent d2b9a2e2aa
commit 0973f9c454
4 changed files with 36 additions and 26 deletions

View File

@@ -5,10 +5,21 @@
#include <tuple>
#include <vector>
struct ResponsePICOBOOT {
struct Envelope {
static constexpr int8_t ext_id = 0;
uint32_t message_id;
uint32_t checksum;
std::vector<uint8_t> payload;
auto as_tuple() const { return std::tie(message_id, checksum, payload); }
auto as_tuple() { return std::tie(message_id, checksum, payload); }
};
struct DeviceError {
static constexpr int8_t ext_id = 1;
auto as_tuple() const { return std::tie(); }
auto as_tuple() { return std::tie(); }
uint32_t code;
std::string message;
auto as_tuple() const { return std::tie(code, message); }
auto as_tuple() { return std::tie(code, message); }
};
struct RequestPICOBOOT {
@@ -17,6 +28,12 @@ struct RequestPICOBOOT {
auto as_tuple() { return std::tie(); }
};
struct ResponsePICOBOOT {
static constexpr int8_t ext_id = 3;
auto as_tuple() const { return std::tie(); }
auto as_tuple() { return std::tie(); }
};
struct RequestInfo {
static constexpr int8_t ext_id = 4;
auto as_tuple() const { return std::tie(); }
@@ -25,24 +42,8 @@ struct RequestInfo {
struct ResponseInfo {
static constexpr int8_t ext_id = 5;
std::array<uint8_t, 8> board_id;
std::array<uint8_t, 6> mac;
auto as_tuple() const { return std::tie(mac); }
auto as_tuple() { return std::tie(mac); }
};
struct DeviceError {
static constexpr int8_t ext_id = 3;
uint32_t code;
std::string message;
auto as_tuple() const { return std::tie(code, message); }
auto as_tuple() { return std::tie(code, message); }
};
struct Envelope {
static constexpr int8_t ext_id = 0;
uint32_t message_id;
uint32_t checksum;
std::vector<uint8_t> payload;
auto as_tuple() const { return std::tie(message_id, checksum, payload); }
auto as_tuple() { return std::tie(message_id, checksum, payload); }
auto as_tuple() const { return std::tie(board_id, mac); }
auto as_tuple() { return std::tie(board_id, mac); }
};