Skip to content

Commit 369b890

Browse files
committed
Regen messages from spec 2025-10-17
1 parent 065560a commit 369b890

19 files changed

+280
-62
lines changed

src/messages/m10008_base_page_gen.toit

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ class BasePage extends protocol.Data:
77
static MT_NAME := "BasePage"
88

99
static PAGE-ID := 3
10+
static PAGE-ID_HOME-PAGE := 1
11+
12+
static PAGE-ID_STRINGS := {
13+
1: "Home Page",
14+
}
15+
16+
static page-id-from-int value/int -> string:
17+
return PAGE-ID_STRINGS.get value --if-absent=(: "unknown")
18+
1019
static STATUS-BAR-ENABLE := 5
1120
static REDRAW-TYPE := 6
1221
static REDRAW-TYPE_AUTO := 0
@@ -65,9 +74,11 @@ class BasePage extends protocol.Data:
6574
return protocol.Message.with-data MT data
6675

6776
/**
68-
* The page to draw or update.
69-
* Page ids 0-10 are reserved for system use.
70-
* If no page id is provided, page id 11 will be assumed.
77+
* The page to draw.
78+
*
79+
*
80+
* Valid values:
81+
* - PAGE-ID_HOME-PAGE (1): The preset home page programmed into the device
7182
*/
7283
page-id -> int:
7384
return get-data-uint PAGE-ID

src/messages/m10010_menu_page_gen.toit

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,20 @@ class MenuPage extends protocol.Data:
8989
* The page to draw or update.
9090
* Page ids 0-10 are reserved for system use.
9191
* If no page id is provided, page id 11 will be assumed.
92+
* You can provide the same page id as last time to update the menu, or a new page id to create a new menu.
9293
*/
9394
page-id -> int:
9495
return get-data-uint PAGE-ID
9596

9697
/**
97-
* Number of items in the menu. Max 20.
98+
* Number of items in the menu (max 20). Required.
9899
*/
99100
item-count -> int:
100101
return get-data-uint ITEM-COUNT
101102

102103
/**
103-
* Optionally select a specific item, else the first will be used. 0 indexed.
104+
* Optionally select a specific item, else the first will be unsubscribed.
105+
* Zero indexed.
104106
*/
105107
selected-item -> int:
106108
return get-data-uint SELECTED-ITEM

src/messages/m1004_lora_gen.toit

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ class LORA extends protocol.Data:
5858
static msg --data/protocol.Data?=protocol.Data -> protocol.Message:
5959
return protocol.Message.with-data MT data
6060

61-
/**
62-
* Creates a DO Request message for LORA.
63-
*
64-
* Returns: A Message ready to be sent
65-
*/
66-
static do-msg --base-data/protocol.Data?=protocol.Data -> protocol.Message:
67-
return protocol.Message.with-method MT protocol.Header.METHOD-DO base-data
68-
6961
/**
7062
* Creates a GET Request message for LORA.
7163
*

src/messages/m11_open_gen.toit

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Open extends protocol.Data:
66
static MT := 11
77
static MT_NAME := "Open"
88

9+
static FLAGS := 1
910
static DEVICE-TYPE := 10
1011

1112
constructor:
@@ -22,8 +23,9 @@ class Open extends protocol.Data:
2223
*
2324
* Returns: A protocol.Data object with the specified field values
2425
*/
25-
static data --device-type/int?=null --base-data/protocol.Data?=protocol.Data -> protocol.Data:
26+
static data --flags/int?=null --device-type/int?=null --base-data/protocol.Data?=protocol.Data -> protocol.Data:
2627
data := base-data
28+
if flags != null: data.add-data-uint FLAGS flags
2729
if device-type != null: data.add-data-uint DEVICE-TYPE device-type
2830
return data
2931

@@ -42,13 +44,19 @@ class Open extends protocol.Data:
4244
return protocol.Message.with-data MT data
4345

4446
/**
45-
* Type of device, relates to the serial number prefix.
46-
* Primarily used by inter processor communication to identify the type of device.
47+
* For future use, if used should currently always be 0
48+
*/
49+
flags -> int:
50+
return get-data-uint FLAGS
51+
52+
/**
53+
* Type of device, relates to the SN prefix
4754
*/
4855
device-type -> int:
4956
return get-data-uint DEVICE-TYPE
5057

5158
stringify -> string:
5259
return {
60+
"Flags": flags,
5361
"Device Type": device-type,
5462
}.stringify

src/messages/m13_heartbeat_gen.toit

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ class Heartbeat extends protocol.Data:
66
static MT := 13
77
static MT_NAME := "Heartbeat"
88

9+
static BATTERY-PERCENT := 6
10+
911
constructor:
1012
super
1113

