modify for Hydro version
Fork of rosserial_mbed_lib by
sensor_msgs/NavSatStatus.h@0:77afd7560544, 2011-08-19 (annotated)
- Committer:
- nucho
- Date:
- Fri Aug 19 09:06:30 2011 +0000
- Revision:
- 0:77afd7560544
- Child:
- 3:1cf99502f396
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucho | 0:77afd7560544 | 1 | #ifndef ros_NavSatStatus_h |
nucho | 0:77afd7560544 | 2 | #define ros_NavSatStatus_h |
nucho | 0:77afd7560544 | 3 | |
nucho | 0:77afd7560544 | 4 | #include <stdint.h> |
nucho | 0:77afd7560544 | 5 | #include <string.h> |
nucho | 0:77afd7560544 | 6 | #include <stdlib.h> |
nucho | 0:77afd7560544 | 7 | #include "../ros/msg.h" |
nucho | 0:77afd7560544 | 8 | |
nucho | 0:77afd7560544 | 9 | namespace sensor_msgs |
nucho | 0:77afd7560544 | 10 | { |
nucho | 0:77afd7560544 | 11 | |
nucho | 0:77afd7560544 | 12 | class NavSatStatus : public ros::Msg |
nucho | 0:77afd7560544 | 13 | { |
nucho | 0:77afd7560544 | 14 | public: |
nucho | 0:77afd7560544 | 15 | signed char status; |
nucho | 0:77afd7560544 | 16 | unsigned short service; |
nucho | 0:77afd7560544 | 17 | enum { STATUS_NO_FIX = -1 }; |
nucho | 0:77afd7560544 | 18 | enum { STATUS_FIX = 0 }; |
nucho | 0:77afd7560544 | 19 | enum { STATUS_SBAS_FIX = 1 }; |
nucho | 0:77afd7560544 | 20 | enum { STATUS_GBAS_FIX = 2 }; |
nucho | 0:77afd7560544 | 21 | enum { SERVICE_GPS = 1 }; |
nucho | 0:77afd7560544 | 22 | enum { SERVICE_GLONASS = 2 }; |
nucho | 0:77afd7560544 | 23 | enum { SERVICE_COMPASS = 4 }; |
nucho | 0:77afd7560544 | 24 | enum { SERVICE_GALILEO = 8 }; |
nucho | 0:77afd7560544 | 25 | |
nucho | 0:77afd7560544 | 26 | virtual int serialize(unsigned char *outbuffer) |
nucho | 0:77afd7560544 | 27 | { |
nucho | 0:77afd7560544 | 28 | int offset = 0; |
nucho | 0:77afd7560544 | 29 | union { |
nucho | 0:77afd7560544 | 30 | signed char real; |
nucho | 0:77afd7560544 | 31 | unsigned char base; |
nucho | 0:77afd7560544 | 32 | } u_status; |
nucho | 0:77afd7560544 | 33 | u_status.real = this->status; |
nucho | 0:77afd7560544 | 34 | *(outbuffer + offset + 0) = (u_status.base >> (8 * 0)) & 0xFF; |
nucho | 0:77afd7560544 | 35 | offset += sizeof(this->status); |
nucho | 0:77afd7560544 | 36 | union { |
nucho | 0:77afd7560544 | 37 | unsigned short real; |
nucho | 0:77afd7560544 | 38 | unsigned short base; |
nucho | 0:77afd7560544 | 39 | } u_service; |
nucho | 0:77afd7560544 | 40 | u_service.real = this->service; |
nucho | 0:77afd7560544 | 41 | *(outbuffer + offset + 0) = (u_service.base >> (8 * 0)) & 0xFF; |
nucho | 0:77afd7560544 | 42 | *(outbuffer + offset + 1) = (u_service.base >> (8 * 1)) & 0xFF; |
nucho | 0:77afd7560544 | 43 | offset += sizeof(this->service); |
nucho | 0:77afd7560544 | 44 | return offset; |
nucho | 0:77afd7560544 | 45 | } |
nucho | 0:77afd7560544 | 46 | |
nucho | 0:77afd7560544 | 47 | virtual int deserialize(unsigned char *inbuffer) |
nucho | 0:77afd7560544 | 48 | { |
nucho | 0:77afd7560544 | 49 | int offset = 0; |
nucho | 0:77afd7560544 | 50 | union { |
nucho | 0:77afd7560544 | 51 | signed char real; |
nucho | 0:77afd7560544 | 52 | unsigned char base; |
nucho | 0:77afd7560544 | 53 | } u_status; |
nucho | 0:77afd7560544 | 54 | u_status.base = 0; |
nucho | 0:77afd7560544 | 55 | u_status.base |= ((typeof(u_status.base)) (*(inbuffer + offset + 0))) << (8 * 0); |
nucho | 0:77afd7560544 | 56 | this->status = u_status.real; |
nucho | 0:77afd7560544 | 57 | offset += sizeof(this->status); |
nucho | 0:77afd7560544 | 58 | union { |
nucho | 0:77afd7560544 | 59 | unsigned short real; |
nucho | 0:77afd7560544 | 60 | unsigned short base; |
nucho | 0:77afd7560544 | 61 | } u_service; |
nucho | 0:77afd7560544 | 62 | u_service.base = 0; |
nucho | 0:77afd7560544 | 63 | u_service.base |= ((typeof(u_service.base)) (*(inbuffer + offset + 0))) << (8 * 0); |
nucho | 0:77afd7560544 | 64 | u_service.base |= ((typeof(u_service.base)) (*(inbuffer + offset + 1))) << (8 * 1); |
nucho | 0:77afd7560544 | 65 | this->service = u_service.real; |
nucho | 0:77afd7560544 | 66 | offset += sizeof(this->service); |
nucho | 0:77afd7560544 | 67 | return offset; |
nucho | 0:77afd7560544 | 68 | } |
nucho | 0:77afd7560544 | 69 | |
nucho | 0:77afd7560544 | 70 | virtual const char * getType(){ return "sensor_msgs/NavSatStatus"; }; |
nucho | 0:77afd7560544 | 71 | |
nucho | 0:77afd7560544 | 72 | }; |
nucho | 0:77afd7560544 | 73 | |
nucho | 0:77afd7560544 | 74 | } |
nucho | 0:77afd7560544 | 75 | #endif |