sbp_messages_template.py
Go to the documentation of this file.
00001 
00002 import struct
00003 
00004 # Automatically generated from sbp.yaml with generate.py, do not hand edit!
00005 
00006 
00007 ((* for m in msgs *))
00008 SBP_(((m.name))) = ((('0x%04X'|format(m.id))))
00009 class ((( m.name | classnameify ))):
00010   """
00011   SBP class for message (((m.name))) ((('(0x%04X)'|format(m.id))))
00012 
00013   (((m.desc)))
00014   """
00015 
00016   def __init__(self, d):
00017     self.from_binary(d)
00018 
00019   def from_binary(self, d):
00020     (
00021     ((*- for f in m.fields *))
00022       self.(((f.name))),
00023     ((*- endfor *))
00024     ) = struct.unpack('((( m.fields | pystruct )))', d)
00025 
00026   def to_binary(self, d):
00027     return struct.pack('((( m.fields | pystruct )))', (
00028     ((*- for f in m.fields *))
00029       self.(((f.name))),
00030     ((*- endfor *))
00031     ))
00032 
00033 ((* endfor *))
00034 
00035 msg_classses = {
00036 ((*- for m in msgs *))
00037   ((('0x%04X'|format(m.id)))): ((( m.name | classnameify ))),
00038 ((*- endfor *))
00039 }
00040 
00041 def sbp_decode(t, d):
00042   return msg_classses[t](d)
00043 


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:58