make changes on buffer serial

Dependencies:   BufferedSerial

Dependents:  

Committer:
Gary Servin
Date:
Fri Nov 08 14:38:09 2019 -0300
Revision:
0:04ac6be8229a
Initial commit, generated based on a clean melodic-desktop-full

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Gary Servin 0:04ac6be8229a 1 #ifndef _ROS_visualization_msgs_InteractiveMarkerFeedback_h
Gary Servin 0:04ac6be8229a 2 #define _ROS_visualization_msgs_InteractiveMarkerFeedback_h
Gary Servin 0:04ac6be8229a 3
Gary Servin 0:04ac6be8229a 4 #include <stdint.h>
Gary Servin 0:04ac6be8229a 5 #include <string.h>
Gary Servin 0:04ac6be8229a 6 #include <stdlib.h>
Gary Servin 0:04ac6be8229a 7 #include "ros/msg.h"
Gary Servin 0:04ac6be8229a 8 #include "std_msgs/Header.h"
Gary Servin 0:04ac6be8229a 9 #include "geometry_msgs/Pose.h"
Gary Servin 0:04ac6be8229a 10 #include "geometry_msgs/Point.h"
Gary Servin 0:04ac6be8229a 11
Gary Servin 0:04ac6be8229a 12 namespace visualization_msgs
Gary Servin 0:04ac6be8229a 13 {
Gary Servin 0:04ac6be8229a 14
Gary Servin 0:04ac6be8229a 15 class InteractiveMarkerFeedback : public ros::Msg
Gary Servin 0:04ac6be8229a 16 {
Gary Servin 0:04ac6be8229a 17 public:
Gary Servin 0:04ac6be8229a 18 typedef std_msgs::Header _header_type;
Gary Servin 0:04ac6be8229a 19 _header_type header;
Gary Servin 0:04ac6be8229a 20 typedef const char* _client_id_type;
Gary Servin 0:04ac6be8229a 21 _client_id_type client_id;
Gary Servin 0:04ac6be8229a 22 typedef const char* _marker_name_type;
Gary Servin 0:04ac6be8229a 23 _marker_name_type marker_name;
Gary Servin 0:04ac6be8229a 24 typedef const char* _control_name_type;
Gary Servin 0:04ac6be8229a 25 _control_name_type control_name;
Gary Servin 0:04ac6be8229a 26 typedef uint8_t _event_type_type;
Gary Servin 0:04ac6be8229a 27 _event_type_type event_type;
Gary Servin 0:04ac6be8229a 28 typedef geometry_msgs::Pose _pose_type;
Gary Servin 0:04ac6be8229a 29 _pose_type pose;
Gary Servin 0:04ac6be8229a 30 typedef uint32_t _menu_entry_id_type;
Gary Servin 0:04ac6be8229a 31 _menu_entry_id_type menu_entry_id;
Gary Servin 0:04ac6be8229a 32 typedef geometry_msgs::Point _mouse_point_type;
Gary Servin 0:04ac6be8229a 33 _mouse_point_type mouse_point;
Gary Servin 0:04ac6be8229a 34 typedef bool _mouse_point_valid_type;
Gary Servin 0:04ac6be8229a 35 _mouse_point_valid_type mouse_point_valid;
Gary Servin 0:04ac6be8229a 36 enum { KEEP_ALIVE = 0 };
Gary Servin 0:04ac6be8229a 37 enum { POSE_UPDATE = 1 };
Gary Servin 0:04ac6be8229a 38 enum { MENU_SELECT = 2 };
Gary Servin 0:04ac6be8229a 39 enum { BUTTON_CLICK = 3 };
Gary Servin 0:04ac6be8229a 40 enum { MOUSE_DOWN = 4 };
Gary Servin 0:04ac6be8229a 41 enum { MOUSE_UP = 5 };
Gary Servin 0:04ac6be8229a 42
Gary Servin 0:04ac6be8229a 43 InteractiveMarkerFeedback():
Gary Servin 0:04ac6be8229a 44 header(),
Gary Servin 0:04ac6be8229a 45 client_id(""),
Gary Servin 0:04ac6be8229a 46 marker_name(""),
Gary Servin 0:04ac6be8229a 47 control_name(""),
Gary Servin 0:04ac6be8229a 48 event_type(0),
Gary Servin 0:04ac6be8229a 49 pose(),
Gary Servin 0:04ac6be8229a 50 menu_entry_id(0),
Gary Servin 0:04ac6be8229a 51 mouse_point(),
Gary Servin 0:04ac6be8229a 52 mouse_point_valid(0)
Gary Servin 0:04ac6be8229a 53 {
Gary Servin 0:04ac6be8229a 54 }
Gary Servin 0:04ac6be8229a 55
Gary Servin 0:04ac6be8229a 56 virtual int serialize(unsigned char *outbuffer) const
Gary Servin 0:04ac6be8229a 57 {
Gary Servin 0:04ac6be8229a 58 int offset = 0;
Gary Servin 0:04ac6be8229a 59 offset += this->header.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 60 uint32_t length_client_id = strlen(this->client_id);
Gary Servin 0:04ac6be8229a 61 varToArr(outbuffer + offset, length_client_id);
Gary Servin 0:04ac6be8229a 62 offset += 4;
Gary Servin 0:04ac6be8229a 63 memcpy(outbuffer + offset, this->client_id, length_client_id);
Gary Servin 0:04ac6be8229a 64 offset += length_client_id;
Gary Servin 0:04ac6be8229a 65 uint32_t length_marker_name = strlen(this->marker_name);
Gary Servin 0:04ac6be8229a 66 varToArr(outbuffer + offset, length_marker_name);
Gary Servin 0:04ac6be8229a 67 offset += 4;
Gary Servin 0:04ac6be8229a 68 memcpy(outbuffer + offset, this->marker_name, length_marker_name);
Gary Servin 0:04ac6be8229a 69 offset += length_marker_name;
Gary Servin 0:04ac6be8229a 70 uint32_t length_control_name = strlen(this->control_name);
Gary Servin 0:04ac6be8229a 71 varToArr(outbuffer + offset, length_control_name);
Gary Servin 0:04ac6be8229a 72 offset += 4;
Gary Servin 0:04ac6be8229a 73 memcpy(outbuffer + offset, this->control_name, length_control_name);
Gary Servin 0:04ac6be8229a 74 offset += length_control_name;
Gary Servin 0:04ac6be8229a 75 *(outbuffer + offset + 0) = (this->event_type >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 76 offset += sizeof(this->event_type);
Gary Servin 0:04ac6be8229a 77 offset += this->pose.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 78 *(outbuffer + offset + 0) = (this->menu_entry_id >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 79 *(outbuffer + offset + 1) = (this->menu_entry_id >> (8 * 1)) & 0xFF;
Gary Servin 0:04ac6be8229a 80 *(outbuffer + offset + 2) = (this->menu_entry_id >> (8 * 2)) & 0xFF;
Gary Servin 0:04ac6be8229a 81 *(outbuffer + offset + 3) = (this->menu_entry_id >> (8 * 3)) & 0xFF;
Gary Servin 0:04ac6be8229a 82 offset += sizeof(this->menu_entry_id);
Gary Servin 0:04ac6be8229a 83 offset += this->mouse_point.serialize(outbuffer + offset);
Gary Servin 0:04ac6be8229a 84 union {
Gary Servin 0:04ac6be8229a 85 bool real;
Gary Servin 0:04ac6be8229a 86 uint8_t base;
Gary Servin 0:04ac6be8229a 87 } u_mouse_point_valid;
Gary Servin 0:04ac6be8229a 88 u_mouse_point_valid.real = this->mouse_point_valid;
Gary Servin 0:04ac6be8229a 89 *(outbuffer + offset + 0) = (u_mouse_point_valid.base >> (8 * 0)) & 0xFF;
Gary Servin 0:04ac6be8229a 90 offset += sizeof(this->mouse_point_valid);
Gary Servin 0:04ac6be8229a 91 return offset;
Gary Servin 0:04ac6be8229a 92 }
Gary Servin 0:04ac6be8229a 93
Gary Servin 0:04ac6be8229a 94 virtual int deserialize(unsigned char *inbuffer)
Gary Servin 0:04ac6be8229a 95 {
Gary Servin 0:04ac6be8229a 96 int offset = 0;
Gary Servin 0:04ac6be8229a 97 offset += this->header.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 98 uint32_t length_client_id;
Gary Servin 0:04ac6be8229a 99 arrToVar(length_client_id, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 100 offset += 4;
Gary Servin 0:04ac6be8229a 101 for(unsigned int k= offset; k< offset+length_client_id; ++k){
Gary Servin 0:04ac6be8229a 102 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 103 }
Gary Servin 0:04ac6be8229a 104 inbuffer[offset+length_client_id-1]=0;
Gary Servin 0:04ac6be8229a 105 this->client_id = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 106 offset += length_client_id;
Gary Servin 0:04ac6be8229a 107 uint32_t length_marker_name;
Gary Servin 0:04ac6be8229a 108 arrToVar(length_marker_name, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 109 offset += 4;
Gary Servin 0:04ac6be8229a 110 for(unsigned int k= offset; k< offset+length_marker_name; ++k){
Gary Servin 0:04ac6be8229a 111 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 112 }
Gary Servin 0:04ac6be8229a 113 inbuffer[offset+length_marker_name-1]=0;
Gary Servin 0:04ac6be8229a 114 this->marker_name = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 115 offset += length_marker_name;
Gary Servin 0:04ac6be8229a 116 uint32_t length_control_name;
Gary Servin 0:04ac6be8229a 117 arrToVar(length_control_name, (inbuffer + offset));
Gary Servin 0:04ac6be8229a 118 offset += 4;
Gary Servin 0:04ac6be8229a 119 for(unsigned int k= offset; k< offset+length_control_name; ++k){
Gary Servin 0:04ac6be8229a 120 inbuffer[k-1]=inbuffer[k];
Gary Servin 0:04ac6be8229a 121 }
Gary Servin 0:04ac6be8229a 122 inbuffer[offset+length_control_name-1]=0;
Gary Servin 0:04ac6be8229a 123 this->control_name = (char *)(inbuffer + offset-1);
Gary Servin 0:04ac6be8229a 124 offset += length_control_name;
Gary Servin 0:04ac6be8229a 125 this->event_type = ((uint8_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 126 offset += sizeof(this->event_type);
Gary Servin 0:04ac6be8229a 127 offset += this->pose.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 128 this->menu_entry_id = ((uint32_t) (*(inbuffer + offset)));
Gary Servin 0:04ac6be8229a 129 this->menu_entry_id |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
Gary Servin 0:04ac6be8229a 130 this->menu_entry_id |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
Gary Servin 0:04ac6be8229a 131 this->menu_entry_id |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
Gary Servin 0:04ac6be8229a 132 offset += sizeof(this->menu_entry_id);
Gary Servin 0:04ac6be8229a 133 offset += this->mouse_point.deserialize(inbuffer + offset);
Gary Servin 0:04ac6be8229a 134 union {
Gary Servin 0:04ac6be8229a 135 bool real;
Gary Servin 0:04ac6be8229a 136 uint8_t base;
Gary Servin 0:04ac6be8229a 137 } u_mouse_point_valid;
Gary Servin 0:04ac6be8229a 138 u_mouse_point_valid.base = 0;
Gary Servin 0:04ac6be8229a 139 u_mouse_point_valid.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
Gary Servin 0:04ac6be8229a 140 this->mouse_point_valid = u_mouse_point_valid.real;
Gary Servin 0:04ac6be8229a 141 offset += sizeof(this->mouse_point_valid);
Gary Servin 0:04ac6be8229a 142 return offset;
Gary Servin 0:04ac6be8229a 143 }
Gary Servin 0:04ac6be8229a 144
Gary Servin 0:04ac6be8229a 145 const char * getType(){ return "visualization_msgs/InteractiveMarkerFeedback"; };
Gary Servin 0:04ac6be8229a 146 const char * getMD5(){ return "ab0f1eee058667e28c19ff3ffc3f4b78"; };
Gary Servin 0:04ac6be8229a 147
Gary Servin 0:04ac6be8229a 148 };
Gary Servin 0:04ac6be8229a 149
Gary Servin 0:04ac6be8229a 150 }
Gary Servin 0:04ac6be8229a 151 #endif