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

SmachContainerInitialStatusCmd.h

00001 #ifndef _ROS_smach_msgs_SmachContainerInitialStatusCmd_h
00002 #define _ROS_smach_msgs_SmachContainerInitialStatusCmd_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 
00009 namespace smach_msgs
00010 {
00011 
00012   class SmachContainerInitialStatusCmd : public ros::Msg
00013   {
00014     public:
00015       const char* path;
00016       uint8_t initial_states_length;
00017       char* st_initial_states;
00018       char* * initial_states;
00019       const char* local_data;
00020 
00021     SmachContainerInitialStatusCmd():
00022       path(""),
00023       initial_states_length(0), initial_states(NULL),
00024       local_data("")
00025     {
00026     }
00027 
00028     virtual int serialize(unsigned char *outbuffer) const
00029     {
00030       int offset = 0;
00031       uint32_t length_path = strlen(this->path);
00032       memcpy(outbuffer + offset, &length_path, sizeof(uint32_t));
00033       offset += 4;
00034       memcpy(outbuffer + offset, this->path, length_path);
00035       offset += length_path;
00036       *(outbuffer + offset++) = initial_states_length;
00037       *(outbuffer + offset++) = 0;
00038       *(outbuffer + offset++) = 0;
00039       *(outbuffer + offset++) = 0;
00040       for( uint8_t i = 0; i < initial_states_length; i++){
00041       uint32_t length_initial_statesi = strlen(this->initial_states[i]);
00042       memcpy(outbuffer + offset, &length_initial_statesi, sizeof(uint32_t));
00043       offset += 4;
00044       memcpy(outbuffer + offset, this->initial_states[i], length_initial_statesi);
00045       offset += length_initial_statesi;
00046       }
00047       uint32_t length_local_data = strlen(this->local_data);
00048       memcpy(outbuffer + offset, &length_local_data, sizeof(uint32_t));
00049       offset += 4;
00050       memcpy(outbuffer + offset, this->local_data, length_local_data);
00051       offset += length_local_data;
00052       return offset;
00053     }
00054 
00055     virtual int deserialize(unsigned char *inbuffer)
00056     {
00057       int offset = 0;
00058       uint32_t length_path;
00059       memcpy(&length_path, (inbuffer + offset), sizeof(uint32_t));
00060       offset += 4;
00061       for(unsigned int k= offset; k< offset+length_path; ++k){
00062           inbuffer[k-1]=inbuffer[k];
00063       }
00064       inbuffer[offset+length_path-1]=0;
00065       this->path = (char *)(inbuffer + offset-1);
00066       offset += length_path;
00067       uint8_t initial_states_lengthT = *(inbuffer + offset++);
00068       if(initial_states_lengthT > initial_states_length)
00069         this->initial_states = (char**)realloc(this->initial_states, initial_states_lengthT * sizeof(char*));
00070       offset += 3;
00071       initial_states_length = initial_states_lengthT;
00072       for( uint8_t i = 0; i < initial_states_length; i++){
00073       uint32_t length_st_initial_states;
00074       memcpy(&length_st_initial_states, (inbuffer + offset), sizeof(uint32_t));
00075       offset += 4;
00076       for(unsigned int k= offset; k< offset+length_st_initial_states; ++k){
00077           inbuffer[k-1]=inbuffer[k];
00078       }
00079       inbuffer[offset+length_st_initial_states-1]=0;
00080       this->st_initial_states = (char *)(inbuffer + offset-1);
00081       offset += length_st_initial_states;
00082         memcpy( &(this->initial_states[i]), &(this->st_initial_states), sizeof(char*));
00083       }
00084       uint32_t length_local_data;
00085       memcpy(&length_local_data, (inbuffer + offset), sizeof(uint32_t));
00086       offset += 4;
00087       for(unsigned int k= offset; k< offset+length_local_data; ++k){
00088           inbuffer[k-1]=inbuffer[k];
00089       }
00090       inbuffer[offset+length_local_data-1]=0;
00091       this->local_data = (char *)(inbuffer + offset-1);
00092       offset += length_local_data;
00093      return offset;
00094     }
00095 
00096     const char * getType(){ return "smach_msgs/SmachContainerInitialStatusCmd"; };
00097     const char * getMD5(){ return "45f8cf31fc29b829db77f23001f788d6"; };
00098 
00099   };
00100 
00101 }
00102 #endif