_BinaryMessageSelect.py
Go to the documentation of this file.
00001 """autogenerated by genpy from applanix_msgs/BinaryMessageSelect.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006 
00007 import applanix_msgs.msg
00008 
00009 class BinaryMessageSelect(genpy.Message):
00010   _md5sum = "5bb4f6bf007b45be4c257f9bdd00e7fa"
00011   _type = "applanix_msgs/BinaryMessageSelect"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# Msg 35
00014 uint16 transaction
00015 
00016 uint8[7] reserved
00017 
00018 uint8 ports_count
00019 COMPortMessages[] ports
00020 
00021 ================================================================================
00022 MSG: applanix_msgs/COMPortMessages
00023 uint8 port_num
00024 
00025 uint32 MESSAGES_NMEA_GST=1
00026 uint32 MESSAGES_NMEA_GGA=2
00027 uint32 MESSAGES_NMEA_HDT=4
00028 uint32 MESSAGES_NMEA_ZDA=8
00029 uint32 MESSAGES_NMEA_EVT1=16
00030 uint32 MESSAGES_NMEA_EVT2=32
00031 uint32 MESSAGES_NMEA_VTG=64
00032 uint32 MESSAGES_NMEA_PASHR=128
00033 uint32 MESSAGES_NMEA_GGA2=8192
00034 uint32 MESSAGES_NMEA_PPS=16384
00035 uint32 MESSAGES_NMEA_GGK=32768
00036 uint32 MESSAGES_NMEA_RMC=65536
00037 uint32 MESSAGES_BIN_GIMBAL_LOOP=1
00038 uint32 MESSAGES_BIN_RDR1=2
00039 uint32 MESSAGES_BIN_PAST2=4
00040 uint32 MESSAGES_BIN_PPS=65536
00041 uint32 MESSAGES_BIN_TM1B=131072
00042 uint32 messages
00043 
00044 uint8 update_rate
00045 
00046 """
00047   __slots__ = ['transaction','reserved','ports_count','ports']
00048   _slot_types = ['uint16','uint8[7]','uint8','applanix_msgs/COMPortMessages[]']
00049 
00050   def __init__(self, *args, **kwds):
00051     """
00052     Constructor. Any message fields that are implicitly/explicitly
00053     set to None will be assigned a default value. The recommend
00054     use is keyword arguments as this is more robust to future message
00055     changes.  You cannot mix in-order arguments and keyword arguments.
00056 
00057     The available fields are:
00058        transaction,reserved,ports_count,ports
00059 
00060     :param args: complete set of field values, in .msg order
00061     :param kwds: use keyword arguments corresponding to message field names
00062     to set specific fields.
00063     """
00064     if args or kwds:
00065       super(BinaryMessageSelect, self).__init__(*args, **kwds)
00066       #message fields cannot be None, assign default values for those that are
00067       if self.transaction is None:
00068         self.transaction = 0
00069       if self.reserved is None:
00070         self.reserved = chr(0)*7
00071       if self.ports_count is None:
00072         self.ports_count = 0
00073       if self.ports is None:
00074         self.ports = []
00075     else:
00076       self.transaction = 0
00077       self.reserved = chr(0)*7
00078       self.ports_count = 0
00079       self.ports = []
00080 
00081   def _get_types(self):
00082     """
00083     internal API method
00084     """
00085     return self._slot_types
00086 
00087   def serialize(self, buff):
00088     """
00089     serialize message into buffer
00090     :param buff: buffer, ``StringIO``
00091     """
00092     try:
00093       buff.write(_struct_H.pack(self.transaction))
00094       _x = self.reserved
00095       # - if encoded as a list instead, serialize as bytes instead of string
00096       if type(_x) in [list, tuple]:
00097         buff.write(_struct_7B.pack(*_x))
00098       else:
00099         buff.write(_struct_7s.pack(_x))
00100       buff.write(_struct_B.pack(self.ports_count))
00101       length = len(self.ports)
00102       buff.write(_struct_I.pack(length))
00103       for val1 in self.ports:
00104         _x = val1
00105         buff.write(_struct_BIB.pack(_x.port_num, _x.messages, _x.update_rate))
00106     except struct.error as se: self._check_types(se)
00107     except TypeError as te: self._check_types(te)
00108 
00109   def deserialize(self, str):
00110     """
00111     unpack serialized message in str into this message instance
00112     :param str: byte array of serialized message, ``str``
00113     """
00114     try:
00115       if self.ports is None:
00116         self.ports = None
00117       end = 0
00118       start = end
00119       end += 2
00120       (self.transaction,) = _struct_H.unpack(str[start:end])
00121       start = end
00122       end += 7
00123       self.reserved = str[start:end]
00124       start = end
00125       end += 1
00126       (self.ports_count,) = _struct_B.unpack(str[start:end])
00127       start = end
00128       end += 4
00129       (length,) = _struct_I.unpack(str[start:end])
00130       self.ports = []
00131       for i in range(0, length):
00132         val1 = applanix_msgs.msg.COMPortMessages()
00133         _x = val1
00134         start = end
00135         end += 6
00136         (_x.port_num, _x.messages, _x.update_rate,) = _struct_BIB.unpack(str[start:end])
00137         self.ports.append(val1)
00138       return self
00139     except struct.error as e:
00140       raise genpy.DeserializationError(e) #most likely buffer underfill
00141 
00142 
00143   def serialize_numpy(self, buff, numpy):
00144     """
00145     serialize message with numpy array types into buffer
00146     :param buff: buffer, ``StringIO``
00147     :param numpy: numpy python module
00148     """
00149     try:
00150       buff.write(_struct_H.pack(self.transaction))
00151       _x = self.reserved
00152       # - if encoded as a list instead, serialize as bytes instead of string
00153       if type(_x) in [list, tuple]:
00154         buff.write(_struct_7B.pack(*_x))
00155       else:
00156         buff.write(_struct_7s.pack(_x))
00157       buff.write(_struct_B.pack(self.ports_count))
00158       length = len(self.ports)
00159       buff.write(_struct_I.pack(length))
00160       for val1 in self.ports:
00161         _x = val1
00162         buff.write(_struct_BIB.pack(_x.port_num, _x.messages, _x.update_rate))
00163     except struct.error as se: self._check_types(se)
00164     except TypeError as te: self._check_types(te)
00165 
00166   def deserialize_numpy(self, str, numpy):
00167     """
00168     unpack serialized message in str into this message instance using numpy for array types
00169     :param str: byte array of serialized message, ``str``
00170     :param numpy: numpy python module
00171     """
00172     try:
00173       if self.ports is None:
00174         self.ports = None
00175       end = 0
00176       start = end
00177       end += 2
00178       (self.transaction,) = _struct_H.unpack(str[start:end])
00179       start = end
00180       end += 7
00181       self.reserved = str[start:end]
00182       start = end
00183       end += 1
00184       (self.ports_count,) = _struct_B.unpack(str[start:end])
00185       start = end
00186       end += 4
00187       (length,) = _struct_I.unpack(str[start:end])
00188       self.ports = []
00189       for i in range(0, length):
00190         val1 = applanix_msgs.msg.COMPortMessages()
00191         _x = val1
00192         start = end
00193         end += 6
00194         (_x.port_num, _x.messages, _x.update_rate,) = _struct_BIB.unpack(str[start:end])
00195         self.ports.append(val1)
00196       return self
00197     except struct.error as e:
00198       raise genpy.DeserializationError(e) #most likely buffer underfill
00199 
00200 _struct_I = genpy.struct_I
00201 _struct_H = struct.Struct("<H")
00202 _struct_B = struct.Struct("<B")
00203 _struct_7s = struct.Struct("<7s")
00204 _struct_7B = struct.Struct("<7B")
00205 _struct_BIB = struct.Struct("<BIB")


applanix_msgs
Author(s): Mike Purvis
autogenerated on Thu Jan 2 2014 11:04:51