Skip to content

Commit

Permalink
Updated SDD and some CI error fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
timcanham committed Nov 14, 2024
1 parent 3bd7436 commit d836bda
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 29 deletions.
6 changes: 3 additions & 3 deletions Svc/DpCatalog/DpCatalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ namespace Svc {
return Fw::CmdResponse::EXECUTION_ERROR;
}

FwSizeType fileLoc = 0;
FwSignedSizeType fileLoc = 0;

Check notice

Code scanning / CodeQL

Use of basic integral type Note

fileLoc uses the basic integral type signed long rather than a typedef with size and signedness.
this->m_stateFileEntries = 0;

// read entries from the state file
Expand All @@ -169,7 +169,7 @@ namespace Svc {
// read the directory index
stat = stateFile.read(buffer, size);
if (stat != Os::File::OP_OK) {
this->log_WARNING_HI_StateFileReadError(this->m_stateFile, stat, static_cast<U32>(fileLoc));
this->log_WARNING_HI_StateFileReadError(this->m_stateFile, stat, static_cast<I32>(fileLoc));
return Fw::CmdResponse::EXECUTION_ERROR;
}

Expand All @@ -182,7 +182,7 @@ namespace Svc {
// abandon it and finish. We can at least operate on
// the entries that were read.
if (size != sizeof(buffer)) {
this->log_WARNING_HI_StateFileTruncated(this->m_stateFile, static_cast<U32>(fileLoc), static_cast<U32>(size));
this->log_WARNING_HI_StateFileTruncated(this->m_stateFile, static_cast<I32>(fileLoc), static_cast<I32>(size));
return Fw::CmdResponse::OK;
}

Expand Down
77 changes: 51 additions & 26 deletions Svc/DpCatalog/docs/sdd.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
NOTE: This release has an early prototype that will do the following:

1. Reads the data product files from the specified directory.
2. Puts them in an unsorted list.
2. Puts them in priority sorted list.
3. Sends requests to `Svc/FileDownlink` to downlink each file in the list.

It does not:

1. Sort the data products
2. Mark them as complete
3. Any of the future features like modifying/deleting data products.
1. Stop transmissions in progress
2. Allow insertion of new products after the catalog is built
3. Clear the catalog via command
4. Send data product files in pieces. It only sends whole files, so if the downlink is interrupted, the whole file will have to be retransmitted.

Features and more extended unit testing will be added over time. Use at your own risk!

Expand Down Expand Up @@ -51,50 +52,74 @@ The design of `DpCatalog` assumes the following:

#### 3.3.1 Role Ports

Name | Type | Role
-----| ---- | ----
`timeCaller` | `Fw::Time` | TimeGet
`cmdIn` | [`Fw::Cmd`](../../../Fw/Cmd/docs/sdd.md) | Cmd
`cmdRegOut` | [`Fw::CmdReg`](../../../Fw/Cmd/docs/sdd.md) | CmdReg
`cmdResponseOut` | [`Fw::CmdResponse`](../../../Fw/Cmd/docs/sdd.md) | CmdResponse
`tlmOut` | [`Fw::Tlm`](../../../Fw/Tlm/docs/sdd.md) | Telemetry
`eventOut` | [`Fw::LogEvent`](../../../Fw/Log/docs/sdd.md) | LogEvent
These ports will be automatically connected in the topology to F Prime services.

|Name|Role|
|---|---|
|cmdDisp|Receives commands|
|CmdReg|Registers commands |
|CmdStatus|Returns command status|
|Log|Outputs events for ground|
|LogText|Outputs events for console|
|Time|Gets time for time tags|
|Tlm|Outputs telemetry|

#### 3.3.2 Component-Specific Ports

Name | Type | Kind | Purpose
---- | ---- | ---- | ----
sendFile|SendFileRequest|output|Send next file to downlink
fileDone|SendFileComplete|async_input|Last requested file is complete
newDp|DpNotify|async_input|Notification that a new DP has been generated
---- | ---- | ---- | ---
pingIn|async input|Svc.Ping|Ping from Health
pingout|output|Svc.Ping|Ping response to Health

Check failure on line 72 in Svc/DpCatalog/docs/sdd.md

View workflow job for this annotation

GitHub Actions / Spell checking

`pingout` is not a recognized word. (unrecognized-spelling)
fileOut|SendFileRequest|output|Send next file to downlink
fileDone|SendFileComplete|async input|Last requested file is complete

### 3.4 Constants

`DpCatalog` can be statically configured with the following constants:

|Constant|Purpose|
|---|---|
|MAX_DP_DIRS|Maximum directories that can be provided for DPs
|DP_MAX_DIRECTORIES|Maximum directories that can be provided for DPs
|DP_MAX_FILES|Maximum number of files that can be tracked across directories

These constants are located in `DpCatalogCfg.hpp` in the `config` directory.

### 3.5 Configuration

During initialization, the initialization function takes a set of parameters:
During initialization, the configuration function takes a set of parameters:

```c++
void configure(
Fw::FileNameString directories[DP_MAX_DIRECTORIES],
FwSizeType numDirs,
Fw::FileNameString& stateFile,
NATIVE_UINT_TYPE memId,
Fw::MemAllocator& allocator
);
```
|Parameter|Purpose|
|---|---|
|dpDirs|A set of strings up to `MAX_DP_DIRS` that are directory names where DPs are written
|maxFiles|Specify the maximum number of files the catalog can track|
|allocator|Memory allocator for catalog records
|`directories`|A set of strings up to `DP_MAX_DIRECTORIES` that are directory names where DPs are written
|`numDirs`|The number of supplied directories
|`stateFile`|The location of the file tracking product downlink state
|`memId`|The id of the RAM memory segment used to store catalog state. Not needed for heap allocation.
|`allocator`|Memory allocator for RAM memory storage
### SDD work will continue from here
#### Constants

### 3.6 State
### 3.6 Commands
|Command|Arguments|Description|
|---|---|---|
|`BUILD_CATALOG`|none|Builds the in-RAM catalog by scanning the directories provided during initialization. Downlink state file will be read in to set downlink state for products|Prerequisite for executing `START_XMIT_CATALOG` command
|`START_XMIT_CATALOG`| |Start transmitting the catalog to the ground in priority order
| |wait|Wait for the transmission to complete before sending command completion status. Used when a sequence wishes to wait for completion before issuing subsequent commands.
|`STOP_XMIT_CATALOG`|none|Stop existing catalog transmission. Will be completed when the current file is done transmitting. __NOT IMPLEMENTED YET__|
|`CLEAR_CATALOG`|none|Clears existing RAM catalog and resets downlink state. Should be followed by `BUILD_CATALOG`. Used for recovery if state file gets corrupted or out of sync with file system contents. __NOT IMPLEMENTED YET__ |
### 3.6 Commands
### 3.7 Algorithms
TODO
## 4 Checklists
Expand Down

0 comments on commit d836bda

Please sign in to comment.