InitFinger.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_InitFinger_h
00019 #define _ROS_SERVICE_InitFinger_h
00020 #include <stdint.h>
00021 #include <string.h>
00022 #include <stdlib.h>
00023 #include "ros/msg.h"
00024 
00025 namespace cob_hand_bridge
00026 {
00027 
00028 static const char INITFINGER[] = "cob_hand_bridge/InitFinger";
00029 
00030   class InitFingerRequest : public ros::Msg
00031   {
00032     public:
00033       const char* port;
00034       int16_t min_pwm0;
00035       int16_t min_pwm1;
00036       int16_t max_pwm0;
00037       int16_t max_pwm1;
00038 
00039     InitFingerRequest():
00040       port(""),
00041       min_pwm0(0),
00042       min_pwm1(0),
00043       max_pwm0(0),
00044       max_pwm1(0)
00045     {
00046     }
00047 
00048     virtual int serialize(unsigned char *outbuffer) const
00049     {
00050       int offset = 0;
00051       uint32_t length_port = strlen(this->port);
00052       memcpy(outbuffer + offset, &length_port, sizeof(uint32_t));
00053       offset += 4;
00054       memcpy(outbuffer + offset, this->port, length_port);
00055       offset += length_port;
00056       union {
00057         int16_t real;
00058         uint16_t base;
00059       } u_min_pwm0;
00060       u_min_pwm0.real = this->min_pwm0;
00061       *(outbuffer + offset + 0) = (u_min_pwm0.base >> (8 * 0)) & 0xFF;
00062       *(outbuffer + offset + 1) = (u_min_pwm0.base >> (8 * 1)) & 0xFF;
00063       offset += sizeof(this->min_pwm0);
00064       union {
00065         int16_t real;
00066         uint16_t base;
00067       } u_min_pwm1;
00068       u_min_pwm1.real = this->min_pwm1;
00069       *(outbuffer + offset + 0) = (u_min_pwm1.base >> (8 * 0)) & 0xFF;
00070       *(outbuffer + offset + 1) = (u_min_pwm1.base >> (8 * 1)) & 0xFF;
00071       offset += sizeof(this->min_pwm1);
00072       union {
00073         int16_t real;
00074         uint16_t base;
00075       } u_max_pwm0;
00076       u_max_pwm0.real = this->max_pwm0;
00077       *(outbuffer + offset + 0) = (u_max_pwm0.base >> (8 * 0)) & 0xFF;
00078       *(outbuffer + offset + 1) = (u_max_pwm0.base >> (8 * 1)) & 0xFF;
00079       offset += sizeof(this->max_pwm0);
00080       union {
00081         int16_t real;
00082         uint16_t base;
00083       } u_max_pwm1;
00084       u_max_pwm1.real = this->max_pwm1;
00085       *(outbuffer + offset + 0) = (u_max_pwm1.base >> (8 * 0)) & 0xFF;
00086       *(outbuffer + offset + 1) = (u_max_pwm1.base >> (8 * 1)) & 0xFF;
00087       offset += sizeof(this->max_pwm1);
00088       return offset;
00089     }
00090 
00091     virtual int deserialize(unsigned char *inbuffer)
00092     {
00093       int offset = 0;
00094       uint32_t length_port;
00095       memcpy(&length_port, (inbuffer + offset), sizeof(uint32_t));
00096       offset += 4;
00097       for(unsigned int k= offset; k< offset+length_port; ++k){
00098           inbuffer[k-1]=inbuffer[k];
00099       }
00100       inbuffer[offset+length_port-1]=0;
00101       this->port = (char *)(inbuffer + offset-1);
00102       offset += length_port;
00103       union {
00104         int16_t real;
00105         uint16_t base;
00106       } u_min_pwm0;
00107       u_min_pwm0.base = 0;
00108       u_min_pwm0.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00109       u_min_pwm0.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00110       this->min_pwm0 = u_min_pwm0.real;
00111       offset += sizeof(this->min_pwm0);
00112       union {
00113         int16_t real;
00114         uint16_t base;
00115       } u_min_pwm1;
00116       u_min_pwm1.base = 0;
00117       u_min_pwm1.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00118       u_min_pwm1.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00119       this->min_pwm1 = u_min_pwm1.real;
00120       offset += sizeof(this->min_pwm1);
00121       union {
00122         int16_t real;
00123         uint16_t base;
00124       } u_max_pwm0;
00125       u_max_pwm0.base = 0;
00126       u_max_pwm0.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00127       u_max_pwm0.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00128       this->max_pwm0 = u_max_pwm0.real;
00129       offset += sizeof(this->max_pwm0);
00130       union {
00131         int16_t real;
00132         uint16_t base;
00133       } u_max_pwm1;
00134       u_max_pwm1.base = 0;
00135       u_max_pwm1.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
00136       u_max_pwm1.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
00137       this->max_pwm1 = u_max_pwm1.real;
00138       offset += sizeof(this->max_pwm1);
00139      return offset;
00140     }
00141 
00142     const char * getType(){ return INITFINGER; };
00143     const char * getMD5(){ return "eb9952475d78dabda515be178e3c9292"; };
00144 
00145   };
00146 
00147   class InitFingerResponse : public ros::Msg
00148   {
00149     public:
00150       bool success;
00151 
00152     InitFingerResponse():
00153       success(0)
00154     {
00155     }
00156 
00157     virtual int serialize(unsigned char *outbuffer) const
00158     {
00159       int offset = 0;
00160       union {
00161         bool real;
00162         uint8_t base;
00163       } u_success;
00164       u_success.real = this->success;
00165       *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
00166       offset += sizeof(this->success);
00167       return offset;
00168     }
00169 
00170     virtual int deserialize(unsigned char *inbuffer)
00171     {
00172       int offset = 0;
00173       union {
00174         bool real;
00175         uint8_t base;
00176       } u_success;
00177       u_success.base = 0;
00178       u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
00179       this->success = u_success.real;
00180       offset += sizeof(this->success);
00181      return offset;
00182     }
00183 
00184     const char * getType(){ return INITFINGER; };
00185     const char * getMD5(){ return "358e233cde0c8a8bcfea4ce193f8fc15"; };
00186 
00187   };
00188 
00189   class InitFinger {
00190     public:
00191     typedef InitFingerRequest Request;
00192     typedef InitFingerResponse Response;
00193   };
00194 
00195 }
00196 #endif


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