REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
Loading...
Searching...
No Matches
ethernet.h
Go to the documentation of this file.
1// Copyright (c) 2023 anabrid GmbH
2// Contact: https://www.anabrid.com/licensing/
3// SPDX-License-Identifier: MIT OR GPL-2.0-or-later
4
5#pragma once
6
7#ifdef ARDUINO
8
9#include <Ethernet.h>
10#include <QNEthernet.h>
11#include <string>
12
14#include "utils/durations.h"
15#include "utils/mac.h"
16#include "utils/singleton.h"
17
18#include "net/auth.h"
19
20namespace net {
21
22// import some practical classes
23using qindesign::network::Ethernet;
24using qindesign::network::EthernetClient;
25using qindesign::network::EthernetServer;
26using qindesign::network::MDNS;
27
29
31void status(JsonObject &msg_out);
32
41public:
42 void reset_defaults();
43
44 std::string name() const { return "net"; }
45
49
56
59
61 std::string hostname;
62
63 IPAddress static_ipaddr,
67
68 // from here on, we have runtime connection settings
69
72
73 int begin_ip();
74 void begin_mdns();
75 // void begin();
76
77 void fromJson(JsonObjectConst src, nvmconfig::Context c = nvmconfig::Context::Flash) override;
78 void toJson(JsonObject target, nvmconfig::Context c = nvmconfig::Context::Flash) const override;
79};
80
82
87/* class RuntimeConfig : nvmconfig::PersistentSettings {
88 void reset_defaults();
89
90 static RuntimeConfig& get() {
91 static RuntimeConfig instance;
92 return instance;
93 }
94 };
95*/
96
97} // namespace net
98
99#endif // ARDUINO
Persistent user-defined ethernet settings which is mostly relevant only during startup as the informa...
Definition ethernet.h:40
bool enable_ethernet
Turn on/off networking completely.
Definition ethernet.h:50
std::string name() const
Definition ethernet.h:44
int begin_ip()
Calls net::Ethernet.begin, sets IP address.
Definition ethernet.cpp:100
void toJson(JsonObject target, nvmconfig::Context c=nvmconfig::Context::Flash) const override
Definition ethernet.cpp:83
void fromJson(JsonObjectConst src, nvmconfig::Context c=nvmconfig::Context::Flash) override
Definition ethernet.cpp:61
IPAddress static_netmask
netmask; used only when use_dhcp=false
Definition ethernet.h:64
int jsonl_port
TCP port for jsonl server.
Definition ethernet.h:57
void begin_mdns()
Calls net::MDNS.begin.
Definition ethernet.cpp:156
IPAddress static_dns
DNS server address; used only when use_dhcp=false.
Definition ethernet.h:66
bool enable_mdns
Enable mDNS/zeroconf multicast service discovery.
Definition ethernet.h:55
bool enable_dhcp
DHCP client vs static IP configuration.
Definition ethernet.h:51
bool enable_webserver
Enable embedded webserver for REST access.
Definition ethernet.h:53
bool enable_websockets
Enable websocket server ontop of webserver.
Definition ethernet.h:54
int webserver_port
TCP port for webserver.
Definition ethernet.h:58
IPAddress static_ipaddr
own ip address, used only when use_dhcp=false
Definition ethernet.h:63
MacAddress mac
Custom MAC address. Defaults to original permanent system Mac.
Definition ethernet.h:60
uint8_t max_connections
(Runtime-changable) Maximum number of parallel connections accepted
Definition ethernet.h:71
std::string hostname
used only for DHCP client. Maximum 250 characters.
Definition ethernet.h:61
IPAddress static_gw
gateway address; used only when use_dhcp=false
Definition ethernet.h:65
uint32_t connection_timeout_ms
(Runtime-changable) Time after idling connections time out.
Definition ethernet.h:70
bool enable_jsonl
Enable the JSONL TCP/IP server.
Definition ethernet.h:52
StartupConfig()
Initializes with default values which are always valid and serve as a fallback if invalid options are...
Definition ethernet.h:48
Define singletons which are not static-space allocated (and thus consume valuable ICTM space).
Definition singleton.h:46
utils::status status
Definition daq.h:28
uint32_t
Definition flasher.cpp:195
uint32_t src
Definition flasher.cpp:63
#define JSON_CONVERT_SUGAR(type)
Definition json.h:11
Definition auth.h:22
@ Flash
Flash-Facing (writing/reading)
Represents Ethernet Mac address.
Definition mac.h:26