2019-10-18 00:33:17 -03:00
|
|
|
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)
|
|
|
|
|
2020-03-21 03:56:15 -03:00
|
|
|
def emit(self, doccos, enumerations):
|
2019-10-18 00:33:17 -03:00
|
|
|
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)
|
2023-12-22 06:52:52 -04:00
|
|
|
print(" <tr><th>FieldName</th><th>Units/Type</th><th>Description</th><tr>",
|
2019-10-18 00:33:17 -03:00
|
|
|
file=self.fh)
|
2020-03-20 03:05:57 -03:00
|
|
|
for f in docco.fields_order:
|
2019-10-18 00:33:17 -03:00
|
|
|
if "description" in docco.fields[f]:
|
|
|
|
fdesc = docco.fields[f]["description"]
|
|
|
|
else:
|
|
|
|
fdesc = ""
|
2023-12-22 06:52:52 -04:00
|
|
|
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),
|
2019-10-18 00:33:17 -03:00
|
|
|
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()
|