00001 """autogenerated by genpy from gateway_comms/RemoteRule.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 gateway_comms.msg
00008
00009 class RemoteRule(genpy.Message):
00010 _md5sum = "14f4c5aaf33b32b22c50fd514747f99f"
00011 _type = "gateway_comms/RemoteRule"
00012 _has_header = False
00013 _full_text = """# Definition for a flip. It represents either:
00014 #
00015 # 1) an existing flipped connection (from the local gateway)
00016 # 2) a rule that is put on a watchlist
00017
00018 # The target recipient of the flip
00019 string gateway
00020
00021 # Connection has the following parameters that need setting
00022 # - name : fully qualified name of the connection (str)
00023 # - type : connection type (str)
00024 #
00025 # Use one of the types defined in Connection string constants:
00026 # (publisher, subscriber, service, action_client, action_server)
00027 #
00028 # - node : name of the node it originates from (str)(optional)
00029 #
00030 # Node name is necessary, for instance, if you have multiple subscribers
00031 # publishing to a single topic. Most of the time it is not necessary,
00032 # but in some cases it helps refine the rule. It helps refine the rule.
00033 #
00034 Rule rule
00035
00036 ================================================================================
00037 MSG: gateway_comms/Rule
00038 # Standard gateway connection rule
00039
00040 # type of connection (from gateway_comms.msg.Connection)
00041 string type
00042
00043 # this is the topic/service name or the action base name (a regex is supported)
00044 string name
00045
00046 # (optional) an optional node name can be provided. if node name is not provided
00047 # then all nodes are matched (also supports regex)
00048 string node
00049
00050 """
00051 __slots__ = ['gateway','rule']
00052 _slot_types = ['string','gateway_comms/Rule']
00053
00054 def __init__(self, *args, **kwds):
00055 """
00056 Constructor. Any message fields that are implicitly/explicitly
00057 set to None will be assigned a default value. The recommend
00058 use is keyword arguments as this is more robust to future message
00059 changes. You cannot mix in-order arguments and keyword arguments.
00060
00061 The available fields are:
00062 gateway,rule
00063
00064 :param args: complete set of field values, in .msg order
00065 :param kwds: use keyword arguments corresponding to message field names
00066 to set specific fields.
00067 """
00068 if args or kwds:
00069 super(RemoteRule, self).__init__(*args, **kwds)
00070
00071 if self.gateway is None:
00072 self.gateway = ''
00073 if self.rule is None:
00074 self.rule = gateway_comms.msg.Rule()
00075 else:
00076 self.gateway = ''
00077 self.rule = gateway_comms.msg.Rule()
00078
00079 def _get_types(self):
00080 """
00081 internal API method
00082 """
00083 return self._slot_types
00084
00085 def serialize(self, buff):
00086 """
00087 serialize message into buffer
00088 :param buff: buffer, ``StringIO``
00089 """
00090 try:
00091 _x = self.gateway
00092 length = len(_x)
00093 if python3 or type(_x) == unicode:
00094 _x = _x.encode('utf-8')
00095 length = len(_x)
00096 buff.write(struct.pack('<I%ss'%length, length, _x))
00097 _x = self.rule.type
00098 length = len(_x)
00099 if python3 or type(_x) == unicode:
00100 _x = _x.encode('utf-8')
00101 length = len(_x)
00102 buff.write(struct.pack('<I%ss'%length, length, _x))
00103 _x = self.rule.name
00104 length = len(_x)
00105 if python3 or type(_x) == unicode:
00106 _x = _x.encode('utf-8')
00107 length = len(_x)
00108 buff.write(struct.pack('<I%ss'%length, length, _x))
00109 _x = self.rule.node
00110 length = len(_x)
00111 if python3 or type(_x) == unicode:
00112 _x = _x.encode('utf-8')
00113 length = len(_x)
00114 buff.write(struct.pack('<I%ss'%length, length, _x))
00115 except struct.error as se: self._check_types(se)
00116 except TypeError as te: self._check_types(te)
00117
00118 def deserialize(self, str):
00119 """
00120 unpack serialized message in str into this message instance
00121 :param str: byte array of serialized message, ``str``
00122 """
00123 try:
00124 if self.rule is None:
00125 self.rule = gateway_comms.msg.Rule()
00126 end = 0
00127 start = end
00128 end += 4
00129 (length,) = _struct_I.unpack(str[start:end])
00130 start = end
00131 end += length
00132 if python3:
00133 self.gateway = str[start:end].decode('utf-8')
00134 else:
00135 self.gateway = str[start:end]
00136 start = end
00137 end += 4
00138 (length,) = _struct_I.unpack(str[start:end])
00139 start = end
00140 end += length
00141 if python3:
00142 self.rule.type = str[start:end].decode('utf-8')
00143 else:
00144 self.rule.type = str[start:end]
00145 start = end
00146 end += 4
00147 (length,) = _struct_I.unpack(str[start:end])
00148 start = end
00149 end += length
00150 if python3:
00151 self.rule.name = str[start:end].decode('utf-8')
00152 else:
00153 self.rule.name = str[start:end]
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 start = end
00158 end += length
00159 if python3:
00160 self.rule.node = str[start:end].decode('utf-8')
00161 else:
00162 self.rule.node = str[start:end]
00163 return self
00164 except struct.error as e:
00165 raise genpy.DeserializationError(e)
00166
00167
00168 def serialize_numpy(self, buff, numpy):
00169 """
00170 serialize message with numpy array types into buffer
00171 :param buff: buffer, ``StringIO``
00172 :param numpy: numpy python module
00173 """
00174 try:
00175 _x = self.gateway
00176 length = len(_x)
00177 if python3 or type(_x) == unicode:
00178 _x = _x.encode('utf-8')
00179 length = len(_x)
00180 buff.write(struct.pack('<I%ss'%length, length, _x))
00181 _x = self.rule.type
00182 length = len(_x)
00183 if python3 or type(_x) == unicode:
00184 _x = _x.encode('utf-8')
00185 length = len(_x)
00186 buff.write(struct.pack('<I%ss'%length, length, _x))
00187 _x = self.rule.name
00188 length = len(_x)
00189 if python3 or type(_x) == unicode:
00190 _x = _x.encode('utf-8')
00191 length = len(_x)
00192 buff.write(struct.pack('<I%ss'%length, length, _x))
00193 _x = self.rule.node
00194 length = len(_x)
00195 if python3 or type(_x) == unicode:
00196 _x = _x.encode('utf-8')
00197 length = len(_x)
00198 buff.write(struct.pack('<I%ss'%length, length, _x))
00199 except struct.error as se: self._check_types(se)
00200 except TypeError as te: self._check_types(te)
00201
00202 def deserialize_numpy(self, str, numpy):
00203 """
00204 unpack serialized message in str into this message instance using numpy for array types
00205 :param str: byte array of serialized message, ``str``
00206 :param numpy: numpy python module
00207 """
00208 try:
00209 if self.rule is None:
00210 self.rule = gateway_comms.msg.Rule()
00211 end = 0
00212 start = end
00213 end += 4
00214 (length,) = _struct_I.unpack(str[start:end])
00215 start = end
00216 end += length
00217 if python3:
00218 self.gateway = str[start:end].decode('utf-8')
00219 else:
00220 self.gateway = str[start:end]
00221 start = end
00222 end += 4
00223 (length,) = _struct_I.unpack(str[start:end])
00224 start = end
00225 end += length
00226 if python3:
00227 self.rule.type = str[start:end].decode('utf-8')
00228 else:
00229 self.rule.type = str[start:end]
00230 start = end
00231 end += 4
00232 (length,) = _struct_I.unpack(str[start:end])
00233 start = end
00234 end += length
00235 if python3:
00236 self.rule.name = str[start:end].decode('utf-8')
00237 else:
00238 self.rule.name = str[start:end]
00239 start = end
00240 end += 4
00241 (length,) = _struct_I.unpack(str[start:end])
00242 start = end
00243 end += length
00244 if python3:
00245 self.rule.node = str[start:end].decode('utf-8')
00246 else:
00247 self.rule.node = str[start:end]
00248 return self
00249 except struct.error as e:
00250 raise genpy.DeserializationError(e)
00251
00252 _struct_I = genpy.struct_I