This class represents an entry in the object dictionary of a device. More...
#include <entry.h>
Public Types | |
using | ValueChangedCallback = std::function< void(const Value &value) > |
type of a callback for a value changed event Important: Never call add_value_changed_callback() from within (-> deadlock)! | |
Public Member Functions | |
Entry () | |
Constructs an empty entry. | |
Entry (const uint16_t _index, const uint8_t _subindex, const std::string &_name, const Type _type, const AccessType _access_type) | |
Standard constructor. More... | |
Entry (const Entry &other)=delete | |
copy constructor | |
Entry (Entry &&other)=default | |
move constructor | |
Entry & | operator= (const Entry &other)=delete |
copy assignment | |
Entry & | operator= (Entry &&other)=default |
move assignment | |
void | set_value (const Value &value) |
Sets the value. More... | |
const Value & | get_value () const |
Returns the value. More... | |
bool | valid () const |
Returns if the value is set/valid. More... | |
Type | get_type () const |
Returns the data type. More... | |
void | add_value_changed_callback (ValueChangedCallback callback) |
Registers a given function to be called when the value is changed. More... | |
void | print () const |
Prints relevant information concerning this entry on standard output - name, index, possibly value, ... This is used by Device::print_dictionary() More... | |
bool | operator< (const Entry &other) const |
Compares entries by index and subindex. This can be used for sorting the dictionary. More... | |
Public Attributes | |
uint16_t | index |
index in dictionary | |
uint8_t | subindex |
subindex in dictionary. if is_array==true, this variable is not used | |
std::string | name |
Human-readable name Should be escaped for consitency using Utils::escape(). | |
Type | type |
Data type of the value. | |
AccessType | access_type |
Accessibility of the entry. | |
ReadAccessMethod | read_access_method = ReadAccessMethod::sdo |
Standard method for reading this entry. Used by Device::get_entry(). | |
WriteAccessMethod | write_access_method = WriteAccessMethod::sdo |
Standard method for writing this entry. Used by Device::set_entry(). | |
bool | disabled |
Disables this entry. This is used when a device reports "Object does not exist in the object dictionary". | |
bool | is_generic = false |
This is set to true, if the entry has been created through a default CiA EDS file. This means that it's not guaranteed that the entry actually exists in the current device. For manually added entries and entries from manufacturer-specific EDS files, this is set to false. | |
This class represents an entry in the object dictionary of a device.
Add missing fields like high and low limit.
Array type entries are currently not used and may be deleted in future.
kaco::Entry::Entry | ( | const uint16_t | _index, |
const uint8_t | _subindex, | ||
const std::string & | _name, | ||
const Type | _type, | ||
const AccessType | _access_type | ||
) |
void kaco::Entry::add_value_changed_callback | ( | ValueChangedCallback | callback | ) |
Type kaco::Entry::get_type | ( | ) | const |
const Value & kaco::Entry::get_value | ( | ) | const |
bool kaco::Entry::operator< | ( | const Entry & | other | ) | const |
void kaco::Entry::print | ( | ) | const |
Prints relevant information concerning this entry on standard output - name, index, possibly value, ... This is used by Device::print_dictionary()
void kaco::Entry::set_value | ( | const Value & | value | ) |
bool kaco::Entry::valid | ( | ) | const |