dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
uavobjecttemplate.py
Go to the documentation of this file.
1 ##
2 ##############################################################################
3 #
4 # @file $(NAMELC).py
5 # @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 # @brief Implementation of the $(NAME) object. This file has been
7 # automatically generated by the UAVObjectGenerator.
8 #
9 # @note Object definition file: $(XMLFILE).
10 # This is an automatically generated file.
11 # DO NOT modify manually.
12 #
13 # @see The GNU Public License (GPL) Version 3
14 #
15 #############################################################################/
16 #
17 # This program is free software; you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; either version 3 of the License, or
20 # (at your option) any later version.
21 #
22 # This program is distributed in the hope that it will be useful, but
23 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 # for more details.
26 #
27 # You should have received a copy of the GNU General Public License along
28 # with this program; if not, see <http://www.gnu.org/licenses/>
29 #
30 
31 
32 import uavobject
33 
34 import struct
35 from collections import namedtuple
36 
37 # This is a list of instances of the data fields contained in this object
38 _fields = $(DATAFIELDS)
39 
40 class $(NAME)(uavobject.UAVObject):
41  ## Object constants
42  OBJID = $(OBJID)
43  NAME = "$(NAME)"
44  METANAME = "$(NAME)Meta"
45  ISSINGLEINST = $(ISSINGLEINST)
46  ISSETTINGS = $(ISSETTINGS)
47 
48  def __init__(self):
50  self.OBJID,
51  self.NAME,
52  self.METANAME,
53  0,
54  self.ISSINGLEINST)
55 
56  for f in _fields:
57  self.add_field(f)
58 
59  def __str__(self):
60  s = ("0x%08X (%10u) %-30s %3u bytes format '%s'\n"
61  % (self.OBJID, self.OBJID, self.NAME, self.get_struct().size, self.get_struct().format))
62  for f in self.get_tuple()._fields:
63  s += ("\t%s\n" % f)
64  return (s)
65 
66 def main():
67  # Instantiate the object and dump out some interesting info
68  x = $(NAME)()
69  print (x)
70 
71 if __name__ == "__main__":
72  #import pdb ; pdb.run('main()')
73  main()
tuple OBJID
Object constants.