InitPins.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_InitPins_h
19 #define _ROS_SERVICE_InitPins_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 INITPINS[] = "cob_hand_bridge/InitPins";
29 
30  class InitPinsRequest : public ros::Msg
31  {
32  public:
34  uint8_t st_input_pins;
35  uint8_t * input_pins;
37  uint8_t st_output_pins;
38  uint8_t * output_pins;
39 
41  input_pins_length(0), input_pins(NULL),
42  output_pins_length(0), output_pins(NULL)
43  {
44  }
45 
46  virtual int serialize(unsigned char *outbuffer) const
47  {
48  int offset = 0;
49  *(outbuffer + offset++) = input_pins_length;
50  *(outbuffer + offset++) = 0;
51  *(outbuffer + offset++) = 0;
52  *(outbuffer + offset++) = 0;
53  for( uint8_t i = 0; i < input_pins_length; i++){
54  *(outbuffer + offset + 0) = (this->input_pins[i] >> (8 * 0)) & 0xFF;
55  offset += sizeof(this->input_pins[i]);
56  }
57  *(outbuffer + offset++) = output_pins_length;
58  *(outbuffer + offset++) = 0;
59  *(outbuffer + offset++) = 0;
60  *(outbuffer + offset++) = 0;
61  for( uint8_t i = 0; i < output_pins_length; i++){
62  *(outbuffer + offset + 0) = (this->output_pins[i] >> (8 * 0)) & 0xFF;
63  offset += sizeof(this->output_pins[i]);
64  }
65  return offset;
66  }
67 
68  virtual int deserialize(unsigned char *inbuffer)
69  {
70  int offset = 0;
71  uint8_t input_pins_lengthT = *(inbuffer + offset++);
72  if(input_pins_lengthT > input_pins_length)
73  this->input_pins = (uint8_t*)realloc(this->input_pins, input_pins_lengthT * sizeof(uint8_t));
74  offset += 3;
75  input_pins_length = input_pins_lengthT;
76  for( uint8_t i = 0; i < input_pins_length; i++){
77  this->st_input_pins = ((uint8_t) (*(inbuffer + offset)));
78  offset += sizeof(this->st_input_pins);
79  memcpy( &(this->input_pins[i]), &(this->st_input_pins), sizeof(uint8_t));
80  }
81  uint8_t output_pins_lengthT = *(inbuffer + offset++);
82  if(output_pins_lengthT > output_pins_length)
83  this->output_pins = (uint8_t*)realloc(this->output_pins, output_pins_lengthT * sizeof(uint8_t));
84  offset += 3;
85  output_pins_length = output_pins_lengthT;
86  for( uint8_t i = 0; i < output_pins_length; i++){
87  this->st_output_pins = ((uint8_t) (*(inbuffer + offset)));
88  offset += sizeof(this->st_output_pins);
89  memcpy( &(this->output_pins[i]), &(this->st_output_pins), sizeof(uint8_t));
90  }
91  return offset;
92  }
93 
94  const char * getType(){ return INITPINS; };
95  const char * getMD5(){ return "842fe571cf71231e47b423e75069e2bd"; };
96 
97  };
98 
99  class InitPinsResponse : public ros::Msg
100  {
101  public:
102  bool success;
103 
105  success(0)
106  {
107  }
108 
109  virtual int serialize(unsigned char *outbuffer) const
110  {
111  int offset = 0;
112  union {
113  bool real;
114  uint8_t base;
115  } u_success;
116  u_success.real = this->success;
117  *(outbuffer + offset + 0) = (u_success.base >> (8 * 0)) & 0xFF;
118  offset += sizeof(this->success);
119  return offset;
120  }
121 
122  virtual int deserialize(unsigned char *inbuffer)
123  {
124  int offset = 0;
125  union {
126  bool real;
127  uint8_t base;
128  } u_success;
129  u_success.base = 0;
130  u_success.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0);
131  this->success = u_success.real;
132  offset += sizeof(this->success);
133  return offset;
134  }
135 
136  const char * getType(){ return INITPINS; };
137  const char * getMD5(){ return "358e233cde0c8a8bcfea4ce193f8fc15"; };
138 
139  };
140 
141  class InitPins {
142  public:
145  };
146 
147 }
148 #endif
InitPinsRequest Request
Definition: InitPins.h:143
virtual int deserialize(unsigned char *inbuffer)
Definition: InitPins.h:122
InitPinsResponse Response
Definition: InitPins.h:144
virtual int deserialize(unsigned char *inbuffer)
Definition: InitPins.h:68
virtual int serialize(unsigned char *outbuffer) const
Definition: InitPins.h:109
static const char INITPINS[]
Definition: InitPins.h:28
virtual int serialize(unsigned char *outbuffer) const
Definition: InitPins.h:46
Definition: msg.h:26


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