9 #ifndef DOXYGEN_OMIT_INTERNAL 12 reinterpret_cast<Group*
>(user_data)->callAttachedHandlers(group_feedback);
14 #endif // DOXYGEN_OMIT_INTERNAL 22 for (
unsigned int i = 0; i <
handlers_.size(); i++)
37 float initial_feedback_frequency,
38 int32_t initial_command_lifetime)
41 if (initial_feedback_frequency != 0)
43 if (initial_command_lifetime != 0)
103 char* buffer =
new char[len];
105 std::string ret(buffer, --len);
124 char* buffer =
new char[len];
126 std::string ret(buffer, --len);
139 if (
internal ==
nullptr) {
140 return std::shared_ptr<LogFile>();
143 return std::shared_ptr<LogFile>(
void addFeedbackHandler(GroupFeedbackHandler handler)
Adds a handler function to be called by the internal feedback request thread.
void hebiStringRelease(HebiStringPtr str)
Releases a string instance.
std::string startLog(const std::string &dir)
Starts log (stopping any active log).
A list of Feedback objects that can be received from a Group of modules; the size() must match the nu...
void clearFeedbackHandlers()
Removes all feedback handlers presently added.
HebiLogFilePtr hebiGroupStopLog(HebiGroupPtr group)
Stops logging data to a file.
Represents a group of physical HEBI modules, and allows Command, Feedback, and Info objects to be sen...
A list of Info objects that can be received from a Group of modules; the size() must match the number...
HebiStatusCode hebiGroupSendCommand(HebiGroupPtr group, HebiGroupCommandPtr command)
Sends a command to the given group without requesting an acknowledgement.
Group(HebiGroupPtr group, float initial_feedback_frequency=0.0f, int32_t initial_command_lifetime=0)
float getFeedbackFrequencyHz()
Gets the frequency of the internal feedback request + callback thread.
~Group() noexcept
Destructor cleans up group.
HebiStatusCode hebiGroupStartLog(HebiGroupPtr group, const char *dir, const char *file, HebiStringPtr *ret)
Starts logging data to a file.
bool sendCommandWithAcknowledgement(const GroupCommand &group_command, int32_t timeout_ms=DEFAULT_TIMEOUT_MS)
Send a command to the given group, requesting an acknowledgement of transmission to be sent back...
struct _HebiGroup * HebiGroupPtr
The C-style's API representation of a group.
struct _HebiGroupFeedback * HebiGroupFeedbackPtr
The C-style's API representation of group feedback.
void callAttachedHandlers(HebiGroupFeedbackPtr group_feedback)
void hebiGroupRelease(HebiGroupPtr group)
Release resources for a given group; group should not be used after this call.
int size()
Returns the number of modules in the group.
bool sendCommand(const GroupCommand &group_command)
Send a command to the given group without requesting an acknowledgement.
bool setCommandLifetimeMs(int32_t ms)
Sets the command lifetime for the modules in this group.
std::shared_ptr< LogFile > stopLog()
Stops any active log.
HebiStatusCode hebiGroupSetFeedbackFrequencyHz(HebiGroupPtr group, float frequency)
Sets the feedback request loop frequency (in Hz).
float hebiGroupGetFeedbackFrequencyHz(HebiGroupPtr group)
Returns the current feedback request loop frequency (in Hz).
HebiStatusCode hebiGroupRequestInfo(HebiGroupPtr group, HebiGroupInfoPtr info, int32_t timeout_ms)
Requests info from the group, and writes it to the provided info object.
HebiStatusCode hebiGroupSetCommandLifetime(HebiGroupPtr group, int32_t lifetime_ms)
Sets the command lifetime for the group, in milliseconds.
static std::shared_ptr< Group > createImitation(size_t size)
Creates an imitation group of provided size.
HebiStatusCode hebiGroupSendFeedbackRequest(HebiGroupPtr group)
Requests feedback from the group.
HebiStatusCode hebiGroupSendCommandWithAcknowledgement(HebiGroupPtr group, HebiGroupCommandPtr command, int32_t timeout_ms)
Sends a command to the given group, requesting an acknowledgement of transmission to be sent back...
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 recei...
A list of Command objects appropriate for sending to a Group of modules; the size() must match the nu...
HebiGroupCommandPtr internal_
HebiStatusCode hebiStringGetString(HebiStringPtr str, char *buffer, size_t *length)
Copy the string into a buffer.
bool requestInfo(GroupInfo &info, int32_t timeout_ms=DEFAULT_TIMEOUT_MS)
Request info from the group, and store it in the passed-in info object.
HebiGroupFeedbackPtr internal_
std::vector< GroupFeedbackHandler > handlers_
HebiStatusCode hebiGroupGetNextFeedback(HebiGroupPtr group, HebiGroupFeedbackPtr feedback, int32_t timeout_ms)
Returns the most recently stored feedback from a sent feedback request, or returns the next one recei...
size_t hebiLogFileGetNumberOfModules(HebiLogFilePtr log_file)
Retrieve the number of modules in the group represented by an opened log file.
HebiGroupInfoPtr internal_
size_t hebiGroupGetSize(HebiGroupPtr group)
Returns the number of modules in a group.
HebiGroupPtr hebiGroupCreateImitation(size_t size)
Creates an "imitation" group with the specified number of modules.
HebiStatusCode hebiGroupRegisterFeedbackHandler(HebiGroupPtr group, GroupFeedbackHandlerFunction handler, void *user_data)
Add a function that is called whenever feedback is returned from the group.
void hebiGroupClearFeedbackHandlers(HebiGroupPtr group)
Removes all feedback handling functions from the queue to be called on receipt of group feedback...
struct _HebiString * HebiStringPtr
The C-style's API representation of a string.
const int number_of_modules_
void callbackWrapper(HebiGroupFeedbackPtr group_feedback, void *user_data)
bool setFeedbackFrequencyHz(float frequency)
Sets the frequency of the internal feedback request + callback thread.
friend void callbackWrapper(HebiGroupFeedbackPtr group_feedback, void *user_data)
bool sendFeedbackRequest()
Requests feedback from the group.
std::function< void(const GroupFeedback &)> GroupFeedbackHandler
Definition of a callback function for GroupFeedback returned from a Group of modules.