rosserial library for mbed Inspired by nucho's rosserial library This library is still under development
Dependents: mbed_roshydro_test
Library still under development!
household_objects_database_msgs/TranslateRecognitionId.h@0:30537dec6e0b, 2015-02-15 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
akashvibhute | 0:30537dec6e0b | 1 | #ifndef _ROS_SERVICE_TranslateRecognitionId_h |
akashvibhute | 0:30537dec6e0b | 2 | #define _ROS_SERVICE_TranslateRecognitionId_h |
akashvibhute | 0:30537dec6e0b | 3 | #include <stdint.h> |
akashvibhute | 0:30537dec6e0b | 4 | #include <string.h> |
akashvibhute | 0:30537dec6e0b | 5 | #include <stdlib.h> |
akashvibhute | 0:30537dec6e0b | 6 | #include "ros/msg.h" |
akashvibhute | 0:30537dec6e0b | 7 | |
akashvibhute | 0:30537dec6e0b | 8 | namespace household_objects_database_msgs |
akashvibhute | 0:30537dec6e0b | 9 | { |
akashvibhute | 0:30537dec6e0b | 10 | |
akashvibhute | 0:30537dec6e0b | 11 | static const char TRANSLATERECOGNITIONID[] = "household_objects_database_msgs/TranslateRecognitionId"; |
akashvibhute | 0:30537dec6e0b | 12 | |
akashvibhute | 0:30537dec6e0b | 13 | class TranslateRecognitionIdRequest : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 14 | { |
akashvibhute | 0:30537dec6e0b | 15 | public: |
akashvibhute | 0:30537dec6e0b | 16 | const char* recognition_id; |
akashvibhute | 0:30537dec6e0b | 17 | |
akashvibhute | 0:30537dec6e0b | 18 | TranslateRecognitionIdRequest(): |
akashvibhute | 0:30537dec6e0b | 19 | recognition_id("") |
akashvibhute | 0:30537dec6e0b | 20 | { |
akashvibhute | 0:30537dec6e0b | 21 | } |
akashvibhute | 0:30537dec6e0b | 22 | |
akashvibhute | 0:30537dec6e0b | 23 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 24 | { |
akashvibhute | 0:30537dec6e0b | 25 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 26 | uint32_t length_recognition_id = strlen(this->recognition_id); |
akashvibhute | 0:30537dec6e0b | 27 | memcpy(outbuffer + offset, &length_recognition_id, sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 28 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 29 | memcpy(outbuffer + offset, this->recognition_id, length_recognition_id); |
akashvibhute | 0:30537dec6e0b | 30 | offset += length_recognition_id; |
akashvibhute | 0:30537dec6e0b | 31 | return offset; |
akashvibhute | 0:30537dec6e0b | 32 | } |
akashvibhute | 0:30537dec6e0b | 33 | |
akashvibhute | 0:30537dec6e0b | 34 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 35 | { |
akashvibhute | 0:30537dec6e0b | 36 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 37 | uint32_t length_recognition_id; |
akashvibhute | 0:30537dec6e0b | 38 | memcpy(&length_recognition_id, (inbuffer + offset), sizeof(uint32_t)); |
akashvibhute | 0:30537dec6e0b | 39 | offset += 4; |
akashvibhute | 0:30537dec6e0b | 40 | for(unsigned int k= offset; k< offset+length_recognition_id; ++k){ |
akashvibhute | 0:30537dec6e0b | 41 | inbuffer[k-1]=inbuffer[k]; |
akashvibhute | 0:30537dec6e0b | 42 | } |
akashvibhute | 0:30537dec6e0b | 43 | inbuffer[offset+length_recognition_id-1]=0; |
akashvibhute | 0:30537dec6e0b | 44 | this->recognition_id = (char *)(inbuffer + offset-1); |
akashvibhute | 0:30537dec6e0b | 45 | offset += length_recognition_id; |
akashvibhute | 0:30537dec6e0b | 46 | return offset; |
akashvibhute | 0:30537dec6e0b | 47 | } |
akashvibhute | 0:30537dec6e0b | 48 | |
akashvibhute | 0:30537dec6e0b | 49 | const char * getType(){ return TRANSLATERECOGNITIONID; }; |
akashvibhute | 0:30537dec6e0b | 50 | const char * getMD5(){ return "4d95610f63ed69a670a8f8aaa3c6aa36"; }; |
akashvibhute | 0:30537dec6e0b | 51 | |
akashvibhute | 0:30537dec6e0b | 52 | }; |
akashvibhute | 0:30537dec6e0b | 53 | |
akashvibhute | 0:30537dec6e0b | 54 | class TranslateRecognitionIdResponse : public ros::Msg |
akashvibhute | 0:30537dec6e0b | 55 | { |
akashvibhute | 0:30537dec6e0b | 56 | public: |
akashvibhute | 0:30537dec6e0b | 57 | int32_t household_objects_id; |
akashvibhute | 0:30537dec6e0b | 58 | int32_t ID_NOT_FOUND; |
akashvibhute | 0:30537dec6e0b | 59 | int32_t DATABASE_ERROR; |
akashvibhute | 0:30537dec6e0b | 60 | int32_t OTHER_ERROR; |
akashvibhute | 0:30537dec6e0b | 61 | int32_t result; |
akashvibhute | 0:30537dec6e0b | 62 | enum { SUCCESS = 0 }; |
akashvibhute | 0:30537dec6e0b | 63 | |
akashvibhute | 0:30537dec6e0b | 64 | TranslateRecognitionIdResponse(): |
akashvibhute | 0:30537dec6e0b | 65 | household_objects_id(0), |
akashvibhute | 0:30537dec6e0b | 66 | ID_NOT_FOUND(0), |
akashvibhute | 0:30537dec6e0b | 67 | DATABASE_ERROR(0), |
akashvibhute | 0:30537dec6e0b | 68 | OTHER_ERROR(0), |
akashvibhute | 0:30537dec6e0b | 69 | result(0) |
akashvibhute | 0:30537dec6e0b | 70 | { |
akashvibhute | 0:30537dec6e0b | 71 | } |
akashvibhute | 0:30537dec6e0b | 72 | |
akashvibhute | 0:30537dec6e0b | 73 | virtual int serialize(unsigned char *outbuffer) const |
akashvibhute | 0:30537dec6e0b | 74 | { |
akashvibhute | 0:30537dec6e0b | 75 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 76 | union { |
akashvibhute | 0:30537dec6e0b | 77 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 78 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 79 | } u_household_objects_id; |
akashvibhute | 0:30537dec6e0b | 80 | u_household_objects_id.real = this->household_objects_id; |
akashvibhute | 0:30537dec6e0b | 81 | *(outbuffer + offset + 0) = (u_household_objects_id.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 82 | *(outbuffer + offset + 1) = (u_household_objects_id.base >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 83 | *(outbuffer + offset + 2) = (u_household_objects_id.base >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 84 | *(outbuffer + offset + 3) = (u_household_objects_id.base >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 85 | offset += sizeof(this->household_objects_id); |
akashvibhute | 0:30537dec6e0b | 86 | union { |
akashvibhute | 0:30537dec6e0b | 87 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 88 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 89 | } u_ID_NOT_FOUND; |
akashvibhute | 0:30537dec6e0b | 90 | u_ID_NOT_FOUND.real = this->ID_NOT_FOUND; |
akashvibhute | 0:30537dec6e0b | 91 | *(outbuffer + offset + 0) = (u_ID_NOT_FOUND.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 92 | *(outbuffer + offset + 1) = (u_ID_NOT_FOUND.base >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 93 | *(outbuffer + offset + 2) = (u_ID_NOT_FOUND.base >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 94 | *(outbuffer + offset + 3) = (u_ID_NOT_FOUND.base >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 95 | offset += sizeof(this->ID_NOT_FOUND); |
akashvibhute | 0:30537dec6e0b | 96 | union { |
akashvibhute | 0:30537dec6e0b | 97 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 98 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 99 | } u_DATABASE_ERROR; |
akashvibhute | 0:30537dec6e0b | 100 | u_DATABASE_ERROR.real = this->DATABASE_ERROR; |
akashvibhute | 0:30537dec6e0b | 101 | *(outbuffer + offset + 0) = (u_DATABASE_ERROR.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 102 | *(outbuffer + offset + 1) = (u_DATABASE_ERROR.base >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 103 | *(outbuffer + offset + 2) = (u_DATABASE_ERROR.base >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 104 | *(outbuffer + offset + 3) = (u_DATABASE_ERROR.base >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 105 | offset += sizeof(this->DATABASE_ERROR); |
akashvibhute | 0:30537dec6e0b | 106 | union { |
akashvibhute | 0:30537dec6e0b | 107 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 108 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 109 | } u_OTHER_ERROR; |
akashvibhute | 0:30537dec6e0b | 110 | u_OTHER_ERROR.real = this->OTHER_ERROR; |
akashvibhute | 0:30537dec6e0b | 111 | *(outbuffer + offset + 0) = (u_OTHER_ERROR.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 112 | *(outbuffer + offset + 1) = (u_OTHER_ERROR.base >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 113 | *(outbuffer + offset + 2) = (u_OTHER_ERROR.base >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 114 | *(outbuffer + offset + 3) = (u_OTHER_ERROR.base >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 115 | offset += sizeof(this->OTHER_ERROR); |
akashvibhute | 0:30537dec6e0b | 116 | union { |
akashvibhute | 0:30537dec6e0b | 117 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 118 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 119 | } u_result; |
akashvibhute | 0:30537dec6e0b | 120 | u_result.real = this->result; |
akashvibhute | 0:30537dec6e0b | 121 | *(outbuffer + offset + 0) = (u_result.base >> (8 * 0)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 122 | *(outbuffer + offset + 1) = (u_result.base >> (8 * 1)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 123 | *(outbuffer + offset + 2) = (u_result.base >> (8 * 2)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 124 | *(outbuffer + offset + 3) = (u_result.base >> (8 * 3)) & 0xFF; |
akashvibhute | 0:30537dec6e0b | 125 | offset += sizeof(this->result); |
akashvibhute | 0:30537dec6e0b | 126 | return offset; |
akashvibhute | 0:30537dec6e0b | 127 | } |
akashvibhute | 0:30537dec6e0b | 128 | |
akashvibhute | 0:30537dec6e0b | 129 | virtual int deserialize(unsigned char *inbuffer) |
akashvibhute | 0:30537dec6e0b | 130 | { |
akashvibhute | 0:30537dec6e0b | 131 | int offset = 0; |
akashvibhute | 0:30537dec6e0b | 132 | union { |
akashvibhute | 0:30537dec6e0b | 133 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 134 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 135 | } u_household_objects_id; |
akashvibhute | 0:30537dec6e0b | 136 | u_household_objects_id.base = 0; |
akashvibhute | 0:30537dec6e0b | 137 | u_household_objects_id.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 138 | u_household_objects_id.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 139 | u_household_objects_id.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 140 | u_household_objects_id.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 141 | this->household_objects_id = u_household_objects_id.real; |
akashvibhute | 0:30537dec6e0b | 142 | offset += sizeof(this->household_objects_id); |
akashvibhute | 0:30537dec6e0b | 143 | union { |
akashvibhute | 0:30537dec6e0b | 144 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 145 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 146 | } u_ID_NOT_FOUND; |
akashvibhute | 0:30537dec6e0b | 147 | u_ID_NOT_FOUND.base = 0; |
akashvibhute | 0:30537dec6e0b | 148 | u_ID_NOT_FOUND.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 149 | u_ID_NOT_FOUND.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 150 | u_ID_NOT_FOUND.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 151 | u_ID_NOT_FOUND.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 152 | this->ID_NOT_FOUND = u_ID_NOT_FOUND.real; |
akashvibhute | 0:30537dec6e0b | 153 | offset += sizeof(this->ID_NOT_FOUND); |
akashvibhute | 0:30537dec6e0b | 154 | union { |
akashvibhute | 0:30537dec6e0b | 155 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 156 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 157 | } u_DATABASE_ERROR; |
akashvibhute | 0:30537dec6e0b | 158 | u_DATABASE_ERROR.base = 0; |
akashvibhute | 0:30537dec6e0b | 159 | u_DATABASE_ERROR.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 160 | u_DATABASE_ERROR.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 161 | u_DATABASE_ERROR.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 162 | u_DATABASE_ERROR.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 163 | this->DATABASE_ERROR = u_DATABASE_ERROR.real; |
akashvibhute | 0:30537dec6e0b | 164 | offset += sizeof(this->DATABASE_ERROR); |
akashvibhute | 0:30537dec6e0b | 165 | union { |
akashvibhute | 0:30537dec6e0b | 166 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 167 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 168 | } u_OTHER_ERROR; |
akashvibhute | 0:30537dec6e0b | 169 | u_OTHER_ERROR.base = 0; |
akashvibhute | 0:30537dec6e0b | 170 | u_OTHER_ERROR.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 171 | u_OTHER_ERROR.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 172 | u_OTHER_ERROR.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 173 | u_OTHER_ERROR.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 174 | this->OTHER_ERROR = u_OTHER_ERROR.real; |
akashvibhute | 0:30537dec6e0b | 175 | offset += sizeof(this->OTHER_ERROR); |
akashvibhute | 0:30537dec6e0b | 176 | union { |
akashvibhute | 0:30537dec6e0b | 177 | int32_t real; |
akashvibhute | 0:30537dec6e0b | 178 | uint32_t base; |
akashvibhute | 0:30537dec6e0b | 179 | } u_result; |
akashvibhute | 0:30537dec6e0b | 180 | u_result.base = 0; |
akashvibhute | 0:30537dec6e0b | 181 | u_result.base |= ((uint32_t) (*(inbuffer + offset + 0))) << (8 * 0); |
akashvibhute | 0:30537dec6e0b | 182 | u_result.base |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
akashvibhute | 0:30537dec6e0b | 183 | u_result.base |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
akashvibhute | 0:30537dec6e0b | 184 | u_result.base |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
akashvibhute | 0:30537dec6e0b | 185 | this->result = u_result.real; |
akashvibhute | 0:30537dec6e0b | 186 | offset += sizeof(this->result); |
akashvibhute | 0:30537dec6e0b | 187 | return offset; |
akashvibhute | 0:30537dec6e0b | 188 | } |
akashvibhute | 0:30537dec6e0b | 189 | |
akashvibhute | 0:30537dec6e0b | 190 | const char * getType(){ return TRANSLATERECOGNITIONID; }; |
akashvibhute | 0:30537dec6e0b | 191 | const char * getMD5(){ return "b4afd505fbee150bf06acaffa82e84cf"; }; |
akashvibhute | 0:30537dec6e0b | 192 | |
akashvibhute | 0:30537dec6e0b | 193 | }; |
akashvibhute | 0:30537dec6e0b | 194 | |
akashvibhute | 0:30537dec6e0b | 195 | class TranslateRecognitionId { |
akashvibhute | 0:30537dec6e0b | 196 | public: |
akashvibhute | 0:30537dec6e0b | 197 | typedef TranslateRecognitionIdRequest Request; |
akashvibhute | 0:30537dec6e0b | 198 | typedef TranslateRecognitionIdResponse Response; |
akashvibhute | 0:30537dec6e0b | 199 | }; |
akashvibhute | 0:30537dec6e0b | 200 | |
akashvibhute | 0:30537dec6e0b | 201 | } |
akashvibhute | 0:30537dec6e0b | 202 | #endif |
akashvibhute | 0:30537dec6e0b | 203 |