Project

General

Profile

Statistics
| Branch: | Revision:

scoutos / scout / power / src / power / srv / _query_power.py @ dd4eb68c

History | View | Annotate | Download (6.8 KB)

1
"""autogenerated by genmsg_py from query_powerRequest.msg. Do not edit."""
2
import roslib.message
3
import struct
4

    
5

    
6
class query_powerRequest(roslib.message.Message):
7
  _md5sum = "d41d8cd98f00b204e9800998ecf8427e"
8
  _type = "power/query_powerRequest"
9
  _has_header = False #flag to mark the presence of a Header object
10
  _full_text = """
11
"""
12
  __slots__ = []
13
  _slot_types = []
14

    
15
  def __init__(self, *args, **kwds):
16
    """
17
    Constructor. Any message fields that are implicitly/explicitly
18
    set to None will be assigned a default value. The recommend
19
    use is keyword arguments as this is more robust to future message
20
    changes.  You cannot mix in-order arguments and keyword arguments.
21
    
22
    The available fields are:
23
       
24
    
25
    @param args: complete set of field values, in .msg order
26
    @param kwds: use keyword arguments corresponding to message field names
27
    to set specific fields. 
28
    """
29
    if args or kwds:
30
      super(query_powerRequest, self).__init__(*args, **kwds)
31

    
32
  def _get_types(self):
33
    """
34
    internal API method
35
    """
36
    return self._slot_types
37

    
38
  def serialize(self, buff):
39
    """
40
    serialize message into buffer
41
    @param buff: buffer
42
    @type  buff: StringIO
43
    """
44
    try:
45
      pass
46
    except struct.error, se: self._check_types(se)
47
    except TypeError, te: self._check_types(te)
48

    
49
  def deserialize(self, str):
50
    """
51
    unpack serialized message in str into this message instance
52
    @param str: byte array of serialized message
53
    @type  str: str
54
    """
55
    try:
56
      end = 0
57
      return self
58
    except struct.error, e:
59
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
60

    
61

    
62
  def serialize_numpy(self, buff, numpy):
63
    """
64
    serialize message with numpy array types into buffer
65
    @param buff: buffer
66
    @type  buff: StringIO
67
    @param numpy: numpy python module
68
    @type  numpy module
69
    """
70
    try:
71
      pass
72
    except struct.error, se: self._check_types(se)
73
    except TypeError, te: self._check_types(te)
74

    
75
  def deserialize_numpy(self, str, numpy):
76
    """
77
    unpack serialized message in str into this message instance using numpy for array types
78
    @param str: byte array of serialized message
79
    @type  str: str
80
    @param numpy: numpy python module
81
    @type  numpy: module
82
    """
83
    try:
84
      end = 0
85
      return self
86
    except struct.error, e:
87
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
88

    
89
_struct_I = roslib.message.struct_I
90
"""autogenerated by genmsg_py from query_powerResponse.msg. Do not edit."""
91
import roslib.message
92
import struct
93

    
94

    
95
class query_powerResponse(roslib.message.Message):
96
  _md5sum = "7f7505c0b2499fcf6c85ecc5dee6164e"
97
  _type = "power/query_powerResponse"
98
  _has_header = False #flag to mark the presence of a Header object
99
  _full_text = """
100
uint32 voltage
101

102
uint32 percentage
103

104
uint32 draw
105

106
bool externalpower
107

108
bool warning
109

110
bool critical
111

112

113
"""
114
  __slots__ = ['voltage','percentage','draw','externalpower','warning','critical']
115
  _slot_types = ['uint32','uint32','uint32','bool','bool','bool']
116

    
117
  def __init__(self, *args, **kwds):
118
    """
119
    Constructor. Any message fields that are implicitly/explicitly
120
    set to None will be assigned a default value. The recommend
121
    use is keyword arguments as this is more robust to future message
122
    changes.  You cannot mix in-order arguments and keyword arguments.
123
    
124
    The available fields are:
125
       voltage,percentage,draw,externalpower,warning,critical
126
    
127
    @param args: complete set of field values, in .msg order
128
    @param kwds: use keyword arguments corresponding to message field names
129
    to set specific fields. 
130
    """
131
    if args or kwds:
132
      super(query_powerResponse, self).__init__(*args, **kwds)
133
      #message fields cannot be None, assign default values for those that are
134
      if self.voltage is None:
135
        self.voltage = 0
136
      if self.percentage is None:
137
        self.percentage = 0
138
      if self.draw is None:
139
        self.draw = 0
140
      if self.externalpower is None:
141
        self.externalpower = False
142
      if self.warning is None:
143
        self.warning = False
144
      if self.critical is None:
145
        self.critical = False
146
    else:
147
      self.voltage = 0
148
      self.percentage = 0
149
      self.draw = 0
150
      self.externalpower = False
151
      self.warning = False
152
      self.critical = False
153

    
154
  def _get_types(self):
155
    """
156
    internal API method
157
    """
158
    return self._slot_types
159

    
160
  def serialize(self, buff):
161
    """
162
    serialize message into buffer
163
    @param buff: buffer
164
    @type  buff: StringIO
165
    """
166
    try:
167
      _x = self
168
      buff.write(_struct_3I3B.pack(_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical))
169
    except struct.error, se: self._check_types(se)
170
    except TypeError, te: self._check_types(te)
171

    
172
  def deserialize(self, str):
173
    """
174
    unpack serialized message in str into this message instance
175
    @param str: byte array of serialized message
176
    @type  str: str
177
    """
178
    try:
179
      end = 0
180
      _x = self
181
      start = end
182
      end += 15
183
      (_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical,) = _struct_3I3B.unpack(str[start:end])
184
      self.externalpower = bool(self.externalpower)
185
      self.warning = bool(self.warning)
186
      self.critical = bool(self.critical)
187
      return self
188
    except struct.error, e:
189
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
190

    
191

    
192
  def serialize_numpy(self, buff, numpy):
193
    """
194
    serialize message with numpy array types into buffer
195
    @param buff: buffer
196
    @type  buff: StringIO
197
    @param numpy: numpy python module
198
    @type  numpy module
199
    """
200
    try:
201
      _x = self
202
      buff.write(_struct_3I3B.pack(_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical))
203
    except struct.error, se: self._check_types(se)
204
    except TypeError, te: self._check_types(te)
205

    
206
  def deserialize_numpy(self, str, numpy):
207
    """
208
    unpack serialized message in str into this message instance using numpy for array types
209
    @param str: byte array of serialized message
210
    @type  str: str
211
    @param numpy: numpy python module
212
    @type  numpy: module
213
    """
214
    try:
215
      end = 0
216
      _x = self
217
      start = end
218
      end += 15
219
      (_x.voltage, _x.percentage, _x.draw, _x.externalpower, _x.warning, _x.critical,) = _struct_3I3B.unpack(str[start:end])
220
      self.externalpower = bool(self.externalpower)
221
      self.warning = bool(self.warning)
222
      self.critical = bool(self.critical)
223
      return self
224
    except struct.error, e:
225
      raise roslib.message.DeserializationError(e) #most likely buffer underfill
226

    
227
_struct_I = roslib.message.struct_I
228
_struct_3I3B = struct.Struct("<3I3B")
229
class query_power(roslib.message.ServiceDefinition):
230
  _type          = 'power/query_power'
231
  _md5sum = '7f7505c0b2499fcf6c85ecc5dee6164e'
232
  _request_class  = query_powerRequest
233
  _response_class = query_powerResponse