00001 """autogenerated by genpy from applanix_msgs/COMPortSetup.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 COMPortSetup(genpy.Message):
00010 _md5sum = "a6bd005ff624172e9e2145b5e8243fec"
00011 _type = "applanix_msgs/COMPortSetup"
00012 _has_header = False
00013 _full_text = """# Msg 34
00014 uint16 transaction
00015
00016 uint16 ports_count
00017 COMPortParams[] ports
00018 uint16 port_mask
00019
00020 ================================================================================
00021 MSG: applanix_msgs/COMPortParams
00022 uint8 BAUD_2400=0
00023 uint8 BAUD_4800=1
00024 uint8 BAUD_9600=2
00025 uint8 BAUD_19200=3
00026 uint8 BAUD_38400=4
00027 uint8 BAUD_57600=5
00028 uint8 BAUD_76800=6
00029 uint8 BAUD_115200=7
00030 uint8 baud
00031
00032 uint8 PARITY_NONE=0
00033 uint8 PARITY_EVEN=1
00034 uint8 PARITY_ODD=2
00035 uint8 parity
00036
00037 uint8 DATA_7_STOP_1=0
00038 uint8 DATA_7_STOP_2=1
00039 uint8 DATA_8_STOP_1=2
00040 uint8 DATA_8_STOP_2=3
00041 uint8 data_stop
00042
00043 uint8 FLOW_NONE=0
00044 uint8 FLOW_HARDWARE=1
00045 uint8 FLOW_XONXOFF=2
00046 uint8 FLOW_RS422=3
00047 uint8 flow
00048
00049 uint16 INPUT_NONE=0
00050 uint16 INPUT_AUX_1_GNSS=1
00051 uint16 INPUT_AUX_2_GNSS=2
00052 uint16 INPUT_BASE_1_GNSS=4
00053 uint16 INPUT_BASE_2_GNSS=5
00054 uint16 INPUT_GNSS_1=7
00055 uint16 INPUT_GNSS_2=8
00056 uint16 input_select
00057
00058 uint16 OUTPUT_NONE=0
00059 uint16 OUTPUT_NMEA=1
00060 uint16 OUTPUT_BINARY=2
00061 uint16 OUTPUT_BASE_1_GNSS=4
00062 uint16 OUTPUT_BASE_2_GNSS=5
00063 uint16 OUTPUT_GNSS_1=7
00064 uint16 OUTPUT_GNSS_2=8
00065 uint16 output_select
00066
00067 """
00068 __slots__ = ['transaction','ports_count','ports','port_mask']
00069 _slot_types = ['uint16','uint16','applanix_msgs/COMPortParams[]','uint16']
00070
00071 def __init__(self, *args, **kwds):
00072 """
00073 Constructor. Any message fields that are implicitly/explicitly
00074 set to None will be assigned a default value. The recommend
00075 use is keyword arguments as this is more robust to future message
00076 changes. You cannot mix in-order arguments and keyword arguments.
00077
00078 The available fields are:
00079 transaction,ports_count,ports,port_mask
00080
00081 :param args: complete set of field values, in .msg order
00082 :param kwds: use keyword arguments corresponding to message field names
00083 to set specific fields.
00084 """
00085 if args or kwds:
00086 super(COMPortSetup, self).__init__(*args, **kwds)
00087
00088 if self.transaction is None:
00089 self.transaction = 0
00090 if self.ports_count is None:
00091 self.ports_count = 0
00092 if self.ports is None:
00093 self.ports = []
00094 if self.port_mask is None:
00095 self.port_mask = 0
00096 else:
00097 self.transaction = 0
00098 self.ports_count = 0
00099 self.ports = []
00100 self.port_mask = 0
00101
00102 def _get_types(self):
00103 """
00104 internal API method
00105 """
00106 return self._slot_types
00107
00108 def serialize(self, buff):
00109 """
00110 serialize message into buffer
00111 :param buff: buffer, ``StringIO``
00112 """
00113 try:
00114 _x = self
00115 buff.write(_struct_2H.pack(_x.transaction, _x.ports_count))
00116 length = len(self.ports)
00117 buff.write(_struct_I.pack(length))
00118 for val1 in self.ports:
00119 _x = val1
00120 buff.write(_struct_4B2H.pack(_x.baud, _x.parity, _x.data_stop, _x.flow, _x.input_select, _x.output_select))
00121 buff.write(_struct_H.pack(self.port_mask))
00122 except struct.error as se: self._check_types(se)
00123 except TypeError as te: self._check_types(te)
00124
00125 def deserialize(self, str):
00126 """
00127 unpack serialized message in str into this message instance
00128 :param str: byte array of serialized message, ``str``
00129 """
00130 try:
00131 if self.ports is None:
00132 self.ports = None
00133 end = 0
00134 _x = self
00135 start = end
00136 end += 4
00137 (_x.transaction, _x.ports_count,) = _struct_2H.unpack(str[start:end])
00138 start = end
00139 end += 4
00140 (length,) = _struct_I.unpack(str[start:end])
00141 self.ports = []
00142 for i in range(0, length):
00143 val1 = applanix_msgs.msg.COMPortParams()
00144 _x = val1
00145 start = end
00146 end += 8
00147 (_x.baud, _x.parity, _x.data_stop, _x.flow, _x.input_select, _x.output_select,) = _struct_4B2H.unpack(str[start:end])
00148 self.ports.append(val1)
00149 start = end
00150 end += 2
00151 (self.port_mask,) = _struct_H.unpack(str[start:end])
00152 return self
00153 except struct.error as e:
00154 raise genpy.DeserializationError(e)
00155
00156
00157 def serialize_numpy(self, buff, numpy):
00158 """
00159 serialize message with numpy array types into buffer
00160 :param buff: buffer, ``StringIO``
00161 :param numpy: numpy python module
00162 """
00163 try:
00164 _x = self
00165 buff.write(_struct_2H.pack(_x.transaction, _x.ports_count))
00166 length = len(self.ports)
00167 buff.write(_struct_I.pack(length))
00168 for val1 in self.ports:
00169 _x = val1
00170 buff.write(_struct_4B2H.pack(_x.baud, _x.parity, _x.data_stop, _x.flow, _x.input_select, _x.output_select))
00171 buff.write(_struct_H.pack(self.port_mask))
00172 except struct.error as se: self._check_types(se)
00173 except TypeError as te: self._check_types(te)
00174
00175 def deserialize_numpy(self, str, numpy):
00176 """
00177 unpack serialized message in str into this message instance using numpy for array types
00178 :param str: byte array of serialized message, ``str``
00179 :param numpy: numpy python module
00180 """
00181 try:
00182 if self.ports is None:
00183 self.ports = None
00184 end = 0
00185 _x = self
00186 start = end
00187 end += 4
00188 (_x.transaction, _x.ports_count,) = _struct_2H.unpack(str[start:end])
00189 start = end
00190 end += 4
00191 (length,) = _struct_I.unpack(str[start:end])
00192 self.ports = []
00193 for i in range(0, length):
00194 val1 = applanix_msgs.msg.COMPortParams()
00195 _x = val1
00196 start = end
00197 end += 8
00198 (_x.baud, _x.parity, _x.data_stop, _x.flow, _x.input_select, _x.output_select,) = _struct_4B2H.unpack(str[start:end])
00199 self.ports.append(val1)
00200 start = end
00201 end += 2
00202 (self.port_mask,) = _struct_H.unpack(str[start:end])
00203 return self
00204 except struct.error as e:
00205 raise genpy.DeserializationError(e)
00206
00207 _struct_I = genpy.struct_I
00208 _struct_4B2H = struct.Struct("<4B2H")
00209 _struct_2H = struct.Struct("<2H")
00210 _struct_H = struct.Struct("<H")