capstone_finish

Dependencies:   BufferedSerial motor_sn7544

Committer:
Jeonghoon
Date:
Tue Aug 13 05:53:22 2019 +0000
Revision:
3:2a3664dc6634
with ROS;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeonghoon 3:2a3664dc6634 1 #ifndef _ROS_SERVICE_RequestServiceInfo_h
Jeonghoon 3:2a3664dc6634 2 #define _ROS_SERVICE_RequestServiceInfo_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 REQUESTSERVICEINFO[] = "rosserial_msgs/RequestServiceInfo";
Jeonghoon 3:2a3664dc6634 12
Jeonghoon 3:2a3664dc6634 13 class RequestServiceInfoRequest : public ros::Msg
Jeonghoon 3:2a3664dc6634 14 {
Jeonghoon 3:2a3664dc6634 15 public:
Jeonghoon 3:2a3664dc6634 16 typedef const char* _service_type;
Jeonghoon 3:2a3664dc6634 17 _service_type service;
Jeonghoon 3:2a3664dc6634 18
Jeonghoon 3:2a3664dc6634 19 RequestServiceInfoRequest():
Jeonghoon 3:2a3664dc6634 20 service("")
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_service = strlen(this->service);
Jeonghoon 3:2a3664dc6634 28 varToArr(outbuffer + offset, length_service);
Jeonghoon 3:2a3664dc6634 29 offset += 4;
Jeonghoon 3:2a3664dc6634 30 memcpy(outbuffer + offset, this->service, length_service);
Jeonghoon 3:2a3664dc6634 31 offset += length_service;
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_service;
Jeonghoon 3:2a3664dc6634 39 arrToVar(length_service, (inbuffer + offset));
Jeonghoon 3:2a3664dc6634 40 offset += 4;
Jeonghoon 3:2a3664dc6634 41 for(unsigned int k= offset; k< offset+length_service; ++k){
Jeonghoon 3:2a3664dc6634 42 inbuffer[k-1]=inbuffer[k];
Jeonghoon 3:2a3664dc6634 43 }
Jeonghoon 3:2a3664dc6634 44 inbuffer[offset+length_service-1]=0;
Jeonghoon 3:2a3664dc6634 45 this->service = (char *)(inbuffer + offset-1);
Jeonghoon 3:2a3664dc6634 46 offset += length_service;
Jeonghoon 3:2a3664dc6634 47 return offset;
Jeonghoon 3:2a3664dc6634 48 }
Jeonghoon 3:2a3664dc6634 49
Jeonghoon 3:2a3664dc6634 50 const char * getType(){ return REQUESTSERVICEINFO; };
Jeonghoon 3:2a3664dc6634 51 const char * getMD5(){ return "1cbcfa13b08f6d36710b9af8741e6112"; };
Jeonghoon 3:2a3664dc6634 52
Jeonghoon 3:2a3664dc6634 53 };
Jeonghoon 3:2a3664dc6634 54
Jeonghoon 3:2a3664dc6634 55 class RequestServiceInfoResponse : public ros::Msg
Jeonghoon 3:2a3664dc6634 56 {
Jeonghoon 3:2a3664dc6634 57 public:
Jeonghoon 3:2a3664dc6634 58 typedef const char* _service_md5_type;
Jeonghoon 3:2a3664dc6634 59 _service_md5_type service_md5;
Jeonghoon 3:2a3664dc6634 60 typedef const char* _request_md5_type;
Jeonghoon 3:2a3664dc6634 61 _request_md5_type request_md5;
Jeonghoon 3:2a3664dc6634 62 typedef const char* _response_md5_type;
Jeonghoon 3:2a3664dc6634 63 _response_md5_type response_md5;
Jeonghoon 3:2a3664dc6634 64
Jeonghoon 3:2a3664dc6634 65 RequestServiceInfoResponse():
Jeonghoon 3:2a3664dc6634 66 service_md5(""),
Jeonghoon 3:2a3664dc6634 67 request_md5(""),
Jeonghoon 3:2a3664dc6634 68 response_md5("")
Jeonghoon 3:2a3664dc6634 69 {
Jeonghoon 3:2a3664dc6634 70 }
Jeonghoon 3:2a3664dc6634 71
Jeonghoon 3:2a3664dc6634 72 virtual int serialize(unsigned char *outbuffer) const
Jeonghoon 3:2a3664dc6634 73 {
Jeonghoon 3:2a3664dc6634 74 int offset = 0;
Jeonghoon 3:2a3664dc6634 75 uint32_t length_service_md5 = strlen(this->service_md5);
Jeonghoon 3:2a3664dc6634 76 varToArr(outbuffer + offset, length_service_md5);
Jeonghoon 3:2a3664dc6634 77 offset += 4;
Jeonghoon 3:2a3664dc6634 78 memcpy(outbuffer + offset, this->service_md5, length_service_md5);
Jeonghoon 3:2a3664dc6634 79 offset += length_service_md5;
Jeonghoon 3:2a3664dc6634 80 uint32_t length_request_md5 = strlen(this->request_md5);
Jeonghoon 3:2a3664dc6634 81 varToArr(outbuffer + offset, length_request_md5);
Jeonghoon 3:2a3664dc6634 82 offset += 4;
Jeonghoon 3:2a3664dc6634 83 memcpy(outbuffer + offset, this->request_md5, length_request_md5);
Jeonghoon 3:2a3664dc6634 84 offset += length_request_md5;
Jeonghoon 3:2a3664dc6634 85 uint32_t length_response_md5 = strlen(this->response_md5);
Jeonghoon 3:2a3664dc6634 86 varToArr(outbuffer + offset, length_response_md5);
Jeonghoon 3:2a3664dc6634 87 offset += 4;
Jeonghoon 3:2a3664dc6634 88 memcpy(outbuffer + offset, this->response_md5, length_response_md5);
Jeonghoon 3:2a3664dc6634 89 offset += length_response_md5;
Jeonghoon 3:2a3664dc6634 90 return offset;
Jeonghoon 3:2a3664dc6634 91 }
Jeonghoon 3:2a3664dc6634 92
Jeonghoon 3:2a3664dc6634 93 virtual int deserialize(unsigned char *inbuffer)
Jeonghoon 3:2a3664dc6634 94 {
Jeonghoon 3:2a3664dc6634 95 int offset = 0;
Jeonghoon 3:2a3664dc6634 96 uint32_t length_service_md5;
Jeonghoon 3:2a3664dc6634 97 arrToVar(length_service_md5, (inbuffer + offset));
Jeonghoon 3:2a3664dc6634 98 offset += 4;
Jeonghoon 3:2a3664dc6634 99 for(unsigned int k= offset; k< offset+length_service_md5; ++k){
Jeonghoon 3:2a3664dc6634 100 inbuffer[k-1]=inbuffer[k];
Jeonghoon 3:2a3664dc6634 101 }
Jeonghoon 3:2a3664dc6634 102 inbuffer[offset+length_service_md5-1]=0;
Jeonghoon 3:2a3664dc6634 103 this->service_md5 = (char *)(inbuffer + offset-1);
Jeonghoon 3:2a3664dc6634 104 offset += length_service_md5;
Jeonghoon 3:2a3664dc6634 105 uint32_t length_request_md5;
Jeonghoon 3:2a3664dc6634 106 arrToVar(length_request_md5, (inbuffer + offset));
Jeonghoon 3:2a3664dc6634 107 offset += 4;
Jeonghoon 3:2a3664dc6634 108 for(unsigned int k= offset; k< offset+length_request_md5; ++k){
Jeonghoon 3:2a3664dc6634 109 inbuffer[k-1]=inbuffer[k];
Jeonghoon 3:2a3664dc6634 110 }
Jeonghoon 3:2a3664dc6634 111 inbuffer[offset+length_request_md5-1]=0;
Jeonghoon 3:2a3664dc6634 112 this->request_md5 = (char *)(inbuffer + offset-1);
Jeonghoon 3:2a3664dc6634 113 offset += length_request_md5;
Jeonghoon 3:2a3664dc6634 114 uint32_t length_response_md5;
Jeonghoon 3:2a3664dc6634 115 arrToVar(length_response_md5, (inbuffer + offset));
Jeonghoon 3:2a3664dc6634 116 offset += 4;
Jeonghoon 3:2a3664dc6634 117 for(unsigned int k= offset; k< offset+length_response_md5; ++k){
Jeonghoon 3:2a3664dc6634 118 inbuffer[k-1]=inbuffer[k];
Jeonghoon 3:2a3664dc6634 119 }
Jeonghoon 3:2a3664dc6634 120 inbuffer[offset+length_response_md5-1]=0;
Jeonghoon 3:2a3664dc6634 121 this->response_md5 = (char *)(inbuffer + offset-1);
Jeonghoon 3:2a3664dc6634 122 offset += length_response_md5;
Jeonghoon 3:2a3664dc6634 123 return offset;
Jeonghoon 3:2a3664dc6634 124 }
Jeonghoon 3:2a3664dc6634 125
Jeonghoon 3:2a3664dc6634 126 const char * getType(){ return REQUESTSERVICEINFO; };
Jeonghoon 3:2a3664dc6634 127 const char * getMD5(){ return "c3d6dd25b909596479fbbc6559fa6874"; };
Jeonghoon 3:2a3664dc6634 128
Jeonghoon 3:2a3664dc6634 129 };
Jeonghoon 3:2a3664dc6634 130
Jeonghoon 3:2a3664dc6634 131 class RequestServiceInfo {
Jeonghoon 3:2a3664dc6634 132 public:
Jeonghoon 3:2a3664dc6634 133 typedef RequestServiceInfoRequest Request;
Jeonghoon 3:2a3664dc6634 134 typedef RequestServiceInfoResponse Response;
Jeonghoon 3:2a3664dc6634 135 };
Jeonghoon 3:2a3664dc6634 136
Jeonghoon 3:2a3664dc6634 137 }
Jeonghoon 3:2a3664dc6634 138 #endif