28 namespace canopen_schunk {
31 m_can_device(can_device),
33 m_state(NMTS_INITIALISATION)
43 LOGGING_ERROR_C(CanOpen,
NMT,
"NMT Update called with wrong canopen ID. Received ID: " << node_id <<
" Node ID: " <<
m_node_id <<
". Update ignored." <<
endl);
51 LOGGING_ERROR_C(CanOpen,
NMT,
"NMT Update called with illegal length message. Expected length: " << 1 <<
" got: " << msg.
dlc <<
". Update ignored." <<
endl);
68 uint8_t state_to_check = (payload & 0x7F);
71 if (
m_state != static_cast<eNMT_State>(state_to_check))
80 LOGGING_TRACE_C(CanOpen,
NMT,
"NMT Nodeguarding for node " << node_id <<
" received. ALL IS WELL!");
85 LOGGING_DEBUG_C(CanOpen,
NMT,
"NMT Nodeguarding for node " << node_id <<
" received illegal NMT state information. Ignoring message" <<
endl);
145 unsigned char msg[2];
146 msg[0] =
static_cast<unsigned char>(cmd);
void update(const CanMsg &msg)
update Updates the NMT status with newly received data
CanDevPtr m_can_device
can device handle for sending of NMT commands
#define LOGGING_INFO_C(streamname, classname, arg)
void resetCommunication()
resetCommunication Resets the communication of a device, setting communication values to their defaul...
NMT(const uint8_t &node_id, const CanDevPtr &can_device)
NMT Construct a new NMT object to manage the NMT state of a device.
The NMT class provides access to NMT functions of the canOpen protocol and keeps the NMT state of can...
const std::string nmtStateToString(const eNMT_State &state)
nmtStateToString Returns a string corresponding to a given NMT state
void preOperational()
preOperational switches the device back into pre-operational state where configuration can occur ...
bool isValidNmtState(const uint8_t &state)
isValidNmtState Helper function to check if a received value is a valid NMT state ...
#define LOGGING_WARNING_C(streamname, classname, arg)
static const uint16_t ID_NMT_ERROR_MIN
void reset()
reset Resets the device and triggers a complete reboot
void stop()
stop Stops the device by setting the NMT state to stopped
#define LOGGING_DEBUG_C(streamname, classname, arg)
static const uint16_t ID_NMT
ThreadStream & endl(ThreadStream &stream)
uint8_t m_node_id
We keep the node ID which this NMT object is corresponding to.
eNMT_Command
NMT Command specifies what the state machine shall do value = "cs" as specified in ds301 7...
void sendCommand(const eNMT_Command &cmd)
sendCommand Sends an actual NMT command to the device. This will proactively change the state of the ...
void start()
start Starts the device by setting the NMT state to operational
eNMT_State
The NMT state indicates the behavior of the communication of a device, everything else is device spec...
#define LOGGING_TRACE_C(streamname, classname, arg)
icl_hardware::can::tCanMessage CanMsg
#define LOGGING_ERROR_C(streamname, classname, arg)
eNMT_State m_state
Status of the NMT state machine.