Rotate the link-layer address with the pseudonym again

The app sends the pseudonym's MAC in the 16-octet STATION_CONFIGURE (address_configuration
0), the station uses it for unsigned frames too, and a different MAC reconfigures the
station. A ride rotates it with the station ID; the bench CAM pinger keeps one. Without a
MAC the station behaves as before (ticket-derived when signed, random when unsigned).

tools/station_tx_test.py plays the phone over USB and reads the station's own raw capture
(source MAC, signed or not, submitted and completed counts). Add the 16-octet form to the
spec (revision 2), a firmware unit test and an app test. Fix the stale Connection texts.
This commit is contained in:
Ashin Walpola
2026-11-11 15:02:39 +01:00
parent a7a6c39ca1
commit 37707548ca
13 changed files with 313 additions and 24 deletions
+16
View File
@@ -121,6 +121,22 @@ TEST(station_configure_is_the_six_octet_form_the_app_sends) {
CHECK(!link::decode(hex("02b4001401"), bad)); // five octets
}
TEST(station_configure_with_a_named_mac_is_the_sixteen_octet_form) {
// the app's form for a ride (rotating pseudonym MAC) and for the bench pinger (fixed MAC)
link::StationConfigure c;
CHECK(link::decode(hex("02010002112233445500b40014020205"), c));
CHECK_EQ(c.station_type, 2); CHECK_EQ(c.security, 1);
CHECK_EQ(c.address_configuration, 0); // AUTO: the MID below names the address
CHECK_STR(to_hex(Bytes(c.mid, c.mid + 6)), std::string("021122334455"));
CHECK_EQ(c.channel_number, 180); CHECK_EQ(c.transmit_power_dbm, 20);
CHECK_EQ(c.radio, 2); CHECK_EQ(c.default_traffic_class, 2); CHECK_EQ(c.default_lifetime, 0x05);
// and the station's own encoder produces the same bytes for the same values
CHECK_STR(to_hex(link::encode(c)), std::string("02010002112233445500b40014020205"));
link::StationConfigure bad;
CHECK(!link::decode(hex("02010002112233445500b4001402"), bad)); // cut short
CHECK(!link::decode(hex("02010202112233445500b40014020205"), bad)); // address_configuration 2 does not exist
}
TEST(poti_update_decodes_the_apps_31_octets) {
link::PotiUpdate p;
CHECK(link::decode(hex("fbb2b7ffa60000002bcbeb1f914bf905e601e60100000e000000001f02d204"), p));