_App.py
Go to the documentation of this file.
00001 """autogenerated by genpy from app_manager/App.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 app_manager.msg
00008 
00009 class App(genpy.Message):
00010   _md5sum = "643c1db5f71b615a47789ff5e190811e"
00011   _type = "app_manager/App"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """# app name
00014 string name
00015 # user-friendly display name of application
00016 string display_name
00017 # icon for showing app
00018 Icon icon
00019 # ordered list (by preference) of client applications to interact with this robot app.  
00020 ClientApp[] client_apps
00021 
00022 ================================================================================
00023 MSG: app_manager/Icon
00024 # Image data format.  "jpeg" or "png"
00025 string format
00026 
00027 # Image data.
00028 uint8[] data
00029 
00030 ================================================================================
00031 MSG: app_manager/ClientApp
00032 # like "android" or "web" or "linux"
00033 string client_type
00034 
00035 # like "intent = ros.android.teleop" and "accelerometer = true", used to choose which ClientApp to use
00036 KeyValue[] manager_data
00037 
00038 # parameters which just get passed through to the client app.
00039 KeyValue[] app_data
00040 
00041 ================================================================================
00042 MSG: app_manager/KeyValue
00043 string key
00044 string value
00045 
00046 """
00047   __slots__ = ['name','display_name','icon','client_apps']
00048   _slot_types = ['string','string','app_manager/Icon','app_manager/ClientApp[]']
00049 
00050   def __init__(self, *args, **kwds):
00051     """
00052     Constructor. Any message fields that are implicitly/explicitly
00053     set to None will be assigned a default value. The recommend
00054     use is keyword arguments as this is more robust to future message
00055     changes.  You cannot mix in-order arguments and keyword arguments.
00056 
00057     The available fields are:
00058        name,display_name,icon,client_apps
00059 
00060     :param args: complete set of field values, in .msg order
00061     :param kwds: use keyword arguments corresponding to message field names
00062     to set specific fields.
00063     """
00064     if args or kwds:
00065       super(App, self).__init__(*args, **kwds)
00066       #message fields cannot be None, assign default values for those that are
00067       if self.name is None:
00068         self.name = ''
00069       if self.display_name is None:
00070         self.display_name = ''
00071       if self.icon is None:
00072         self.icon = app_manager.msg.Icon()
00073       if self.client_apps is None:
00074         self.client_apps = []
00075     else:
00076       self.name = ''
00077       self.display_name = ''
00078       self.icon = app_manager.msg.Icon()
00079       self.client_apps = []
00080 
00081   def _get_types(self):
00082     """
00083     internal API method
00084     """
00085     return self._slot_types
00086 
00087   def serialize(self, buff):
00088     """
00089     serialize message into buffer
00090     :param buff: buffer, ``StringIO``
00091     """
00092     try:
00093       _x = self.name
00094       length = len(_x)
00095       if python3 or type(_x) == unicode:
00096         _x = _x.encode('utf-8')
00097         length = len(_x)
00098       buff.write(struct.pack('<I%ss'%length, length, _x))
00099       _x = self.display_name
00100       length = len(_x)
00101       if python3 or type(_x) == unicode:
00102         _x = _x.encode('utf-8')
00103         length = len(_x)
00104       buff.write(struct.pack('<I%ss'%length, length, _x))
00105       _x = self.icon.format
00106       length = len(_x)
00107       if python3 or type(_x) == unicode:
00108         _x = _x.encode('utf-8')
00109         length = len(_x)
00110       buff.write(struct.pack('<I%ss'%length, length, _x))
00111       _x = self.icon.data
00112       length = len(_x)
00113       # - if encoded as a list instead, serialize as bytes instead of string
00114       if type(_x) in [list, tuple]:
00115         buff.write(struct.pack('<I%sB'%length, length, *_x))
00116       else:
00117         buff.write(struct.pack('<I%ss'%length, length, _x))
00118       length = len(self.client_apps)
00119       buff.write(_struct_I.pack(length))
00120       for val1 in self.client_apps:
00121         _x = val1.client_type
00122         length = len(_x)
00123         if python3 or type(_x) == unicode:
00124           _x = _x.encode('utf-8')
00125           length = len(_x)
00126         buff.write(struct.pack('<I%ss'%length, length, _x))
00127         length = len(val1.manager_data)
00128         buff.write(_struct_I.pack(length))
00129         for val2 in val1.manager_data:
00130           _x = val2.key
00131           length = len(_x)
00132           if python3 or type(_x) == unicode:
00133             _x = _x.encode('utf-8')
00134             length = len(_x)
00135           buff.write(struct.pack('<I%ss'%length, length, _x))
00136           _x = val2.value
00137           length = len(_x)
00138           if python3 or type(_x) == unicode:
00139             _x = _x.encode('utf-8')
00140             length = len(_x)
00141           buff.write(struct.pack('<I%ss'%length, length, _x))
00142         length = len(val1.app_data)
00143         buff.write(_struct_I.pack(length))
00144         for val2 in val1.app_data:
00145           _x = val2.key
00146           length = len(_x)
00147           if python3 or type(_x) == unicode:
00148             _x = _x.encode('utf-8')
00149             length = len(_x)
00150           buff.write(struct.pack('<I%ss'%length, length, _x))
00151           _x = val2.value
00152           length = len(_x)
00153           if python3 or type(_x) == unicode:
00154             _x = _x.encode('utf-8')
00155             length = len(_x)
00156           buff.write(struct.pack('<I%ss'%length, length, _x))
00157     except struct.error as se: self._check_types(se)
00158     except TypeError as te: self._check_types(te)
00159 
00160   def deserialize(self, str):
00161     """
00162     unpack serialized message in str into this message instance
00163     :param str: byte array of serialized message, ``str``
00164     """
00165     try:
00166       if self.icon is None:
00167         self.icon = app_manager.msg.Icon()
00168       if self.client_apps is None:
00169         self.client_apps = None
00170       end = 0
00171       start = end
00172       end += 4
00173       (length,) = _struct_I.unpack(str[start:end])
00174       start = end
00175       end += length
00176       if python3:
00177         self.name = str[start:end].decode('utf-8')
00178       else:
00179         self.name = str[start:end]
00180       start = end
00181       end += 4
00182       (length,) = _struct_I.unpack(str[start:end])
00183       start = end
00184       end += length
00185       if python3:
00186         self.display_name = str[start:end].decode('utf-8')
00187       else:
00188         self.display_name = str[start:end]
00189       start = end
00190       end += 4
00191       (length,) = _struct_I.unpack(str[start:end])
00192       start = end
00193       end += length
00194       if python3:
00195         self.icon.format = str[start:end].decode('utf-8')
00196       else:
00197         self.icon.format = str[start:end]
00198       start = end
00199       end += 4
00200       (length,) = _struct_I.unpack(str[start:end])
00201       start = end
00202       end += length
00203       self.icon.data = str[start:end]
00204       start = end
00205       end += 4
00206       (length,) = _struct_I.unpack(str[start:end])
00207       self.client_apps = []
00208       for i in range(0, length):
00209         val1 = app_manager.msg.ClientApp()
00210         start = end
00211         end += 4
00212         (length,) = _struct_I.unpack(str[start:end])
00213         start = end
00214         end += length
00215         if python3:
00216           val1.client_type = str[start:end].decode('utf-8')
00217         else:
00218           val1.client_type = str[start:end]
00219         start = end
00220         end += 4
00221         (length,) = _struct_I.unpack(str[start:end])
00222         val1.manager_data = []
00223         for i in range(0, length):
00224           val2 = app_manager.msg.KeyValue()
00225           start = end
00226           end += 4
00227           (length,) = _struct_I.unpack(str[start:end])
00228           start = end
00229           end += length
00230           if python3:
00231             val2.key = str[start:end].decode('utf-8')
00232           else:
00233             val2.key = str[start:end]
00234           start = end
00235           end += 4
00236           (length,) = _struct_I.unpack(str[start:end])
00237           start = end
00238           end += length
00239           if python3:
00240             val2.value = str[start:end].decode('utf-8')
00241           else:
00242             val2.value = str[start:end]
00243           val1.manager_data.append(val2)
00244         start = end
00245         end += 4
00246         (length,) = _struct_I.unpack(str[start:end])
00247         val1.app_data = []
00248         for i in range(0, length):
00249           val2 = app_manager.msg.KeyValue()
00250           start = end
00251           end += 4
00252           (length,) = _struct_I.unpack(str[start:end])
00253           start = end
00254           end += length
00255           if python3:
00256             val2.key = str[start:end].decode('utf-8')
00257           else:
00258             val2.key = str[start:end]
00259           start = end
00260           end += 4
00261           (length,) = _struct_I.unpack(str[start:end])
00262           start = end
00263           end += length
00264           if python3:
00265             val2.value = str[start:end].decode('utf-8')
00266           else:
00267             val2.value = str[start:end]
00268           val1.app_data.append(val2)
00269         self.client_apps.append(val1)
00270       return self
00271     except struct.error as e:
00272       raise genpy.DeserializationError(e) #most likely buffer underfill
00273 
00274 
00275   def serialize_numpy(self, buff, numpy):
00276     """
00277     serialize message with numpy array types into buffer
00278     :param buff: buffer, ``StringIO``
00279     :param numpy: numpy python module
00280     """
00281     try:
00282       _x = self.name
00283       length = len(_x)
00284       if python3 or type(_x) == unicode:
00285         _x = _x.encode('utf-8')
00286         length = len(_x)
00287       buff.write(struct.pack('<I%ss'%length, length, _x))
00288       _x = self.display_name
00289       length = len(_x)
00290       if python3 or type(_x) == unicode:
00291         _x = _x.encode('utf-8')
00292         length = len(_x)
00293       buff.write(struct.pack('<I%ss'%length, length, _x))
00294       _x = self.icon.format
00295       length = len(_x)
00296       if python3 or type(_x) == unicode:
00297         _x = _x.encode('utf-8')
00298         length = len(_x)
00299       buff.write(struct.pack('<I%ss'%length, length, _x))
00300       _x = self.icon.data
00301       length = len(_x)
00302       # - if encoded as a list instead, serialize as bytes instead of string
00303       if type(_x) in [list, tuple]:
00304         buff.write(struct.pack('<I%sB'%length, length, *_x))
00305       else:
00306         buff.write(struct.pack('<I%ss'%length, length, _x))
00307       length = len(self.client_apps)
00308       buff.write(_struct_I.pack(length))
00309       for val1 in self.client_apps:
00310         _x = val1.client_type
00311         length = len(_x)
00312         if python3 or type(_x) == unicode:
00313           _x = _x.encode('utf-8')
00314           length = len(_x)
00315         buff.write(struct.pack('<I%ss'%length, length, _x))
00316         length = len(val1.manager_data)
00317         buff.write(_struct_I.pack(length))
00318         for val2 in val1.manager_data:
00319           _x = val2.key
00320           length = len(_x)
00321           if python3 or type(_x) == unicode:
00322             _x = _x.encode('utf-8')
00323             length = len(_x)
00324           buff.write(struct.pack('<I%ss'%length, length, _x))
00325           _x = val2.value
00326           length = len(_x)
00327           if python3 or type(_x) == unicode:
00328             _x = _x.encode('utf-8')
00329             length = len(_x)
00330           buff.write(struct.pack('<I%ss'%length, length, _x))
00331         length = len(val1.app_data)
00332         buff.write(_struct_I.pack(length))
00333         for val2 in val1.app_data:
00334           _x = val2.key
00335           length = len(_x)
00336           if python3 or type(_x) == unicode:
00337             _x = _x.encode('utf-8')
00338             length = len(_x)
00339           buff.write(struct.pack('<I%ss'%length, length, _x))
00340           _x = val2.value
00341           length = len(_x)
00342           if python3 or type(_x) == unicode:
00343             _x = _x.encode('utf-8')
00344             length = len(_x)
00345           buff.write(struct.pack('<I%ss'%length, length, _x))
00346     except struct.error as se: self._check_types(se)
00347     except TypeError as te: self._check_types(te)
00348 
00349   def deserialize_numpy(self, str, numpy):
00350     """
00351     unpack serialized message in str into this message instance using numpy for array types
00352     :param str: byte array of serialized message, ``str``
00353     :param numpy: numpy python module
00354     """
00355     try:
00356       if self.icon is None:
00357         self.icon = app_manager.msg.Icon()
00358       if self.client_apps is None:
00359         self.client_apps = None
00360       end = 0
00361       start = end
00362       end += 4
00363       (length,) = _struct_I.unpack(str[start:end])
00364       start = end
00365       end += length
00366       if python3:
00367         self.name = str[start:end].decode('utf-8')
00368       else:
00369         self.name = str[start:end]
00370       start = end
00371       end += 4
00372       (length,) = _struct_I.unpack(str[start:end])
00373       start = end
00374       end += length
00375       if python3:
00376         self.display_name = str[start:end].decode('utf-8')
00377       else:
00378         self.display_name = str[start:end]
00379       start = end
00380       end += 4
00381       (length,) = _struct_I.unpack(str[start:end])
00382       start = end
00383       end += length
00384       if python3:
00385         self.icon.format = str[start:end].decode('utf-8')
00386       else:
00387         self.icon.format = str[start:end]
00388       start = end
00389       end += 4
00390       (length,) = _struct_I.unpack(str[start:end])
00391       start = end
00392       end += length
00393       self.icon.data = str[start:end]
00394       start = end
00395       end += 4
00396       (length,) = _struct_I.unpack(str[start:end])
00397       self.client_apps = []
00398       for i in range(0, length):
00399         val1 = app_manager.msg.ClientApp()
00400         start = end
00401         end += 4
00402         (length,) = _struct_I.unpack(str[start:end])
00403         start = end
00404         end += length
00405         if python3:
00406           val1.client_type = str[start:end].decode('utf-8')
00407         else:
00408           val1.client_type = str[start:end]
00409         start = end
00410         end += 4
00411         (length,) = _struct_I.unpack(str[start:end])
00412         val1.manager_data = []
00413         for i in range(0, length):
00414           val2 = app_manager.msg.KeyValue()
00415           start = end
00416           end += 4
00417           (length,) = _struct_I.unpack(str[start:end])
00418           start = end
00419           end += length
00420           if python3:
00421             val2.key = str[start:end].decode('utf-8')
00422           else:
00423             val2.key = str[start:end]
00424           start = end
00425           end += 4
00426           (length,) = _struct_I.unpack(str[start:end])
00427           start = end
00428           end += length
00429           if python3:
00430             val2.value = str[start:end].decode('utf-8')
00431           else:
00432             val2.value = str[start:end]
00433           val1.manager_data.append(val2)
00434         start = end
00435         end += 4
00436         (length,) = _struct_I.unpack(str[start:end])
00437         val1.app_data = []
00438         for i in range(0, length):
00439           val2 = app_manager.msg.KeyValue()
00440           start = end
00441           end += 4
00442           (length,) = _struct_I.unpack(str[start:end])
00443           start = end
00444           end += length
00445           if python3:
00446             val2.key = str[start:end].decode('utf-8')
00447           else:
00448             val2.key = str[start:end]
00449           start = end
00450           end += 4
00451           (length,) = _struct_I.unpack(str[start:end])
00452           start = end
00453           end += length
00454           if python3:
00455             val2.value = str[start:end].decode('utf-8')
00456           else:
00457             val2.value = str[start:end]
00458           val1.app_data.append(val2)
00459         self.client_apps.append(val1)
00460       return self
00461     except struct.error as e:
00462       raise genpy.DeserializationError(e) #most likely buffer underfill
00463 
00464 _struct_I = genpy.struct_I


app_manager
Author(s): Jeremy Leibs, Ken Conley
autogenerated on Mon Dec 2 2013 13:03:54