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