FileDownlink
is an active ISF component.
It manages downlink of files from the spacecraft.
Requirement | Description | Rationale | Verification Method |
---|---|---|---|
FD-001 | Upon command, FileDownlink shall read a file from non-volatile storage, partition the file into packets, and send out the packets. |
This requirement provides the capability to downlink files from the spacecraft. | Test |
The design of FileDownlink
assumes the following:
-
File downlink occurs by dividing files into packets of type
Fw::FilePacket
. -
One file downlink happens at a time.
Name | Type | Role |
---|---|---|
timeCaller |
Fw::Time |
TimeGet |
cmdIn |
Fw::Cmd |
Cmd |
cmdRegOut |
Fw::CmdReg |
CmdReg |
cmdResponseOut |
Fw::CmdResponse |
CmdResponse |
tlmOut |
Fw::Tlm |
Telemetry |
eventOut |
Fw::LogEvent |
LogEvent |
Name | Type | Kind | Purpose |
---|---|---|---|
bufferGet |
Fw::BufferGet |
output (caller) | Requests buffers for sending file packets. |
bufferSendOut |
Fw::BufferSend |
output | Sends buffers containing file packets. |
FileDownlink
has the following constants, initialized
at component instantiation time:
- downlinkPacketSize: The size of the packets to use on downlink.
FileDownlink
maintains a mode equal to
one of the following values:
-
IDLE (0):
FileDownlink
is idle. -
DOWNLINK (1):
FileDownlink
is performing a file downlink. -
CANCEL (2):
FileDownlink
is canceling a file downlink.
The initial value is IDLE.
FileDownlink
recognizes the commands described in the following sections.
SendFile is an asynchronous command. It has two arguments:
-
sourceFileName: The name of the on-board file to send.
-
destFileName: The name of the destination file on the ground.
When File Downlink
receives this command, it carries
out the following steps:
-
If mode = CANCEL, then
a. Issue a DownlinkCanceled event.
b. set mode = IDLE and return.
-
Set mode = DOWNLINK.
-
Open the file sourceFileName for reading with file descriptor d. If there is any problem opening the file, then issue a FileOpenError warning and abort the command execution.
-
Invoke bufferGetCaller to request a buffer whose size is the size of a START packet. Fill the buffer and send it out on bufferSendOut.
-
Set a remainder r to the size of the file with descriptor d.
-
While r > 0 and mode = DOWNLINK do:
a. Let n be the smaller of downlinkPacketSize and r.
b. Invoke bufferGetCaller to request a buffer B whose size is the size of a DATA packet with a data payload of n bytes.
c. Read the next n bytes out of the file with descriptor d. If there is any problem reading the file, then issue a FileReadError warning, close the file, and abort the command execution.
d. Fill B with (i) the data read the previous step and (ii) the appropriate metadata. Send B out on bufferSendOut.
e. Reduce r by n.
-
Close the file with descriptor d.
-
If mode = CANCEL, then
a. Invoke bufferGetCaller to request a buffer whose size is the size of a CANCEL packet. Fill the packet and send it out on bufferSendOut.
b. Issue a DownlinkCanceled event.
-
Otherwise invoke bufferGetCaller to request a buffer whose size is the size of an END packet. Fill the buffer and send it out on bufferSendOut.
-
Set mode = IDLE.
Cancel is a synchronous command. If mode = DOWNLINK, it sets mode to CANCEL. Otherwise it does nothing.
Document | Link |
---|---|
Design | Link |
Code | Link |
Unit Test | Link |
TODO