Files
rich 0189a23267 palm-client: messaging protocol (send DM/channel, SENT, acks, channels, clock, advert)
Builders for SEND_TXT_MSG, SEND_CHANNEL_TXT_MSG (with MeshTerm's 150/130
byte limits), GET_CHANNEL, GET/SET_DEVICE_TIME and SEND_SELF_ADVERT; parsers
for CHANNEL_INFO, SENT (expected ack + timeout), PUSH_SEND_CONFIRMED and
CURR_TIME. All per MyMesh.cpp, checked byte for byte in host tests.
TxtPalmToUtf8 converts outgoing text from the Visor's Windows-1252 to UTF-8
and never cuts a character; it round-trips with TxtUtf8ToPalm.
2026-11-01 15:21:17 -05:00

105 lines
4.6 KiB
C

/*
* Companion-protocol frames for host tests (complete frames, '>' header included).
* Generated once; see the comment on each for where it came from.
*/
/* SELF_INFO captured from the SB-LoRa XIAO (MeshCore v1.17.1, factory settings) over
* the D6/D7 UART. Public key replaced with 0x10..0x2f and name with "TestNode" (same length). */
static const UInt8 kSelfInfo[] = {
0x3e, 0x42, 0x00, 0x05, 0x01, 0x16, 0x16, 0x10, 0x11, 0x12, 0x13, 0x14,
0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20,
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c,
0x2d, 0x2e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xf2, 0x44, 0x0d, 0x00, 0x24, 0xf4, 0x00, 0x00, 0x08,
0x05, 0x54, 0x65, 0x73, 0x74, 0x4e, 0x6f, 0x64, 0x65,
};
/* SYNTHETIC: CONTACT laid out per MyMesh::writeContactRespFrame. type 2 (repeater),
* 2-hop path, lat 40.712345, lon -74.006789, last_advert 1793000000, lastmod 1793000123. */
static const UInt8 kContact[] = {
0x3e, 0x94, 0x00, 0x03, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3,
0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
0x02, 0x00, 0x02, 0x5a, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x69, 0x6c, 0x6c, 0x74,
0x6f, 0x70, 0x20, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x65, 0x72, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x40, 0x02, 0xdf, 0x6a, 0x99, 0x38, 0x6d, 0x02, 0xfb,
0xbe, 0x96, 0xfb, 0xbb, 0x02, 0xdf, 0x6a,
};
/* SYNTHETIC: CONTACTS_START, count 1. */
static const UInt8 kContactsStart[] = {
0x3e, 0x05, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00,
};
/* SYNTHETIC: END_OF_CONTACTS, most recent lastmod 1793000123. */
static const UInt8 kEndOfContacts[] = {
0x3e, 0x05, 0x00, 0x04, 0xbb, 0x02, 0xdf, 0x6a,
};
/* SYNTHETIC: CONTACT_MSG_RECV_V3 per MyMesh::queueMessage. SNR -2.5 dB (0xf6 = -10/4),
* direct (path 0xff), plain text, timestamp 1793001000, "hello visor". */
static const UInt8 kContactMsg[] = {
0x3e, 0x1b, 0x00, 0x10, 0xf6, 0x00, 0x00, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4,
0xa5, 0xff, 0x00, 0x28, 0x06, 0xdf, 0x6a, 0x68, 0x65, 0x6c, 0x6c, 0x6f,
0x20, 0x76, 0x69, 0x73, 0x6f, 0x72,
};
/* SYNTHETIC: CONTACT_MSG_RECV_V3, signed plain (txt_type 2) with the 4-byte signer prefix
* before the text. SNR +5 dB, 1 hop, "signed hi". */
static const UInt8 kSignedMsg[] = {
0x3e, 0x1d, 0x00, 0x10, 0x14, 0x00, 0x00, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4,
0xa5, 0x01, 0x02, 0x29, 0x06, 0xdf, 0x6a, 0xa0, 0xa1, 0xa2, 0xa3, 0x73,
0x69, 0x67, 0x6e, 0x65, 0x64, 0x20, 0x68, 0x69,
};
/* SYNTHETIC: CHANNEL_MSG_RECV_V3 per MyMesh::onChannelMessageRecv. Channel 0, 3 hops,
* SNR +3 dB, "Alice: hi all" (MeshCore puts the sender name in the text). */
static const UInt8 kChannelMsg[] = {
0x3e, 0x18, 0x00, 0x11, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x2a, 0x06,
0xdf, 0x6a, 0x41, 0x6c, 0x69, 0x63, 0x65, 0x3a, 0x20, 0x68, 0x69, 0x20,
0x61, 0x6c, 0x6c,
};
/* NO_MORE_MESSAGES captured from the XIAO. */
static const UInt8 kNoMoreMessages[] = {
0x3e, 0x01, 0x00, 0x0a,
};
/* GET_CONTACTS reply captured from the XIAO with no contacts: CONTACTS_START (0), END_OF_CONTACTS (0). */
static const UInt8 kContactsEmpty[] = {
0x3e, 0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x05, 0x00, 0x04,
0x00, 0x00, 0x00, 0x00,
};
/* SYNTHETIC: CHANNEL_INFO per MyMesh.cpp CMD_GET_CHANNEL: slot 1, "#phillymesh", secret 0x11..0x20. */
static const UInt8 kChannelInfo[] = {
0x3e, 0x32, 0x00, 0x12, 0x01, 0x23, 0x70, 0x68, 0x69, 0x6c, 0x6c, 0x79,
0x6d, 0x65, 0x73, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b,
0x1c, 0x1d, 0x1e, 0x1f, 0x20,
};
/* SYNTHETIC: SENT: flood, expected ack 0xdeadbeef, timeout 12000 ms. */
static const UInt8 kSent[] = {
0x3e, 0x0a, 0x00, 0x06, 0x01, 0xef, 0xbe, 0xad, 0xde, 0xe0, 0x2e, 0x00,
0x00,
};
/* SYNTHETIC: PUSH_SEND_CONFIRMED: ack 0xdeadbeef, round trip 850 ms. */
static const UInt8 kSendConfirmed[] = {
0x3e, 0x09, 0x00, 0x82, 0xef, 0xbe, 0xad, 0xde, 0x52, 0x03, 0x00, 0x00,
};
/* SYNTHETIC: CURR_TIME 1792432680. */
static const UInt8 kCurrTime[] = {
0x3e, 0x05, 0x00, 0x09, 0x28, 0x5a, 0xd6, 0x6a,
};