ROS Serial library for Mbed platforms for ROS Kinetic Kame. Check http://wiki.ros.org/rosserial_mbed/ for more information.
Dependents: mbed-os-example-blinky
rosserial_msgs/RequestServiceInfo.h@2:f2240ad62eaf, 2019-08-01 (annotated)
- Committer:
- fllay
- Date:
- Thu Aug 01 17:08:55 2019 +0000
- Revision:
- 2:f2240ad62eaf
- Parent:
- 0:9e9b7db60fd5
fix time.h
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
garyservin | 0:9e9b7db60fd5 | 1 | #ifndef _ROS_SERVICE_RequestServiceInfo_h |
garyservin | 0:9e9b7db60fd5 | 2 | #define _ROS_SERVICE_RequestServiceInfo_h |
garyservin | 0:9e9b7db60fd5 | 3 | #include <stdint.h> |
garyservin | 0:9e9b7db60fd5 | 4 | #include <string.h> |
garyservin | 0:9e9b7db60fd5 | 5 | #include <stdlib.h> |
garyservin | 0:9e9b7db60fd5 | 6 | #include "ros/msg.h" |
garyservin | 0:9e9b7db60fd5 | 7 | |
garyservin | 0:9e9b7db60fd5 | 8 | namespace rosserial_msgs |
garyservin | 0:9e9b7db60fd5 | 9 | { |
garyservin | 0:9e9b7db60fd5 | 10 | |
garyservin | 0:9e9b7db60fd5 | 11 | static const char REQUESTSERVICEINFO[] = "rosserial_msgs/RequestServiceInfo"; |
garyservin | 0:9e9b7db60fd5 | 12 | |
garyservin | 0:9e9b7db60fd5 | 13 | class RequestServiceInfoRequest : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 14 | { |
garyservin | 0:9e9b7db60fd5 | 15 | public: |
garyservin | 0:9e9b7db60fd5 | 16 | typedef const char* _service_type; |
garyservin | 0:9e9b7db60fd5 | 17 | _service_type service; |
garyservin | 0:9e9b7db60fd5 | 18 | |
garyservin | 0:9e9b7db60fd5 | 19 | RequestServiceInfoRequest(): |
garyservin | 0:9e9b7db60fd5 | 20 | service("") |
garyservin | 0:9e9b7db60fd5 | 21 | { |
garyservin | 0:9e9b7db60fd5 | 22 | } |
garyservin | 0:9e9b7db60fd5 | 23 | |
garyservin | 0:9e9b7db60fd5 | 24 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 25 | { |
garyservin | 0:9e9b7db60fd5 | 26 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 27 | uint32_t length_service = strlen(this->service); |
garyservin | 0:9e9b7db60fd5 | 28 | varToArr(outbuffer + offset, length_service); |
garyservin | 0:9e9b7db60fd5 | 29 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 30 | memcpy(outbuffer + offset, this->service, length_service); |
garyservin | 0:9e9b7db60fd5 | 31 | offset += length_service; |
garyservin | 0:9e9b7db60fd5 | 32 | return offset; |
garyservin | 0:9e9b7db60fd5 | 33 | } |
garyservin | 0:9e9b7db60fd5 | 34 | |
garyservin | 0:9e9b7db60fd5 | 35 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 36 | { |
garyservin | 0:9e9b7db60fd5 | 37 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 38 | uint32_t length_service; |
garyservin | 0:9e9b7db60fd5 | 39 | arrToVar(length_service, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 40 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 41 | for(unsigned int k= offset; k< offset+length_service; ++k){ |
garyservin | 0:9e9b7db60fd5 | 42 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 43 | } |
garyservin | 0:9e9b7db60fd5 | 44 | inbuffer[offset+length_service-1]=0; |
garyservin | 0:9e9b7db60fd5 | 45 | this->service = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 46 | offset += length_service; |
garyservin | 0:9e9b7db60fd5 | 47 | return offset; |
garyservin | 0:9e9b7db60fd5 | 48 | } |
garyservin | 0:9e9b7db60fd5 | 49 | |
garyservin | 0:9e9b7db60fd5 | 50 | const char * getType(){ return REQUESTSERVICEINFO; }; |
garyservin | 0:9e9b7db60fd5 | 51 | const char * getMD5(){ return "1cbcfa13b08f6d36710b9af8741e6112"; }; |
garyservin | 0:9e9b7db60fd5 | 52 | |
garyservin | 0:9e9b7db60fd5 | 53 | }; |
garyservin | 0:9e9b7db60fd5 | 54 | |
garyservin | 0:9e9b7db60fd5 | 55 | class RequestServiceInfoResponse : public ros::Msg |
garyservin | 0:9e9b7db60fd5 | 56 | { |
garyservin | 0:9e9b7db60fd5 | 57 | public: |
garyservin | 0:9e9b7db60fd5 | 58 | typedef const char* _service_md5_type; |
garyservin | 0:9e9b7db60fd5 | 59 | _service_md5_type service_md5; |
garyservin | 0:9e9b7db60fd5 | 60 | typedef const char* _request_md5_type; |
garyservin | 0:9e9b7db60fd5 | 61 | _request_md5_type request_md5; |
garyservin | 0:9e9b7db60fd5 | 62 | typedef const char* _response_md5_type; |
garyservin | 0:9e9b7db60fd5 | 63 | _response_md5_type response_md5; |
garyservin | 0:9e9b7db60fd5 | 64 | |
garyservin | 0:9e9b7db60fd5 | 65 | RequestServiceInfoResponse(): |
garyservin | 0:9e9b7db60fd5 | 66 | service_md5(""), |
garyservin | 0:9e9b7db60fd5 | 67 | request_md5(""), |
garyservin | 0:9e9b7db60fd5 | 68 | response_md5("") |
garyservin | 0:9e9b7db60fd5 | 69 | { |
garyservin | 0:9e9b7db60fd5 | 70 | } |
garyservin | 0:9e9b7db60fd5 | 71 | |
garyservin | 0:9e9b7db60fd5 | 72 | virtual int serialize(unsigned char *outbuffer) const |
garyservin | 0:9e9b7db60fd5 | 73 | { |
garyservin | 0:9e9b7db60fd5 | 74 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 75 | uint32_t length_service_md5 = strlen(this->service_md5); |
garyservin | 0:9e9b7db60fd5 | 76 | varToArr(outbuffer + offset, length_service_md5); |
garyservin | 0:9e9b7db60fd5 | 77 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 78 | memcpy(outbuffer + offset, this->service_md5, length_service_md5); |
garyservin | 0:9e9b7db60fd5 | 79 | offset += length_service_md5; |
garyservin | 0:9e9b7db60fd5 | 80 | uint32_t length_request_md5 = strlen(this->request_md5); |
garyservin | 0:9e9b7db60fd5 | 81 | varToArr(outbuffer + offset, length_request_md5); |
garyservin | 0:9e9b7db60fd5 | 82 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 83 | memcpy(outbuffer + offset, this->request_md5, length_request_md5); |
garyservin | 0:9e9b7db60fd5 | 84 | offset += length_request_md5; |
garyservin | 0:9e9b7db60fd5 | 85 | uint32_t length_response_md5 = strlen(this->response_md5); |
garyservin | 0:9e9b7db60fd5 | 86 | varToArr(outbuffer + offset, length_response_md5); |
garyservin | 0:9e9b7db60fd5 | 87 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 88 | memcpy(outbuffer + offset, this->response_md5, length_response_md5); |
garyservin | 0:9e9b7db60fd5 | 89 | offset += length_response_md5; |
garyservin | 0:9e9b7db60fd5 | 90 | return offset; |
garyservin | 0:9e9b7db60fd5 | 91 | } |
garyservin | 0:9e9b7db60fd5 | 92 | |
garyservin | 0:9e9b7db60fd5 | 93 | virtual int deserialize(unsigned char *inbuffer) |
garyservin | 0:9e9b7db60fd5 | 94 | { |
garyservin | 0:9e9b7db60fd5 | 95 | int offset = 0; |
garyservin | 0:9e9b7db60fd5 | 96 | uint32_t length_service_md5; |
garyservin | 0:9e9b7db60fd5 | 97 | arrToVar(length_service_md5, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 98 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 99 | for(unsigned int k= offset; k< offset+length_service_md5; ++k){ |
garyservin | 0:9e9b7db60fd5 | 100 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 101 | } |
garyservin | 0:9e9b7db60fd5 | 102 | inbuffer[offset+length_service_md5-1]=0; |
garyservin | 0:9e9b7db60fd5 | 103 | this->service_md5 = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 104 | offset += length_service_md5; |
garyservin | 0:9e9b7db60fd5 | 105 | uint32_t length_request_md5; |
garyservin | 0:9e9b7db60fd5 | 106 | arrToVar(length_request_md5, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 107 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 108 | for(unsigned int k= offset; k< offset+length_request_md5; ++k){ |
garyservin | 0:9e9b7db60fd5 | 109 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 110 | } |
garyservin | 0:9e9b7db60fd5 | 111 | inbuffer[offset+length_request_md5-1]=0; |
garyservin | 0:9e9b7db60fd5 | 112 | this->request_md5 = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 113 | offset += length_request_md5; |
garyservin | 0:9e9b7db60fd5 | 114 | uint32_t length_response_md5; |
garyservin | 0:9e9b7db60fd5 | 115 | arrToVar(length_response_md5, (inbuffer + offset)); |
garyservin | 0:9e9b7db60fd5 | 116 | offset += 4; |
garyservin | 0:9e9b7db60fd5 | 117 | for(unsigned int k= offset; k< offset+length_response_md5; ++k){ |
garyservin | 0:9e9b7db60fd5 | 118 | inbuffer[k-1]=inbuffer[k]; |
garyservin | 0:9e9b7db60fd5 | 119 | } |
garyservin | 0:9e9b7db60fd5 | 120 | inbuffer[offset+length_response_md5-1]=0; |
garyservin | 0:9e9b7db60fd5 | 121 | this->response_md5 = (char *)(inbuffer + offset-1); |
garyservin | 0:9e9b7db60fd5 | 122 | offset += length_response_md5; |
garyservin | 0:9e9b7db60fd5 | 123 | return offset; |
garyservin | 0:9e9b7db60fd5 | 124 | } |
garyservin | 0:9e9b7db60fd5 | 125 | |
garyservin | 0:9e9b7db60fd5 | 126 | const char * getType(){ return REQUESTSERVICEINFO; }; |
garyservin | 0:9e9b7db60fd5 | 127 | const char * getMD5(){ return "c3d6dd25b909596479fbbc6559fa6874"; }; |
garyservin | 0:9e9b7db60fd5 | 128 | |
garyservin | 0:9e9b7db60fd5 | 129 | }; |
garyservin | 0:9e9b7db60fd5 | 130 | |
garyservin | 0:9e9b7db60fd5 | 131 | class RequestServiceInfo { |
garyservin | 0:9e9b7db60fd5 | 132 | public: |
garyservin | 0:9e9b7db60fd5 | 133 | typedef RequestServiceInfoRequest Request; |
garyservin | 0:9e9b7db60fd5 | 134 | typedef RequestServiceInfoResponse Response; |
garyservin | 0:9e9b7db60fd5 | 135 | }; |
garyservin | 0:9e9b7db60fd5 | 136 | |
garyservin | 0:9e9b7db60fd5 | 137 | } |
garyservin | 0:9e9b7db60fd5 | 138 | #endif |