-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the class of the TC "Transmit Packet"
- Loading branch information
Showing
1 changed file
with
48 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# | ||
# tc_transmit_packet.py | ||
# | ||
# Copyright The SpaceLab-Transmitter Contributors. | ||
# | ||
# This file is part of SpaceLab-Transmitter. | ||
# | ||
# SpaceLab-Transmitter is free software; you can redistribute it | ||
# and/or modify it under the terms of the GNU General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# SpaceLab-Transmitter is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public | ||
# License along with SpaceLab-Transmitter; if not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# | ||
|
||
|
||
from spacelab_transmitter.telecommand import Telecommand | ||
|
||
class TransmitPacket(Telecommand): | ||
""" | ||
Transmit packet | ||
""" | ||
def __init__(self): | ||
""" | ||
Constructor. | ||
""" | ||
super().__init__(0x4F, "transmit_packet") | ||
|
||
def generate(self, src_adr, data): | ||
""" | ||
This telecommand is composed by three fields: | ||
Packet ID (1 byte = 0x4F) | ||
Source callsign (7 bytes ASCII) | ||
Data (sequence of bytes, up to 52) | ||
The inputs of the "generate" method will be | ||
the source callsign (ASCII string), | ||
the data to transmit (list of integers). | ||
""" | ||
return [self.get_id()] + self._prepare_callsign(src_adr) + data |