2626#define URL_SIZE 256
2727#define ID_SIZE 16
2828#define MAX_LIB_VERSION_SIZE 10
29- #define UID_SIZE 32
30- #define SIGNATURE_SIZE 246
29+ #define UHWID_SIZE 32
30+ #define PROVISIONING_JWT_SIZE 246
31+ #define WIFI_SSID_SIZE 33 // Max length of ssid is 32 + \0
32+ #define WIFI_PWD_SIZE 64 // Max length of password is 63 + \0
33+ #define LORA_APPEUI_SIZE 17 // appeui is 8 octets * 2 (hex format) + \0
34+ #define LORA_APPKEY_SIZE 33 // appeui is 16 octets * 2 (hex format) + \0
35+ #define LORA_CHANNEL_MASK_SIZE 13
36+ #define LORA_DEVICE_CLASS_SIZE 2 // 1 char + \0
37+ #define PIN_SIZE 9 // 8 digits + \0
38+ #define APN_SIZE 101 // Max length of apn is 100 + \0
39+ #define LOGIN_SIZE 65 // Max length of login is 64 + \0
40+ #define PASS_SIZE 65 // Max length of password is 64 + \0
41+ #define BAND_SIZE 4
42+ #define MAX_WIFI_NETWORKS 20
43+ #define MAX_IP_SIZE 16
3144
3245/******************************************************************************
3346 TYPEDEF
@@ -67,8 +80,8 @@ enum CommandId: uint32_t {
6780 /* Provisioning commands*/
6881 ProvisioningStatus ,
6982 ProvisioningListWifiNetworks ,
70- ProvisioningUniqueId ,
71- ProvisioningSignature ,
83+ ProvisioningUniqueHardwareId ,
84+ ProvisioningJWT ,
7285 ProvisioningTimestamp ,
7386 ProvisioningCommands ,
7487 ProvisioningWifiConfig ,
@@ -180,22 +193,22 @@ struct WiFiNetwork {
180193struct ProvisioningListWifiNetworksMessage {
181194 Command c ;
182195 struct {
183- WiFiNetwork discoveredWifiNetworks [20 ];
196+ WiFiNetwork discoveredWifiNetworks [MAX_WIFI_NETWORKS ];
184197 uint8_t numDiscoveredWiFiNetworks = 0 ;
185198 } params ;
186199};
187200
188- struct ProvisioningUniqueIdMessage {
201+ struct ProvisioningUniqueHardwareIdMessage {
189202 Command c ;
190203 struct {
191- char uniqueId [ 32 ]; //The payload is an array of char with a maximum length of 32, not null terminated. It's not a string.
204+ char uniqueHardwareId [ UHWID_SIZE ]; //The payload is an array of char with a maximum length of 32, not null terminated. It's not a string.
192205 } params ;
193206};
194207
195- struct ProvisioningSignatureMessage {
208+ struct ProvisioningJWTMessage {
196209 Command c ;
197210 struct {
198- char signature [ 246 ]; //The payload is an array of char with a maximum length of 246, not null terminated. It's not a string.
211+ char jwt [ PROVISIONING_JWT_SIZE ]; //The payload is an array of char with a maximum length of 246, not null terminated. It's not a string.
199212 } params ;
200213};
201214
@@ -216,30 +229,30 @@ struct ProvisioningCommandsMessage {
216229struct ProvisioningWifiConfigMessage {
217230 Command c ;
218231 struct {
219- char ssid [33 ]; // Max length of ssid is 32 + \0
220- char pwd [64 ]; // Max length of password is 63 + \0
232+ char ssid [WIFI_SSID_SIZE ];
233+ char pwd [WIFI_PWD_SIZE ];
221234 } params ;
222235};
223236
224237struct ProvisioningLoRaConfigMessage {
225238 Command c ;
226239 struct {
227- char appeui [17 ]; // appeui is 8 octets * 2 (hex format) + \0
228- char appkey [33 ]; // appeui is 16 octets * 2 (hex format) + \0
240+ char appeui [LORA_APPEUI_SIZE ];
241+ char appkey [LORA_APPKEY_SIZE ];
229242 uint8_t band ;
230- char channelMask [13 ];
231- char deviceClass [2 ];
243+ char channelMask [LORA_CHANNEL_MASK_SIZE ];
244+ char deviceClass [LORA_DEVICE_CLASS_SIZE ];
232245 } params ;
233246};
234247
235248struct ProvisioningCATM1ConfigMessage {
236249 Command c ;
237250 struct {
238- char pin [9 ];
239- char apn [101 ]; // Max length of apn is 100 + \0
240- char login [65 ];
241- char pass [65 ];
242- uint32_t band [4 ];
251+ char pin [PIN_SIZE ];
252+ char apn [APN_SIZE ];
253+ char login [LOGIN_SIZE ];
254+ char pass [PASS_SIZE ];
255+ uint32_t band [BAND_SIZE ];
243256 } params ;
244257};
245258
@@ -249,7 +262,7 @@ struct ProvisioningIPStruct{
249262 IPV6
250263 };
251264 IPType type ;
252- uint8_t ip [16 ];
265+ uint8_t ip [MAX_IP_SIZE ];
253266};
254267
255268struct ProvisioningEthernetConfigMessage {
@@ -268,10 +281,10 @@ struct ProvisioningEthernetConfigMessage {
268281struct ProvisioningCellularConfigMessage {
269282 Command c ;
270283 struct {
271- char pin [9 ];
272- char apn [101 ]; // Max length of apn is 100 + \0
273- char login [65 ];
274- char pass [65 ];
284+ char pin [PIN_SIZE ];
285+ char apn [APN_SIZE ];
286+ char login [LOGIN_SIZE ];
287+ char pass [PASS_SIZE ];
275288 } params ;
276289};
277290
0 commit comments