|
Motion Master 6.0.0-alpha.86
Next-generation motion control software
|
The .variant file: which features a SOMANET Integro was licensed with, and the fieldbus character its firmware descriptor carries.
More...
#include <array>#include <cstdint>#include <expected>#include <nlohmann/json_fwd.hpp>#include <optional>#include <span>#include <string>#include <string_view>#include <vector>Go to the source code of this file.
Classes | |
| struct | mm::node::IntegroVariantOption |
| One entry of the Integro runtime-variant option catalogue. More... | |
| struct | mm::node::IntegroVariant |
A parsed .variant file. More... | |
Namespaces | |
| namespace | mm |
| namespace | mm::node |
Enumerations | |
| enum class | mm::node::VariantOperationMode : uint16_t { mm::node::kPassive = 0x51 , mm::node::kTrial = 0x53 , mm::node::kProduction = 0x55 , mm::node::kLive = 0x57 } |
How the drive treats its variant options (firmware OPTIONS_MODE_*). More... | |
Functions | |
| std::string_view | mm::node::toString (VariantOperationMode mode) |
| The mode's name, or "unknown" for a value no firmware release defines. | |
| std::span< const IntegroVariantOption > | mm::node::integroVariantOptions () |
| The whole catalogue, in code order. | |
| const IntegroVariantOption * | mm::node::integroVariantOption (uint16_t id) |
| Looks a code up in the catalogue. | |
| void | mm::node::to_json (nlohmann::json &j, const IntegroVariantOption &option) |
Serialises one catalogue entry — the body of GET /api/integro-variant/options. | |
| std::expected< IntegroVariant, std::string > | mm::node::parseIntegroVariant (std::span< const uint8_t > content) |
Decodes content as a .variant file. | |
| std::optional< uint16_t > | mm::node::variantFieldbusProtocol (const IntegroVariant &variant) |
| The selected fieldbus protocol, for the tail of a full firmware descriptor (specification §3.4.2.1). | |
| void | mm::node::to_json (nlohmann::json &j, const IntegroVariant &variant) |
| Serialises a parsed file. | |
Variables | |
| constexpr uint16_t | mm::node::kMaxVariantOptions = 32 |
The most options a file may carry (firmware MAX_VARIANTS_COUNT). | |
The .variant file: which features a SOMANET Integro was licensed with, and the fieldbus character its firmware descriptor carries.
Pure transform over bytes — no fieldbus, no filesystem, no HTTP. It exists here for one concrete reason: the Hardware description specification §3.4.2.1 notes that the fieldbus protocol does not appear in the hardware description and lives in this file instead, so a full firmware descriptor ending in a fieldbus character cannot be assembled without reading it. Everything else it decodes is a bonus that comes free with the header.
The layout is taken from the firmware that writes and reads it (App_Utils.h / AppUtil_GetVariantData in somanet_software), not from a specification — there is none — and verified against real files. A 128-byte header:
| Offset | Size | Field |
|---|---|---|
| 0 | 4 | file version |
| 4 | 64 | signature |
| 68 | 12 | netX chip id |
| 80 | 24 | device serial number, NUL-padded |
| 104 | 8 | MAC address — 2 bytes of padding, then the 6 bytes |
| 112 | 4 | customer id |
| 116 | 2 | operation mode |
| 118 | 10 | reserved |
followed by the variant data section: two reserved bytes, a two-byte option count, then that many two-byte option codes. All little-endian and packed.
Named for the Integro because the option catalogue is: the firmware's own comment beside it reads "These are option list for Integro. Other devices (even newer Integros) might have a different options list in the future". The file layout itself is not Integro-specific, so a device of another kind carrying one would still decode — only its option meanings would be a guess, which is why an unknown code is reported as unknown rather than dropped.