_PortControl.py
Go to the documentation of this file.
00001 """autogenerated by genpy from applanix_msgs/PortControl.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 PortControl(genpy.Message):
00010   _md5sum = "580f01d560eac7e9f65f2de16e8d84ca"
00011   _type = "applanix_msgs/PortControl"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# Msg 51, 52, 61
00014 uint16 transaction
00015 
00016 uint16 groups_count
00017 OutputGroup[] groups
00018 
00019 # Valid only for primary/secondary data port.
00020 # 1, 2, 10, 20, 25, 50, 100, 200
00021 uint16 rate
00022 
00023 ================================================================================
00024 MSG: applanix_msgs/OutputGroup
00025 uint16 group
00026 
00027 """
00028   __slots__ = ['transaction','groups_count','groups','rate']
00029   _slot_types = ['uint16','uint16','applanix_msgs/OutputGroup[]','uint16']
00030 
00031   def __init__(self, *args, **kwds):
00032     """
00033     Constructor. Any message fields that are implicitly/explicitly
00034     set to None will be assigned a default value. The recommend
00035     use is keyword arguments as this is more robust to future message
00036     changes.  You cannot mix in-order arguments and keyword arguments.
00037 
00038     The available fields are:
00039        transaction,groups_count,groups,rate
00040 
00041     :param args: complete set of field values, in .msg order
00042     :param kwds: use keyword arguments corresponding to message field names
00043     to set specific fields.
00044     """
00045     if args or kwds:
00046       super(PortControl, self).__init__(*args, **kwds)
00047       #message fields cannot be None, assign default values for those that are
00048       if self.transaction is None:
00049         self.transaction = 0
00050       if self.groups_count is None:
00051         self.groups_count = 0
00052       if self.groups is None:
00053         self.groups = []
00054       if self.rate is None:
00055         self.rate = 0
00056     else:
00057       self.transaction = 0
00058       self.groups_count = 0
00059       self.groups = []
00060       self.rate = 0
00061 
00062   def _get_types(self):
00063     """
00064     internal API method
00065     """
00066     return self._slot_types
00067 
00068   def serialize(self, buff):
00069     """
00070     serialize message into buffer
00071     :param buff: buffer, ``StringIO``
00072     """
00073     try:
00074       _x = self
00075       buff.write(_struct_2H.pack(_x.transaction, _x.groups_count))
00076       length = len(self.groups)
00077       buff.write(_struct_I.pack(length))
00078       for val1 in self.groups:
00079         buff.write(_struct_H.pack(val1.group))
00080       buff.write(_struct_H.pack(self.rate))
00081     except struct.error as se: self._check_types(se)
00082     except TypeError as te: self._check_types(te)
00083 
00084   def deserialize(self, str):
00085     """
00086     unpack serialized message in str into this message instance
00087     :param str: byte array of serialized message, ``str``
00088     """
00089     try:
00090       if self.groups is None:
00091         self.groups = None
00092       end = 0
00093       _x = self
00094       start = end
00095       end += 4
00096       (_x.transaction, _x.groups_count,) = _struct_2H.unpack(str[start:end])
00097       start = end
00098       end += 4
00099       (length,) = _struct_I.unpack(str[start:end])
00100       self.groups = []
00101       for i in range(0, length):
00102         val1 = applanix_msgs.msg.OutputGroup()
00103         start = end
00104         end += 2
00105         (val1.group,) = _struct_H.unpack(str[start:end])
00106         self.groups.append(val1)
00107       start = end
00108       end += 2
00109       (self.rate,) = _struct_H.unpack(str[start:end])
00110       return self
00111     except struct.error as e:
00112       raise genpy.DeserializationError(e) #most likely buffer underfill
00113 
00114 
00115   def serialize_numpy(self, buff, numpy):
00116     """
00117     serialize message with numpy array types into buffer
00118     :param buff: buffer, ``StringIO``
00119     :param numpy: numpy python module
00120     """
00121     try:
00122       _x = self
00123       buff.write(_struct_2H.pack(_x.transaction, _x.groups_count))
00124       length = len(self.groups)
00125       buff.write(_struct_I.pack(length))
00126       for val1 in self.groups:
00127         buff.write(_struct_H.pack(val1.group))
00128       buff.write(_struct_H.pack(self.rate))
00129     except struct.error as se: self._check_types(se)
00130     except TypeError as te: self._check_types(te)
00131 
00132   def deserialize_numpy(self, str, numpy):
00133     """
00134     unpack serialized message in str into this message instance using numpy for array types
00135     :param str: byte array of serialized message, ``str``
00136     :param numpy: numpy python module
00137     """
00138     try:
00139       if self.groups is None:
00140         self.groups = None
00141       end = 0
00142       _x = self
00143       start = end
00144       end += 4
00145       (_x.transaction, _x.groups_count,) = _struct_2H.unpack(str[start:end])
00146       start = end
00147       end += 4
00148       (length,) = _struct_I.unpack(str[start:end])
00149       self.groups = []
00150       for i in range(0, length):
00151         val1 = applanix_msgs.msg.OutputGroup()
00152         start = end
00153         end += 2
00154         (val1.group,) = _struct_H.unpack(str[start:end])
00155         self.groups.append(val1)
00156       start = end
00157       end += 2
00158       (self.rate,) = _struct_H.unpack(str[start:end])
00159       return self
00160     except struct.error as e:
00161       raise genpy.DeserializationError(e) #most likely buffer underfill
00162 
00163 _struct_I = genpy.struct_I
00164 _struct_H = struct.Struct("<H")
00165 _struct_2H = struct.Struct("<2H")


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