$search
00001 """autogenerated by genmsg_py from RemotePowerPortStatus.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class RemotePowerPortStatus(roslib.message.Message): 00007 _md5sum = "5a83ed221c3d07874c5b8530cf089621" 00008 _type = "remote_power_manager/RemotePowerPortStatus" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """bool[] port_status 00011 00012 """ 00013 __slots__ = ['port_status'] 00014 _slot_types = ['bool[]'] 00015 00016 def __init__(self, *args, **kwds): 00017 """ 00018 Constructor. Any message fields that are implicitly/explicitly 00019 set to None will be assigned a default value. The recommend 00020 use is keyword arguments as this is more robust to future message 00021 changes. You cannot mix in-order arguments and keyword arguments. 00022 00023 The available fields are: 00024 port_status 00025 00026 @param args: complete set of field values, in .msg order 00027 @param kwds: use keyword arguments corresponding to message field names 00028 to set specific fields. 00029 """ 00030 if args or kwds: 00031 super(RemotePowerPortStatus, self).__init__(*args, **kwds) 00032 #message fields cannot be None, assign default values for those that are 00033 if self.port_status is None: 00034 self.port_status = [] 00035 else: 00036 self.port_status = [] 00037 00038 def _get_types(self): 00039 """ 00040 internal API method 00041 """ 00042 return self._slot_types 00043 00044 def serialize(self, buff): 00045 """ 00046 serialize message into buffer 00047 @param buff: buffer 00048 @type buff: StringIO 00049 """ 00050 try: 00051 length = len(self.port_status) 00052 buff.write(_struct_I.pack(length)) 00053 pattern = '<%sB'%length 00054 buff.write(struct.pack(pattern, *self.port_status)) 00055 except struct.error as se: self._check_types(se) 00056 except TypeError as te: self._check_types(te) 00057 00058 def deserialize(self, str): 00059 """ 00060 unpack serialized message in str into this message instance 00061 @param str: byte array of serialized message 00062 @type str: str 00063 """ 00064 try: 00065 end = 0 00066 start = end 00067 end += 4 00068 (length,) = _struct_I.unpack(str[start:end]) 00069 pattern = '<%sB'%length 00070 start = end 00071 end += struct.calcsize(pattern) 00072 self.port_status = struct.unpack(pattern, str[start:end]) 00073 self.port_status = map(bool, self.port_status) 00074 return self 00075 except struct.error as e: 00076 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00077 00078 00079 def serialize_numpy(self, buff, numpy): 00080 """ 00081 serialize message with numpy array types into buffer 00082 @param buff: buffer 00083 @type buff: StringIO 00084 @param numpy: numpy python module 00085 @type numpy module 00086 """ 00087 try: 00088 length = len(self.port_status) 00089 buff.write(_struct_I.pack(length)) 00090 pattern = '<%sB'%length 00091 buff.write(self.port_status.tostring()) 00092 except struct.error as se: self._check_types(se) 00093 except TypeError as te: self._check_types(te) 00094 00095 def deserialize_numpy(self, str, numpy): 00096 """ 00097 unpack serialized message in str into this message instance using numpy for array types 00098 @param str: byte array of serialized message 00099 @type str: str 00100 @param numpy: numpy python module 00101 @type numpy: module 00102 """ 00103 try: 00104 end = 0 00105 start = end 00106 end += 4 00107 (length,) = _struct_I.unpack(str[start:end]) 00108 pattern = '<%sB'%length 00109 start = end 00110 end += struct.calcsize(pattern) 00111 self.port_status = numpy.frombuffer(str[start:end], dtype=numpy.bool, count=length) 00112 self.port_status = map(bool, self.port_status) 00113 return self 00114 except struct.error as e: 00115 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00116 00117 _struct_I = roslib.message.struct_I