Go to the documentation of this file.00001 """autogenerated by genpy from ros_arduino_msgs/Digital.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 std_msgs.msg
00008
00009 class Digital(genpy.Message):
00010 _md5sum = "90539346f3c3c8fc47f159ab9a6ff208"
00011 _type = "ros_arduino_msgs/Digital"
00012 _has_header = True
00013 _full_text = """# Reading on a digital pin
00014 Header header
00015 uint8 value
00016
00017
00018 ================================================================================
00019 MSG: std_msgs/Header
00020 # Standard metadata for higher-level stamped data types.
00021 # This is generally used to communicate timestamped data
00022 # in a particular coordinate frame.
00023 #
00024 # sequence ID: consecutively increasing ID
00025 uint32 seq
00026 #Two-integer timestamp that is expressed as:
00027 # * stamp.secs: seconds (stamp_secs) since epoch
00028 # * stamp.nsecs: nanoseconds since stamp_secs
00029 # time-handling sugar is provided by the client library
00030 time stamp
00031 #Frame this data is associated with
00032 # 0: no frame
00033 # 1: global frame
00034 string frame_id
00035
00036 """
00037 __slots__ = ['header','value']
00038 _slot_types = ['std_msgs/Header','uint8']
00039
00040 def __init__(self, *args, **kwds):
00041 """
00042 Constructor. Any message fields that are implicitly/explicitly
00043 set to None will be assigned a default value. The recommend
00044 use is keyword arguments as this is more robust to future message
00045 changes. You cannot mix in-order arguments and keyword arguments.
00046
00047 The available fields are:
00048 header,value
00049
00050 :param args: complete set of field values, in .msg order
00051 :param kwds: use keyword arguments corresponding to message field names
00052 to set specific fields.
00053 """
00054 if args or kwds:
00055 super(Digital, self).__init__(*args, **kwds)
00056
00057 if self.header is None:
00058 self.header = std_msgs.msg.Header()
00059 if self.value is None:
00060 self.value = 0
00061 else:
00062 self.header = std_msgs.msg.Header()
00063 self.value = 0
00064
00065 def _get_types(self):
00066 """
00067 internal API method
00068 """
00069 return self._slot_types
00070
00071 def serialize(self, buff):
00072 """
00073 serialize message into buffer
00074 :param buff: buffer, ``StringIO``
00075 """
00076 try:
00077 _x = self
00078 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00079 _x = self.header.frame_id
00080 length = len(_x)
00081 if python3 or type(_x) == unicode:
00082 _x = _x.encode('utf-8')
00083 length = len(_x)
00084 buff.write(struct.pack('<I%ss'%length, length, _x))
00085 buff.write(_struct_B.pack(self.value))
00086 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00087 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00088
00089 def deserialize(self, str):
00090 """
00091 unpack serialized message in str into this message instance
00092 :param str: byte array of serialized message, ``str``
00093 """
00094 try:
00095 if self.header is None:
00096 self.header = std_msgs.msg.Header()
00097 end = 0
00098 _x = self
00099 start = end
00100 end += 12
00101 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00102 start = end
00103 end += 4
00104 (length,) = _struct_I.unpack(str[start:end])
00105 start = end
00106 end += length
00107 if python3:
00108 self.header.frame_id = str[start:end].decode('utf-8')
00109 else:
00110 self.header.frame_id = str[start:end]
00111 start = end
00112 end += 1
00113 (self.value,) = _struct_B.unpack(str[start:end])
00114 return self
00115 except struct.error as e:
00116 raise genpy.DeserializationError(e)
00117
00118
00119 def serialize_numpy(self, buff, numpy):
00120 """
00121 serialize message with numpy array types into buffer
00122 :param buff: buffer, ``StringIO``
00123 :param numpy: numpy python module
00124 """
00125 try:
00126 _x = self
00127 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00128 _x = self.header.frame_id
00129 length = len(_x)
00130 if python3 or type(_x) == unicode:
00131 _x = _x.encode('utf-8')
00132 length = len(_x)
00133 buff.write(struct.pack('<I%ss'%length, length, _x))
00134 buff.write(_struct_B.pack(self.value))
00135 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00136 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00137
00138 def deserialize_numpy(self, str, numpy):
00139 """
00140 unpack serialized message in str into this message instance using numpy for array types
00141 :param str: byte array of serialized message, ``str``
00142 :param numpy: numpy python module
00143 """
00144 try:
00145 if self.header is None:
00146 self.header = std_msgs.msg.Header()
00147 end = 0
00148 _x = self
00149 start = end
00150 end += 12
00151 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00152 start = end
00153 end += 4
00154 (length,) = _struct_I.unpack(str[start:end])
00155 start = end
00156 end += length
00157 if python3:
00158 self.header.frame_id = str[start:end].decode('utf-8')
00159 else:
00160 self.header.frame_id = str[start:end]
00161 start = end
00162 end += 1
00163 (self.value,) = _struct_B.unpack(str[start:end])
00164 return self
00165 except struct.error as e:
00166 raise genpy.DeserializationError(e)
00167
00168 _struct_I = genpy.struct_I
00169 _struct_3I = struct.Struct("<3I")
00170 _struct_B = struct.Struct("<B")