Package network_monitor_udp :: Package msg :: Module _UdpSink
[frames] | no frames]

Source Code for Module network_monitor_udp.msg._UdpSink

  1  """autogenerated by genpy from network_monitor_udp/UdpSink.msg. Do not edit.""" 
  2  import sys 
  3  python3 = True if sys.hexversion > 0x03000000 else False 
  4  import genpy 
  5  import struct 
  6   
  7   
8 -class UdpSink(genpy.Message):
9 _md5sum = "a56e2a33942a368e87b357cc9e894ec5" 10 _type = "network_monitor_udp/UdpSink" 11 _has_header = False #flag to mark the presence of a Header object 12 _full_text = """### data send from sink to source 13 uint8[4] magic 14 float64 send_time 15 float64 echo_time 16 int32 seqnum 17 int32 source_id 18 19 20 """ 21 __slots__ = ['magic','send_time','echo_time','seqnum','source_id'] 22 _slot_types = ['uint8[4]','float64','float64','int32','int32'] 23
24 - def __init__(self, *args, **kwds):
25 """ 26 Constructor. Any message fields that are implicitly/explicitly 27 set to None will be assigned a default value. The recommend 28 use is keyword arguments as this is more robust to future message 29 changes. You cannot mix in-order arguments and keyword arguments. 30 31 The available fields are: 32 magic,send_time,echo_time,seqnum,source_id 33 34 :param args: complete set of field values, in .msg order 35 :param kwds: use keyword arguments corresponding to message field names 36 to set specific fields. 37 """ 38 if args or kwds: 39 super(UdpSink, self).__init__(*args, **kwds) 40 #message fields cannot be None, assign default values for those that are 41 if self.magic is None: 42 self.magic = chr(0)*4 43 if self.send_time is None: 44 self.send_time = 0. 45 if self.echo_time is None: 46 self.echo_time = 0. 47 if self.seqnum is None: 48 self.seqnum = 0 49 if self.source_id is None: 50 self.source_id = 0 51 else: 52 self.magic = chr(0)*4 53 self.send_time = 0. 54 self.echo_time = 0. 55 self.seqnum = 0 56 self.source_id = 0
57
58 - def _get_types(self):
59 """ 60 internal API method 61 """ 62 return self._slot_types
63
64 - def serialize(self, buff):
65 """ 66 serialize message into buffer 67 :param buff: buffer, ``StringIO`` 68 """ 69 try: 70 _x = self.magic 71 # - if encoded as a list instead, serialize as bytes instead of string 72 if type(_x) in [list, tuple]: 73 buff.write(_struct_4B.pack(*_x)) 74 else: 75 buff.write(_struct_4s.pack(_x)) 76 _x = self 77 buff.write(_struct_2d2i.pack(_x.send_time, _x.echo_time, _x.seqnum, _x.source_id)) 78 except struct.error as se: self._check_types(se) 79 except TypeError as te: self._check_types(te)
80
81 - def deserialize(self, str):
82 """ 83 unpack serialized message in str into this message instance 84 :param str: byte array of serialized message, ``str`` 85 """ 86 try: 87 end = 0 88 start = end 89 end += 4 90 self.magic = str[start:end] 91 _x = self 92 start = end 93 end += 24 94 (_x.send_time, _x.echo_time, _x.seqnum, _x.source_id,) = _struct_2d2i.unpack(str[start:end]) 95 return self 96 except struct.error as e: 97 raise genpy.DeserializationError(e) #most likely buffer underfill
98 99
100 - def serialize_numpy(self, buff, numpy):
101 """ 102 serialize message with numpy array types into buffer 103 :param buff: buffer, ``StringIO`` 104 :param numpy: numpy python module 105 """ 106 try: 107 _x = self.magic 108 # - if encoded as a list instead, serialize as bytes instead of string 109 if type(_x) in [list, tuple]: 110 buff.write(_struct_4B.pack(*_x)) 111 else: 112 buff.write(_struct_4s.pack(_x)) 113 _x = self 114 buff.write(_struct_2d2i.pack(_x.send_time, _x.echo_time, _x.seqnum, _x.source_id)) 115 except struct.error as se: self._check_types(se) 116 except TypeError as te: self._check_types(te)
117
118 - def deserialize_numpy(self, str, numpy):
119 """ 120 unpack serialized message in str into this message instance using numpy for array types 121 :param str: byte array of serialized message, ``str`` 122 :param numpy: numpy python module 123 """ 124 try: 125 end = 0 126 start = end 127 end += 4 128 self.magic = str[start:end] 129 _x = self 130 start = end 131 end += 24 132 (_x.send_time, _x.echo_time, _x.seqnum, _x.source_id,) = _struct_2d2i.unpack(str[start:end]) 133 return self 134 except struct.error as e: 135 raise genpy.DeserializationError(e) #most likely buffer underfill
136 137 _struct_I = genpy.struct_I 138 _struct_2d2i = struct.Struct("<2d2i") 139 _struct_4B = struct.Struct("<4B") 140 _struct_4s = struct.Struct("<4s") 141