Status.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_cob_hand_bridge_Status_h
19 #define _ROS_cob_hand_bridge_Status_h
20 
21 #include <stdint.h>
22 #include <string.h>
23 #include <stdlib.h>
24 #include "ros/msg.h"
25 #include "ros/time.h"
27 
28 namespace cob_hand_bridge
29 {
30 
31  class Status : public ros::Msg
32  {
33  public:
34  uint32_t seq;
36  uint8_t status;
37  uint8_t rc;
38  uint32_t pins;
40  enum { NOT_INITIALIZED = 0 };
41  enum { MASK_FINGER_READY = 1 };
42  enum { MASK_GPIO_READY = 2 };
43  enum { MASK_ERROR = 4 };
44  enum { RC_OK = 0 };
45 
46  Status():
47  seq(0),
48  stamp(),
49  status(0),
50  rc(0),
51  pins(0),
52  joints()
53  {
54  }
55 
56  virtual int serialize(unsigned char *outbuffer) const
57  {
58  int offset = 0;
59  *(outbuffer + offset + 0) = (this->seq >> (8 * 0)) & 0xFF;
60  *(outbuffer + offset + 1) = (this->seq >> (8 * 1)) & 0xFF;
61  *(outbuffer + offset + 2) = (this->seq >> (8 * 2)) & 0xFF;
62  *(outbuffer + offset + 3) = (this->seq >> (8 * 3)) & 0xFF;
63  offset += sizeof(this->seq);
64  *(outbuffer + offset + 0) = (this->stamp.sec >> (8 * 0)) & 0xFF;
65  *(outbuffer + offset + 1) = (this->stamp.sec >> (8 * 1)) & 0xFF;
66  *(outbuffer + offset + 2) = (this->stamp.sec >> (8 * 2)) & 0xFF;
67  *(outbuffer + offset + 3) = (this->stamp.sec >> (8 * 3)) & 0xFF;
68  offset += sizeof(this->stamp.sec);
69  *(outbuffer + offset + 0) = (this->stamp.nsec >> (8 * 0)) & 0xFF;
70  *(outbuffer + offset + 1) = (this->stamp.nsec >> (8 * 1)) & 0xFF;
71  *(outbuffer + offset + 2) = (this->stamp.nsec >> (8 * 2)) & 0xFF;
72  *(outbuffer + offset + 3) = (this->stamp.nsec >> (8 * 3)) & 0xFF;
73  offset += sizeof(this->stamp.nsec);
74  *(outbuffer + offset + 0) = (this->status >> (8 * 0)) & 0xFF;
75  offset += sizeof(this->status);
76  *(outbuffer + offset + 0) = (this->rc >> (8 * 0)) & 0xFF;
77  offset += sizeof(this->rc);
78  *(outbuffer + offset + 0) = (this->pins >> (8 * 0)) & 0xFF;
79  *(outbuffer + offset + 1) = (this->pins >> (8 * 1)) & 0xFF;
80  *(outbuffer + offset + 2) = (this->pins >> (8 * 2)) & 0xFF;
81  *(outbuffer + offset + 3) = (this->pins >> (8 * 3)) & 0xFF;
82  offset += sizeof(this->pins);
83  offset += this->joints.serialize(outbuffer + offset);
84  return offset;
85  }
86 
87  virtual int deserialize(unsigned char *inbuffer)
88  {
89  int offset = 0;
90  this->seq = ((uint32_t) (*(inbuffer + offset)));
91  this->seq |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
92  this->seq |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
93  this->seq |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
94  offset += sizeof(this->seq);
95  this->stamp.sec = ((uint32_t) (*(inbuffer + offset)));
96  this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
97  this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
98  this->stamp.sec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
99  offset += sizeof(this->stamp.sec);
100  this->stamp.nsec = ((uint32_t) (*(inbuffer + offset)));
101  this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
102  this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
103  this->stamp.nsec |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
104  offset += sizeof(this->stamp.nsec);
105  this->status = ((uint8_t) (*(inbuffer + offset)));
106  offset += sizeof(this->status);
107  this->rc = ((uint8_t) (*(inbuffer + offset)));
108  offset += sizeof(this->rc);
109  this->pins = ((uint32_t) (*(inbuffer + offset)));
110  this->pins |= ((uint32_t) (*(inbuffer + offset + 1))) << (8 * 1);
111  this->pins |= ((uint32_t) (*(inbuffer + offset + 2))) << (8 * 2);
112  this->pins |= ((uint32_t) (*(inbuffer + offset + 3))) << (8 * 3);
113  offset += sizeof(this->pins);
114  offset += this->joints.deserialize(inbuffer + offset);
115  return offset;
116  }
117 
118  const char * getType(){ return "cob_hand_bridge/Status"; };
119  const char * getMD5(){ return "d1e9c755cdcb7c29d72650239e9eb91a"; };
120 
121  };
122 
123 }
124 #endif
const char * getMD5()
Definition: Status.h:119
virtual int deserialize(unsigned char *inbuffer)
Definition: Status.h:87
Definition: time.h:30
virtual int deserialize(unsigned char *inbuffer)
Definition: JointValues.h:79
virtual int serialize(unsigned char *outbuffer) const
Definition: Status.h:56
cob_hand_bridge::JointValues joints
Definition: Status.h:39
Definition: msg.h:26
const char * getType()
Definition: Status.h:118
virtual int serialize(unsigned char *outbuffer) const
Definition: JointValues.h:43


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