Motion Master
Loading...
Searching...
No Matches
soem_od_entry.h
Go to the documentation of this file.
1#pragma once
2
3#include <nlohmann/json.hpp>
4
5#include "virtual_parameter.h"
6
8 public:
9 friend class Soem;
10 friend class Soes;
11 friend class SoemMaster;
12 friend class SoemSlave;
14
15 friend void to_json(nlohmann::json& j, const SoemOdEntry& e);
16 friend void from_json(const nlohmann::json& j, SoemOdEntry& e);
17
18 Type get_parameter_type() override;
19 uint16_t get_index() override;
20 uint8_t get_subindex() override;
21 bool is_pdo_mapped() override;
22 bool set_pdo_mapping(PdoMapping pdo_mapping);
23 uint64_t get_raw_value() override;
24 uint64_t get_raw_value(bool force_refresh) override;
25 int32_t get_int_value() override;
26 int32_t get_int_value(bool force_refresh) override;
27 float get_float_value() override;
28 float get_float_value(bool force_refresh) override;
29 std::string get_string_value() override;
30 std::string get_string_value(bool force_refresh) override;
31 bool get_value_status() override;
32 int32_t set_raw_value(uint64_t value) override;
33 int32_t set_value(int32_t value) override;
34 int32_t set_value(float value) override;
35 int32_t set_value(const std::string& value) override;
36 ValueType get_value_type() override;
37 std::string get_name() override;
38 std::string get_parent_name() override;
39 bool is_read() override;
40 bool is_write() override;
41 std::string get_unit() override;
42 int32_t get_min() override;
43 int32_t get_max() override;
44 bool is_value_fresh() override;
45
46 private:
47 uint16_t absolute_slave_position_;
48
49 uint16_t index_;
50 uint8_t subindex_;
51
52 uint8_t value_[128];
53
54 int32_t bit_length_;
55 uint8_t object_type_; // define(s) in co_dictionary.h
56 uint16_t entry_type_; // defined in ethercattype.h - ec_datatype
57 std::string name_;
58 std::string parent_name_;
59 uint16_t access_;
60 std::string unit_;
61 int32_t min_value_ = INT32_MIN;
62 int32_t max_value_ = INT32_MAX;
63
64 std::atomic<uint64_t> pdo_value_ = 0;
65 std::atomic_bool value_status_ = false;
66 std::atomic_bool value_initially_refreshed_ = false;
67
69
70 int32_t refresh_value();
71 int32_t set_value_sdo(uint64_t value);
72 int32_t set_value_sdo(float value);
73 int32_t set_value_sdo(const std::string& value);
74};
Definition soem_od_entry.h:7
friend class ParameterValueRefresher
Definition soem_od_entry.h:13
friend class Soem
Definition soem_od_entry.h:9
bool is_pdo_mapped() override
Check if the parameter is PDO mapped.
Definition soem_od_entry.cc:19
bool set_pdo_mapping(PdoMapping pdo_mapping)
Definition soem_od_entry.cc:23
int32_t get_int_value() override
Get the integer value of the parameter.
Definition soem_od_entry.cc:43
friend void to_json(nlohmann::json &j, const SoemOdEntry &e)
Definition soem_od_entry.cc:550
std::string get_name() override
Get the name of the parameter.
Definition soem_od_entry.cc:341
int32_t set_value(int32_t value) override
Set an integer value.
Definition soem_od_entry.cc:147
friend class Soes
Definition soem_od_entry.h:10
std::string get_parent_name() override
Get the parameter parent name.
Definition soem_od_entry.cc:343
std::string get_unit() override
Get the defined unit of the parameter value.
Definition soem_od_entry.cc:363
friend class SoemSlave
Definition soem_od_entry.h:12
Type get_parameter_type() override
Get the type of the parameter.
Definition soem_od_entry.cc:11
bool is_write() override
Definition soem_od_entry.cc:361
ValueType get_value_type() override
Get the parameter value type.
Definition soem_od_entry.cc:306
float get_float_value() override
Get the float value of the parameter.
Definition soem_od_entry.cc:93
bool get_value_status() override
Check the current status of the parameter value.
Definition soem_od_entry.cc:123
int32_t get_max() override
Get the maximum value the parameter should hold.
Definition soem_od_entry.cc:367
bool is_read() override
Definition soem_od_entry.cc:352
bool is_value_fresh() override
Check if the value is fresh.
Definition soem_od_entry.cc:369
uint8_t get_subindex() override
Get the subindex of the parameter.
Definition soem_od_entry.cc:17
int32_t get_min() override
Get the minimum value the parameter should hold.
Definition soem_od_entry.cc:365
int32_t set_raw_value(uint64_t value) override
Set a raw (64-bit unsigned integer) value.
Definition soem_od_entry.cc:125
uint16_t get_index() override
Get the index of the parameter.
Definition soem_od_entry.cc:15
friend class SoemMaster
Definition soem_od_entry.h:11
std::string get_string_value() override
Get the string value of the parameter.
Definition soem_od_entry.cc:109
uint64_t get_raw_value() override
Get the raw (64-bit unsigned integer) value of the OD entry.
Definition soem_od_entry.cc:28
friend void from_json(const nlohmann::json &j, SoemOdEntry &e)
Definition soem_od_entry.cc:573
Definition virtual_parameter.h:9
PdoMapping
Definition virtual_parameter.h:36
@ kNotPdoMapped
Definition virtual_parameter.h:36
Type
Definition virtual_parameter.h:11
ValueType
Definition virtual_parameter.h:19
uint8_t * value
Definition co_dictionary.h:9