Руслан Бредун / Mbed 2 deprecated STM32-MC_node

Dependencies:   mbed Watchdog stm32-sensor-base2

Committer:
ommpy
Date:
Tue Jul 07 15:19:06 2020 +0530
Revision:
2:b7fdc74e5c5d
new board files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ommpy 2:b7fdc74e5c5d 1 #ifndef _ROS_SERVICE_GetLinkState_h
ommpy 2:b7fdc74e5c5d 2 #define _ROS_SERVICE_GetLinkState_h
ommpy 2:b7fdc74e5c5d 3 #include <stdint.h>
ommpy 2:b7fdc74e5c5d 4 #include <string.h>
ommpy 2:b7fdc74e5c5d 5 #include <stdlib.h>
ommpy 2:b7fdc74e5c5d 6 #include "ros/msg.h"
ommpy 2:b7fdc74e5c5d 7 #include "gazebo_msgs/LinkState.h"
ommpy 2:b7fdc74e5c5d 8
ommpy 2:b7fdc74e5c5d 9 namespace gazebo_msgs
ommpy 2:b7fdc74e5c5d 10 {
ommpy 2:b7fdc74e5c5d 11
ommpy 2:b7fdc74e5c5d 12 static const char GETLINKSTATE[] = "gazebo_msgs/GetLinkState";
ommpy 2:b7fdc74e5c5d 13
ommpy 2:b7fdc74e5c5d 14 class GetLinkStateRequest : public ros::Msg
ommpy 2:b7fdc74e5c5d 15 {
ommpy 2:b7fdc74e5c5d 16 public:
ommpy 2:b7fdc74e5c5d 17 typedef const char* _link_name_type;
ommpy 2:b7fdc74e5c5d 18 _link_name_type link_name;
ommpy 2:b7fdc74e5c5d 19 typedef const char* _reference_frame_type;
ommpy 2:b7fdc74e5c5d 20 _reference_frame_type reference_frame;
ommpy 2:b7fdc74e5c5d 21
ommpy 2:b7fdc74e5c5d 22 GetLinkStateRequest():
ommpy 2:b7fdc74e5c5d 23 link_name(""),
ommpy 2:b7fdc74e5c5d 24 reference_frame("")
ommpy 2:b7fdc74e5c5d 25 {
ommpy 2:b7fdc74e5c5d 26 }
ommpy 2:b7fdc74e5c5d 27
ommpy 2:b7fdc74e5c5d 28 virtual int serialize(unsigned char *outbuffer) const
ommpy 2:b7fdc74e5c5d 29 {
ommpy 2:b7fdc74e5c5d 30 int offset = 0;
ommpy 2:b7fdc74e5c5d 31 uint32_t length_link_name = strlen(this->link_name);
ommpy 2:b7fdc74e5c5d 32 varToArr(outbuffer + offset, length_link_name);
ommpy 2:b7fdc74e5c5d 33 offset += 4;
ommpy 2:b7fdc74e5c5d 34 memcpy(outbuffer + offset, this->link_name, length_link_name);
ommpy 2:b7fdc74e5c5d 35 offset += length_link_name;
ommpy 2:b7fdc74e5c5d 36 uint32_t length_reference_frame = strlen(this->reference_frame);
ommpy 2:b7fdc74e5c5d 37 varToArr(outbuffer + offset, length_reference_frame);
ommpy 2:b7fdc74e5c5d 38 offset += 4;
ommpy 2:b7fdc74e5c5d 39 memcpy(outbuffer + offset, this->reference_frame, length_reference_frame);
ommpy 2:b7fdc74e5c5d 40 offset += length_reference_frame;
ommpy 2:b7fdc74e5c5d 41 return offset;
ommpy 2:b7fdc74e5c5d 42 }
ommpy 2:b7fdc74e5c5d 43
ommpy 2:b7fdc74e5c5d 44 virtual int deserialize(unsigned char *inbuffer)
ommpy 2:b7fdc74e5c5d 45 {
ommpy 2:b7fdc74e5c5d 46 int offset = 0;
ommpy 2:b7fdc74e5c5d 47 uint32_t length_link_name;
ommpy 2:b7fdc74e5c5d 48 arrToVar(length_link_name, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 49 offset += 4;
ommpy 2:b7fdc74e5c5d 50 for(unsigned int k= offset; k< offset+length_link_name; ++k){
ommpy 2:b7fdc74e5c5d 51 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 52 }
ommpy 2:b7fdc74e5c5d 53 inbuffer[offset+length_link_name-1]=0;
ommpy 2:b7fdc74e5c5d 54 this->link_name = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 55 offset += length_link_name;
ommpy 2:b7fdc74e5c5d 56 uint32_t length_reference_frame;
ommpy 2:b7fdc74e5c5d 57 arrToVar(length_reference_frame, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 58 offset += 4;
ommpy 2:b7fdc74e5c5d 59 for(unsigned int k= offset; k< offset+length_reference_frame; ++k){
ommpy 2:b7fdc74e5c5d 60 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 61 }
ommpy 2:b7fdc74e5c5d 62 inbuffer[offset+length_reference_frame-1]=0;
ommpy 2:b7fdc74e5c5d 63 this->reference_frame = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 64 offset += length_reference_frame;
ommpy 2:b7fdc74e5c5d 65 return offset;
ommpy 2:b7fdc74e5c5d 66 }
ommpy 2:b7fdc74e5c5d 67
ommpy 2:b7fdc74e5c5d 68 const char * getType(){ return GETLINKSTATE; };
ommpy 2:b7fdc74e5c5d 69 const char * getMD5(){ return "7551675c30aaa71f7c288d4864552001"; };
ommpy 2:b7fdc74e5c5d 70
ommpy 2:b7fdc74e5c5d 71 };
ommpy 2:b7fdc74e5c5d 72
ommpy 2:b7fdc74e5c5d 73 class GetLinkStateResponse : public ros::Msg
ommpy 2:b7fdc74e5c5d 74 {
ommpy 2:b7fdc74e5c5d 75 public:
ommpy 2:b7fdc74e5c5d 76 typedef gazebo_msgs::LinkState _link_state_type;
ommpy 2:b7fdc74e5c5d 77 _link_state_type link_state;
ommpy 2:b7fdc74e5c5d 78 typedef bool _success_type;
ommpy 2:b7fdc74e5c5d 79 _success_type success;
ommpy 2:b7fdc74e5c5d 80 typedef const char* _status_message_type;
ommpy 2:b7fdc74e5c5d 81 _status_message_type status_message;
ommpy 2:b7fdc74e5c5d 82
ommpy 2:b7fdc74e5c5d 83 GetLinkStateResponse():
ommpy 2:b7fdc74e5c5d 84 link_state(),
ommpy 2:b7fdc74e5c5d 85 success(0),
ommpy 2:b7fdc74e5c5d 86 status_message("")
ommpy 2:b7fdc74e5c5d 87 {
ommpy 2:b7fdc74e5c5d 88 }
ommpy 2:b7fdc74e5c5d 89
ommpy 2:b7fdc74e5c5d 90 virtual int serialize(unsigned char *outbuffer) const
ommpy 2:b7fdc74e5c5d 91 {
ommpy 2:b7fdc74e5c5d 92 int offset = 0;
ommpy 2:b7fdc74e5c5d 93 offset += this->link_state.serialize(outbuffer + offset);
ommpy 2:b7fdc74e5c5d 94 union {
ommpy 2:b7fdc74e5c5d 95 bool real;
ommpy 2:b7fdc74e5c5d 96 uint8_t base;
ommpy 2:b7fdc74e5c5d 97 } u_success;
ommpy 2:b7fdc74e5c5d 98 u_success.real = this->success;
ommpy 2:b7fdc74e5c5d 99 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
ommpy 2:b7fdc74e5c5d 100 offset += sizeof(this->success);
ommpy 2:b7fdc74e5c5d 101 uint32_t length_status_message = strlen(this->status_message);
ommpy 2:b7fdc74e5c5d 102 varToArr(outbuffer + offset, length_status_message);
ommpy 2:b7fdc74e5c5d 103 offset += 4;
ommpy 2:b7fdc74e5c5d 104 memcpy(outbuffer + offset, this->status_message, length_status_message);
ommpy 2:b7fdc74e5c5d 105 offset += length_status_message;
ommpy 2:b7fdc74e5c5d 106 return offset;
ommpy 2:b7fdc74e5c5d 107 }
ommpy 2:b7fdc74e5c5d 108
ommpy 2:b7fdc74e5c5d 109 virtual int deserialize(unsigned char *inbuffer)
ommpy 2:b7fdc74e5c5d 110 {
ommpy 2:b7fdc74e5c5d 111 int offset = 0;
ommpy 2:b7fdc74e5c5d 112 offset += this->link_state.deserialize(inbuffer + offset);
ommpy 2:b7fdc74e5c5d 113 union {
ommpy 2:b7fdc74e5c5d 114 bool real;
ommpy 2:b7fdc74e5c5d 115 uint8_t base;
ommpy 2:b7fdc74e5c5d 116 } u_success;
ommpy 2:b7fdc74e5c5d 117 u_success.base = 0;
ommpy 2:b7fdc74e5c5d 118 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
ommpy 2:b7fdc74e5c5d 119 this->success = u_success.real;
ommpy 2:b7fdc74e5c5d 120 offset += sizeof(this->success);
ommpy 2:b7fdc74e5c5d 121 uint32_t length_status_message;
ommpy 2:b7fdc74e5c5d 122 arrToVar(length_status_message, (inbuffer + offset));
ommpy 2:b7fdc74e5c5d 123 offset += 4;
ommpy 2:b7fdc74e5c5d 124 for(unsigned int k= offset; k< offset+length_status_message; ++k){
ommpy 2:b7fdc74e5c5d 125 inbuffer[k-1]=inbuffer[k];
ommpy 2:b7fdc74e5c5d 126 }
ommpy 2:b7fdc74e5c5d 127 inbuffer[offset+length_status_message-1]=0;
ommpy 2:b7fdc74e5c5d 128 this->status_message = (char *)(inbuffer + offset-1);
ommpy 2:b7fdc74e5c5d 129 offset += length_status_message;
ommpy 2:b7fdc74e5c5d 130 return offset;
ommpy 2:b7fdc74e5c5d 131 }
ommpy 2:b7fdc74e5c5d 132
ommpy 2:b7fdc74e5c5d 133 const char * getType(){ return GETLINKSTATE; };
ommpy 2:b7fdc74e5c5d 134 const char * getMD5(){ return "8ba55ad34f9c072e75c0de57b089753b"; };
ommpy 2:b7fdc74e5c5d 135
ommpy 2:b7fdc74e5c5d 136 };
ommpy 2:b7fdc74e5c5d 137
ommpy 2:b7fdc74e5c5d 138 class GetLinkState {
ommpy 2:b7fdc74e5c5d 139 public:
ommpy 2:b7fdc74e5c5d 140 typedef GetLinkStateRequest Request;
ommpy 2:b7fdc74e5c5d 141 typedef GetLinkStateResponse Response;
ommpy 2:b7fdc74e5c5d 142 };
ommpy 2:b7fdc74e5c5d 143
ommpy 2:b7fdc74e5c5d 144 }
ommpy 2:b7fdc74e5c5d 145 #endif