make changes on buffer serial
actionlib_msgs/GoalStatus.h@0:04ac6be8229a, 2019-11-08 (annotated)
- Committer:
- Gary Servin
- Date:
- Fri Nov 08 14:38:09 2019 -0300
- Revision:
- 0:04ac6be8229a
Initial commit, generated based on a clean melodic-desktop-full
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Gary Servin |
0:04ac6be8229a | 1 | #ifndef _ROS_actionlib_msgs_GoalStatus_h |
Gary Servin |
0:04ac6be8229a | 2 | #define _ROS_actionlib_msgs_GoalStatus_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 "actionlib_msgs/GoalID.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 GoalStatus : public ros::Msg |
Gary Servin |
0:04ac6be8229a | 14 | { |
Gary Servin |
0:04ac6be8229a | 15 | public: |
Gary Servin |
0:04ac6be8229a | 16 | typedef actionlib_msgs::GoalID _goal_id_type; |
Gary Servin |
0:04ac6be8229a | 17 | _goal_id_type goal_id; |
Gary Servin |
0:04ac6be8229a | 18 | typedef uint8_t _status_type; |
Gary Servin |
0:04ac6be8229a | 19 | _status_type status; |
Gary Servin |
0:04ac6be8229a | 20 | typedef const char* _text_type; |
Gary Servin |
0:04ac6be8229a | 21 | _text_type text; |
Gary Servin |
0:04ac6be8229a | 22 | enum { PENDING = 0 }; |
Gary Servin |
0:04ac6be8229a | 23 | enum { ACTIVE = 1 }; |
Gary Servin |
0:04ac6be8229a | 24 | enum { PREEMPTED = 2 }; |
Gary Servin |
0:04ac6be8229a | 25 | enum { SUCCEEDED = 3 }; |
Gary Servin |
0:04ac6be8229a | 26 | enum { ABORTED = 4 }; |
Gary Servin |
0:04ac6be8229a | 27 | enum { REJECTED = 5 }; |
Gary Servin |
0:04ac6be8229a | 28 | enum { PREEMPTING = 6 }; |
Gary Servin |
0:04ac6be8229a | 29 | enum { RECALLING = 7 }; |
Gary Servin |
0:04ac6be8229a | 30 | enum { RECALLED = 8 }; |
Gary Servin |
0:04ac6be8229a | 31 | enum { LOST = 9 }; |
Gary Servin |
0:04ac6be8229a | 32 | |
Gary Servin |
0:04ac6be8229a | 33 | GoalStatus(): |
Gary Servin |
0:04ac6be8229a | 34 | goal_id(), |
Gary Servin |
0:04ac6be8229a | 35 | status(0), |
Gary Servin |
0:04ac6be8229a | 36 | text("") |
Gary Servin |
0:04ac6be8229a | 37 | { |
Gary Servin |
0:04ac6be8229a | 38 | } |
Gary Servin |
0:04ac6be8229a | 39 | |
Gary Servin |
0:04ac6be8229a | 40 | virtual int serialize(unsigned char *outbuffer) const |
Gary Servin |
0:04ac6be8229a | 41 | { |
Gary Servin |
0:04ac6be8229a | 42 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 43 | offset += this->goal_id.serialize(outbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 44 | *(outbuffer + offset + 0) = (this->status >> (8 * 0)) & 0xFF; |
Gary Servin |
0:04ac6be8229a | 45 | offset += sizeof(this->status); |
Gary Servin |
0:04ac6be8229a | 46 | uint32_t length_text = strlen(this->text); |
Gary Servin |
0:04ac6be8229a | 47 | varToArr(outbuffer + offset, length_text); |
Gary Servin |
0:04ac6be8229a | 48 | offset += 4; |
Gary Servin |
0:04ac6be8229a | 49 | memcpy(outbuffer + offset, this->text, length_text); |
Gary Servin |
0:04ac6be8229a | 50 | offset += length_text; |
Gary Servin |
0:04ac6be8229a | 51 | return offset; |
Gary Servin |
0:04ac6be8229a | 52 | } |
Gary Servin |
0:04ac6be8229a | 53 | |
Gary Servin |
0:04ac6be8229a | 54 | virtual int deserialize(unsigned char *inbuffer) |
Gary Servin |
0:04ac6be8229a | 55 | { |
Gary Servin |
0:04ac6be8229a | 56 | int offset = 0; |
Gary Servin |
0:04ac6be8229a | 57 | offset += this->goal_id.deserialize(inbuffer + offset); |
Gary Servin |
0:04ac6be8229a | 58 | this->status = ((uint8_t) (*(inbuffer + offset))); |
Gary Servin |
0:04ac6be8229a | 59 | offset += sizeof(this->status); |
Gary Servin |
0:04ac6be8229a | 60 | uint32_t length_text; |
Gary Servin |
0:04ac6be8229a | 61 | arrToVar(length_text, (inbuffer + offset)); |
Gary Servin |
0:04ac6be8229a | 62 | offset += 4; |
Gary Servin |
0:04ac6be8229a | 63 | for(unsigned int k= offset; k< offset+length_text; ++k){ |
Gary Servin |
0:04ac6be8229a | 64 | inbuffer[k-1]=inbuffer[k]; |
Gary Servin |
0:04ac6be8229a | 65 | } |
Gary Servin |
0:04ac6be8229a | 66 | inbuffer[offset+length_text-1]=0; |
Gary Servin |
0:04ac6be8229a | 67 | this->text = (char *)(inbuffer + offset-1); |
Gary Servin |
0:04ac6be8229a | 68 | offset += length_text; |
Gary Servin |
0:04ac6be8229a | 69 | return offset; |
Gary Servin |
0:04ac6be8229a | 70 | } |
Gary Servin |
0:04ac6be8229a | 71 | |
Gary Servin |
0:04ac6be8229a | 72 | const char * getType(){ return "actionlib_msgs/GoalStatus"; }; |
Gary Servin |
0:04ac6be8229a | 73 | const char * getMD5(){ return "d388f9b87b3c471f784434d671988d4a"; }; |
Gary Servin |
0:04ac6be8229a | 74 | |
Gary Servin |
0:04ac6be8229a | 75 | }; |
Gary Servin |
0:04ac6be8229a | 76 | |
Gary Servin |
0:04ac6be8229a | 77 | } |
Gary Servin |
0:04ac6be8229a | 78 | #endif |