ROS Serial library for Mbed platforms for ROS Melodic Morenia. Check http://wiki.ros.org/rosserial_mbed/ for more information.
actionlib_msgs/GoalID.h@2:fa426560b283, 2021-05-27 (annotated)
- Committer:
- krogedal
- Date:
- Thu May 27 19:25:46 2021 +0000
- Revision:
- 2:fa426560b283
- Parent:
- 0:04ac6be8229a
no change
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gary Servin |
0:04ac6be8229a | 1 | #ifndef _ROS_actionlib_msgs_GoalID_h |
Gary Servin |
0:04ac6be8229a | 2 | #define _ROS_actionlib_msgs_GoalID_h |
Gary Servin |
0:04ac6be8229a | 3 | |
Gary Servin |
0:04ac6be8229a | 4 | #include <stdint.h> |
Gary Servin |
0:04ac6be8229a | 5 | #include <string.h> |
Gary Servin |
0:04ac6be8229a | 6 | #include <stdlib.h> |
Gary Servin |
0:04ac6be8229a | 7 | #include "ros/msg.h" |
Gary Servin |
0:04ac6be8229a | 8 | #include "ros/time.h" |
Gary Servin |
0:04ac6be8229a | 9 | |
Gary Servin |
0:04ac6be8229a | 10 | namespace actionlib_msgs |
Gary Servin |
0:04ac6be8229a | 11 | { |
Gary Servin |
0:04ac6be8229a | 12 | |
Gary Servin |
0:04ac6be8229a | 13 | class GoalID : public ros::Msg |
Gary Servin |
0:04ac6be8229a | 14 | { |
Gary Servin |
0:04ac6be8229a | 15 | public: |
Gary Servin |
0:04ac6be8229a | 16 | typedef ros::Time _stamp_type; |
Gary Servin |
0:04ac6be8229a | 17 | _stamp_type stamp; |
Gary Servin |
0:04ac6be8229a | 18 | typedef const char* _id_type; |
Gary Servin |
0:04ac6be8229a | 19 | _id_type id; |
Gary Servin |
0:04ac6be8229a | 20 | |
Gary Servin |
0:04ac6be8229a | 21 | GoalID(): |
Gary Servin |
0:04ac6be8229a | 22 | stamp(), |
Gary Servin |
0:04ac6be8229a | 23 | id("") |
Gary Servin |
0:04ac6be8229a | 24 | { |
Gary Servin |
0:04ac6be8229a | 25 | } |
Gary Servin |
0:04ac6be8229a | 26 | |
Gary Servin |
0:04ac6be8229a | 27 | virtual int serialize(unsigned char *outbuffer) const |
Gary Servin |
0:04ac6be8229a | 28 | { |
Gary Servin |
0:04ac6be8229a | 29 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 30 | *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 31 | *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 32 | *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 33 | *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 34 | offset += sizeof(this->stamp.sec); |
Gary Servin |
0:04ac6be8229a | 35 | *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 36 | *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 37 | *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 38 | *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 39 | offset += sizeof(this->stamp.nsec); |
Gary Servin |
0:04ac6be8229a | 40 | uint32_t length_id = strlen(this->id); |
Gary Servin |
0:04ac6be8229a | 41 | varToArr(outbuffer + offset, length_id); |
Gary Servin |
0:04ac6be8229a | 42 | offset += 4; |
Gary Servin |
0:04ac6be8229a | 43 | memcpy(outbuffer + offset, this->id, length_id); |
Gary Servin |
0:04ac6be8229a | 44 | offset += length_id; |
Gary Servin |
0:04ac6be8229a | 45 | return offset; |
Gary Servin |
0:04ac6be8229a | 46 | } |
Gary Servin |
0:04ac6be8229a | 47 | |
Gary Servin |
0:04ac6be8229a | 48 | virtual int deserialize(unsigned char *inbuffer) |
Gary Servin |
0:04ac6be8229a | 49 | { |
Gary Servin |
0:04ac6be8229a | 50 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 51 | this->stamp.sec = ((uint32_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 52 | this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 53 | this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 54 | this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 55 | offset += sizeof(this->stamp.sec); |
Gary Servin |
0:04ac6be8229a | 56 | this->stamp.nsec = ((uint32_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 57 | this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1); |
Gary Servin |
0:04ac6be8229a | 58 | this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2); |
Gary Servin |
0:04ac6be8229a | 59 | this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3); |
Gary Servin |
0:04ac6be8229a | 60 | offset += sizeof(this->stamp.nsec); |
Gary Servin |
0:04ac6be8229a | 61 | uint32_t length_id; |
Gary Servin |
0:04ac6be8229a | 62 | arrToVar(length_id, (inbuffer + offset)); |
Gary Servin |
0:04ac6be8229a | 63 | offset += 4; |
Gary Servin |
0:04ac6be8229a | 64 | for(unsigned int k= offset; k< offset+length_id; ++k){ |
Gary Servin |
0:04ac6be8229a | 65 | inbuffer[k-1]=inbuffer[k]; |
Gary Servin |
0:04ac6be8229a | 66 | } |
Gary Servin |
0:04ac6be8229a | 67 | inbuffer[offset+length_id-1]=0; |
Gary Servin |
0:04ac6be8229a | 68 | this->id = (char *)(inbuffer + offset-1); |
Gary Servin |
0:04ac6be8229a | 69 | offset += length_id; |
Gary Servin |
0:04ac6be8229a | 70 | return offset; |
Gary Servin |
0:04ac6be8229a | 71 | } |
Gary Servin |
0:04ac6be8229a | 72 | |
Gary Servin |
0:04ac6be8229a | 73 | const char * getType(){ return "actionlib_msgs/GoalID"; }; |
Gary Servin |
0:04ac6be8229a | 74 | const char * getMD5(){ return "302881f31927c1df708a2dbab0e80ee8"; }; |
Gary Servin |
0:04ac6be8229a | 75 | |
Gary Servin |
0:04ac6be8229a | 76 | }; |
Gary Servin |
0:04ac6be8229a | 77 | |
Gary Servin |
0:04ac6be8229a | 78 | } |
Gary Servin |
0:04ac6be8229a | 79 | #endif |