forked from arduino-libraries/Arduino_ConnectionHandler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings_default.h
More file actions
72 lines (58 loc) · 2.11 KB
/
settings_default.h
File metadata and controls
72 lines (58 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
This file is part of the Arduino_ConnectionHandler library.
Copyright (c) 2024 Arduino SA
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#pragma once
#include "settings.h"
namespace models {
/*
* if the cpp version is older than cpp14 then a constexpr function cannot include
* other than a simple return statement, thsu we can define it only as inline
*/
#if __cplusplus > 201103L
constexpr NetworkSetting settingsDefault(NetworkAdapter type) {
#else
inline NetworkSetting settingsDefault(NetworkAdapter type) {
#endif
NetworkSetting res = {type, {}};
switch(type) {
#if defined(BOARD_HAS_ETHERNET)
case NetworkAdapter::ETHERNET:
res.eth.timeout = 15000;
res.eth.response_timeout = 4000;
break;
#endif //defined(BOARD_HAS_ETHERNET)
#if defined(BOARD_HAS_CATM1_NBIOT)
case NetworkAdapter::CATM1:
res.catm1.rat = 7; // CATM1
res.catm1.band = 0x04 | 0x80000 | 0x40000; // BAND_3 | BAND_20 | BAND_19
break;
#endif //defined(BOARD_HAS_CATM1_NBIOT)
#if defined(BOARD_HAS_LORA)
case NetworkAdapter::LORA:
res.lora.band = 5; // _lora_band::EU868
res.lora.channelMask[0] = '\0';
res.lora.deviceClass = 'A'; // _lora_class::CLASS_A
break;
#endif //defined(BOARD_HAS_LORA)
#if defined(BOARD_HAS_WIFI)
case NetworkAdapter::WIFI: // nothing todo, default optional values are fine with 0
#endif //defined(BOARD_HAS_WIFI)
#if defined(BOARD_HAS_NB)
case NetworkAdapter::NB: // nothing todo, default optional values are fine with 0
#endif //defined(BOARD_HAS_NB)
#if defined(BOARD_HAS_GSM)
case NetworkAdapter::GSM: // nothing todo, default optional values are fine with 0
#endif //defined(BOARD_HAS_GSM)
#if defined(BOARD_HAS_CELLULAR)
case NetworkAdapter::CELL: // nothing todo, default optional values are fine with 0
#endif //defined(BOARD_HAS_CELLULAR)
default:
(void) 0;
}
return res;
}
}