Gary Servin / ros_lib_indigo

Dependencies:   BufferedSerial

Dependents:   rosserial_mbed_hello_world_publisher rtos_base_control rosserial_mbed_F64MA ROS-RTOS ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers InteractiveMarkerFeedback.h Source File

InteractiveMarkerFeedback.h

00001 #ifndef _ROS_visualization_msgs_InteractiveMarkerFeedback_h
00002 #define _ROS_visualization_msgs_InteractiveMarkerFeedback_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "std_msgs/Header.h"
00009 #include "geometry_msgs/Pose.h"
00010 #include "geometry_msgs/Point.h"
00011 
00012 namespace visualization_msgs
00013 {
00014 
00015   class InteractiveMarkerFeedback : public ros::Msg
00016   {
00017     public:
00018       std_msgs::Header header;
00019       const char* client_id;
00020       const char* marker_name;
00021       const char* control_name;
00022       uint8_t event_type;
00023       geometry_msgs::Pose pose;
00024       uint32_t menu_entry_id;
00025       geometry_msgs::Point mouse_point;
00026       bool mouse_point_valid;
00027       enum { KEEP_ALIVE =  0 };
00028       enum { POSE_UPDATE =  1 };
00029       enum { MENU_SELECT =  2 };
00030       enum { BUTTON_CLICK =  3 };
00031       enum { MOUSE_DOWN =  4 };
00032       enum { MOUSE_UP =  5 };
00033 
00034     InteractiveMarkerFeedback():
00035       header(),
00036       client_id(""),
00037       marker_name(""),
00038       control_name(""),
00039       event_type(0),
00040       pose(),
00041       menu_entry_id(0),
00042       mouse_point(),
00043       mouse_point_valid(0)
00044     {
00045     }
00046 
00047     virtual int serialize(unsigned char *outbuffer) const
00048     {
00049       int offset = 0;
00050       offset += this->header.serialize(outbuffer + offset);
00051       uint32_t length_client_id = strlen(this->client_id);
00052       memcpy(outbuffer + offset, &length_client_id, sizeof(uint32_t));
00053       offset += 4;
00054       memcpy(outbuffer + offset, this->client_id, length_client_id);
00055       offset += length_client_id;
00056       uint32_t length_marker_name = strlen(this->marker_name);
00057       memcpy(outbuffer + offset, &length_marker_name, sizeof(uint32_t));
00058       offset += 4;
00059       memcpy(outbuffer + offset, this->marker_name, length_marker_name);
00060       offset += length_marker_name;
00061       uint32_t length_control_name = strlen(this->control_name);
00062       memcpy(outbuffer + offset, &length_control_name, sizeof(uint32_t));
00063       offset += 4;
00064       memcpy(outbuffer + offset, this->control_name, length_control_name);
00065       offset += length_control_name;
00066       *(outbuffer + offset + 0) = (this->event_type >> (8 * 0)) & 0xFF;
00067       offset += sizeof(this->event_type);
00068       offset += this->pose.serialize(outbuffer + offset);
00069       *(outbuffer + offset + 0) = (this->menu_entry_id >> (8 * 0)) & 0xFF;
00070       *(outbuffer + offset + 1) = (this->menu_entry_id >> (8 * 1)) & 0xFF;
00071       *(outbuffer + offset + 2) = (this->menu_entry_id >> (8 * 2)) & 0xFF;
00072       *(outbuffer + offset + 3) = (this->menu_entry_id >> (8 * 3)) & 0xFF;
00073       offset += sizeof(this->menu_entry_id);
00074       offset += this->mouse_point.serialize(outbuffer + offset);
00075       union {
00076         bool real;
00077         uint8_t base;
00078       } u_mouse_point_valid;
00079       u_mouse_point_valid.real = this->mouse_point_valid;
00080       *(outbuffer + offset + 0) = (u_mouse_point_valid.base >> (8 * 0)) & 0xFF;
00081       offset += sizeof(this->mouse_point_valid);
00082       return offset;
00083     }
00084 
00085     virtual int deserialize(unsigned char *inbuffer)
00086     {
00087       int offset = 0;
00088       offset += this->header.deserialize(inbuffer + offset);
00089       uint32_t length_client_id;
00090       memcpy(&length_client_id, (inbuffer + offset), sizeof(uint32_t));
00091       offset += 4;
00092       for(unsigned int k= offset; k< offset+length_client_id; ++k){
00093           inbuffer[k-1]=inbuffer[k];
00094       }
00095       inbuffer[offset+length_client_id-1]=0;
00096       this->client_id = (char *)(inbuffer + offset-1);
00097       offset += length_client_id;
00098       uint32_t length_marker_name;
00099       memcpy(&length_marker_name, (inbuffer + offset), sizeof(uint32_t));
00100       offset += 4;
00101       for(unsigned int k= offset; k< offset+length_marker_name; ++k){
00102           inbuffer[k-1]=inbuffer[k];
00103       }
00104       inbuffer[offset+length_marker_name-1]=0;
00105       this->marker_name = (char *)(inbuffer + offset-1);
00106       offset += length_marker_name;
00107       uint32_t length_control_name;
00108       memcpy(&length_control_name, (inbuffer + offset), sizeof(uint32_t));
00109       offset += 4;
00110       for(unsigned int k= offset; k< offset+length_control_name; ++k){
00111           inbuffer[k-1]=inbuffer[k];
00112       }
00113       inbuffer[offset+length_control_name-1]=0;
00114       this->control_name = (char *)(inbuffer + offset-1);
00115       offset += length_control_name;
00116       this->event_type =  ((uint8_t) (*(inbuffer + offset)));
00117       offset += sizeof(this->event_type);
00118       offset += this->pose.deserialize(inbuffer + offset);
00119       this->menu_entry_id =  ((uint32_t) (*(inbuffer + offset)));
00120       this->menu_entry_id |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00121       this->menu_entry_id |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00122       this->menu_entry_id |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00123       offset += sizeof(this->menu_entry_id);
00124       offset += this->mouse_point.deserialize(inbuffer + offset);
00125       union {
00126         bool real;
00127         uint8_t base;
00128       } u_mouse_point_valid;
00129       u_mouse_point_valid.base = 0;
00130       u_mouse_point_valid.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00131       this->mouse_point_valid = u_mouse_point_valid.real;
00132       offset += sizeof(this->mouse_point_valid);
00133      return offset;
00134     }
00135 
00136     const char * getType(){ return "visualization_msgs/InteractiveMarkerFeedback"; };
00137     const char * getMD5(){ return "ab0f1eee058667e28c19ff3ffc3f4b78"; };
00138 
00139   };
00140 
00141 }
00142 #endif