@@ -20,7 +22,10 @@ class Heartbeat extends protocol.Data:
2022
*
2123
* Returns: A protocol.Data object with the specified field values
2224
*/
23-
static data --base-data/protocol.Data?=protocol.Data -> protocol.Data: return base-data
25+
static data --battery-percent/int?=null --base-data/protocol.Data?=protocol.Data -> protocol.Data:
26+
data := base-data
27+
if battery-percent != null: data.add-data-uint BATTERY-PERCENT battery-percent
28+
return data
2429

2530
/**
2631
* Creates a Heartbeat message without a specific method.
@@ -36,6 +41,13 @@ class Heartbeat extends protocol.Data:
3641
static msg --data/protocol.Data?=protocol.Data -> protocol.Message:
3742
return protocol.Message.with-data MT data
3843

44+
/**
45+
* Devices send battery percentage in heartbeats
46+
*/
47+
battery-percent -> int:
48+
return get-data-uint BATTERY-PERCENT
49+
3950
stringify -> string:
4051
return {
52+
"Battery Percent": battery-percent,
4153
}.stringify

src/messages/m15_position_gen.toit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ class Position extends protocol.Data:
1919
static TYPE_INVALID := 0
2020
static TYPE_FIXED := 1
2121
static TYPE_RESERVED := 2
22-
static TYPE_3D := 3
22+
static TYPE_STANDALONE := 3
2323
static TYPE_RTK-FLOAT := 4
2424
static TYPE_RTK-FIX := 5
2525

2626
static TYPE_STRINGS := {
2727
0: "invalid",
2828
1: "fixed",
2929
2: "reserved",
30-
3: "3d",
30+
3: "standalone",
3131
4: "rtk-float",
3232
5: "rtk-fix",
3333
}
@@ -173,7 +173,7 @@ class Position extends protocol.Data:
173173
* - TYPE_INVALID (0): invalid
174174
* - TYPE_FIXED (1): fixed
175175
* - TYPE_RESERVED (2): Can indicate a 2D fix, low accuracy, should be treated as invalid
176-
* - TYPE_3D (3): standalone 3d fix
176+
* - TYPE_STANDALONE (3): standalone 3d fix
177177
* - TYPE_RTK-FLOAT (4): rtk-float
178178
* - TYPE_RTK-FIX (5): rtk-fix
179179
*/

src/messages/m30_transmit_now_gen.toit

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,35 @@ class TransmitNow extends protocol.Data:
3434
return data
3535

3636
/**
37-
* Creates a DO Request message for Transmit Now.
37+
* Creates a Transmit Now message without a specific method.
38+
*
39+
* This is used for messages that don't require a specific method type
40+
* (like GET, SET, SUBSCRIBE) but still need to carry data.
41+
*
42+
* Parameters:
43+
* - data: Optional protocol.Data object containing message payload
3844
*
3945
* Returns: A Message ready to be sent
4046
*/
41-
static do-msg --base-data/protocol.Data?=protocol.Data -> protocol.Message:
42-
return protocol.Message.with-method MT protocol.Header.METHOD-DO base-data
47+
static msg --data/protocol.Data?=protocol.Data -> protocol.Message:
48+
return protocol.Message.with-data MT data
4349

4450
/**
45-
* GPS Search
51+
* 0 = no gps fix required
52+
* 1 = wait for GPS lock (or timeout) before send
4653
*/
4754
gps-search -> bool:
4855
return get-data-bool GPS-SEARCH
4956

5057
/**
51-
* Data to send, can be up to 200 bytes
58+
* Data to send, can be up to 200 bytes.
59+
* Only supported by devices that support uart_blob sensorReading type. (Currently only Vipers)
5260
*/
5361
payload -> ByteArray:
5462
return get-data PAYLOAD
5563

