diff --git a/aprslib/packets/__init__.py b/aprslib/packets/__init__.py index 32b8a0c..79edfb9 100644 --- a/aprslib/packets/__init__.py +++ b/aprslib/packets/__init__.py @@ -1,2 +1,3 @@ from aprslib.packets.position import PositionReport from aprslib.packets.telemetry import TelemetryReport +from aprslib.packets.telemetryunitlabels import TelemetryUnitLabelsReport diff --git a/aprslib/packets/telemetryunitlabels.py b/aprslib/packets/telemetryunitlabels.py new file mode 100644 index 0000000..ffd4aa4 --- /dev/null +++ b/aprslib/packets/telemetryunitlabels.py @@ -0,0 +1,43 @@ +from aprslib.packets.base import APRSPacket + +class TelemetryUnitLabelsReport(APRSPacket): + format = 'raw' + telemetrystation = "N0CALL" + a1 = "BITS" + a2 = "BITS" + a3 = "BITS" + a4 = "BITS" + a5 = "BITS" + b1 = "EN" + b2 = "EN" + b3 = "EN" + b4 = "EN" + b5 = "EN" + b6 = "EN" + b7 = "EN" + b8 = "EN" + comment = '' + + def _serialize_body(self): + + body = [ + ':{0} :UNIT.'.format(self.telemetrystation), # packet type + self.a1, + self.a2, + self.a3, + self.a4, + self.a5, + self.b1, + self.b2, + self.b3, + self.b4, + self.b5, + self.b6, + self.b7, + self.b8, + ] + tmpbody = ",".join(body) + badcomma = tmpbody.index(",") + + # remove static but erroneous comma between UNIT. and a1 value + return tmpbody[:badcomma] + tmpbody[badcomma+1:]