Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
GetPolledImage.h
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 typedef const char* _response_namespace_type; 00020 _response_namespace_type response_namespace; 00021 typedef ros::Duration _timeout_type; 00022 _timeout_type timeout; 00023 typedef uint32_t _binning_x_type; 00024 _binning_x_type binning_x; 00025 typedef uint32_t _binning_y_type; 00026 _binning_y_type binning_y; 00027 typedef sensor_msgs::RegionOfInterest _roi_type; 00028 _roi_type roi; 00029 00030 GetPolledImageRequest(): 00031 response_namespace(""), 00032 timeout(), 00033 binning_x(0), 00034 binning_y(0), 00035 roi() 00036 { 00037 } 00038 00039 virtual int serialize(unsigned char *outbuffer) const 00040 { 00041 int offset = 0; 00042 uint32_t length_response_namespace = strlen(this->response_namespace); 00043 varToArr(outbuffer + offset, length_response_namespace); 00044 offset += 4; 00045 memcpy(outbuffer + offset, this->response_namespace, length_response_namespace); 00046 offset += length_response_namespace; 00047 *(outbuffer + offset + 0) = (this->timeout.sec >> (8 * 0)) & 0xFF; 00048 *(outbuffer + offset + 1) = (this->timeout.sec >> (8 * 1)) & 0xFF; 00049 *(outbuffer + offset + 2) = (this->timeout.sec >> (8 * 2)) & 0xFF; 00050 *(outbuffer + offset + 3) = (this->timeout.sec >> (8 * 3)) & 0xFF; 00051 offset += sizeof(this->timeout.sec); 00052 *(outbuffer + offset + 0) = (this->timeout.nsec >> (8 * 0)) & 0xFF; 00053 *(outbuffer + offset + 1) = (this->timeout.nsec >> (8 * 1)) & 0xFF; 00054 *(outbuffer + offset + 2) = (this->timeout.nsec >> (8 * 2)) & 0xFF; 00055 *(outbuffer + offset + 3) = (this->timeout.nsec >> (8 * 3)) & 0xFF; 00056 offset += sizeof(this->timeout.nsec); 00057 *(outbuffer + offset + 0) = (this->binning_x >> (8 * 0)) & 0xFF; 00058 *(outbuffer + offset + 1) = (this->binning_x >> (8 * 1)) & 0xFF; 00059 *(outbuffer + offset + 2) = (this->binning_x >> (8 * 2)) & 0xFF; 00060 *(outbuffer + offset + 3) = (this->binning_x >> (8 * 3)) & 0xFF; 00061 offset += sizeof(this->binning_x); 00062 *(outbuffer + offset + 0) = (this->binning_y >> (8 * 0)) & 0xFF; 00063 *(outbuffer + offset + 1) = (this->binning_y >> (8 * 1)) & 0xFF; 00064 *(outbuffer + offset + 2) = (this->binning_y >> (8 * 2)) & 0xFF; 00065 *(outbuffer + offset + 3) = (this->binning_y >> (8 * 3)) & 0xFF; 00066 offset += sizeof(this->binning_y); 00067 offset += this->roi.serialize(outbuffer + offset); 00068 return offset; 00069 } 00070 00071 virtual int deserialize(unsigned char *inbuffer) 00072 { 00073 int offset = 0; 00074 uint32_t length_response_namespace; 00075 arrToVar(length_response_namespace, (inbuffer + offset)); 00076 offset += 4; 00077 for(unsigned int k= offset; k< offset+length_response_namespace; ++k){ 00078 inbuffer[k-1]=inbuffer[k]; 00079 } 00080 inbuffer[offset+length_response_namespace-1]=0; 00081 this->response_namespace = (char *)(inbuffer + offset-1); 00082 offset += length_response_namespace; 00083 this->timeout.sec = ((uint32_t) (*(inbuffer + offset))); 00084 this->timeout.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00085 this->timeout.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00086 this->timeout.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00087 offset += sizeof(this->timeout.sec); 00088 this->timeout.nsec = ((uint32_t) (*(inbuffer + offset))); 00089 this->timeout.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00090 this->timeout.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00091 this->timeout.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00092 offset += sizeof(this->timeout.nsec); 00093 this->binning_x = ((uint32_t) (*(inbuffer + offset))); 00094 this->binning_x |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00095 this->binning_x |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00096 this->binning_x |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00097 offset += sizeof(this->binning_x); 00098 this->binning_y = ((uint32_t) (*(inbuffer + offset))); 00099 this->binning_y |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00100 this->binning_y |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00101 this->binning_y |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00102 offset += sizeof(this->binning_y); 00103 offset += this->roi.deserialize(inbuffer + offset); 00104 return offset; 00105 } 00106 00107 const char * getType(){ return GETPOLLEDIMAGE; }; 00108 const char * getMD5(){ return "c77ed43e530fd48e9e7a2a93845e154c"; }; 00109 00110 }; 00111 00112 class GetPolledImageResponse : public ros::Msg 00113 { 00114 public: 00115 typedef bool _success_type; 00116 _success_type success; 00117 typedef const char* _status_message_type; 00118 _status_message_type status_message; 00119 typedef ros::Time _stamp_type; 00120 _stamp_type stamp; 00121 00122 GetPolledImageResponse(): 00123 success(0), 00124 status_message(""), 00125 stamp() 00126 { 00127 } 00128 00129 virtual int serialize(unsigned char *outbuffer) const 00130 { 00131 int offset = 0; 00132 union { 00133 bool real; 00134 uint8_t base; 00135 } u_success; 00136 u_success.real = this->success; 00137 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; 00138 offset += sizeof(this->success); 00139 uint32_t length_status_message = strlen(this->status_message); 00140 varToArr(outbuffer + offset, length_status_message); 00141 offset += 4; 00142 memcpy(outbuffer + offset, this->status_message, length_status_message); 00143 offset += length_status_message; 00144 *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF; 00145 *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF; 00146 *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF; 00147 *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF; 00148 offset += sizeof(this->stamp.sec); 00149 *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF; 00150 *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF; 00151 *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF; 00152 *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF; 00153 offset += sizeof(this->stamp.nsec); 00154 return offset; 00155 } 00156 00157 virtual int deserialize(unsigned char *inbuffer) 00158 { 00159 int offset = 0; 00160 union { 00161 bool real; 00162 uint8_t base; 00163 } u_success; 00164 u_success.base = 0; 00165 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00166 this->success = u_success.real; 00167 offset += sizeof(this->success); 00168 uint32_t length_status_message; 00169 arrToVar(length_status_message, (inbuffer + offset)); 00170 offset += 4; 00171 for(unsigned int k= offset; k< offset+length_status_message; ++k){ 00172 inbuffer[k-1]=inbuffer[k]; 00173 } 00174 inbuffer[offset+length_status_message-1]=0; 00175 this->status_message = (char *)(inbuffer + offset-1); 00176 offset += length_status_message; 00177 this->stamp.sec = ((uint32_t) (*(inbuffer + offset))); 00178 this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00179 this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00180 this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00181 offset += sizeof(this->stamp.sec); 00182 this->stamp.nsec = ((uint32_t) (*(inbuffer + offset))); 00183 this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); 00184 this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); 00185 this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); 00186 offset += sizeof(this->stamp.nsec); 00187 return offset; 00188 } 00189 00190 const char * getType(){ return GETPOLLEDIMAGE; }; 00191 const char * getMD5(){ return "dbf1f851bc511800e6129ccd5a3542ab"; }; 00192 00193 }; 00194 00195 class GetPolledImage { 00196 public: 00197 typedef GetPolledImageRequest Request; 00198 typedef GetPolledImageResponse Response; 00199 }; 00200 00201 } 00202 #endif
Generated on Wed Jul 13 2022 23:30:17 by
