-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial telemetry packet report (#27)
- Loading branch information
1 parent
7d5dafa
commit 96d914b
Showing
2 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from aprslib.packets.position import PositionReport | ||
from aprslib.packets.telemetry import TelemetryReport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from aprslib.packets.base import APRSPacket | ||
|
||
class TelemetryReport(APRSPacket): | ||
format = 'raw' | ||
telemetry = dict(seq=0, | ||
vals=['0']*6) | ||
telemetry['vals'][5] = ['1']*8 # Replace io data with list of 8 values | ||
comment = '' | ||
|
||
def _serialize_body(self): | ||
# What do we do when len(digitalvalue) != 8? | ||
tempio = ''.join(self.telemetry['vals'][5]) | ||
|
||
body = [ | ||
str(self.telemetry['seq']).zfill(3), | ||
str(self.telemetry['vals'][0]).zfill(3), | ||
str(self.telemetry['vals'][1]).zfill(3), | ||
str(self.telemetry['vals'][2]).zfill(3), | ||
str(self.telemetry['vals'][3]).zfill(3), | ||
str(self.telemetry['vals'][4]).zfill(3), | ||
str(tempio), | ||
self.comment, | ||
] | ||
# Add packet type to body joined by commas | ||
return 'T#' + ",".join(body) |