Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add file upload command #67

Merged
merged 5 commits into from
Nov 19, 2024
Merged

Conversation

sasataku
Copy link
Member

This PR adds the file upload command handler for Zero.
The file upload commands and telemetry are same as the MAIN/ADCS board.

CSP commands related to file operation may take time to process.
Therefore, a dedicated thread is provided to handle CSP packets
sequentially via a glib-2.0 queue. This commit only adds the
framework for this functionality.

Additionally, the CSP port for file-related commands is set to `13`
to maintain consistency with MAIN and ADCS.

Signed-off-by: Takuya Sasaki <[email protected]>
Fixes a invalid command offset for command ID argument.

Signed-off-by: Takuya Sasaki <[email protected]>
This commit adds the open file command needed for file upload from
the Ground System to SC-Sat1. This command includes the session ID
and the target file name. On the SC-Sat1 side, it associates the
session ID with the file name and opens the target file with write
permissions. If the target file does not exist, it will be newly
created. The session ID will be included in subsequent Data Packets
(DATA).

For uploads, the file that can be opened is defined by
UPLOAD_MAX_SESSION.

This implementation also uses `g_slist` for session management;
however, since upload commands are processed sequentially from the
CSP server thread, mutual exclusion is not implemented at this time.

In a subsequent commit, the DATA and CLOSE commands will also be
added.

Signed-off-by: Takuya Sasaki <[email protected]>
This commit adds the write data command needed for file upload from
the Ground System to SC-Sat1. This command includes the session ID
indicating the file opened with OPEN command, the write offset, the
size, and the actual datae.

This command is expected to be sent continuously, so sending a reply
telemetry each time would waste downlink bandwidth and could cause
collisions with the upload command on the CAN bus. Therefore, a
mechanism has been implemented to stack a certain number of results
and return a response only when a set threshold is reached.

The maximum length of the data is set to 200 bytes, considering the
uplink frame limit of the SRS-3.

Signed-off-by: Takuya Sasaki <[email protected]>
This commit adds the close file command needed for file upload from
the Ground System to SC-Sat1. This command closes the file that was
written using the OPEN and DATA commands, and it releases the session
management information.

Signed-off-by: Takuya Sasaki <[email protected]>
@sasataku sasataku requested a review from yashi as a code owner November 19, 2024 08:29
@sasataku sasataku merged commit 0d94902 into spacecubics:main Nov 19, 2024
20 checks passed
@sasataku sasataku deleted the add-file-upload-command branch November 19, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant