3 #ifndef __NMT_PROTOCOL_HPP__
4 #define __NMT_PROTOCOL_HPP__
10 #include "ICanSenderDelegate.hpp"
51 : id(id), sender(sender)
56 { this->sender = sender; }
62 bool accept(
const std::uint8_t * data);
71 { callback = HandlerFn(); }
74 using HandlerFn = std::function<void(
NmtState)>;
Implementation-agnostic consumer for TX CAN transfers.
Definition: ICanSenderDelegate.hpp:22
Representation of NMT protocol.
Definition: NmtProtocol.hpp:45
NmtProtocol(std::uint8_t id, ICanSenderDelegate *sender=nullptr)
Constructor, registers CAN sender handle.
Definition: NmtProtocol.hpp:50
bool accept(const std::uint8_t *data)
Invoke callback on parsed CAN message data.
Definition: NmtProtocol.cpp:13
void configureSender(ICanSenderDelegate *sender)
Configure CAN sender delegate handle.
Definition: NmtProtocol.hpp:55
static constexpr std::uint8_t BROADCAST
Broadcast CAN ID.
Definition: NmtProtocol.hpp:47
void registerHandler(Fn &&fn)
Register callback.
Definition: NmtProtocol.hpp:66
void unregisterHandler()
Unregister callback.
Definition: NmtProtocol.hpp:70
bool issueServiceCommand(NmtService command)
Send NMT service indication.
Definition: NmtProtocol.cpp:7
NmtState
NMT state machine.
Definition: NmtProtocol.hpp:33
NmtService
NMT service commands.
Definition: NmtProtocol.hpp:20
@ PRE_OPERATIONAL
Pre-operational state.
@ OPERATIONAL
Operational state.
@ ENTER_PRE_OPERATIONAL
Enter pre-operational indication.
@ START_REMOTE_NODE
Start remote node indication.
@ RESET_COMMUNICATION
Reset communication indication.
@ RESET_NODE
Reset node indication.
@ STOP_REMOTE_NODE
Stop remote node indication.
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6