5664
/**
57-
* 0 - 10
65+
* Number of retries [0-10]. Exponential backoff (10 = 25h)
5866
*/
5967
retries -> int:
6068
return get-data-uint RETRIES
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import ..protocol as protocol
2+
3+
// Auto generated class for protocol message
4+
class SIMsettings extends protocol.Data:
5+
6+
static MT := 33
7+
static MT_NAME := "SIMsettings"
8+
9+
static ACTIVE-SIM := 1
10+
static ACTIVE-SIM_SIM1 := 0
11+
static ACTIVE-SIM_SIM2 := 1
12+
13+
static ACTIVE-SIM_STRINGS := {
14+
0: "SIM1",
15+
1: "SIM2",
16+
}
17+
18+
static active-sim-from-int value/int -> string:
19+
return ACTIVE-SIM_STRINGS.get value --if-absent=(: "unknown")
20+
21+
static SIM2-APN := 2
22+
static SIM2-APN-USERNAME := 3
23+
static SIM2-APN-PASSWORD := 4
24+
static SIM2-ICCID := 8
25+
26+
constructor:
27+
super
28+
29+
constructor.from-data data/protocol.Data:
30+
super.from-data data
31+
32+
/**
33+
* Creates a protocol.Data object with all available fields for this message type.
34+
*
35+
* This is a comprehensive helper that accepts all possible fields.
36+
* For method-specific usage, consider using the dedicated request/response methods.
37+
*
38+
* Returns: A protocol.Data object with the specified field values
39+
*/
40+
static data --active-sim/int?=null --sim2-apn/string?=null --sim2-apn-username/string?=null --sim2-apn-password/string?=null --sim2-iccid/string?=null --base-data/protocol.Data?=protocol.Data -> protocol.Data:
41+
data := base-data
42+
if active-sim != null: data.add-data-uint ACTIVE-SIM active-sim
43+
if sim2-apn != null: data.add-data-ascii SIM2-APN sim2-apn
44+
if sim2-apn-username != null: data.add-data-ascii SIM2-APN-USERNAME sim2-apn-username
45+
if sim2-apn-password != null: data.add-data-ascii SIM2-APN-PASSWORD sim2-apn-password
46+
if sim2-iccid != null: data.add-data-ascii SIM2-ICCID sim2-iccid
47+
return data
48+
49+
/**
50+
* Creates a GET Request message for SIM settings.
51+
*
52+
* Returns: A Message ready to be sent
53+
*/
54+
static get-msg --base-data/protocol.Data?=protocol.Data -> protocol.Message:
55+
return protocol.Message.with-method MT protocol.Header.METHOD-GET base-data
56+
57+
/**
58+
* Creates a SET Request message for SIM settings.
59+
*
60+
* Returns: A Message ready to be sent
61+
*/
62+
static set-msg --base-data/protocol.Data?=protocol.Data -> protocol.Message:
63+
return protocol.Message.with-method MT protocol.Header.METHOD-SET base-data
64+
65+
/**
66+
* Activate the specified SIM
67+
* If SIM2 is selected, sending the APN settings is required
68+
*
69+
*
70+
* Valid values:
71+
* - ACTIVE-SIM_SIM1 (0): SIM1
72+
* - ACTIVE-SIM_SIM2 (1): SIM2
73+
*/
74+
active-sim -> int:
75+
return get-data-uint ACTIVE-SIM
76+
77+
/**
78+
* SIM2 APN
79+
*/
80+
sim2-apn -> string:
81+
return get-data-ascii SIM2-APN
82+
83+
/**
84+
* SIM2 APN Username
85+
*/
86+
sim2-apn-username -> string:
87+
return get-data-ascii SIM2-APN-USERNAME
88+
89+
/**
90+
* SIM2 APN Password
91+
*/
92+
sim2-apn-password -> string:
93+
return get-data-ascii SIM2-APN-PASSWORD
94+
95+
/**
96+
* SIM2 ICCID if known, read-only
97+
*/
98+
sim2-iccid -> string:
99+
return get-data-ascii SIM2-ICCID
100+
101+
stringify -> string:
102+
return {
103+
"Active SIM": active-sim,
104+
"SIM2 APN": sim2-apn,
105+
"SIM2 APN Username": sim2-apn-username,
106+
"SIM2 APN Password": sim2-apn-password,
107+
"SIM2 ICCID": sim2-iccid,
108+
}.stringify

src/messages/m34_device_status_gen.toit

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,25 +114,30 @@ class DeviceStatus extends protocol.Data:
114114
return get-data-uint NETWORK-TYPE
115115

116116
/**
117-
* Network MNC
117+
* MNC of the currently connected network.
118+
* Can be 0 if not connected.
119+
* See <a href="https://mcc-mnc.net/" target="_blank">mcc-mnc.net</a>
118120
*/
119121
network-mnc -> int:
120122
return get-data-uint NETWORK-MNC
121123

122124
/**
123-
* Network MCC
125+
* MCC of the currently connected network.
126+
* Can be 0 if not connected.
127+
* See <a href="https://mcc-mnc.net/" target="_blank">mcc-mnc.net</a>
124128
*/
125129
network-mcc -> int:
126130
return get-data-uint NETWORK-MCC
127131

128132
/**
129-
* Firmware Version
133+
* Firmware version as a single integer, e.g. 2287
130134
*/
131135
firmware-version -> int:
132136
return get-data-uint FIRMWARE-VERSION
133137

134138
/**
135-
* Type of device, relates to the SN prefix
139+
* Type of device, relates to the SN prefix.
140+
* For devices released from 2025 onwards, this is documented on the device specification page.
136141
*/
137142
device-type -> int:
138143
return get-data-uint DEVICE-TYPE

src/messages/m35_device_ids_gen.toit

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ class DeviceIDs extends protocol.Data:
4040
return protocol.Message.with-method MT protocol.Header.METHOD-GET base-data
4141

4242
/**
43-
* Unique ID for the device which is used in the cloud API. uint32 or uint64 only
43+
* Unique ID for the device which is used in the cloud API.
44+
* uint32 or uint64 only
4445
*/
4546
id -> int:
4647
return get-data-uint ID

0 commit comments

Comments
 (0)