rosserial library for mbed Inspired by nucho's rosserial library This library is still under development

Dependencies:   MODSERIAL mbed

Dependents:   mbed_roshydro_test

Library still under development!

Committer:
akashvibhute
Date:
Sun Feb 15 10:53:43 2015 +0000
Revision:
0:30537dec6e0b
First commit; Library still need to be debugged, compilation issues with new mbed and modserial updates.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
akashvibhute 0:30537dec6e0b 1 #ifndef _ROS_ur_msgs_IOStates_h
akashvibhute 0:30537dec6e0b 2 #define _ROS_ur_msgs_IOStates_h
akashvibhute 0:30537dec6e0b 3
akashvibhute 0:30537dec6e0b 4 #include <stdint.h>
akashvibhute 0:30537dec6e0b 5 #include <string.h>
akashvibhute 0:30537dec6e0b 6 #include <stdlib.h>
akashvibhute 0:30537dec6e0b 7 #include "ros/msg.h"
akashvibhute 0:30537dec6e0b 8 #include "ur_msgs/Digital.h"
akashvibhute 0:30537dec6e0b 9 #include "ur_msgs/Analog.h"
akashvibhute 0:30537dec6e0b 10
akashvibhute 0:30537dec6e0b 11 namespace ur_msgs
akashvibhute 0:30537dec6e0b 12 {
akashvibhute 0:30537dec6e0b 13
akashvibhute 0:30537dec6e0b 14 class IOStates : public ros::Msg
akashvibhute 0:30537dec6e0b 15 {
akashvibhute 0:30537dec6e0b 16 public:
akashvibhute 0:30537dec6e0b 17 uint8_t digital_in_states_length;
akashvibhute 0:30537dec6e0b 18 ur_msgs::Digital st_digital_in_states;
akashvibhute 0:30537dec6e0b 19 ur_msgs::Digital * digital_in_states;
akashvibhute 0:30537dec6e0b 20 uint8_t digital_out_states_length;
akashvibhute 0:30537dec6e0b 21 ur_msgs::Digital st_digital_out_states;
akashvibhute 0:30537dec6e0b 22 ur_msgs::Digital * digital_out_states;
akashvibhute 0:30537dec6e0b 23 uint8_t flag_states_length;
akashvibhute 0:30537dec6e0b 24 ur_msgs::Digital st_flag_states;
akashvibhute 0:30537dec6e0b 25 ur_msgs::Digital * flag_states;
akashvibhute 0:30537dec6e0b 26 uint8_t analog_in_states_length;
akashvibhute 0:30537dec6e0b 27 ur_msgs::Analog st_analog_in_states;
akashvibhute 0:30537dec6e0b 28 ur_msgs::Analog * analog_in_states;
akashvibhute 0:30537dec6e0b 29 uint8_t analog_out_states_length;
akashvibhute 0:30537dec6e0b 30 ur_msgs::Analog st_analog_out_states;
akashvibhute 0:30537dec6e0b 31 ur_msgs::Analog * analog_out_states;
akashvibhute 0:30537dec6e0b 32
akashvibhute 0:30537dec6e0b 33 IOStates():
akashvibhute 0:30537dec6e0b 34 digital_in_states_length(0), digital_in_states(NULL),
akashvibhute 0:30537dec6e0b 35 digital_out_states_length(0), digital_out_states(NULL),
akashvibhute 0:30537dec6e0b 36 flag_states_length(0), flag_states(NULL),
akashvibhute 0:30537dec6e0b 37 analog_in_states_length(0), analog_in_states(NULL),
akashvibhute 0:30537dec6e0b 38 analog_out_states_length(0), analog_out_states(NULL)
akashvibhute 0:30537dec6e0b 39 {
akashvibhute 0:30537dec6e0b 40 }
akashvibhute 0:30537dec6e0b 41
akashvibhute 0:30537dec6e0b 42 virtual int serialize(unsigned char *outbuffer) const
akashvibhute 0:30537dec6e0b 43 {
akashvibhute 0:30537dec6e0b 44 int offset = 0;
akashvibhute 0:30537dec6e0b 45 *(outbuffer + offset++) = digital_in_states_length;
akashvibhute 0:30537dec6e0b 46 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 47 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 48 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 49 for( uint8_t i = 0; i < digital_in_states_length; i++){
akashvibhute 0:30537dec6e0b 50 offset += this->digital_in_states[i].serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 51 }
akashvibhute 0:30537dec6e0b 52 *(outbuffer + offset++) = digital_out_states_length;
akashvibhute 0:30537dec6e0b 53 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 54 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 55 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 56 for( uint8_t i = 0; i < digital_out_states_length; i++){
akashvibhute 0:30537dec6e0b 57 offset += this->digital_out_states[i].serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 58 }
akashvibhute 0:30537dec6e0b 59 *(outbuffer + offset++) = flag_states_length;
akashvibhute 0:30537dec6e0b 60 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 61 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 62 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 63 for( uint8_t i = 0; i < flag_states_length; i++){
akashvibhute 0:30537dec6e0b 64 offset += this->flag_states[i].serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 65 }
akashvibhute 0:30537dec6e0b 66 *(outbuffer + offset++) = analog_in_states_length;
akashvibhute 0:30537dec6e0b 67 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 68 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 69 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 70 for( uint8_t i = 0; i < analog_in_states_length; i++){
akashvibhute 0:30537dec6e0b 71 offset += this->analog_in_states[i].serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 72 }
akashvibhute 0:30537dec6e0b 73 *(outbuffer + offset++) = analog_out_states_length;
akashvibhute 0:30537dec6e0b 74 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 75 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 76 *(outbuffer + offset++) = 0;
akashvibhute 0:30537dec6e0b 77 for( uint8_t i = 0; i < analog_out_states_length; i++){
akashvibhute 0:30537dec6e0b 78 offset += this->analog_out_states[i].serialize(outbuffer + offset);
akashvibhute 0:30537dec6e0b 79 }
akashvibhute 0:30537dec6e0b 80 return offset;
akashvibhute 0:30537dec6e0b 81 }
akashvibhute 0:30537dec6e0b 82
akashvibhute 0:30537dec6e0b 83 virtual int deserialize(unsigned char *inbuffer)
akashvibhute 0:30537dec6e0b 84 {
akashvibhute 0:30537dec6e0b 85 int offset = 0;
akashvibhute 0:30537dec6e0b 86 uint8_t digital_in_states_lengthT = *(inbuffer + offset++);
akashvibhute 0:30537dec6e0b 87 if(digital_in_states_lengthT > digital_in_states_length)
akashvibhute 0:30537dec6e0b 88 this->digital_in_states = (ur_msgs::Digital*)realloc(this->digital_in_states, digital_in_states_lengthT * sizeof(ur_msgs::Digital));
akashvibhute 0:30537dec6e0b 89 offset += 3;
akashvibhute 0:30537dec6e0b 90 digital_in_states_length = digital_in_states_lengthT;
akashvibhute 0:30537dec6e0b 91 for( uint8_t i = 0; i < digital_in_states_length; i++){
akashvibhute 0:30537dec6e0b 92 offset += this->st_digital_in_states.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 93 memcpy( &(this->digital_in_states[i]), &(this->st_digital_in_states), sizeof(ur_msgs::Digital));
akashvibhute 0:30537dec6e0b 94 }
akashvibhute 0:30537dec6e0b 95 uint8_t digital_out_states_lengthT = *(inbuffer + offset++);
akashvibhute 0:30537dec6e0b 96 if(digital_out_states_lengthT > digital_out_states_length)
akashvibhute 0:30537dec6e0b 97 this->digital_out_states = (ur_msgs::Digital*)realloc(this->digital_out_states, digital_out_states_lengthT * sizeof(ur_msgs::Digital));
akashvibhute 0:30537dec6e0b 98 offset += 3;
akashvibhute 0:30537dec6e0b 99 digital_out_states_length = digital_out_states_lengthT;
akashvibhute 0:30537dec6e0b 100 for( uint8_t i = 0; i < digital_out_states_length; i++){
akashvibhute 0:30537dec6e0b 101 offset += this->st_digital_out_states.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 102 memcpy( &(this->digital_out_states[i]), &(this->st_digital_out_states), sizeof(ur_msgs::Digital));
akashvibhute 0:30537dec6e0b 103 }
akashvibhute 0:30537dec6e0b 104 uint8_t flag_states_lengthT = *(inbuffer + offset++);
akashvibhute 0:30537dec6e0b 105 if(flag_states_lengthT > flag_states_length)
akashvibhute 0:30537dec6e0b 106 this->flag_states = (ur_msgs::Digital*)realloc(this->flag_states, flag_states_lengthT * sizeof(ur_msgs::Digital));
akashvibhute 0:30537dec6e0b 107 offset += 3;
akashvibhute 0:30537dec6e0b 108 flag_states_length = flag_states_lengthT;
akashvibhute 0:30537dec6e0b 109 for( uint8_t i = 0; i < flag_states_length; i++){
akashvibhute 0:30537dec6e0b 110 offset += this->st_flag_states.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 111 memcpy( &(this->flag_states[i]), &(this->st_flag_states), sizeof(ur_msgs::Digital));
akashvibhute 0:30537dec6e0b 112 }
akashvibhute 0:30537dec6e0b 113 uint8_t analog_in_states_lengthT = *(inbuffer + offset++);
akashvibhute 0:30537dec6e0b 114 if(analog_in_states_lengthT > analog_in_states_length)
akashvibhute 0:30537dec6e0b 115 this->analog_in_states = (ur_msgs::Analog*)realloc(this->analog_in_states, analog_in_states_lengthT * sizeof(ur_msgs::Analog));
akashvibhute 0:30537dec6e0b 116 offset += 3;
akashvibhute 0:30537dec6e0b 117 analog_in_states_length = analog_in_states_lengthT;
akashvibhute 0:30537dec6e0b 118 for( uint8_t i = 0; i < analog_in_states_length; i++){
akashvibhute 0:30537dec6e0b 119 offset += this->st_analog_in_states.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 120 memcpy( &(this->analog_in_states[i]), &(this->st_analog_in_states), sizeof(ur_msgs::Analog));
akashvibhute 0:30537dec6e0b 121 }
akashvibhute 0:30537dec6e0b 122 uint8_t analog_out_states_lengthT = *(inbuffer + offset++);
akashvibhute 0:30537dec6e0b 123 if(analog_out_states_lengthT > analog_out_states_length)
akashvibhute 0:30537dec6e0b 124 this->analog_out_states = (ur_msgs::Analog*)realloc(this->analog_out_states, analog_out_states_lengthT * sizeof(ur_msgs::Analog));
akashvibhute 0:30537dec6e0b 125 offset += 3;
akashvibhute 0:30537dec6e0b 126 analog_out_states_length = analog_out_states_lengthT;
akashvibhute 0:30537dec6e0b 127 for( uint8_t i = 0; i < analog_out_states_length; i++){
akashvibhute 0:30537dec6e0b 128 offset += this->st_analog_out_states.deserialize(inbuffer + offset);
akashvibhute 0:30537dec6e0b 129 memcpy( &(this->analog_out_states[i]), &(this->st_analog_out_states), sizeof(ur_msgs::Analog));
akashvibhute 0:30537dec6e0b 130 }
akashvibhute 0:30537dec6e0b 131 return offset;
akashvibhute 0:30537dec6e0b 132 }
akashvibhute 0:30537dec6e0b 133
akashvibhute 0:30537dec6e0b 134 const char * getType(){ return "ur_msgs/IOStates"; };
akashvibhute 0:30537dec6e0b 135 const char * getMD5(){ return "0a5c7b73e3189e9a2caf8583d1bae2e2"; };
akashvibhute 0:30537dec6e0b 136
akashvibhute 0:30537dec6e0b 137 };
akashvibhute 0:30537dec6e0b 138
akashvibhute 0:30537dec6e0b 139 }
akashvibhute 0:30537dec6e0b 140 #endif