Trigger.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *   http://www.apache.org/licenses/LICENSE-2.0
00009 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016  
00017 
00018 #ifndef _ROS_SERVICE_Trigger_h
00019 #define _ROS_SERVICE_Trigger_h
00020 #include <stdint.h>
00021 #include <string.h>
00022 #include <stdlib.h>
00023 #include "ros/msg.h"
00024 
00025 namespace std_srvs
00026 {
00027 
00028 static const char TRIGGER[] = "std_srvs/Trigger";
00029 
00030   class TriggerRequest : public ros::Msg
00031   {
00032     public:
00033 
00034     TriggerRequest()
00035     {
00036     }
00037 
00038     virtual int serialize(unsigned char *outbuffer) const
00039     {
00040       int offset = 0;
00041       return offset;
00042     }
00043 
00044     virtual int deserialize(unsigned char *inbuffer)
00045     {
00046       int offset = 0;
00047      return offset;
00048     }
00049 
00050     const char * getType(){ return TRIGGER; };
00051     const char * getMD5(){ return "d41d8cd98f00b204e9800998ecf8427e"; };
00052 
00053   };
00054 
00055   class TriggerResponse : public ros::Msg
00056   {
00057     public:
00058       bool success;
00059       const char* message;
00060 
00061     TriggerResponse():
00062       success(0),
00063       message("")
00064     {
00065     }
00066 
00067     virtual int serialize(unsigned char *outbuffer) const
00068     {
00069       int offset = 0;
00070       union {
00071         bool real;
00072         uint8_t base;
00073       } u_success;
00074       u_success.real = this->success;
00075       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00076       offset += sizeof(this->success);
00077       uint32_t length_message = strlen(this->message);
00078       memcpy(outbuffer + offset, &length_message, sizeof(uint32_t));
00079       offset += 4;
00080       memcpy(outbuffer + offset, this->message, length_message);
00081       offset += length_message;
00082       return offset;
00083     }
00084 
00085     virtual int deserialize(unsigned char *inbuffer)
00086     {
00087       int offset = 0;
00088       union {
00089         bool real;
00090         uint8_t base;
00091       } u_success;
00092       u_success.base = 0;
00093       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00094       this->success = u_success.real;
00095       offset += sizeof(this->success);
00096       uint32_t length_message;
00097       memcpy(&length_message, (inbuffer + offset), sizeof(uint32_t));
00098       offset += 4;
00099       for(unsigned int k= offset; k< offset+length_message; ++k){
00100           inbuffer[k-1]=inbuffer[k];
00101       }
00102       inbuffer[offset+length_message-1]=0;
00103       this->message = (char *)(inbuffer + offset-1);
00104       offset += length_message;
00105      return offset;
00106     }
00107 
00108     const char * getType(){ return TRIGGER; };
00109     const char * getMD5(){ return "937c9679a518e3a18d831e57125ea522"; };
00110 
00111   };
00112 
00113   class Trigger {
00114     public:
00115     typedef TriggerRequest Request;
00116     typedef TriggerResponse Response;
00117   };
00118 
00119 }
00120 #endif


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Thu Jun 6 2019 20:43:57