ROS Serial library for Mbed platforms for ROS Indigo Igloo. Check http://wiki.ros.org/rosserial_mbed/ for more information

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 GoalID.h Source File

GoalID.h

00001 #ifndef _ROS_actionlib_msgs_GoalID_h
00002 #define _ROS_actionlib_msgs_GoalID_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "ros/time.h"
00009 
00010 namespace actionlib_msgs
00011 {
00012 
00013   class GoalID : public ros::Msg
00014   {
00015     public:
00016       ros::Time stamp;
00017       const char* id;
00018 
00019     GoalID():
00020       stamp(),
00021       id("")
00022     {
00023     }
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF;
00029       *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF;
00030       *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF;
00031       *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF;
00032       offset += sizeof(this->stamp.sec);
00033       *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF;
00034       *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF;
00035       *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF;
00036       *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF;
00037       offset += sizeof(this->stamp.nsec);
00038       uint32_t length_id = strlen(this->id);
00039       memcpy(outbuffer + offset, &length_id, sizeof(uint32_t));
00040       offset += 4;
00041       memcpy(outbuffer + offset, this->id, length_id);
00042       offset += length_id;
00043       return offset;
00044     }
00045 
00046     virtual int deserialize(unsigned char *inbuffer)
00047     {
00048       int offset = 0;
00049       this->stamp.sec =  ((uint32_t) (*(inbuffer + offset)));
00050       this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00051       this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00052       this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00053       offset += sizeof(this->stamp.sec);
00054       this->stamp.nsec =  ((uint32_t) (*(inbuffer + offset)));
00055       this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00056       this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00057       this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00058       offset += sizeof(this->stamp.nsec);
00059       uint32_t length_id;
00060       memcpy(&length_id, (inbuffer + offset), sizeof(uint32_t));
00061       offset += 4;
00062       for(unsigned int k= offset; k< offset+length_id; ++k){
00063           inbuffer[k-1]=inbuffer[k];
00064       }
00065       inbuffer[offset+length_id-1]=0;
00066       this->id = (char *)(inbuffer + offset-1);
00067       offset += length_id;
00068      return offset;
00069     }
00070 
00071     const char * getType(){ return "actionlib_msgs/GoalID"; };
00072     const char * getMD5(){ return "302881f31927c1df708a2dbab0e80ee8"; };
00073 
00074   };
00075 
00076 }
00077 #endif