Go to the documentation of this file.00001 #ifndef _ROS_SERVICE_GetPolledImage_h
00002 #define _ROS_SERVICE_GetPolledImage_h
00003 #include <stdint.h>
00004 #include <string.h>
00005 #include <stdlib.h>
00006 #include "ros/msg.h"
00007 #include "sensor_msgs/RegionOfInterest.h"
00008 #include "ros/duration.h"
00009 #include "ros/time.h"
00010
00011 namespace polled_camera
00012 {
00013
00014 static const char GETPOLLEDIMAGE[] = "polled_camera/GetPolledImage";
00015
00016 class GetPolledImageRequest : public ros::Msg
00017 {
00018 public:
00019 const char* response_namespace;
00020 ros::Duration timeout;
00021 uint32_t binning_x;
00022 uint32_t binning_y;
00023 sensor_msgs::RegionOfInterest roi;
00024
00025 virtual int serialize(unsigned char *outbuffer) const
00026 {
00027 int offset = 0;
00028 uint32_t length_response_namespace = strlen(this->response_namespace);
00029 memcpy(outbuffer + offset, &length_response_namespace, sizeof(uint32_t));
00030 offset += 4;
00031 memcpy(outbuffer + offset, this->response_namespace, length_response_namespace);
00032 offset += length_response_namespace;
00033 *(outbuffer + offset + 0) = (this->timeout.sec >> (8 * 0)) & 0xFF;
00034 *(outbuffer + offset + 1) = (this->timeout.sec >> (8 * 1)) & 0xFF;
00035 *(outbuffer + offset + 2) = (this->timeout.sec >> (8 * 2)) & 0xFF;
00036 *(outbuffer + offset + 3) = (this->timeout.sec >> (8 * 3)) & 0xFF;
00037 offset += sizeof(this->timeout.sec);
00038 *(outbuffer + offset + 0) = (this->timeout.nsec >> (8 * 0)) & 0xFF;
00039 *(outbuffer + offset + 1) = (this->timeout.nsec >> (8 * 1)) & 0xFF;
00040 *(outbuffer + offset + 2) = (this->timeout.nsec >> (8 * 2)) & 0xFF;
00041 *(outbuffer + offset + 3) = (this->timeout.nsec >> (8 * 3)) & 0xFF;
00042 offset += sizeof(this->timeout.nsec);
00043 *(outbuffer + offset + 0) = (this->binning_x >> (8 * 0)) & 0xFF;
00044 *(outbuffer + offset + 1) = (this->binning_x >> (8 * 1)) & 0xFF;
00045 *(outbuffer + offset + 2) = (this->binning_x >> (8 * 2)) & 0xFF;
00046 *(outbuffer + offset + 3) = (this->binning_x >> (8 * 3)) & 0xFF;
00047 offset += sizeof(this->binning_x);
00048 *(outbuffer + offset + 0) = (this->binning_y >> (8 * 0)) & 0xFF;
00049 *(outbuffer + offset + 1) = (this->binning_y >> (8 * 1)) & 0xFF;
00050 *(outbuffer + offset + 2) = (this->binning_y >> (8 * 2)) & 0xFF;
00051 *(outbuffer + offset + 3) = (this->binning_y >> (8 * 3)) & 0xFF;
00052 offset += sizeof(this->binning_y);
00053 offset += this->roi.serialize(outbuffer + offset);
00054 return offset;
00055 }
00056
00057 virtual int deserialize(unsigned char *inbuffer)
00058 {
00059 int offset = 0;
00060 uint32_t length_response_namespace;
00061 memcpy(&length_response_namespace, (inbuffer + offset), sizeof(uint32_t));
00062 offset += 4;
00063 for(unsigned int k= offset; k< offset+length_response_namespace; ++k){
00064 inbuffer[k-1]=inbuffer[k];
00065 }
00066 inbuffer[offset+length_response_namespace-1]=0;
00067 this->response_namespace = (char *)(inbuffer + offset-1);
00068 offset += length_response_namespace;
00069 this->timeout.sec = ((uint32_t) (*(inbuffer + offset)));
00070 this->timeout.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00071 this->timeout.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00072 this->timeout.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00073 offset += sizeof(this->timeout.sec);
00074 this->timeout.nsec = ((uint32_t) (*(inbuffer + offset)));
00075 this->timeout.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00076 this->timeout.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00077 this->timeout.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00078 offset += sizeof(this->timeout.nsec);
00079 this->binning_x = ((uint32_t) (*(inbuffer + offset)));
00080 this->binning_x |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00081 this->binning_x |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00082 this->binning_x |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00083 offset += sizeof(this->binning_x);
00084 this->binning_y = ((uint32_t) (*(inbuffer + offset)));
00085 this->binning_y |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00086 this->binning_y |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00087 this->binning_y |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00088 offset += sizeof(this->binning_y);
00089 offset += this->roi.deserialize(inbuffer + offset);
00090 return offset;
00091 }
00092
00093 const char * getType(){ return GETPOLLEDIMAGE; };
00094 const char * getMD5(){ return "c77ed43e530fd48e9e7a2a93845e154c"; };
00095
00096 };
00097
00098 class GetPolledImageResponse : public ros::Msg
00099 {
00100 public:
00101 bool success;
00102 const char* status_message;
00103 ros::Time stamp;
00104
00105 virtual int serialize(unsigned char *outbuffer) const
00106 {
00107 int offset = 0;
00108 union {
00109 bool real;
00110 uint8_t base;
00111 } u_success;
00112 u_success.real = this->success;
00113 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00114 offset += sizeof(this->success);
00115 uint32_t length_status_message = strlen(this->status_message);
00116 memcpy(outbuffer + offset, &length_status_message, sizeof(uint32_t));
00117 offset += 4;
00118 memcpy(outbuffer + offset, this->status_message, length_status_message);
00119 offset += length_status_message;
00120 *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF;
00121 *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF;
00122 *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF;
00123 *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF;
00124 offset += sizeof(this->stamp.sec);
00125 *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF;
00126 *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF;
00127 *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF;
00128 *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF;
00129 offset += sizeof(this->stamp.nsec);
00130 return offset;
00131 }
00132
00133 virtual int deserialize(unsigned char *inbuffer)
00134 {
00135 int offset = 0;
00136 union {
00137 bool real;
00138 uint8_t base;
00139 } u_success;
00140 u_success.base = 0;
00141 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00142 this->success = u_success.real;
00143 offset += sizeof(this->success);
00144 uint32_t length_status_message;
00145 memcpy(&length_status_message, (inbuffer + offset), sizeof(uint32_t));
00146 offset += 4;
00147 for(unsigned int k= offset; k< offset+length_status_message; ++k){
00148 inbuffer[k-1]=inbuffer[k];
00149 }
00150 inbuffer[offset+length_status_message-1]=0;
00151 this->status_message = (char *)(inbuffer + offset-1);
00152 offset += length_status_message;
00153 this->stamp.sec = ((uint32_t) (*(inbuffer + offset)));
00154 this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00155 this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00156 this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00157 offset += sizeof(this->stamp.sec);
00158 this->stamp.nsec = ((uint32_t) (*(inbuffer + offset)));
00159 this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
00160 this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
00161 this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
00162 offset += sizeof(this->stamp.nsec);
00163 return offset;
00164 }
00165
00166 const char * getType(){ return GETPOLLEDIMAGE; };
00167 const char * getMD5(){ return "dbf1f851bc511800e6129ccd5a3542ab"; };
00168
00169 };
00170
00171 class GetPolledImage {
00172 public:
00173 typedef GetPolledImageRequest Request;
00174 typedef GetPolledImageResponse Response;
00175 };
00176
00177 }
00178 #endif