capstone_finish

Dependencies:   BufferedSerial motor_sn7544

Committer:
Jeonghoon
Date:
Tue Nov 26 15:30:27 2019 +0000
Revision:
10:ca4e4062701a
Parent:
3:2a3664dc6634
capstone finish

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeonghoon 3:2a3664dc6634 1 #ifndef _ROS_SERVICE_RequestMessageInfo_h
Jeonghoon 3:2a3664dc6634 2 #define _ROS_SERVICE_RequestMessageInfo_h
Jeonghoon 3:2a3664dc6634 3 #include <stdint.h>
Jeonghoon 3:2a3664dc6634 4 #include <string.h>
Jeonghoon 3:2a3664dc6634 5 #include <stdlib.h>
Jeonghoon 3:2a3664dc6634 6 #include "ros/msg.h"
Jeonghoon 3:2a3664dc6634 7
Jeonghoon 3:2a3664dc6634 8 namespace rosserial_msgs
Jeonghoon 3:2a3664dc6634 9 {
Jeonghoon 3:2a3664dc6634 10
Jeonghoon 3:2a3664dc6634 11 static const char REQUESTMESSAGEINFO[] = "rosserial_msgs/RequestMessageInfo";
Jeonghoon 3:2a3664dc6634 12
Jeonghoon 3:2a3664dc6634 13 class RequestMessageInfoRequest : public ros::Msg
Jeonghoon 3:2a3664dc6634 14 {
Jeonghoon 3:2a3664dc6634 15 public:
Jeonghoon 3:2a3664dc6634 16 typedef const char* _type_type;
Jeonghoon 3:2a3664dc6634 17 _type_type type;
Jeonghoon 3:2a3664dc6634 18
Jeonghoon 3:2a3664dc6634 19 RequestMessageInfoRequest():
Jeonghoon 3:2a3664dc6634 20 type("")
Jeonghoon 3:2a3664dc6634 21 {
Jeonghoon 3:2a3664dc6634 22 }
Jeonghoon 3:2a3664dc6634 23
Jeonghoon 3:2a3664dc6634 24 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 3:2a3664dc6634 25 {
Jeonghoon 3:2a3664dc6634 26 int offset = 0;
Jeonghoon 3:2a3664dc6634 27 uint32_t length_type = strlen(this->type);
Jeonghoon 3:2a3664dc6634 28 varToArr(outbuffer + offset, length_type);
Jeonghoon 3:2a3664dc6634 29 offset += 4;
Jeonghoon 3:2a3664dc6634 30 memcpy(outbuffer + offset, this->type, length_type);
Jeonghoon 3:2a3664dc6634 31 offset += length_type;
Jeonghoon 3:2a3664dc6634 32 return offset;
Jeonghoon 3:2a3664dc6634 33 }
Jeonghoon 3:2a3664dc6634 34
Jeonghoon 3:2a3664dc6634 35 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 3:2a3664dc6634 36 {
Jeonghoon 3:2a3664dc6634 37 int offset = 0;
Jeonghoon 3:2a3664dc6634 38 uint32_t length_type;
Jeonghoon 3:2a3664dc6634 39 arrToVar(length_type, (inbuffer + offset));
Jeonghoon 3:2a3664dc6634 40 offset += 4;
Jeonghoon 3:2a3664dc6634 41 for(unsigned int k= offset; k< offset+length_type; ++k){
Jeonghoon 3:2a3664dc6634 42 inbuffer[k-1]=inbuffer[k];
Jeonghoon 3:2a3664dc6634 43 }
Jeonghoon 3:2a3664dc6634 44 inbuffer[offset+length_type-1]=0;
Jeonghoon 3:2a3664dc6634 45 this->type = (char *)(inbuffer + offset-1);
Jeonghoon 3:2a3664dc6634 46 offset += length_type;
Jeonghoon 3:2a3664dc6634 47 return offset;
Jeonghoon 3:2a3664dc6634 48 }
Jeonghoon 3:2a3664dc6634 49
Jeonghoon 3:2a3664dc6634 50 const char * getType(){ return REQUESTMESSAGEINFO; };
Jeonghoon 3:2a3664dc6634 51 const char * getMD5(){ return "dc67331de85cf97091b7d45e5c64ab75"; };
Jeonghoon 3:2a3664dc6634 52
Jeonghoon 3:2a3664dc6634 53 };
Jeonghoon 3:2a3664dc6634 54
Jeonghoon 3:2a3664dc6634 55 class RequestMessageInfoResponse : public ros::Msg
Jeonghoon 3:2a3664dc6634 56 {
Jeonghoon 3:2a3664dc6634 57 public:
Jeonghoon 3:2a3664dc6634 58 typedef const char* _md5_type;
Jeonghoon 3:2a3664dc6634 59 _md5_type md5;
Jeonghoon 3:2a3664dc6634 60 typedef const char* _definition_type;
Jeonghoon 3:2a3664dc6634 61 _definition_type definition;
Jeonghoon 3:2a3664dc6634 62
Jeonghoon 3:2a3664dc6634 63 RequestMessageInfoResponse():
Jeonghoon 3:2a3664dc6634 64 md5(""),
Jeonghoon 3:2a3664dc6634 65 definition("")
Jeonghoon 3:2a3664dc6634 66 {
Jeonghoon 3:2a3664dc6634 67 }
Jeonghoon 3:2a3664dc6634 68
Jeonghoon 3:2a3664dc6634 69 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 3:2a3664dc6634 70 {
Jeonghoon 3:2a3664dc6634 71 int offset = 0;
Jeonghoon 3:2a3664dc6634 72 uint32_t length_md5 = strlen(this->md5);
Jeonghoon 3:2a3664dc6634 73 varToArr(outbuffer + offset, length_md5);
Jeonghoon 3:2a3664dc6634 74 offset += 4;
Jeonghoon 3:2a3664dc6634 75 memcpy(outbuffer + offset, this->md5, length_md5);
Jeonghoon 3:2a3664dc6634 76 offset += length_md5;
Jeonghoon 3:2a3664dc6634 77 uint32_t length_definition = strlen(this->definition);
Jeonghoon 3:2a3664dc6634 78 varToArr(outbuffer + offset, length_definition);
Jeonghoon 3:2a3664dc6634 79 offset += 4;
Jeonghoon 3:2a3664dc6634 80 memcpy(outbuffer + offset, this->definition, length_definition);
Jeonghoon 3:2a3664dc6634 81 offset += length_definition;
Jeonghoon 3:2a3664dc6634 82 return offset;
Jeonghoon 3:2a3664dc6634 83 }
Jeonghoon 3:2a3664dc6634 84
Jeonghoon 3:2a3664dc6634 85 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 3:2a3664dc6634 86 {
Jeonghoon 3:2a3664dc6634 87 int offset = 0;
Jeonghoon 3:2a3664dc6634 88 uint32_t length_md5;
Jeonghoon 3:2a3664dc6634 89 arrToVar(length_md5, (inbuffer + offset));
Jeonghoon 3:2a3664dc6634 90 offset += 4;
Jeonghoon 3:2a3664dc6634 91 for(unsigned int k= offset; k< offset+length_md5; ++k){
Jeonghoon 3:2a3664dc6634 92 inbuffer[k-1]=inbuffer[k];
Jeonghoon 3:2a3664dc6634 93 }
Jeonghoon 3:2a3664dc6634 94 inbuffer[offset+length_md5-1]=0;
Jeonghoon 3:2a3664dc6634 95 this->md5 = (char *)(inbuffer + offset-1);
Jeonghoon 3:2a3664dc6634 96 offset += length_md5;
Jeonghoon 3:2a3664dc6634 97 uint32_t length_definition;
Jeonghoon 3:2a3664dc6634 98 arrToVar(length_definition, (inbuffer + offset));
Jeonghoon 3:2a3664dc6634 99 offset += 4;
Jeonghoon 3:2a3664dc6634 100 for(unsigned int k= offset; k< offset+length_definition; ++k){
Jeonghoon 3:2a3664dc6634 101 inbuffer[k-1]=inbuffer[k];
Jeonghoon 3:2a3664dc6634 102 }
Jeonghoon 3:2a3664dc6634 103 inbuffer[offset+length_definition-1]=0;
Jeonghoon 3:2a3664dc6634 104 this->definition = (char *)(inbuffer + offset-1);
Jeonghoon 3:2a3664dc6634 105 offset += length_definition;
Jeonghoon 3:2a3664dc6634 106 return offset;
Jeonghoon 3:2a3664dc6634 107 }
Jeonghoon 3:2a3664dc6634 108
Jeonghoon 3:2a3664dc6634 109 const char * getType(){ return REQUESTMESSAGEINFO; };
Jeonghoon 3:2a3664dc6634 110 const char * getMD5(){ return "fe452186a069bed40f09b8628fe5eac8"; };
Jeonghoon 3:2a3664dc6634 111
Jeonghoon 3:2a3664dc6634 112 };
Jeonghoon 3:2a3664dc6634 113
Jeonghoon 3:2a3664dc6634 114 class RequestMessageInfo {
Jeonghoon 3:2a3664dc6634 115 public:
Jeonghoon 3:2a3664dc6634 116 typedef RequestMessageInfoRequest Request;
Jeonghoon 3:2a3664dc6634 117 typedef RequestMessageInfoResponse Response;
Jeonghoon 3:2a3664dc6634 118 };
Jeonghoon 3:2a3664dc6634 119
Jeonghoon 3:2a3664dc6634 120 }
Jeonghoon 3:2a3664dc6634 121 #endif