InitFinger.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef _ROS_SERVICE_InitFinger_h
19 #define _ROS_SERVICE_InitFinger_h
20 #include <stdint.h>
21 #include <string.h>
22 #include <stdlib.h>
23 #include "ros/msg.h"
24 
25 namespace cob_hand_bridge
26 {
27 
28 static const char INITFINGER[] = "cob_hand_bridge/InitFinger";
29 
30  class InitFingerRequest : public ros::Msg
31  {
32  public:
33  const char* port;
34  int16_t min_pwm0;
35  int16_t min_pwm1;
36  int16_t max_pwm0;
37  int16_t max_pwm1;
38 
40  port(""),
41  min_pwm0(0),
42  min_pwm1(0),
43  max_pwm0(0),
44  max_pwm1(0)
45  {
46  }
47 
48  virtual int serialize(unsigned char *outbuffer) const
49  {
50  int offset = 0;
51  uint32_t length_port = strlen(this->port);
52  memcpy(outbuffer + offset, &length_port, sizeof(uint32_t));
53  offset += 4;
54  memcpy(outbuffer + offset, this->port, length_port);
55  offset += length_port;
56  union {
57  int16_t real;
58  uint16_t base;
59  } u_min_pwm0;
60  u_min_pwm0.real = this->min_pwm0;
61  *(outbuffer + offset + 0) = (u_min_pwm0.base >> (8 * 0)) & 0xFF;
62  *(outbuffer + offset + 1) = (u_min_pwm0.base >> (8 * 1)) & 0xFF;
63  offset += sizeof(this->min_pwm0);
64  union {
65  int16_t real;
66  uint16_t base;
67  } u_min_pwm1;
68  u_min_pwm1.real = this->min_pwm1;
69  *(outbuffer + offset + 0) = (u_min_pwm1.base >> (8 * 0)) & 0xFF;
70  *(outbuffer + offset + 1) = (u_min_pwm1.base >> (8 * 1)) & 0xFF;
71  offset += sizeof(this->min_pwm1);
72  union {
73  int16_t real;
74  uint16_t base;
75  } u_max_pwm0;
76  u_max_pwm0.real = this->max_pwm0;
77  *(outbuffer + offset + 0) = (u_max_pwm0.base >> (8 * 0)) & 0xFF;
78  *(outbuffer + offset + 1) = (u_max_pwm0.base >> (8 * 1)) & 0xFF;
79  offset += sizeof(this->max_pwm0);
80  union {
81  int16_t real;
82  uint16_t base;
83  } u_max_pwm1;
84  u_max_pwm1.real = this->max_pwm1;
85  *(outbuffer + offset + 0) = (u_max_pwm1.base >> (8 * 0)) & 0xFF;
86  *(outbuffer + offset + 1) = (u_max_pwm1.base >> (8 * 1)) & 0xFF;
87  offset += sizeof(this->max_pwm1);
88  return offset;
89  }
90 
91  virtual int deserialize(unsigned char *inbuffer)
92  {
93  int offset = 0;
94  uint32_t length_port;
95  memcpy(&length_port, (inbuffer + offset), sizeof(uint32_t));
96  offset += 4;
97  for(unsigned int k= offset; k< offset+length_port; ++k){
98  inbuffer[k-1]=inbuffer[k];
99  }
100  inbuffer[offset+length_port-1]=0;
101  this->port = (char *)(inbuffer + offset-1);
102  offset += length_port;
103  union {
104  int16_t real;
105  uint16_t base;
106  } u_min_pwm0;
107  u_min_pwm0.base = 0;
108  u_min_pwm0.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
109  u_min_pwm0.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
110  this->min_pwm0 = u_min_pwm0.real;
111  offset += sizeof(this->min_pwm0);
112  union {
113  int16_t real;
114  uint16_t base;
115  } u_min_pwm1;
116  u_min_pwm1.base = 0;
117  u_min_pwm1.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
118  u_min_pwm1.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
119  this->min_pwm1 = u_min_pwm1.real;
120  offset += sizeof(this->min_pwm1);
121  union {
122  int16_t real;
123  uint16_t base;
124  } u_max_pwm0;
125  u_max_pwm0.base = 0;
126  u_max_pwm0.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
127  u_max_pwm0.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
128  this->max_pwm0 = u_max_pwm0.real;
129  offset += sizeof(this->max_pwm0);
130  union {
131  int16_t real;
132  uint16_t base;
133  } u_max_pwm1;
134  u_max_pwm1.base = 0;
135  u_max_pwm1.base |= ((uint16_t) (*(inbuffer + offset + 0))) << (8 * 0);
136  u_max_pwm1.base |= ((uint16_t) (*(inbuffer + offset + 1))) << (8 * 1);
137  this->max_pwm1 = u_max_pwm1.real;
138  offset += sizeof(this->max_pwm1);
139  return offset;
140  }
141 
142  const char * getType(){ return INITFINGER; };
143  const char * getMD5(){ return "eb9952475d78dabda515be178e3c9292"; };
144 
145  };
146 
148  {
149  public:
150  bool success;
151 
153  success(0)
154  {
155  }
156 
157  virtual int serialize(unsigned char *outbuffer) const
158  {
159  int offset = 0;
160  union {
161  bool real;
162  uint8_t base;
163  } u_success;
164  u_success.real = this->success;
165  *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
166  offset += sizeof(this->success);
167  return offset;
168  }
169 
170  virtual int deserialize(unsigned char *inbuffer)
171  {
172  int offset = 0;
173  union {
174  bool real;
175  uint8_t base;
176  } u_success;
177  u_success.base = 0;
178  u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
179  this->success = u_success.real;
180  offset += sizeof(this->success);
181  return offset;
182  }
183 
184  const char * getType(){ return INITFINGER; };
185  const char * getMD5(){ return "358e233cde0c8a8bcfea4ce193f8fc15"; };
186 
187  };
188 
189  class InitFinger {
190  public:
193  };
194 
195 }
196 #endif
InitFingerResponse Response
Definition: InitFinger.h:192
InitFingerRequest Request
Definition: InitFinger.h:191
virtual int serialize(unsigned char *outbuffer) const
Definition: InitFinger.h:48
static const char INITFINGER[]
Definition: InitFinger.h:28
virtual int deserialize(unsigned char *inbuffer)
Definition: InitFinger.h:170
virtual int deserialize(unsigned char *inbuffer)
Definition: InitFinger.h:91
Definition: msg.h:26
virtual int serialize(unsigned char *outbuffer) const
Definition: InitFinger.h:157


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Tue Oct 20 2020 03:35:57