Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
firmware_package.h File Reference

What a SOMANET firmware package is, offline: how its filename decodes, what its zip holds, and which hardware it belongs on. More...

#include <array>
#include <cstdint>
#include <expected>
#include <nlohmann/json_fwd.hpp>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <vector>
#include "node/hardware_description.h"
#include "node/integro_variant.h"
Include dependency graph for firmware_package.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mm::node::FirmwarePackageName
 A SOMANET firmware package filename, broken into the five fields the naming convention defines (Hardware description specification §3.4.2). More...
 
struct  mm::node::FirmwarePackageFile
 One entry of a package, extracted. More...
 
struct  mm::node::FirmwarePackage
 A firmware package's contents, sorted by where each entry is going. More...
 
struct  mm::node::FullFirmwareDescriptors
 The full firmware descriptors one device accepts firmware under (specification §3.4.1). More...
 
struct  mm::node::FirmwareCompatibility
 The verdict on one package against one device. More...
 

Namespaces

namespace  mm
 
namespace  mm::node
 

Enumerations

enum class  mm::node::FirmwareMatch { mm::node::kNone , mm::node::kAssembly , mm::node::kDevice }
 Which of a device's descriptors a package matched. More...
 

Functions

std::expected< FirmwarePackageName, std::string > mm::node::parseFirmwarePackageName (std::string_view filename)
 Decodes filename as a SOMANET firmware package name.
 
void mm::node::to_json (nlohmann::json &j, const FirmwarePackageName &name)
 Serialises a decoded package name — the body of GET /api/firmware-package-name.
 
std::expected< FirmwarePackage, std::string > mm::node::openFirmwarePackage (std::span< const uint8_t > zip, std::span< const std::string > skipFiles)
 Reads a firmware package zip held in memory, dropping the entries named in skipFiles.
 
FullFirmwareDescriptors mm::node::fullFirmwareDescriptors (const HardwareDescription &description, const IntegroVariant *variant)
 Assembles the descriptors description accepts, appending variant's fieldbus character when there is one.
 
std::string_view mm::node::toString (FirmwareMatch match)
 What a match is called, for a message or a JSON body: "none", "assembly", "device".
 
FirmwareCompatibility mm::node::checkFirmwareCompatibility (const HardwareDescription &description, const FirmwarePackageName &packageName, const IntegroVariant *variant=nullptr)
 Decides whether packageName belongs on the hardware description describes.
 
std::expected< FirmwareCompatibility, std::string > mm::node::checkFirmwareCompatibility (std::string_view hardwareDescriptionContent, std::string_view packageFilename, const IntegroVariant *variant=nullptr)
 Parses both inputs, then decides — the whole check from a file's text and a filename.
 
void mm::node::to_json (nlohmann::json &j, const FullFirmwareDescriptors &descriptors)
 Serialises the descriptors and a verdict.
 
void mm::node::to_json (nlohmann::json &j, const FirmwareCompatibility &compatibility)
 

Variables

constexpr std::array< std::string_view, 2 > mm::node::kDefaultSkippedFirmwareFiles
 The entries an install skips unless the request names a different set.
 

Detailed Description

What a SOMANET firmware package is, offline: how its filename decodes, what its zip holds, and which hardware it belongs on.

Pure transform over bytes and text — no fieldbus, no filesystem, no HTTP — so the rules that decide what gets written to a drive are unit-testable against real packages without hardware. The installing half is the firmware installation procedure in somanet_procedures.h.

Names follow the Hardware description specification §3.3, which is worth reading once because two of its terms are easy to swap: a package's fullFirmwareDescriptor is the whole <firmwareId>-<firmwareVersion>[-<keyId>[-<fieldbusProtocol>]] string, while firmwareVersion alone is the hardware revision inside it ("04") and has nothing to do with the software version the filename ends with ("v5.6.10"). Hence softwareName / softwareVersion for that pair.