Skip to content

Commit a0f3441

Browse files
defining interface settings in a struct
1 parent bbaabd2 commit a0f3441

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

src/settings/settings.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* This file is part of ArduinoIoTCloud.
3+
*
4+
* Copyright 2019 ARDUINO SA (http://www.arduino.cc/)
5+
*
6+
* This software is released under the GNU General Public License version 3,
7+
* which covers the main part of arduino-cli.
8+
* The terms of this license can be found at:
9+
* https://www.gnu.org/licenses/gpl-3.0.en.html
10+
*
11+
* You can be released from the requirements of the above licenses by purchasing
12+
* a commercial license. Buying such a license is mandatory if you want to modify or
13+
* otherwise use the software for commercial activities involving the Arduino
14+
* software without disclosing the source code of your own applications. To purchase
15+
* a commercial license, send an email to [email protected].
16+
*/
17+
18+
#pragma once
19+
20+
#include "Arduino_ConnectionHandlerDefinitions.h"
21+
#include <stdint.h>
22+
23+
namespace models {
24+
struct WiFiSetting {
25+
char ssid[33]; // Max length of ssid is 32 + \0
26+
char pwd[64]; // Max length of password is 63 + \0
27+
};
28+
29+
struct EthernetSetting {
30+
IPAddress ip;
31+
IPAddress dns;
32+
IPAddress gateway;
33+
IPAddress netmask;
34+
unsigned long timeout;
35+
unsigned long response_timeout;
36+
};
37+
38+
struct CellularSetting {
39+
char pin[8];
40+
char apn[101]; // Max length of apn is 100 + \0
41+
char login[32];
42+
char pass[32];
43+
};
44+
45+
typedef CellularSetting GSMSetting;
46+
typedef CellularSetting NBSetting;
47+
typedef CellularSetting CATM1Setting;
48+
49+
struct LoraSetting {
50+
char appeui[17]; // appeui is 8 octets * 2 (hex format) + \0
51+
char appkey[33]; // appeui is 16 octets * 2 (hex format) + \0
52+
_lora_band band;
53+
char channelMask[33]; //
54+
_lora_class deviceClass;
55+
};
56+
57+
struct NetworkSetting {
58+
NetworkAdapter type;
59+
union {
60+
WiFiSetting wifi;
61+
CatM1Setting catM1;
62+
GSMSetting gsm;
63+
NBSetting nb;
64+
LoraSetting lora;
65+
} values;
66+
};
67+
}

0 commit comments

Comments
 (0)