77 return "communication";
81 return "manufacturer";
96 std::chrono::milliseconds
settle{1000};
162 std::expected<uint32_t, std::string>
deviceType()
const;
170 std::expected<int32_t, std::string>
cobIdSync()
const;
173 std::expected<void, std::string>
setCobIdSync(int32_t value);
194 std::expected<uint16_t, std::string>
guardTime()
const;
197 std::expected<void, std::string>
setGuardTime(uint16_t value);
279 RestoreGroup group,
const RestoreDefaultParametersConfig& config = {});
300 std::expected<Identity, std::string>
identity()
const;
311 std::expected<std::vector<uint8_t>, std::string>
osCommand()
const;
315 std::expected<void, std::string>
setOsCommand(
const std::vector<uint8_t>& command);
Represents a single node on the fieldbus.
Definition device.h:116
Root of the drive-profile view hierarchy — a concrete, instantiable, borrowed view over a Device that...
Definition profile_device.h:151
Device & device()
The underlying generic device this view operates on.
Definition profile_device.h:157
std::expected< void, std::string > setCommunicationCyclePeriod(int32_t value)
Writes the communication cycle period (0x1006, INTEGER32, µs).
Definition profile_device.cc:100
std::expected< uint32_t, std::string > deviceType() const
Reads the device type (0x1000, UNSIGNED32) — the device profile the object dictionary implements (low...
Definition profile_device.cc:80
std::expected< uint8_t, std::string > osCommandStatus() const
Reads the OS command status (0x1023:02, UNSIGNED8). Read-only but volatile (it tracks the last issued...
Definition profile_device.cc:263
std::expected< void, std::string > setSynchronousCounterOverflowValue(uint8_t value)
Writes the synchronous counter overflow value (0x1019, UNSIGNED8).
Definition profile_device.cc:251
std::expected< uint8_t, std::string > errorRegister() const
Reads the error register (0x1001, UNSIGNED8) — the active error class bit field (bit 0 = generic erro...
Definition profile_device.cc:84
ProfileDevice(Device &device)
Binds an (unchecked) view to device. Prefer createProfileDevice.
Definition profile_device.h:154
std::expected< void, std::string > setProducerHeartbeatTime(uint16_t value)
Writes the producer heartbeat time (0x1017, UNSIGNED16, ms).
Definition profile_device.cc:223
std::expected< uint8_t, std::string > synchronousCounterOverflowValue() const
Reads the synchronous counter overflow value (0x1019, UNSIGNED8). Writable, so every call re-reads th...
Definition profile_device.cc:247
std::expected< void, std::string > runRestoreDefaultParameters(RestoreGroup group, const RestoreDefaultParametersConfig &config={})
Commands a restore of default parameters (0x1011) and waits for the device to confirm.
Definition profile_device.cc:187
std::expected< uint8_t, std::string > lifeTimeFactor() const
Reads the node guarding life time factor (0x100D, UNSIGNED8). Writable, so every call re-reads the de...
Definition profile_device.cc:120
std::expected< std::string, std::string > manufacturerSoftwareVersion() const
Reads the manufacturer software version (0x100A, VISIBLE_STRING) — the firmware version.
Definition profile_device.cc:108
std::expected< Identity, std::string > identity() const
Reads the identity object (0x1018) — vendor ID, product code, revision, serial.
Definition profile_device.cc:227
std::expected< void, std::string > setConsumerHeartbeatTime(uint32_t value)
Writes the consumer heartbeat time (0x1016:01, UNSIGNED32, ms — node ID in bits 16-23).
Definition profile_device.cc:215
std::expected< void, std::string > runStoreParameters(const StoreParametersConfig &config={})
Commands a parameter store (0x1010) and waits for the device to confirm it completed.
Definition profile_device.cc:136
std::expected< void, std::string > setRestoreApplicationDefaultParameters(uint32_t signature)
Writes "restore application default parameters" (0x1011:03, UNSIGNED32) — the ASCII "load" signature ...
Definition profile_device.cc:177
std::expected< void, std::string > setOsCommandMode(uint8_t mode)
Writes the OS command mode (0x1024, UNSIGNED8). Write-only on the device — there is no matching gette...
Definition profile_device.cc:271
std::expected< int32_t, std::string > communicationCyclePeriod() const
Reads the communication cycle period (0x1006, INTEGER32, µs). Writable, so every call re-reads the de...
Definition profile_device.cc:96
std::expected< void, std::string > setRestoreAllDefaultParameters(uint32_t signature)
Writes "restore all default parameters" (0x1011:01, UNSIGNED32). Writing the ASCII "load" signature (...
Definition profile_device.cc:168
std::expected< void, std::string > setRestoreManufacturerDefaultParameters(uint32_t signature)
Writes "restore manufacturer-defined default parameters" (0x1011:04, UNSIGNED32) — the ASCII "load" s...
Definition profile_device.cc:182
std::expected< uint16_t, std::string > producerHeartbeatTime() const
Reads the producer heartbeat time (0x1017, UNSIGNED16, ms). Writable, so every call re-reads the devi...
Definition profile_device.cc:219
std::expected< std::vector< uint8_t >, std::string > osCommandResponse() const
Reads the OS command response bytes (0x1023:03, 8 bytes). Read-only but volatile (it tracks the last ...
Definition profile_device.cc:267
std::expected< void, std::string > setCobIdSync(int32_t value)
Writes the COB-ID of the SYNC message (0x1005, INTEGER32).
Definition profile_device.cc:92
std::expected< void, std::string > setStoreParameters(uint32_t signature)
Writes "save all parameters" (0x1010:01, UNSIGNED32). Writing the ASCII "save" signature (0x65766173)...
Definition profile_device.cc:132
std::expected< uint32_t, std::string > consumerHeartbeatTime() const
Reads the consumer heartbeat time (0x1016:01, UNSIGNED32, ms — node ID in bits 16-23)....
Definition profile_device.cc:211
std::expected< uint32_t, std::string > storeParameters() const
Reads "save all parameters" (0x1010:01, UNSIGNED32) — the save capability (bit 0 = device saves on co...
Definition profile_device.cc:128
std::expected< int32_t, std::string > cobIdSync() const
Reads the COB-ID of the SYNC message (0x1005, INTEGER32). Writable, so every call re-reads the device...
Definition profile_device.cc:88
std::expected< void, std::string > setGuardTime(uint16_t value)
Writes the node guarding guard time (0x100C, UNSIGNED16, ms).
Definition profile_device.cc:116
Device & device_
The borrowed device — the only data member permitted in the whole view chain.
Definition profile_device.h:331
std::expected< RestoreDefaultParameters, std::string > restoreDefaultParameters() const
Reads the restore-default-parameters object (0x1011) — the restore capability of all four groups....
Definition profile_device.cc:143
const Device & device() const
Definition profile_device.h:158
std::expected< uint16_t, std::string > guardTime() const
Reads the node guarding guard time (0x100C, UNSIGNED16, ms). Writable, so every call re-reads the dev...
Definition profile_device.cc:112
std::expected< std::vector< uint8_t >, std::string > osCommand() const
Reads back the OS command bytes (0x1023:01, 8 bytes). Writable (this is the command the caller last i...
Definition profile_device.cc:255
std::expected< std::string, std::string > manufacturerDeviceName() const
Reads the manufacturer device name (0x1008, VISIBLE_STRING).
Definition profile_device.cc:104
std::expected< void, std::string > setLifeTimeFactor(uint8_t value)
Writes the node guarding life time factor (0x100D, UNSIGNED8).
Definition profile_device.cc:124
std::expected< void, std::string > setRestoreCommunicationDefaultParameters(uint32_t signature)
Writes "restore communication default parameters" (0x1011:02, UNSIGNED32) — the ASCII "load" signatur...
Definition profile_device.cc:172
std::expected< void, std::string > setOsCommand(const std::vector< uint8_t > &command)
Writes the OS command bytes (0x1023:01, 8 bytes) — issues an OS command; poll osCommandStatus / osCom...
Definition profile_device.cc:259
Definition bus_health_source.h:7
std::string_view toString(FirmwareMatch match)
What a match is called, for a message or a JSON body: "none", "assembly", "device".
Definition firmware_package.cc:295
@ kManufacturer
Defined by the vendor; 0x6502 has no bit this code can read for it.
RestoreGroup
Which group of default parameters to restore (which 0x1011 sub-entry to command). The enum value is t...
Definition profile_device.h:59
@ kCommunication
0x1011:02 — communication default parameters.
@ kApplication
0x1011:03 — application default parameters.
@ kManufacturer
0x1011:04 — manufacturer-defined default parameters.
@ kAll
0x1011:01 — all default parameters.
GenericObject
Generic CANopen device-profile (CiA301) object indices — present on any CoE device,...
Definition profile_device.h:19
@ kDeviceType
UNSIGNED32, ro — mandatory; the device profile it speaks.
Definition profile_device.h:20
@ kRestoreDefaultParameters
RECORD, rw — restore default parameters.
Definition profile_device.h:29
@ kOsCommandMode
UNSIGNED8, wo — write-only, not readable; setter only.
Definition profile_device.h:35
@ kGuardTime
UNSIGNED16, rw — node guarding guard time in ms.
Definition profile_device.h:26
@ kLifeTimeFactor
UNSIGNED8, rw — node guarding life time factor.
Definition profile_device.h:27
@ kOsCommand
RECORD — command (rw) / status + response (ro, volatile).
Definition profile_device.h:34
@ kStoreParameters
RECORD, rw — save parameters to non-volatile storage.
Definition profile_device.h:28
@ kErrorRegister
UNSIGNED8, ro (volatile) — active error class bit field.
Definition profile_device.h:21
@ kConsumerHeartbeatTime
RECORD, rw — consumer heartbeat time in ms.
Definition profile_device.h:30
@ kManufacturerSoftwareVersion
VISIBLE_STRING, ro — firmware/software version.
Definition profile_device.h:25
@ kManufacturerDeviceName
VISIBLE_STRING, ro — human-readable device name.
Definition profile_device.h:24
@ kCommunicationCyclePeriod
INTEGER32, rw — communication cycle period in µs.
Definition profile_device.h:23
@ kIdentity
IDENTITY record, ro — vendor/product/revision/serial.
Definition profile_device.h:32
@ kCobIdSync
INTEGER32, rw — COB-ID of the SYNC message.
Definition profile_device.h:22
@ kSynchronousCounterOverflowValue
UNSIGNED8, rw — SYNC counter overflow value.
Definition profile_device.h:33
@ kProducerHeartbeatTime
UNSIGNED16, rw — producer heartbeat time in ms.
Definition profile_device.h:31
std::expected< ProfileDevice, std::string > createProfileDevice(Device &device)
Binds a generic device-profile view to device.
Definition profile_device.cc:275
std::optional< RestoreGroup > parseRestoreGroup(std::string_view token)
Parses a restore-group token ("all" / "communication" / "application" / "manufacturer") into a Restor...
Definition profile_device.cc:195
The CANopen identity object (0x1018) — the four UNSIGNED32 sub-entries that uniquely identify a devic...
Definition profile_device.h:40
uint32_t revisionNumber
0x1018:03 — revision number.
Definition profile_device.h:43
uint32_t vendorId
0x1018:01 — EtherCAT vendor ID.
Definition profile_device.h:41
uint32_t productCode
0x1018:02 — vendor-assigned product code.
Definition profile_device.h:42
uint32_t serialNumber
0x1018:04 — device serial number.
Definition profile_device.h:44
Retry/timing for the restore-default-parameters confirmation walk (ProfileDevice::runRestoreDefaultPa...
Definition profile_device.h:112
std::stop_token stop
Abandons the wait, not the restore (see above).
Definition profile_device.h:116
std::chrono::milliseconds interval
Delay between confirmation polls.
Definition profile_device.h:114
std::chrono::milliseconds settle
Wait after the write before the first poll.
Definition profile_device.h:115
uint32_t retries
Maximum confirmation polls after the first.
Definition profile_device.h:113
The restore-default-parameters object (0x1011) — one UNSIGNED32 per restorable group....
Definition profile_device.h:50
uint32_t application
0x1011:03 — restore application default parameters.
Definition profile_device.h:53
uint32_t all
0x1011:01 — restore all default parameters.
Definition profile_device.h:51
uint32_t communication
0x1011:02 — restore communication default parameters.
Definition profile_device.h:52
uint32_t manufacturer
0x1011:04 — restore manufacturer-defined default parameters.
Definition profile_device.h:54
Timing for the store-parameters confirmation walk (ProfileDevice::runStoreParameters).
Definition profile_device.h:93
std::chrono::milliseconds settle
Wait after the write before the first poll.
Definition profile_device.h:96
std::chrono::milliseconds interval
Delay between confirmation polls.
Definition profile_device.h:95
std::stop_token stop
Abandons the confirmation wait; default never stops.
Definition profile_device.h:103
uint32_t retries
Maximum confirmation polls after the first.
Definition profile_device.h:94