mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-02 14:13:42 -04:00
c0a503d74d
Definitions of each character are extracted from LogStructure.h Data is extracted by parsing the logging definition struct Also parse WriteMessage() calls for messages not defined in struct Add support to separate log descriptions for messages with same field list Compute derived unit from combination of format, unit and multiplier For XML output the format and derived unit into new attributes Add enumerations to the XML output (bitmasks were already done) For MD,RST,HTML, output either derived unit, 'char[n]', 'bitmask' or 'enum' Fix support for Blimp by adding it to the parse_enum.py lookup table
67 lines
2.4 KiB
Python
67 lines
2.4 KiB
Python
from __future__ import print_function
|
|
|
|
import emitter
|
|
|
|
class HTMLEmitter(emitter.Emitter):
|
|
def preface(self):
|
|
return """<!-- Dynamically generated list of Logger Messages
|
|
This page was generated using Tools/autotest/logger_metdata/parse.py
|
|
|
|
DO NOT EDIT
|
|
-->
|
|
|
|
|
|
<h3 style="text-align: center">Onboard Message Log Messages</h3>
|
|
<hr />
|
|
|
|
<p>This is a list of log messages which may be present in logs produced and stored onboard ArduPilot vehicles.</p>
|
|
|
|
<!-- add auto-generated table of contents with "Table of Contents Plus" plugin -->
|
|
[toc exclude="Onboard Message Log Messages"]
|
|
|
|
"""
|
|
def postface(self):
|
|
return ""
|
|
|
|
def start(self):
|
|
self.fh = open("LogMessages.html", mode='w')
|
|
print(self.preface(), file=self.fh)
|
|
|
|
def emit(self, doccos, enumerations):
|
|
self.start()
|
|
for docco in doccos:
|
|
print(' <h1>%s</h1>' % docco.name, file=self.fh)
|
|
if docco.url is not None:
|
|
print(' <a href="%s">More information</a>' % docco.url, file=self.fh)
|
|
if docco.description is not None:
|
|
print(' <h2>%s</h2>' %
|
|
docco.description, file=self.fh)
|
|
print(' <table>', file=self.fh)
|
|
print(" <tr><th>FieldName</th><th>Units/Type</th><th>Description</th><tr>",
|
|
file=self.fh)
|
|
for f in docco.fields_order:
|
|
if "description" in docco.fields[f]:
|
|
fdesc = docco.fields[f]["description"]
|
|
else:
|
|
fdesc = ""
|
|
if "units" in docco.fields[f] and docco.fields[f]["units"]!="":
|
|
ftypeunits = docco.fields[f]["units"]
|
|
elif "fmt" in docco.fields[f] and "char" in docco.fields[f]["fmt"]:
|
|
ftypeunits = docco.fields[f]["fmt"]
|
|
elif "bitmaskenum" in docco.fields[f]:
|
|
ftypeunits = "bitmask"
|
|
elif "valueenum" in docco.fields[f]:
|
|
ftypeunits = "enum"
|
|
else:
|
|
ftypeunits = ""
|
|
print(' <tr><td>%s</td><td>%s</td><td>%s</td></tr>' % (f, ftypeunits, fdesc),
|
|
file=self.fh)
|
|
print(' </table>', file=self.fh)
|
|
|
|
print("", file=self.fh)
|
|
self.stop()
|
|
|
|
def stop(self):
|
|
print(self.postface(), file=self.fh)
|
|
self.fh.close()
|