_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       if python3:
00204         self.icon.data = str[start:end].decode('utf-8')
00205       else:
00206         self.icon.data = str[start:end]
00207       start = end
00208       end += 4
00209       (length,) = _struct_I.unpack(str[start:end])
00210       self.client_apps = []
00211       for i in range(0, length):
00212         val1 = app_manager.msg.ClientApp()
00213         start = end
00214         end += 4
00215         (length,) = _struct_I.unpack(str[start:end])
00216         start = end
00217         end += length
00218         if python3:
00219           val1.client_type = str[start:end].decode('utf-8')
00220         else:
00221           val1.client_type = str[start:end]
00222         start = end
00223         end += 4
00224         (length,) = _struct_I.unpack(str[start:end])
00225         val1.manager_data = []
00226         for i in range(0, length):
00227           val2 = app_manager.msg.KeyValue()
00228           start = end
00229           end += 4
00230           (length,) = _struct_I.unpack(str[start:end])
00231           start = end
00232           end += length
00233           if python3:
00234             val2.key = str[start:end].decode('utf-8')
00235           else:
00236             val2.key = str[start:end]
00237           start = end
00238           end += 4
00239           (length,) = _struct_I.unpack(str[start:end])
00240           start = end
00241           end += length
00242           if python3:
00243             val2.value = str[start:end].decode('utf-8')
00244           else:
00245             val2.value = str[start:end]
00246           val1.manager_data.append(val2)
00247         start = end
00248         end += 4
00249         (length,) = _struct_I.unpack(str[start:end])
00250         val1.app_data = []
00251         for i in range(0, length):
00252           val2 = app_manager.msg.KeyValue()
00253           start = end
00254           end += 4
00255           (length,) = _struct_I.unpack(str[start:end])
00256           start = end
00257           end += length
00258           if python3:
00259             val2.key = str[start:end].decode('utf-8')
00260           else:
00261             val2.key = str[start:end]
00262           start = end
00263           end += 4
00264           (length,) = _struct_I.unpack(str[start:end])
00265           start = end
00266           end += length
00267           if python3:
00268             val2.value = str[start:end].decode('utf-8')
00269           else:
00270             val2.value = str[start:end]
00271           val1.app_data.append(val2)
00272         self.client_apps.append(val1)
00273       return self
00274     except struct.error as e:
00275       raise genpy.DeserializationError(e) #most likely buffer underfill
00276 
00277 
00278   def serialize_numpy(self, buff, numpy):
00279     """
00280     serialize message with numpy array types into buffer
00281     :param buff: buffer, ``StringIO``
00282     :param numpy: numpy python module
00283     """
00284     try:
00285       _x = self.name
00286       length = len(_x)
00287       if python3 or type(_x) == unicode:
00288         _x = _x.encode('utf-8')
00289         length = len(_x)
00290       buff.write(struct.pack('<I%ss'%length, length, _x))
00291       _x = self.display_name
00292       length = len(_x)
00293       if python3 or type(_x) == unicode:
00294         _x = _x.encode('utf-8')
00295         length = len(_x)
00296       buff.write(struct.pack('<I%ss'%length, length, _x))
00297       _x = self.icon.format
00298       length = len(_x)
00299       if python3 or type(_x) == unicode:
00300         _x = _x.encode('utf-8')
00301         length = len(_x)
00302       buff.write(struct.pack('<I%ss'%length, length, _x))
00303       _x = self.icon.data
00304       length = len(_x)
00305       # - if encoded as a list instead, serialize as bytes instead of string
00306       if type(_x) in [list, tuple]:
00307         buff.write(struct.pack('<I%sB'%length, length, *_x))
00308       else:
00309         buff.write(struct.pack('<I%ss'%length, length, _x))
00310       length = len(self.client_apps)
00311       buff.write(_struct_I.pack(length))
00312       for val1 in self.client_apps:
00313         _x = val1.client_type
00314         length = len(_x)
00315         if python3 or type(_x) == unicode:
00316           _x = _x.encode('utf-8')
00317           length = len(_x)
00318         buff.write(struct.pack('<I%ss'%length, length, _x))
00319         length = len(val1.manager_data)
00320         buff.write(_struct_I.pack(length))
00321         for val2 in val1.manager_data:
00322           _x = val2.key
00323           length = len(_x)
00324           if python3 or type(_x) == unicode:
00325             _x = _x.encode('utf-8')
00326             length = len(_x)
00327           buff.write(struct.pack('<I%ss'%length, length, _x))
00328           _x = val2.value
00329           length = len(_x)
00330           if python3 or type(_x) == unicode:
00331             _x = _x.encode('utf-8')
00332             length = len(_x)
00333           buff.write(struct.pack('<I%ss'%length, length, _x))
00334         length = len(val1.app_data)
00335         buff.write(_struct_I.pack(length))
00336         for val2 in val1.app_data:
00337           _x = val2.key
00338           length = len(_x)
00339           if python3 or type(_x) == unicode:
00340             _x = _x.encode('utf-8')
00341             length = len(_x)
00342           buff.write(struct.pack('<I%ss'%length, length, _x))
00343           _x = val2.value
00344           length = len(_x)
00345           if python3 or type(_x) == unicode:
00346             _x = _x.encode('utf-8')
00347             length = len(_x)
00348           buff.write(struct.pack('<I%ss'%length, length, _x))
00349     except struct.error as se: self._check_types(se)
00350     except TypeError as te: self._check_types(te)
00351 
00352   def deserialize_numpy(self, str, numpy):
00353     """
00354     unpack serialized message in str into this message instance using numpy for array types
00355     :param str: byte array of serialized message, ``str``
00356     :param numpy: numpy python module
00357     """
00358     try:
00359       if self.icon is None:
00360         self.icon = app_manager.msg.Icon()
00361       if self.client_apps is None:
00362         self.client_apps = None
00363       end = 0
00364       start = end
00365       end += 4
00366       (length,) = _struct_I.unpack(str[start:end])
00367       start = end
00368       end += length
00369       if python3:
00370         self.name = str[start:end].decode('utf-8')
00371       else:
00372         self.name = str[start:end]
00373       start = end
00374       end += 4
00375       (length,) = _struct_I.unpack(str[start:end])
00376       start = end
00377       end += length
00378       if python3:
00379         self.display_name = str[start:end].decode('utf-8')
00380       else:
00381         self.display_name = str[start:end]
00382       start = end
00383       end += 4
00384       (length,) = _struct_I.unpack(str[start:end])
00385       start = end
00386       end += length
00387       if python3:
00388         self.icon.format = str[start:end].decode('utf-8')
00389       else:
00390         self.icon.format = str[start:end]
00391       start = end
00392       end += 4
00393       (length,) = _struct_I.unpack(str[start:end])
00394       start = end
00395       end += length
00396       if python3:
00397         self.icon.data = str[start:end].decode('utf-8')
00398       else:
00399         self.icon.data = str[start:end]
00400       start = end
00401       end += 4
00402       (length,) = _struct_I.unpack(str[start:end])
00403       self.client_apps = []
00404       for i in range(0, length):
00405         val1 = app_manager.msg.ClientApp()
00406         start = end
00407         end += 4
00408         (length,) = _struct_I.unpack(str[start:end])
00409         start = end
00410         end += length
00411         if python3:
00412           val1.client_type = str[start:end].decode('utf-8')
00413         else:
00414           val1.client_type = str[start:end]
00415         start = end
00416         end += 4
00417         (length,) = _struct_I.unpack(str[start:end])
00418         val1.manager_data = []
00419         for i in range(0, length):
00420           val2 = app_manager.msg.KeyValue()
00421           start = end
00422           end += 4
00423           (length,) = _struct_I.unpack(str[start:end])
00424           start = end
00425           end += length
00426           if python3:
00427             val2.key = str[start:end].decode('utf-8')
00428           else:
00429             val2.key = str[start:end]
00430           start = end
00431           end += 4
00432           (length,) = _struct_I.unpack(str[start:end])
00433           start = end
00434           end += length
00435           if python3:
00436             val2.value = str[start:end].decode('utf-8')
00437           else:
00438             val2.value = str[start:end]
00439           val1.manager_data.append(val2)
00440         start = end
00441         end += 4
00442         (length,) = _struct_I.unpack(str[start:end])
00443         val1.app_data = []
00444         for i in range(0, length):
00445           val2 = app_manager.msg.KeyValue()
00446           start = end
00447           end += 4
00448           (length,) = _struct_I.unpack(str[start:end])
00449           start = end
00450           end += length
00451           if python3:
00452             val2.key = str[start:end].decode('utf-8')
00453           else:
00454             val2.key = str[start:end]
00455           start = end
00456           end += 4
00457           (length,) = _struct_I.unpack(str[start:end])
00458           start = end
00459           end += length
00460           if python3:
00461             val2.value = str[start:end].decode('utf-8')
00462           else:
00463             val2.value = str[start:end]
00464           val1.app_data.append(val2)
00465         self.client_apps.append(val1)
00466       return self
00467     except struct.error as e:
00468       raise genpy.DeserializationError(e) #most likely buffer underfill
00469 
00470 _struct_I = genpy.struct_I


app_manager
Author(s): Jeremy Leibs, Ken Conley
autogenerated on Mon Dec 2 2013 11:36:52