Go to the documentation of this file.00001 """autogenerated by genpy from r2_msgs/PowerRequest.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class PowerRequest(genpy.Message):
00009 _md5sum = "1045ad41f2608d96980e5002751cdcee"
00010 _type = "r2_msgs/PowerRequest"
00011 _has_header = False
00012 _full_text = """string channel
00013 bool state
00014
00015 """
00016 __slots__ = ['channel','state']
00017 _slot_types = ['string','bool']
00018
00019 def __init__(self, *args, **kwds):
00020 """
00021 Constructor. Any message fields that are implicitly/explicitly
00022 set to None will be assigned a default value. The recommend
00023 use is keyword arguments as this is more robust to future message
00024 changes. You cannot mix in-order arguments and keyword arguments.
00025
00026 The available fields are:
00027 channel,state
00028
00029 :param args: complete set of field values, in .msg order
00030 :param kwds: use keyword arguments corresponding to message field names
00031 to set specific fields.
00032 """
00033 if args or kwds:
00034 super(PowerRequest, self).__init__(*args, **kwds)
00035
00036 if self.channel is None:
00037 self.channel = ''
00038 if self.state is None:
00039 self.state = False
00040 else:
00041 self.channel = ''
00042 self.state = False
00043
00044 def _get_types(self):
00045 """
00046 internal API method
00047 """
00048 return self._slot_types
00049
00050 def serialize(self, buff):
00051 """
00052 serialize message into buffer
00053 :param buff: buffer, ``StringIO``
00054 """
00055 try:
00056 _x = self.channel
00057 length = len(_x)
00058 if python3 or type(_x) == unicode:
00059 _x = _x.encode('utf-8')
00060 length = len(_x)
00061 buff.write(struct.pack('<I%ss'%length, length, _x))
00062 buff.write(_struct_B.pack(self.state))
00063 except struct.error as se: self._check_types(se)
00064 except TypeError as te: self._check_types(te)
00065
00066 def deserialize(self, str):
00067 """
00068 unpack serialized message in str into this message instance
00069 :param str: byte array of serialized message, ``str``
00070 """
00071 try:
00072 end = 0
00073 start = end
00074 end += 4
00075 (length,) = _struct_I.unpack(str[start:end])
00076 start = end
00077 end += length
00078 if python3:
00079 self.channel = str[start:end].decode('utf-8')
00080 else:
00081 self.channel = str[start:end]
00082 start = end
00083 end += 1
00084 (self.state,) = _struct_B.unpack(str[start:end])
00085 self.state = bool(self.state)
00086 return self
00087 except struct.error as e:
00088 raise genpy.DeserializationError(e)
00089
00090
00091 def serialize_numpy(self, buff, numpy):
00092 """
00093 serialize message with numpy array types into buffer
00094 :param buff: buffer, ``StringIO``
00095 :param numpy: numpy python module
00096 """
00097 try:
00098 _x = self.channel
00099 length = len(_x)
00100 if python3 or type(_x) == unicode:
00101 _x = _x.encode('utf-8')
00102 length = len(_x)
00103 buff.write(struct.pack('<I%ss'%length, length, _x))
00104 buff.write(_struct_B.pack(self.state))
00105 except struct.error as se: self._check_types(se)
00106 except TypeError as te: self._check_types(te)
00107
00108 def deserialize_numpy(self, str, numpy):
00109 """
00110 unpack serialized message in str into this message instance using numpy for array types
00111 :param str: byte array of serialized message, ``str``
00112 :param numpy: numpy python module
00113 """
00114 try:
00115 end = 0
00116 start = end
00117 end += 4
00118 (length,) = _struct_I.unpack(str[start:end])
00119 start = end
00120 end += length
00121 if python3:
00122 self.channel = str[start:end].decode('utf-8')
00123 else:
00124 self.channel = str[start:end]
00125 start = end
00126 end += 1
00127 (self.state,) = _struct_B.unpack(str[start:end])
00128 self.state = bool(self.state)
00129 return self
00130 except struct.error as e:
00131 raise genpy.DeserializationError(e)
00132
00133 _struct_I = genpy.struct_I
00134 _struct_B = struct.Struct("<B")
00135 """autogenerated by genpy from r2_msgs/PowerResponse.msg. Do not edit."""
00136 import sys
00137 python3 = True if sys.hexversion > 0x03000000 else False
00138 import genpy
00139 import struct
00140
00141
00142 class PowerResponse(genpy.Message):
00143 _md5sum = "3a1255d4d998bd4d6585c64639b5ee9a"
00144 _type = "r2_msgs/PowerResponse"
00145 _has_header = False
00146 _full_text = """bool status
00147
00148
00149 """
00150 __slots__ = ['status']
00151 _slot_types = ['bool']
00152
00153 def __init__(self, *args, **kwds):
00154 """
00155 Constructor. Any message fields that are implicitly/explicitly
00156 set to None will be assigned a default value. The recommend
00157 use is keyword arguments as this is more robust to future message
00158 changes. You cannot mix in-order arguments and keyword arguments.
00159
00160 The available fields are:
00161 status
00162
00163 :param args: complete set of field values, in .msg order
00164 :param kwds: use keyword arguments corresponding to message field names
00165 to set specific fields.
00166 """
00167 if args or kwds:
00168 super(PowerResponse, self).__init__(*args, **kwds)
00169
00170 if self.status is None:
00171 self.status = False
00172 else:
00173 self.status = False
00174
00175 def _get_types(self):
00176 """
00177 internal API method
00178 """
00179 return self._slot_types
00180
00181 def serialize(self, buff):
00182 """
00183 serialize message into buffer
00184 :param buff: buffer, ``StringIO``
00185 """
00186 try:
00187 buff.write(_struct_B.pack(self.status))
00188 except struct.error as se: self._check_types(se)
00189 except TypeError as te: self._check_types(te)
00190
00191 def deserialize(self, str):
00192 """
00193 unpack serialized message in str into this message instance
00194 :param str: byte array of serialized message, ``str``
00195 """
00196 try:
00197 end = 0
00198 start = end
00199 end += 1
00200 (self.status,) = _struct_B.unpack(str[start:end])
00201 self.status = bool(self.status)
00202 return self
00203 except struct.error as e:
00204 raise genpy.DeserializationError(e)
00205
00206
00207 def serialize_numpy(self, buff, numpy):
00208 """
00209 serialize message with numpy array types into buffer
00210 :param buff: buffer, ``StringIO``
00211 :param numpy: numpy python module
00212 """
00213 try:
00214 buff.write(_struct_B.pack(self.status))
00215 except struct.error as se: self._check_types(se)
00216 except TypeError as te: self._check_types(te)
00217
00218 def deserialize_numpy(self, str, numpy):
00219 """
00220 unpack serialized message in str into this message instance using numpy for array types
00221 :param str: byte array of serialized message, ``str``
00222 :param numpy: numpy python module
00223 """
00224 try:
00225 end = 0
00226 start = end
00227 end += 1
00228 (self.status,) = _struct_B.unpack(str[start:end])
00229 self.status = bool(self.status)
00230 return self
00231 except struct.error as e:
00232 raise genpy.DeserializationError(e)
00233
00234 _struct_I = genpy.struct_I
00235 _struct_B = struct.Struct("<B")
00236 class Power(object):
00237 _type = 'r2_msgs/Power'
00238 _md5sum = '8ab79e1aeae0eefc42684aa6a50ac610'
00239 _request_class = PowerRequest
00240 _response_class = PowerResponse