bluerobotics / bluerobotics/ping-python

Add instructions on generating new Ping device type

Offen
#74 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
60
Forks
39
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

There are some users interested in extending Ping-Protocol to support other devices with new messages. I just tested what it would take for a normal user to do that and here are instructions:

Copy message definitions and template from a similar device.
```
cd lib/ping-protocol/src/definitions
cp ping1d.json pinghf.json
cd ../../../../generate
cp ping1d.py.in pinghf.py.in
```

Open `generate-python.py` and add the following to the end:
```
definitionFile = "%s/pinghf.json" % definitionPath
templateFile = "%s/pinghf.py.in" % templatePath
f = open("%s/pinghf.py" % args.output_directory, "w")
f.write(g.generate(definitionFile, templateFile, {"structToken": struct_token}))
f.close()
```

Generate the new files:
```
python3 generate/generate-python.py --output-directory brping
```

Now in `python3` you can `from brping import pinghf`.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.