Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Trigger.h
00001 #ifndef _ROS_SERVICE_Trigger_h 00002 #define _ROS_SERVICE_Trigger_h 00003 #include <stdint.h> 00004 #include <string.h> 00005 #include <stdlib.h> 00006 #include "ros/msg.h" 00007 00008 namespace std_srvs 00009 { 00010 00011 static const char TRIGGER[] = "std_srvs/Trigger"; 00012 00013 class TriggerRequest : public ros::Msg 00014 { 00015 public: 00016 00017 TriggerRequest() 00018 { 00019 } 00020 00021 virtual int serialize(unsigned char *outbuffer) const 00022 { 00023 int offset = 0; 00024 return offset; 00025 } 00026 00027 virtual int deserialize(unsigned char *inbuffer) 00028 { 00029 int offset = 0; 00030 return offset; 00031 } 00032 00033 const char * getType(){ return TRIGGER; }; 00034 const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; }; 00035 00036 }; 00037 00038 class TriggerResponse : public ros::Msg 00039 { 00040 public: 00041 typedef bool _success_type; 00042 _success_type success; 00043 typedef const char* _message_type; 00044 _message_type message; 00045 00046 TriggerResponse(): 00047 success(0), 00048 message("") 00049 { 00050 } 00051 00052 virtual int serialize(unsigned char *outbuffer) const 00053 { 00054 int offset = 0; 00055 union { 00056 bool real; 00057 uint8_t base; 00058 } u_success; 00059 u_success.real = this->success; 00060 *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF; 00061 offset += sizeof(this->success); 00062 uint32_t length_message = strlen(this->message); 00063 varToArr(outbuffer + offset, length_message); 00064 offset += 4; 00065 memcpy(outbuffer + offset, this->message, length_message); 00066 offset += length_message; 00067 return offset; 00068 } 00069 00070 virtual int deserialize(unsigned char *inbuffer) 00071 { 00072 int offset = 0; 00073 union { 00074 bool real; 00075 uint8_t base; 00076 } u_success; 00077 u_success.base = 0; 00078 u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); 00079 this->success = u_success.real; 00080 offset += sizeof(this->success); 00081 uint32_t length_message; 00082 arrToVar(length_message, (inbuffer + offset)); 00083 offset += 4; 00084 for(unsigned int k= offset; k< offset+length_message; ++k){ 00085 inbuffer[k-1]=inbuffer[k]; 00086 } 00087 inbuffer[offset+length_message-1]=0; 00088 this->message = (char *)(inbuffer + offset-1); 00089 offset += length_message; 00090 return offset; 00091 } 00092 00093 const char * getType(){ return TRIGGER; }; 00094 const char * getMD5(){ return "937c9679a518e3a18d831e57125ea522"; }; 00095 00096 }; 00097 00098 class Trigger { 00099 public: 00100 typedef TriggerRequest Request; 00101 typedef TriggerResponse Response; 00102 }; 00103 00104 } 00105 #endif
Generated on Wed Jul 13 2022 23:30:19 by
