Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
base.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstdint>
5#include <expected>
6#include <nlohmann/json_fwd.hpp>
7#include <optional>
8#include <string>
9#include <vector>
10
11namespace mm::comm {
12
20 std::string macLinux;
21 std::string macWindows;
22 std::string name;
29 std::string description;
30};
31
39void to_json(nlohmann::json& j, const NetworkAdapter& a);
40
49bool isMacAddress(const std::string& s);
50
60std::string normalizeMac(const std::string& raw, char sep);
61
71std::optional<std::array<uint8_t, 6>> parseMac(const std::string& s);
72
100std::vector<NetworkAdapter> enumerateNetworkAdapters();
101
114std::expected<NetworkAdapter, std::string> resolveNetworkAdapter(const std::string& input);
115
116} // namespace mm::comm
Definition al_status_codes.cc:5
void to_json(nlohmann::json &j, const AlStatusCode &c)
Serialises an AlStatusCode to JSON.
Definition al_status_codes.cc:7
std::optional< std::array< uint8_t, 6 > > parseMac(const std::string &s)
Decodes a MAC address string into its six bytes, in wire order.
Definition base.cc:109
bool isMacAddress(const std::string &s)
Returns true if s is a MAC address in either Linux (:) or Windows (-) separator format.
Definition base.cc:88
std::expected< NetworkAdapter, std::string > resolveNetworkAdapter(const std::string &input)
Resolves a network adapter specifier to a fully populated NetworkAdapter.
Definition base.cc:244
std::vector< NetworkAdapter > enumerateNetworkAdapters()
Enumerates all network adapters visible to the OS.
Definition base.cc:124
std::string normalizeMac(const std::string &raw, char sep)
Normalises a MAC address string to uppercase with the given separator.
Definition base.cc:96
Definition base.h:19
std::string macLinux
Colon-separated uppercase MAC, e.g. "AA:BB:CC:DD:EE:FF".
Definition base.h:20
std::string name
Definition base.h:22
std::string macWindows
Dash-separated uppercase MAC, e.g. "AA-BB-CC-DD-EE-FF".
Definition base.h:21
std::string description
Definition base.h:29