$search
00001 """autogenerated by genmsg_py from IPAddress.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class IPAddress(roslib.message.Message): 00007 _md5sum = "f9c07a2c57bd175eb0fab8fba08b6b4b" 00008 _type = "applanix_msgs/IPAddress" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """# Msg 32 00011 uint16 transaction 00012 00013 uint8[4] address 00014 uint8[4] subnet_mask 00015 00016 00017 """ 00018 __slots__ = ['transaction','address','subnet_mask'] 00019 _slot_types = ['uint16','uint8[4]','uint8[4]'] 00020 00021 def __init__(self, *args, **kwds): 00022 """ 00023 Constructor. Any message fields that are implicitly/explicitly 00024 set to None will be assigned a default value. The recommend 00025 use is keyword arguments as this is more robust to future message 00026 changes. You cannot mix in-order arguments and keyword arguments. 00027 00028 The available fields are: 00029 transaction,address,subnet_mask 00030 00031 @param args: complete set of field values, in .msg order 00032 @param kwds: use keyword arguments corresponding to message field names 00033 to set specific fields. 00034 """ 00035 if args or kwds: 00036 super(IPAddress, self).__init__(*args, **kwds) 00037 #message fields cannot be None, assign default values for those that are 00038 if self.transaction is None: 00039 self.transaction = 0 00040 if self.address is None: 00041 self.address = chr(0)*4 00042 if self.subnet_mask is None: 00043 self.subnet_mask = chr(0)*4 00044 else: 00045 self.transaction = 0 00046 self.address = chr(0)*4 00047 self.subnet_mask = chr(0)*4 00048 00049 def _get_types(self): 00050 """ 00051 internal API method 00052 """ 00053 return self._slot_types 00054 00055 def serialize(self, buff): 00056 """ 00057 serialize message into buffer 00058 @param buff: buffer 00059 @type buff: StringIO 00060 """ 00061 try: 00062 buff.write(_struct_H.pack(self.transaction)) 00063 _x = self.address 00064 # - if encoded as a list instead, serialize as bytes instead of string 00065 if type(_x) in [list, tuple]: 00066 buff.write(_struct_4B.pack(*_x)) 00067 else: 00068 buff.write(_struct_4s.pack(_x)) 00069 _x = self.subnet_mask 00070 # - if encoded as a list instead, serialize as bytes instead of string 00071 if type(_x) in [list, tuple]: 00072 buff.write(_struct_4B.pack(*_x)) 00073 else: 00074 buff.write(_struct_4s.pack(_x)) 00075 except struct.error as se: self._check_types(se) 00076 except TypeError as te: self._check_types(te) 00077 00078 def deserialize(self, str): 00079 """ 00080 unpack serialized message in str into this message instance 00081 @param str: byte array of serialized message 00082 @type str: str 00083 """ 00084 try: 00085 end = 0 00086 start = end 00087 end += 2 00088 (self.transaction,) = _struct_H.unpack(str[start:end]) 00089 start = end 00090 end += 4 00091 self.address = str[start:end] 00092 start = end 00093 end += 4 00094 self.subnet_mask = str[start:end] 00095 return self 00096 except struct.error as e: 00097 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00098 00099 00100 def serialize_numpy(self, buff, numpy): 00101 """ 00102 serialize message with numpy array types into buffer 00103 @param buff: buffer 00104 @type buff: StringIO 00105 @param numpy: numpy python module 00106 @type numpy module 00107 """ 00108 try: 00109 buff.write(_struct_H.pack(self.transaction)) 00110 _x = self.address 00111 # - if encoded as a list instead, serialize as bytes instead of string 00112 if type(_x) in [list, tuple]: 00113 buff.write(_struct_4B.pack(*_x)) 00114 else: 00115 buff.write(_struct_4s.pack(_x)) 00116 _x = self.subnet_mask 00117 # - if encoded as a list instead, serialize as bytes instead of string 00118 if type(_x) in [list, tuple]: 00119 buff.write(_struct_4B.pack(*_x)) 00120 else: 00121 buff.write(_struct_4s.pack(_x)) 00122 except struct.error as se: self._check_types(se) 00123 except TypeError as te: self._check_types(te) 00124 00125 def deserialize_numpy(self, str, numpy): 00126 """ 00127 unpack serialized message in str into this message instance using numpy for array types 00128 @param str: byte array of serialized message 00129 @type str: str 00130 @param numpy: numpy python module 00131 @type numpy: module 00132 """ 00133 try: 00134 end = 0 00135 start = end 00136 end += 2 00137 (self.transaction,) = _struct_H.unpack(str[start:end]) 00138 start = end 00139 end += 4 00140 self.address = str[start:end] 00141 start = end 00142 end += 4 00143 self.subnet_mask = str[start:end] 00144 return self 00145 except struct.error as e: 00146 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00147 00148 _struct_I = roslib.message.struct_I 00149 _struct_H = struct.Struct("<H") 00150 _struct_4B = struct.Struct("<4B") 00151 _struct_4s = struct.Struct("<4s")