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