60#ifndef guWhiteboard_TeleoperationControl_h
61#define guWhiteboard_TeleoperationControl_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_TeleoperationControl_DEFINED
73#define guWhiteboard_TeleoperationControl_DEFINED
75#undef TeleoperationControl_DEFINED
76#define TeleoperationControl_DEFINED
90 void init(uint8_t t_ip = 0, int32_t t_action = 0, int32_t t_stance = 0, int32_t t_streamType = 0, int32_t t_selectedCamera = 0, std::string t_sayString =
"") {
96 gu_strlcpy(
const_cast<char *
>(this->
sayString()), t_sayString.c_str(), 30);
104 TeleoperationControl(uint8_t t_ip = 0, int32_t t_action = 0, int32_t t_stance = 0, int32_t t_streamType = 0, int32_t t_selectedCamera = 0, std::string t_sayString =
"") {
105 this->init(t_ip, t_action, t_stance, t_streamType, t_selectedCamera, t_sayString);
140 return ip() == t_other.
ip()
150 return !(*
this == t_other);
160 return !(*
this == t_other);
168 const uint8_t &
ip()
const
263#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
273#ifdef USE_WB_TELEOPERATION_CONTROL_C_CONVERSION
276 std::string descr = buffer;
279 std::ostringstream ss;
280 ss <<
"ip=" <<
static_cast<unsigned>(this->
ip());
282 ss <<
"action=" <<
static_cast<signed>(this->
action());
284 ss <<
"stance=" <<
static_cast<signed>(this->
stance());
286 ss <<
"streamType=" <<
static_cast<signed>(this->
streamType());
288 ss <<
"selectedCamera=" <<
static_cast<signed>(this->
selectedCamera());
290 if (0 == strncmp(
"", this->
sayString(), 1)) {
291 ss <<
"sayString=" <<
"";
300#ifdef USE_WB_TELEOPERATION_CONTROL_C_CONVERSION
303 std::string toString = buffer;
306 std::ostringstream ss;
307 ss << static_cast<unsigned>(this->
ip());
309 ss << static_cast<signed>(this->
action());
311 ss << static_cast<signed>(this->
stance());
313 ss << static_cast<signed>(this->
streamType());
317 if (0 == strncmp(
"", this->
sayString(), 1)) {
326#ifdef USE_WB_TELEOPERATION_CONTROL_C_CONVERSION
331 char * str_cstr =
const_cast<char *
>(t_str.c_str());
332 size_t temp_length = strlen(str_cstr);
333 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
338 char* var_str = &var_str_buffer[0];
340 char* key = &key_buffer[0];
347 if (index == 0 && str_cstr[0] ==
'{') {
353 for (
int i = index; i < length; i++) {
355 if (bracecount == 0 && str_cstr[i] ==
'=') {
360 if (bracecount == 0 && isspace(str_cstr[i])) {
367 if (bracecount == 0 && str_cstr[i] ==
',') {
371 if (str_cstr[i] ==
'{') {
375 if (str_cstr[i] ==
'}') {
377 if (bracecount < 0) {
382 if (i == length - 1) {
386 if (endKey >= startKey && endKey - startKey < length) {
387 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
388 key[(endKey - startKey) + 1] = 0;
392 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
393 var_str[(index - startVar) + 1] = 0;
399 if (strlen(key) > 0) {
400 if (0 == strcmp(
"ip", key)) {
402 }
else if (0 == strcmp(
"action", key)) {
404 }
else if (0 == strcmp(
"stance", key)) {
406 }
else if (0 == strcmp(
"streamType", key)) {
408 }
else if (0 == strcmp(
"selectedCamera", key)) {
410 }
else if (0 == strcmp(
"sayString", key)) {
420 this->
set_ip(
static_cast<uint8_t
>(atoi(var_str)));
425 this->
set_action(
static_cast<int32_t
>(atoi(var_str)));
430 this->
set_stance(
static_cast<int32_t
>(atoi(var_str)));
452 }
while(index < length);
Provides a C++ wrapper around wb_teleoperation_control.
void set_ip(const uint8_t &t_newValue)
void set_selectedCamera(const int32_t &t_newValue)
void set_action(const int32_t &t_newValue)
bool operator!=(const TeleoperationControl &t_other) const
void set_streamType(const int32_t &t_newValue)
TeleoperationControl(uint8_t t_ip=0, int32_t t_action=0, int32_t t_stance=0, int32_t t_streamType=0, int32_t t_selectedCamera=0, std::string t_sayString="")
Create a new TeleoperationControl.
void set_sayString(const char *t_newValue)
TeleoperationControl(const std::string &t_str)
String Constructor.
void from_string(const std::string &t_str)
const char * sayString() const
const char & sayString(int t_i) const
TeleoperationControl(const struct wb_teleoperation_control &t_other)
Copy Constructor.
int32_t & selectedCamera()
TeleoperationControl(const TeleoperationControl &t_other)
Copy Constructor.
void set_stance(const int32_t &t_newValue)
const uint8_t & ip() const
const int32_t & streamType() const
size_t sayString_size() const
char & sayString(int t_i)
bool operator==(const TeleoperationControl &t_other) const
std::string description()
const int32_t & action() const
TeleoperationControl & operator=(const TeleoperationControl &t_other)
Copy Assignment Operator.
const int32_t & selectedCamera() const
const int32_t & stance() const
WHITEBOARD_POSTER_STRING_CONVERSION.
char sayString[30]
String passed to Say_t.
int32_t streamType
Use enum StreamingType (Vision_Control.h)
int32_t selectedCamera
VisionCamera.
int32_t action
Use guWhiteboard::Motions::action enum values!
uint8_t ip
Last octet of IP address.
int32_t stance
guWhiteboard::Motions::stance
struct wb_teleoperation_control * wb_teleoperation_control_from_string(struct wb_teleoperation_control *self, const char *str)
Convert from a string.
const char * wb_teleoperation_control_description(const struct wb_teleoperation_control *self, char *descString, size_t bufferSize)
Convert to a description string.
const char * wb_teleoperation_control_to_string(const struct wb_teleoperation_control *self, char *toString, size_t bufferSize)
Convert to a string.
#define TELEOPERATIONCONTROL_DESC_BUFFER_SIZE
#define TELEOPERATIONCONTROL_TO_STRING_BUFFER_SIZE