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

JoyFeedbackArray.h

00001 #ifndef _ROS_sensor_msgs_JoyFeedbackArray_h
00002 #define _ROS_sensor_msgs_JoyFeedbackArray_h
00003 
00004 #include <stdint.h>
00005 #include <string.h>
00006 #include <stdlib.h>
00007 #include "ros/msg.h"
00008 #include "sensor_msgs/JoyFeedback.h"
00009 
00010 namespace sensor_msgs
00011 {
00012 
00013   class JoyFeedbackArray : public ros::Msg
00014   {
00015     public:
00016       uint8_t array_length;
00017       sensor_msgs::JoyFeedback st_array;
00018       sensor_msgs::JoyFeedback * array;
00019 
00020     JoyFeedbackArray():
00021       array_length(0), array(NULL)
00022     {
00023     }
00024 
00025     virtual int serialize(unsigned char *outbuffer) const
00026     {
00027       int offset = 0;
00028       *(outbuffer + offset++) = array_length;
00029       *(outbuffer + offset++) = 0;
00030       *(outbuffer + offset++) = 0;
00031       *(outbuffer + offset++) = 0;
00032       for( uint8_t i = 0; i < array_length; i++){
00033       offset += this->array[i].serialize(outbuffer + offset);
00034       }
00035       return offset;
00036     }
00037 
00038     virtual int deserialize(unsigned char *inbuffer)
00039     {
00040       int offset = 0;
00041       uint8_t array_lengthT = *(inbuffer + offset++);
00042       if(array_lengthT > array_length)
00043         this->array = (sensor_msgs::JoyFeedback*)realloc(this->array, array_lengthT * sizeof(sensor_msgs::JoyFeedback));
00044       offset += 3;
00045       array_length = array_lengthT;
00046       for( uint8_t i = 0; i < array_length; i++){
00047       offset += this->st_array.deserialize(inbuffer + offset);
00048         memcpy( &(this->array[i]), &(this->st_array), sizeof(sensor_msgs::JoyFeedback));
00049       }
00050      return offset;
00051     }
00052 
00053     const char * getType(){ return "sensor_msgs/JoyFeedbackArray"; };
00054     const char * getMD5(){ return "cde5730a895b1fc4dee6f91b754b213d"; };
00055 
00056   };
00057 
00058 }
00059 #endif