modm API documentation
|
Abstract base class for a component. More...
#include <modm/communication/xpcc/abstract_component.hpp>
Public Member Functions | |
AbstractComponent (const uint8_t ownIdentifier, Dispatcher &communication) | |
Constructor. More... | |
void | update (...) |
Update method. More... | |
xpcc::Communicator * | getCommunicator () |
Protected Member Functions | |
void | callAction (uint8_t receiver, uint8_t actionIdentifier) |
void | callAction (uint8_t receiver, uint8_t actionIdentifier, ResponseCallback &responseCallback) |
template<typename T > | |
void | callAction (uint8_t receiver, uint8_t actionIdentifier, const T &data) |
template<typename T > | |
void | callAction (uint8_t receiver, uint8_t actionIdentifier, const T &data, ResponseCallback &responseCallback) |
void | publishEvent (uint8_t eventIdentifier) |
template<typename T > | |
void | publishEvent (uint8_t eventIdentifier, const T &data) |
void | sendResponse (const ResponseHandle &handle) |
template<typename T > | |
void | sendResponse (const ResponseHandle &handle, const T &data) |
template<typename T > | |
void | sendNegativeResponse (const ResponseHandle &handle, const T &data) |
void | sendNegativeResponse (const ResponseHandle &handle) |
Abstract base class for a component.
This class give to components an interface to xpcc communication, but effectively it forwards all requests to the internal created Communicator, which is bound to this AbstractComponent.
TODO why do we use the communicator here?
It is a good convention to give to a component which extends xpcc::AbstractComponent an update() method which is to be called during the main loop.
The programmer is always encouraged to bundle special functionality in separate classes called Tasks. These Tasks will usually not be complete components but want send messages in the name of a parent component. Use xpcc::CommunicatableTask for such type of Tasks.
|
inline |
Constructor.
ownIdentifier | Identifier of the component, must be unique within the network. |
communication | Communication class used to send messages |
void xpcc::AbstractComponent::update | ( | ... | ) |
Update method.
A component can feature an update method which might be called on every cycle of the main loop.
This method is used in our robot to implement the behaviour of the component. All other methods set some flags which are then evaluated by a statemachine here.