Motion Master 6.0.0-alpha.50
Next-generation motion control software
Loading...
Searching...
No Matches
process_data_dump.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <cstdint>
5#include <expected>
6#include <functional>
7#include <ostream>
8#include <string>
9#include <vector>
10
12
13namespace mm::node {
14
47
49inline constexpr std::array<char, 4> kDumpMagic = {'M', 'M', 'P', 'D'};
50
53inline constexpr uint16_t kDumpFormatVersion = 1;
54
57inline constexpr std::streamoff kDumpRowCountOffset = 16;
58
61 uint16_t index = 0;
62 uint8_t subindex = 0;
63 bool isOutput = false;
64 uint16_t dataType = 0;
65 uint16_t bitLength = 0;
66 uint32_t bitOffset = 0;
67 std::string name;
68};
69
71struct DumpDevice {
72 uint16_t slavePosition = 0;
73 uint32_t vendorId = 0;
74 uint32_t productCode = 0;
75 uint32_t revisionNumber = 0;
76 uint32_t serialNumber = 0;
77 std::string name;
78 std::vector<DumpPdoEntry> entries;
79};
80
82struct DumpHeader {
83 uint32_t inputBytes = 0;
84 uint32_t outputBytes = 0;
85 std::vector<DumpDevice> devices;
86};
87
90using DumpRecordReader = std::function<bool(uint64_t seq, ProcessDataRing::Record& out)>;
91
103std::expected<uint64_t, std::string> writeProcessDataDump(std::ostream& out,
104 const DumpHeader& header,
105 uint64_t startSeq, uint64_t endSeq,
106 const DumpRecordReader& read);
107
108} // namespace mm::node
Definition http_server.h:16
std::expected< uint64_t, std::string > writeProcessDataDump(std::ostream &out, const DumpHeader &header, uint64_t startSeq, uint64_t endSeq, const DumpRecordReader &read)
Serialises the frozen span [startSeq, endSeq) to out as a .mmpd dump.
Definition process_data_dump.cc:69
constexpr uint16_t kDumpFormatVersion
Current dump format version. A reader rejects an unknown major shape; bump on layout changes so old f...
Definition process_data_dump.h:53
constexpr std::streamoff kDumpRowCountOffset
Byte offset of the rowCount field within the fixed prefix. The writer streams rows first,...
Definition process_data_dump.h:57
constexpr std::array< char, 4 > kDumpMagic
Magic at the very start of every dump file.
Definition process_data_dump.h:49
std::function< bool(uint64_t seq, ProcessDataRing::Record &out)> DumpRecordReader
Reads the record for seq into out; returns false if it is no longer available (lapped or a torn read)...
Definition process_data_dump.h:90
One device's identity and the PDO objects it contributes to the image.
Definition process_data_dump.h:71
uint32_t revisionNumber
Definition process_data_dump.h:75
std::string name
Definition process_data_dump.h:77
uint32_t vendorId
Definition process_data_dump.h:73
uint32_t serialNumber
Definition process_data_dump.h:76
std::vector< DumpPdoEntry > entries
Definition process_data_dump.h:78
uint32_t productCode
Definition process_data_dump.h:74
uint16_t slavePosition
Definition process_data_dump.h:72
The embedded process-image header: everything needed to decode the rows offline.
Definition process_data_dump.h:82
std::vector< DumpDevice > devices
Definition process_data_dump.h:85
uint32_t outputBytes
Per-row output region size.
Definition process_data_dump.h:84
uint32_t inputBytes
Per-row input region size (the published image's input size).
Definition process_data_dump.h:83
One PDO-mapped object as recorded in the dump header.
Definition process_data_dump.h:60
uint32_t bitOffset
Absolute bit offset within its direction's image.
Definition process_data_dump.h:66
std::string name
Object name, or empty when the OD was not enumerated.
Definition process_data_dump.h:67
uint16_t dataType
ETG.1020 data-type code, or 0 when the OD was not enumerated.
Definition process_data_dump.h:64
uint8_t subindex
Definition process_data_dump.h:62
uint16_t bitLength
Width of the value in bits.
Definition process_data_dump.h:65
uint16_t index
Definition process_data_dump.h:61
bool isOutput
True for an RxPDO output, false for a TxPDO input.
Definition process_data_dump.h:63
One recorded cycle, copied out by a reader. inputs / outputs are the raw IOmap bytes for that cycle (...
Definition process_data_ring.h:38