_BaseGNSSModemStatus.py
Go to the documentation of this file.
00001 """autogenerated by genpy from applanix_msgs/BaseGNSSModemStatus.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 BaseGNSSModemStatus(genpy.Message):
00010   _md5sum = "00919adef7a8ce91b9d8181ce0e31f4b"
00011   _type = "applanix_msgs/BaseGNSSModemStatus"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# Groups 21, 22
00014 TimeDistance td
00015 
00016 uint8[16] modem_response
00017 uint8[48] connection_status
00018 
00019 uint32 redials_per_disconnect
00020 uint32 max_redials_per_disconnect
00021 uint32 num_disconnects
00022 uint32 data_gap_length
00023 uint32 max_data_gap_length
00024 
00025 ================================================================================
00026 MSG: applanix_msgs/TimeDistance
00027 float64 time1
00028 float64 time2
00029 float64 distance
00030 uint8 time_types
00031 uint8 distance_type
00032 
00033 """
00034   __slots__ = ['td','modem_response','connection_status','redials_per_disconnect','max_redials_per_disconnect','num_disconnects','data_gap_length','max_data_gap_length']
00035   _slot_types = ['applanix_msgs/TimeDistance','uint8[16]','uint8[48]','uint32','uint32','uint32','uint32','uint32']
00036 
00037   def __init__(self, *args, **kwds):
00038     """
00039     Constructor. Any message fields that are implicitly/explicitly
00040     set to None will be assigned a default value. The recommend
00041     use is keyword arguments as this is more robust to future message
00042     changes.  You cannot mix in-order arguments and keyword arguments.
00043 
00044     The available fields are:
00045        td,modem_response,connection_status,redials_per_disconnect,max_redials_per_disconnect,num_disconnects,data_gap_length,max_data_gap_length
00046 
00047     :param args: complete set of field values, in .msg order
00048     :param kwds: use keyword arguments corresponding to message field names
00049     to set specific fields.
00050     """
00051     if args or kwds:
00052       super(BaseGNSSModemStatus, self).__init__(*args, **kwds)
00053       #message fields cannot be None, assign default values for those that are
00054       if self.td is None:
00055         self.td = applanix_msgs.msg.TimeDistance()
00056       if self.modem_response is None:
00057         self.modem_response = chr(0)*16
00058       if self.connection_status is None:
00059         self.connection_status = chr(0)*48
00060       if self.redials_per_disconnect is None:
00061         self.redials_per_disconnect = 0
00062       if self.max_redials_per_disconnect is None:
00063         self.max_redials_per_disconnect = 0
00064       if self.num_disconnects is None:
00065         self.num_disconnects = 0
00066       if self.data_gap_length is None:
00067         self.data_gap_length = 0
00068       if self.max_data_gap_length is None:
00069         self.max_data_gap_length = 0
00070     else:
00071       self.td = applanix_msgs.msg.TimeDistance()
00072       self.modem_response = chr(0)*16
00073       self.connection_status = chr(0)*48
00074       self.redials_per_disconnect = 0
00075       self.max_redials_per_disconnect = 0
00076       self.num_disconnects = 0
00077       self.data_gap_length = 0
00078       self.max_data_gap_length = 0
00079 
00080   def _get_types(self):
00081     """
00082     internal API method
00083     """
00084     return self._slot_types
00085 
00086   def serialize(self, buff):
00087     """
00088     serialize message into buffer
00089     :param buff: buffer, ``StringIO``
00090     """
00091     try:
00092       _x = self
00093       buff.write(_struct_3d2B.pack(_x.td.time1, _x.td.time2, _x.td.distance, _x.td.time_types, _x.td.distance_type))
00094       _x = self.modem_response
00095       # - if encoded as a list instead, serialize as bytes instead of string
00096       if type(_x) in [list, tuple]:
00097         buff.write(_struct_16B.pack(*_x))
00098       else:
00099         buff.write(_struct_16s.pack(_x))
00100       _x = self.connection_status
00101       # - if encoded as a list instead, serialize as bytes instead of string
00102       if type(_x) in [list, tuple]:
00103         buff.write(_struct_48B.pack(*_x))
00104       else:
00105         buff.write(_struct_48s.pack(_x))
00106       _x = self
00107       buff.write(_struct_5I.pack(_x.redials_per_disconnect, _x.max_redials_per_disconnect, _x.num_disconnects, _x.data_gap_length, _x.max_data_gap_length))
00108     except struct.error as se: self._check_types(se)
00109     except TypeError as te: self._check_types(te)
00110 
00111   def deserialize(self, str):
00112     """
00113     unpack serialized message in str into this message instance
00114     :param str: byte array of serialized message, ``str``
00115     """
00116     try:
00117       if self.td is None:
00118         self.td = applanix_msgs.msg.TimeDistance()
00119       end = 0
00120       _x = self
00121       start = end
00122       end += 26
00123       (_x.td.time1, _x.td.time2, _x.td.distance, _x.td.time_types, _x.td.distance_type,) = _struct_3d2B.unpack(str[start:end])
00124       start = end
00125       end += 16
00126       self.modem_response = str[start:end]
00127       start = end
00128       end += 48
00129       self.connection_status = str[start:end]
00130       _x = self
00131       start = end
00132       end += 20
00133       (_x.redials_per_disconnect, _x.max_redials_per_disconnect, _x.num_disconnects, _x.data_gap_length, _x.max_data_gap_length,) = _struct_5I.unpack(str[start:end])
00134       return self
00135     except struct.error as e:
00136       raise genpy.DeserializationError(e) #most likely buffer underfill
00137 
00138 
00139   def serialize_numpy(self, buff, numpy):
00140     """
00141     serialize message with numpy array types into buffer
00142     :param buff: buffer, ``StringIO``
00143     :param numpy: numpy python module
00144     """
00145     try:
00146       _x = self
00147       buff.write(_struct_3d2B.pack(_x.td.time1, _x.td.time2, _x.td.distance, _x.td.time_types, _x.td.distance_type))
00148       _x = self.modem_response
00149       # - if encoded as a list instead, serialize as bytes instead of string
00150       if type(_x) in [list, tuple]:
00151         buff.write(_struct_16B.pack(*_x))
00152       else:
00153         buff.write(_struct_16s.pack(_x))
00154       _x = self.connection_status
00155       # - if encoded as a list instead, serialize as bytes instead of string
00156       if type(_x) in [list, tuple]:
00157         buff.write(_struct_48B.pack(*_x))
00158       else:
00159         buff.write(_struct_48s.pack(_x))
00160       _x = self
00161       buff.write(_struct_5I.pack(_x.redials_per_disconnect, _x.max_redials_per_disconnect, _x.num_disconnects, _x.data_gap_length, _x.max_data_gap_length))
00162     except struct.error as se: self._check_types(se)
00163     except TypeError as te: self._check_types(te)
00164 
00165   def deserialize_numpy(self, str, numpy):
00166     """
00167     unpack serialized message in str into this message instance using numpy for array types
00168     :param str: byte array of serialized message, ``str``
00169     :param numpy: numpy python module
00170     """
00171     try:
00172       if self.td is None:
00173         self.td = applanix_msgs.msg.TimeDistance()
00174       end = 0
00175       _x = self
00176       start = end
00177       end += 26
00178       (_x.td.time1, _x.td.time2, _x.td.distance, _x.td.time_types, _x.td.distance_type,) = _struct_3d2B.unpack(str[start:end])
00179       start = end
00180       end += 16
00181       self.modem_response = str[start:end]
00182       start = end
00183       end += 48
00184       self.connection_status = str[start:end]
00185       _x = self
00186       start = end
00187       end += 20
00188       (_x.redials_per_disconnect, _x.max_redials_per_disconnect, _x.num_disconnects, _x.data_gap_length, _x.max_data_gap_length,) = _struct_5I.unpack(str[start:end])
00189       return self
00190     except struct.error as e:
00191       raise genpy.DeserializationError(e) #most likely buffer underfill
00192 
00193 _struct_I = genpy.struct_I
00194 _struct_3d2B = struct.Struct("<3d2B")
00195 _struct_48B = struct.Struct("<48B")
00196 _struct_16B = struct.Struct("<16B")
00197 _struct_5I = struct.Struct("<5I")
00198 _struct_48s = struct.Struct("<48s")
00199 _struct_16s = struct.Struct("<16s")


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