![]() |
pnd-cpp-sdk 1.4.4
|
Represents a group of physical Pnd actuator, and allows Command, Feedback, and Info objects to be sent to and recieved from the actuator. More...
#include <group.hpp>
Public Member Functions | |
| Group (PndGroupPtr group, float initial_feedback_frequency=0.0f, int32_t initial_command_lifetime=0) | |
| ~Group () noexcept | |
| Destructor cleans up group. | |
| int | size () |
| Returns the number of modules in the group. | |
| bool | setCommandLifetimeMs (int32_t ms) |
| Sets the command lifetime for the modules in this group. | |
| bool | sendCommand (const GroupCommand &group_command) |
| Send a command to the given group, requesting an acknowledgement of transmission to be sent back. | |
| bool | sendFeedbackRequest (PndFeedbackCode feedbackCode=PndFeedbackAll) |
| Requests feedback from the group. | |
| bool | getNextFeedback (GroupFeedback &feedback, int32_t timeout_ms=DEFAULT_TIMEOUT_MS) |
| Returns the most recently stored feedback from a sent feedback request, or returns the next one received (up to the requested timeout). | |
| bool | setFeedbackFrequencyHz (float frequency) |
| Sets the frequency of the internal feedback request + callback thread. | |
| float | getFeedbackFrequencyHz () |
| void | addFeedbackHandler (GroupFeedbackHandler handler) |
| void | clearFeedbackHandlers () |
| PndFeedbackErrorPtr | getError (int idx) |
| Gets the actuator error message. | |
Static Public Attributes | |
| static const int32_t | DEFAULT_TIMEOUT_MS = 500 |
Friends | |
| void | callbackWrapper (PndGroupFeedbackPtr group_feedback, void *user_data) |
Represents a group of physical Pnd actuator, and allows Command, Feedback, and Info objects to be sent to and recieved from the actuator.
| Pnd::Group::Group | ( | PndGroupPtr | group, |
| float | initial_feedback_frequency = 0.0f, |
||
| int32_t | initial_command_lifetime = 0 |
||
| ) |
Creates a group from the underlying C-style group object. This should only be called to create groups from the lookup class, not from user code!
| void Pnd::Group::addFeedbackHandler | ( | GroupFeedbackHandler | handler | ) |
TODO:
| void Pnd::Group::clearFeedbackHandlers | ( | ) |
TODO:
| float Pnd::Group::getFeedbackFrequencyHz | ( | ) |
TODO:
| bool Pnd::Group::getNextFeedback | ( | GroupFeedback & | feedback, |
| int32_t | timeout_ms = DEFAULT_TIMEOUT_MS |
||
| ) |
Returns the most recently stored feedback from a sent feedback request, or returns the next one received (up to the requested timeout).
Note that a feedback request can be sent either with the sendFeedbackRequest function.
Warning: other data in the provided 'Feedback' object is erased!
| feedback | On success, the group feedback read from the group are written into this structure. |
true if feedback was returned, otherwise false on failure (i.e., connection error or timeout waiting for response). | bool Pnd::Group::sendCommand | ( | const GroupCommand & | group_command | ) |
Send a command to the given group, requesting an acknowledgement of transmission to be sent back.
| group_command | The GroupCommand object containing information to be sent to the group. |
| bool Pnd::Group::sendFeedbackRequest | ( | PndFeedbackCode | feedbackCode = PndFeedbackAll | ) |
Requests feedback from the group.
Sends a background request to the modules in the group; if/when all modules return feedback, any associated handler functions are called. This returned feedback is also stored to be returned by the next call to getNextFeedback (any previously returned data is discarded).
true if feedback was request was successfully sent, otherwise false on failure (i.e., connection error). | bool Pnd::Group::setFeedbackFrequencyHz | ( | float | frequency | ) |
Sets the frequency of the internal feedback request + callback thread.
TODO:
true if the frequency successfully was set, or false if the parameter was outside the accepted range (less than zero or faster than supported maximum).
|
friend |
TODO: