| pnd-cpp-sdk 1.5.1

Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Friends | List of all members
Pnd::Group Class Referencefinal

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)

## Detailed Description

Represents a group of physical Pnd actuator, and allows Command, Feedback, and Info objects to be sent to and recieved from the actuator.

## Constructor & Destructor Documentation

## ◆ Group()

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!

## Member Function Documentation

## ◆ addFeedbackHandler()

void Pnd::Group::addFeedbackHandler | ( | GroupFeedbackHandler | handler | ) |

TODO:

## ◆ clearFeedbackHandlers()

void Pnd::Group::clearFeedbackHandlers | ( |  | ) |

TODO:

## ◆ getFeedbackFrequencyHz()

float Pnd::Group::getFeedbackFrequencyHz | ( |  | ) |

TODO:

## ◆ getNextFeedback()

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!

Parameters

  feedback | On success, the group feedback read from the group are written into this structure.

Returns
  `true` if feedback was returned, otherwise `false` on failure (i.e., connection error or timeout waiting for response).

## ◆ sendCommand()

bool Pnd::Group::sendCommand | ( | const GroupCommand & | group_command | ) |

Send a command to the given group, requesting an acknowledgement of transmission to be sent back.

Parameters

  group_command | The GroupCommand object containing information to be sent to the group.

Returns
  true if an acknowledgement was successfully received (guaranteeing the group received this command), or a negative number for an error otherwise.

## ◆ sendFeedbackRequest()

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).

Returns
  `true` if feedback was request was successfully sent, otherwise `false` on failure (i.e., connection error).

## ◆ setFeedbackFrequencyHz()

bool Pnd::Group::setFeedbackFrequencyHz | ( | float | frequency | ) |

Sets the frequency of the internal feedback request + callback thread.

TODO:

Returns
  `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).

## Friends And Related Symbol Documentation

## ◆ callbackWrapper

void callbackWrapper | ( | PndGroupFeedbackPtr | group_feedback,
|  | void * | user_data
| ) |  |
| friend

TODO:

The documentation for this class was generated from the following files:

- /Users/lvhao/ws/pnd/sdk/pnd-cpp/src/group.hpp
- /Users/lvhao/ws/pnd/sdk/pnd-cpp/src/group.cpp