1
0
forked from fsfw/fsfw

Compare commits

...

106 Commits

Author SHA1 Message Date
3b8ca09299 prepared docker for documentation rsync 2022-09-23 13:46:03 +02:00
9a2146fa2d added impressum and datenschutz in sphinx documentation 2022-09-23 11:36:29 +02:00
131e3ff1e3 Revert "doc corrections"
This reverts commit 423a9540ed.
2022-09-15 13:52:28 +02:00
423a9540ed doc corrections 2022-09-15 13:51:59 +02:00
1a833e2d45 another missing changelog entry 2022-09-15 10:59:10 +02:00
8df6d934d7 another missing changelog entry 2022-09-15 10:56:52 +02:00
5363868120 added another missing changelog entry 2022-09-15 10:54:45 +02:00
9a181aa6a8 another missing changelog entry 2022-09-15 10:47:50 +02:00
655c944c0e another missing changelog entry 2022-09-15 10:45:35 +02:00
2e310fca8d add another missing changelog entry 2022-09-15 10:43:45 +02:00
37390dfc74 add missing changelog entry 2022-09-15 10:42:35 +02:00
0ce568ad26 Merge pull request 'publish documentation for development and master branch' (#681) from mohr/documentation_ci into development
Reviewed-on: fsfw/fsfw#681
2022-09-14 11:22:35 +02:00
6970068d56 small fix in README 2022-09-13 18:19:35 +02:00
af282c7d3e reverting to only publish development 2022-09-13 18:17:56 +02:00
21a9d89fb3 pushing code coverage report to documentation server 2022-09-13 18:14:26 +02:00
3257935150 fixing scp yet again again 2022-09-13 18:06:16 +02:00
f34cf9095d fixing scp yet again 2022-09-13 18:02:38 +02:00
24ecf125a3 fixing scp command again 2022-09-13 17:55:12 +02:00
6451a16888 fixing scp command 2022-09-13 17:51:01 +02:00
fa5605c959 testing Jenkinsfile 2022-09-13 14:50:37 +02:00
8e835be55f testing Jenkinsfile 2022-09-13 14:46:12 +02:00
9bd600c488 testing Jenkinsfile 2022-09-13 14:32:10 +02:00
9c7248e78e typo in Dockerfile 2022-09-13 14:20:30 +02:00
ecf51b2913 testing Jenkinsfile 2022-09-13 14:09:08 +02:00
8bbde05413 add jenkins user in docker so that ssh will work 2022-09-13 14:08:04 +02:00
d79b5348d8 testing Jenkinsfile 2022-09-13 14:00:36 +02:00
92e3ab04f3 testing Jenkinsfile 2022-09-13 13:54:23 +02:00
003a6d00fa Documentation build tools in docker 2022-09-13 13:13:18 +02:00
9ee1896553 Merge pull request 'Refactor Local Pool API' (#667) from mueller/refactor-local-pool-api into development
Reviewed-on: fsfw/fsfw#667
2022-09-12 14:32:08 +02:00
a5b5523111 Merge pull request 'Refactor TMTC Stack, improve test framework' (#655) from mueller/refactor-tmtc-stack into development
Reviewed-on: fsfw/fsfw#655
2022-09-12 14:31:22 +02:00
62cd39e573 Merge pull request 'SerialBufferAdapter refactoring' (#677) from mueller/refactor-serial-buffer-adapter into development
Reviewed-on: fsfw/fsfw#677
2022-09-12 14:30:51 +02:00
278ed36db8 Merge pull request 'bump catch2 version' (#678) from mueller/bump-catch2 into development
Reviewed-on: fsfw/fsfw#678
2022-09-12 14:24:28 +02:00
aed30d54ef Merge pull request 'remove bsp specific code' (#679) from mueller/remove-bsp-specific-code into development
Reviewed-on: fsfw/fsfw#679
2022-09-12 14:23:48 +02:00
1126db2c8a Merge pull request 'remove user includes' (#675) from mueller/remove-user-includes into development
Reviewed-on: fsfw/fsfw#675
2022-09-12 14:15:18 +02:00
a64a04d7fe Merge branch 'development' into mueller/refactor-tmtc-stack 2022-09-12 14:14:49 +02:00
80467bf097 Merge pull request 'sif::buffer: if disabeld do not print' (#680) from mohr/enableDisable into development
Reviewed-on: fsfw/fsfw#680
2022-09-12 14:12:13 +02:00
6a6aa7fdd6 Merge branch 'development' into mohr/enableDisable 2022-09-12 14:11:38 +02:00
7e379d2159 Merge pull request 'provide a weak print char impl' (#674) from mueller/provide-weak-print-char into development
Reviewed-on: fsfw/fsfw#674
2022-09-12 14:10:31 +02:00
6ae709acc3 Merge branch 'development' into mueller/remove-user-includes 2022-09-12 14:07:09 +02:00
d52f335455 sif::buffer: if disabeld do not print 2022-09-08 11:47:40 +02:00
04b619a15c update header as well 2022-09-07 17:58:49 +02:00
282704e0fd remove bsp specific code 2022-09-07 17:54:04 +02:00
07ef9a0ec3 bump catch2 version 2022-09-06 15:47:04 +02:00
80464f2a81 Merge branch 'mueller/refactor-serial-buffer-adapter' into mueller/refactor-tmtc-stack 2022-09-05 16:38:58 +02:00
16688316a8 rename setBuffer to setConstBuffer 2022-09-05 16:31:56 +02:00
3583e30ee6 rename const buf setter 2022-09-05 16:27:20 +02:00
1e395dc402 set buffer expects const pointer now 2022-09-05 16:25:02 +02:00
f5421e9abd refactor tm helper 2022-09-05 16:10:06 +02:00
4c3f9feb93 explicit include 2022-09-05 16:06:24 +02:00
b7ed8ff390 Merge branch 'mueller/refactor-tmtc-stack' of https://egit.irs.uni-stuttgart.de/fsfw/fsfw into mueller/refactor-tmtc-stack 2022-09-05 16:02:41 +02:00
75dc7a405d del data wrapper 2022-09-05 16:02:32 +02:00
b7a1f79d5b update FSFWCnfig.h 2022-09-05 15:36:12 +02:00
f0b7a103d4 refactor ctors 2022-09-05 15:30:53 +02:00
ee93f4a4ca Merge branch 'development' into mueller/refactor-tmtc-stack 2022-09-05 14:46:51 +02:00
d64ad71529 Some improvements for time stamper API 2022-09-05 14:44:35 +02:00
26bc80964e Merge branch 'development' into mueller/provide-weak-print-char 2022-09-05 14:14:06 +02:00
eb03bf52a6 Merge pull request 'better warning for missing include paths' (#676) from mueller/better-missing-inc-path-warning into development
Reviewed-on: fsfw/fsfw#676
2022-09-05 14:13:19 +02:00
80355910ee better warning 2022-09-02 09:05:10 +02:00
04800df31e another user-level-include 2022-09-02 09:04:37 +02:00
1e85cdadfd remove user includes 2022-09-02 08:55:33 +02:00
ebc02673dd provide a weak print char impl 2022-09-02 08:50:39 +02:00
9202c6c17f Merge branch 'mueller/refactor-tmtc-stack' into mueller/refactor-local-pool-api 2022-09-01 17:51:50 +02:00
5f8c549993 Merge remote-tracking branch 'origin/development' into mueller/refactor-local-pool-api 2022-09-01 17:51:44 +02:00
04bff7a522 test fix 2022-09-01 17:51:09 +02:00
5c20cc804e Merge remote-tracking branch 'origin/development' into mueller/refactor-tmtc-stack 2022-09-01 17:48:40 +02:00
eb8e236cd4 Merge pull request 'Bugfix for Space Packet Parser' (#673) from eive/fsfw:mueller/fixes-tmtc-server-sp-parser into development
Reviewed-on: fsfw/fsfw#673
2022-09-01 14:12:16 +02:00
7dec45ccf2 Merge pull request 'Service 11 regression' (#670) from eive/fsfw:mueller/service-11-issues into development
Reviewed-on: fsfw/fsfw#670
2022-09-01 11:59:18 +02:00
2b01e86f9c one small additional precaution 2022-09-01 11:56:07 +02:00
60fd3d43c0 Merge pull request 'DHB TM handler alternative API raw buffer' (#671) from mueller/dhb-handle-device-tm-2 into development
Reviewed-on: fsfw/fsfw#671
2022-09-01 11:22:17 +02:00
67980cb592 Merge branch 'development' into mueller/fixes-tmtc-server-sp-parser 2022-09-01 11:21:02 +02:00
3010f2f925 Merge pull request 'DHB set action commander before buildCommandFromCommand' (#672) from eive/fsfw:mueller/dhb-set-action-commander-before-building-cmd into development
Reviewed-on: fsfw/fsfw#672
2022-09-01 11:18:32 +02:00
01651f0521 more simplfications 2022-09-01 10:52:48 +02:00
c7f300671f update header 2022-09-01 10:45:10 +02:00
7d3223d766 add comment blocks 2022-09-01 10:44:57 +02:00
7ae82a5cb4 do not cache previous recipient 2022-09-01 08:58:18 +02:00
28ecd0e5c6 bugfix for SP parser 2022-09-01 08:51:12 +02:00
7345c18b04 small fix which allows sending action reply immediately 2022-08-31 16:50:48 +02:00
158007fa7f const correct API 2022-08-31 00:02:25 +02:00
ab719a3e59 alternative solution 2022-08-30 23:38:55 +02:00
64a7fde301 this is annoying 2022-08-30 15:19:01 +02:00
9131ca688b make two helper functions protected 2022-08-30 15:01:10 +02:00
8e6cee7761 Merge branch 'mueller/data-wrapper' into mueller/refactor-tmtc-stack 2022-08-30 13:46:03 +02:00
c756297e5c data wrapper update 2022-08-30 13:39:44 +02:00
0f27c7e7e7 extend data wrapper 2022-08-30 13:24:29 +02:00
20d42add03 add new data wrapper helper type 2022-08-30 12:07:09 +02:00
a9277622ce move data wrapper 2022-08-30 12:04:15 +02:00
aea9db75cb better name 2022-08-30 11:12:06 +02:00
9fedd03ed8 use cfg struct for local pool API 2022-08-30 11:02:21 +02:00
10fc4dd89d Merge branch 'mueller/refactor-tmtc-stack' of https://egit.irs.uni-stuttgart.de/fsfw/fsfw into mueller/refactor-tmtc-stack 2022-08-30 10:58:06 +02:00
0cc8af5eb0 afmt 2022-08-30 10:57:17 +02:00
92d65aa3a5 use old lpm api 2022-08-30 10:57:02 +02:00
342a56410c delete commented function 2022-08-30 10:28:55 +02:00
2cab73d972 avoid duplicate code 2022-08-29 20:09:28 +02:00
cb23911ccd default initialization of CDS short struct 2022-08-29 15:30:45 +02:00
b499dedd76 remove TODO 2022-08-29 15:27:53 +02:00
1bb487373d Merge branch 'mueller/refactor-tmtc-stack' of https://egit.irs.uni-stuttgart.de/fsfw/fsfw into mueller/refactor-tmtc-stack 2022-08-29 15:20:51 +02:00
3bffb4f968 fix for static fw obj setter 2022-08-29 15:20:33 +02:00
6bcb208968 Merge branch 'development' into mueller/refactor-tmtc-stack 2022-08-29 15:11:50 +02:00
6c2b5ab39e Merge pull request 'improvements for auto-formatter script' (#665) from eive/fsfw:mueller/update-afmt-script into development
Reviewed-on: fsfw/fsfw#665
2022-08-29 15:06:56 +02:00
a7039bad41 Merge pull request 'PUS Service 11: Additional Safety Check' (#666) from eive/fsfw:mueller/service-11-tweak into development
Reviewed-on: fsfw/fsfw#666
2022-08-29 14:59:24 +02:00
6605ffb6b1 Fixing check in Srv 11 Filer 2022-08-29 14:55:50 +02:00
e2e0190cae Revert "additional safety check"
This reverts commit fd278e410b.
2022-08-29 14:51:14 +02:00
fd278e410b additional safety check 2022-08-29 13:18:54 +02:00
ff4cbea571 improvements for auto-formatter script 2022-08-24 17:44:55 +02:00
a46d8c34d9 small changelog update 2022-08-22 16:37:53 +02:00
ba5c6410d6 tests running again 2022-08-22 16:23:36 +02:00
75 changed files with 472 additions and 583 deletions

View File

@ -10,7 +10,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [v6.0.0]
## Changes
## Fixes
- Bugfix for Serial Buffer Stream: Setting `doActive` to false now
actually fully disables printing.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/680
- `TcpTmTcServer.cpp`: The server was actually not able to handle
CCSDS packets which were clumped together. This has been fixed now.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/673
## Added
@ -26,6 +33,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
for other modules
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/655
which also includes a migration guide
- Bump Catch2 dependency to regular version `v3.1.0`
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/678
- `SerialBufferAdapter`: Rename `setBuffer` to `setConstBuffer` and update
API to expect `const uint8_t*` accordingly.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/677
- Remove the following user includes from `fsfw/events/Event.h` and
`fsfw/returnvalues/returnvalue.h`:
- `#include "events/subsystemIdRanges.h"`
- `#include "returnvalues/classIds.h"`
The user has to include those themselves now
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/675
- `DeviceHandlerBase`: Set command sender before calling `buildCommandFromCommand`.
This allows finishing action commands immediately inside the function.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/672
- `DeviceHandlerBase`: New signature of `handleDeviceTm` which expects
a `const SerializeIF&` and additional helper variant which expects `const uint8_t*`
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/671
# [v5.0.0] 25.07.2022

View File

@ -80,7 +80,7 @@ set(FSFW_CATCH2_LIB_MAJOR_VERSION
3
CACHE STRING "Catch2 library major version requirement")
set(FSFW_CATCH2_LIB_VERSION
v${FSFW_CATCH2_LIB_MAJOR_VERSION}.0.0-preview5
v${FSFW_CATCH2_LIB_MAJOR_VERSION}.1.0
CACHE STRING "Catch2 library exact version requirement")
# Keep this off by default for now. See PR:
@ -360,7 +360,8 @@ if(NOT FSFW_CONFIG_PATH)
if(NOT FSFW_BUILD_DOCS)
message(
WARNING
"${MSG_PREFIX} Flight Software Framework configuration path not set")
"${MSG_PREFIX} Flight Software Framework configuration path FSFW_CONFIG_PATH not set"
)
message(
WARNING
"${MSG_PREFIX} Setting default configuration from ${DEF_CONF_PATH} ..")

View File

@ -175,7 +175,7 @@ cmake -DFSFW_BUILD_DOCS=ON -DFSFW_OSAL=host ..
Then you can generate the documentation using
```sh
cmake --build . -j
cmake --build . -- Sphinx -j
```
You can find the generated documentation inside the `docs/sphinx` folder inside the build

View File

@ -5,16 +5,25 @@ RUN apt-get --yes upgrade
#tzdata is a dependency, won't install otherwise
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping
RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping python3 pip doxygen graphviz rsync
RUN python3 -m pip install sphinx breathe
RUN git clone https://github.com/catchorg/Catch2.git && \
cd Catch2 && \
git checkout v3.0.0-preview5 && \
cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
cmake --build build/ --target install
cd Catch2 && \
git checkout v3.1.0 && \
cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
cmake --build build/ --target install
RUN git clone https://github.com/ETLCPP/etl.git && \
cd etl && \
git checkout 20.28.0 && \
cmake -B build . && \
cmake --install build/
cd etl && \
git checkout 20.28.0 && \
cmake -B build . && \
cmake --install build/
#ssh needs a valid user to work
RUN adduser --uid 114 jenkins
#add documentation server to known hosts
RUN echo "|1|/LzCV4BuTmTb2wKnD146l9fTKgQ=|NJJtVjvWbtRt8OYqFgcYRnMQyVw= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNL8ssTonYtgiR/6RRlSIK9WU1ywOcJmxFTLcEblAwH7oifZzmYq3XRfwXrgfMpylEfMFYfCU8JRqtmi19xc21A=" >> /etc/ssh/ssh_known_hosts
RUN echo "|1|CcBvBc3EG03G+XM5rqRHs6gK/Gg=|oGeJQ+1I8NGI2THIkJsW92DpTzs= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNL8ssTonYtgiR/6RRlSIK9WU1ywOcJmxFTLcEblAwH7oifZzmYq3XRfwXrgfMpylEfMFYfCU8JRqtmi19xc21A=" >> /etc/ssh/ssh_known_hosts

View File

@ -1,9 +1,13 @@
pipeline {
environment {
BUILDDIR = 'cmake-build-tests'
DOCDDIR = 'cmake-build-documentation'
}
agent {
docker { image 'fsfw-ci:d3'}
docker {
image 'fsfw-ci:d5'
args '--network host'
}
}
stages {
stage('Clean') {
@ -39,5 +43,47 @@ pipeline {
}
}
}
stage('Documentation') {
when {
branch 'development'
}
steps {
dir(DOCDDIR) {
sh 'cmake -DFSFW_BUILD_DOCS=ON -DFSFW_OSAL=host ..'
sh 'make Sphinx'
sshagent(credentials: ['documentation-buildfix']) {
sh 'ssh -o StrictHostKeyChecking=no buildfix@documentation.intra.irs.uni-stuttgart.de rm -rf /mnt/data/www/html/fsfw/development/*'
sh 'scp -o StrictHostKeyChecking=no -r docs/sphinx/* buildfix@documentation.intra.irs.uni-stuttgart.de:/mnt/data/www/html/fsfw/development'
}
}
dir(BUILDDIR) {
sshagent(credentials: ['documentation-buildfix']) {
sh 'ssh -o StrictHostKeyChecking=no buildfix@documentation.intra.irs.uni-stuttgart.de rm -rf /mnt/data/www/html/fsfw/coverage/development/*'
sh 'scp -o StrictHostKeyChecking=no -r fsfw-tests_coverage/* buildfix@documentation.intra.irs.uni-stuttgart.de:/mnt/data/www/html/fsfw/coverage/development'
}
}
}
}
stage('Master Documentation') {
when {
branch 'master'
}
steps {
dir(DOCDDIR) {
sh 'cmake -DFSFW_BUILD_DOCS=ON -DFSFW_OSAL=host ..'
sh 'make Sphinx'
sshagent(credentials: ['documentation-buildfix']) {
sh 'ssh -o StrictHostKeyChecking=no buildfix@documentation.intra.irs.uni-stuttgart.de rm -rf /mnt/data/www/html/fsfw/master/*'
sh 'scp -o StrictHostKeyChecking=no -r docs/sphinx/* buildfix@documentation.intra.irs.uni-stuttgart.de:/mnt/data/www/html/fsfw/master'
}
}
dir(BUILDDIR) {
sshagent(credentials: ['documentation-buildfix']) {
sh 'ssh -o StrictHostKeyChecking=no buildfix@documentation.intra.irs.uni-stuttgart.de rm -rf /mnt/data/www/html/fsfw/coverage/master/*'
sh 'scp -o StrictHostKeyChecking=no -r fsfw-tests_coverage/* buildfix@documentation.intra.irs.uni-stuttgart.de:/mnt/data/www/html/fsfw/coverage/master'
}
}
}
}
}
}

View File

@ -50,6 +50,11 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
#
html_theme = 'alabaster'
html_theme_options = {
"extra_nav_links": {"Impressum" : "https://www.uni-stuttgart.de/impressum", "Datenschutz": "https://info.irs.uni-stuttgart.de/datenschutz/datenschutzWebmit.html"}
}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".

View File

@ -4,6 +4,10 @@
#include <cstddef>
#include <cstdint>
// It is assumed the user has a subsystem and class ID list in some user header files.
// #include "events/subsystemIdRanges.h"
// #include "returnvalues/classIds.h"
//! Used to determine whether C++ ostreams are used which can increase
//! the binary size significantly. If this is disabled,
//! the C stdio functions can be used alternatively

View File

@ -35,7 +35,7 @@ void Factory::produceFsfwObjects(void) {
}
void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::NO_OBJECT;
PusServiceBase::PUS_DISTRIBUTOR = objects::NO_OBJECT;
PusServiceBase::PACKET_DESTINATION = objects::NO_OBJECT;
CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;

View File

@ -3,6 +3,11 @@ if [[ ! -f README.md ]]; then
cd ..
fi
folder_list=(
"./src"
"./unittests"
)
cmake_fmt="cmake-format"
file_selectors="-iname CMakeLists.txt"
if command -v ${cmake_fmt} &> /dev/null; then
@ -15,8 +20,10 @@ fi
cpp_format="clang-format"
file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp"
if command -v ${cpp_format} &> /dev/null; then
find ./src ${file_selectors} | xargs ${cpp_format} --style=file -i
find ./unittests ${file_selectors} | xargs ${cpp_format} --style=file -i
for dir in ${folder_list[@]}; do
echo "Auto-formatting ${dir} recursively"
find ${dir} ${file_selectors} | xargs clang-format --style=file -i
done
else
echo "No ${cpp_format} tool found, not formatting C++/C files"
fi

View File

@ -3,7 +3,6 @@
#include "fsfw/cfdp/CfdpMessage.h"
#include "fsfw/ipc/CommandMessage.h"
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/storagemanager/storeAddress.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"

View File

@ -21,7 +21,7 @@ cfdp::Lv& cfdp::Lv::operator=(const Lv& other) {
if (value == nullptr or otherSize == 0) {
this->zeroLen = true;
}
this->value.setBuffer(value, otherSize);
this->value.setConstBuffer(value, otherSize);
return *this;
}
@ -70,7 +70,7 @@ ReturnValue_t cfdp::Lv::deSerialize(const uint8_t** buffer, size_t* size,
}
zeroLen = false;
// Zero-copy implementation
value.setBuffer(const_cast<uint8_t*>(*buffer + 1), lengthField);
value.setConstBuffer(*buffer + 1, lengthField);
*buffer += 1 + lengthField;
*size -= 1 + lengthField;
return returnvalue::OK;

View File

@ -75,7 +75,7 @@ ReturnValue_t cfdp::Tlv::deSerialize(const uint8_t **buffer, size_t *size,
}
zeroLen = false;
// Zero-copy implementation
value.setBuffer(const_cast<uint8_t *>(*buffer + 1), lengthField);
value.setConstBuffer(*buffer + 1, lengthField);
*buffer += 1 + lengthField;
*size -= 1 + lengthField;
return returnvalue::OK;
@ -96,7 +96,7 @@ void cfdp::Tlv::setValue(uint8_t *value, size_t len) {
if (len > 0) {
zeroLen = false;
}
this->value.setBuffer(value, len);
this->value.setConstBuffer(value, len);
}
uint8_t cfdp::Tlv::getLengthField() const { return this->value.getSerializedSize() - 1; }

View File

@ -243,13 +243,14 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
LocalDataPoolManager* getPoolManagerHandle() override;
ReturnValue_t subscribeForRegularPeriodicPacket(subdp::RegularHkPeriodicParams params) override;
ReturnValue_t subscribeForDiagPeriodicPacket(subdp::DiagnosticsHkPeriodicParams params) override;
ReturnValue_t subscribeForPeriodicPacket(subdp::ParamsBase& params);
ReturnValue_t subscribeForRegularUpdatePacket(subdp::RegularHkUpdateParams params) override;
ReturnValue_t subscribeForDiagUpdatePacket(subdp::DiagnosticsHkUpdateParams params) override;
ReturnValue_t subscribeForUpdatePacket(subdp::ParamsBase& params);
protected:
ReturnValue_t subscribeForPeriodicPacket(subdp::ParamsBase& params);
ReturnValue_t subscribeForUpdatePacket(subdp::ParamsBase& params);
/** Core data structure for the actual pool data */
localpool::DataPool localPoolMap;
/** Every housekeeping data manager has a mutex to protect access

View File

@ -8,6 +8,7 @@
#include "fsfw/ipc/MessageQueueMessage.h"
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serialize/SerialBufferAdapter.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/subsystem/SubsystemBase.h"
@ -1257,28 +1258,30 @@ ReturnValue_t DeviceHandlerBase::letChildHandleMessage(CommandMessage* message)
return returnvalue::FAILED;
}
void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t replyId,
bool forceDirectTm) {
if (dataSet == nullptr) {
return;
}
void DeviceHandlerBase::handleDeviceTm(const uint8_t* rawData, size_t rawDataLen,
DeviceCommandId_t replyId, bool forceDirectTm) {
SerialBufferAdapter bufferWrapper(rawData, rawDataLen);
handleDeviceTm(bufferWrapper, replyId, forceDirectTm);
}
DeviceReplyMap::iterator iter = deviceReplyMap.find(replyId);
void DeviceHandlerBase::handleDeviceTm(const SerializeIF& dataSet, DeviceCommandId_t replyId,
bool forceDirectTm) {
auto iter = deviceReplyMap.find(replyId);
if (iter == deviceReplyMap.end()) {
triggerEvent(DEVICE_UNKNOWN_REPLY, replyId);
return;
}
/* Regular replies to a command */
// Regular replies to a command
if (iter->second.command != deviceCommandMap.end()) {
MessageQueueId_t queueId = iter->second.command->second.sendReplyTo;
if (queueId != NO_COMMANDER) {
/* This may fail, but we'll ignore the fault. */
actionHelper.reportData(queueId, replyId, dataSet);
// This may fail, but we'll ignore the fault.
actionHelper.reportData(queueId, replyId, const_cast<SerializeIF*>(&dataSet));
}
/* This check should make sure we get any TM but don't get anything doubled. */
// This check should make sure we get any TM but don't get anything doubled.
if (wiretappingMode == TM && (requestedRawTraffic != queueId)) {
DeviceTmReportingWrapper wrapper(getObjectId(), replyId, dataSet);
actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
@ -1289,22 +1292,17 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF* dataSet, DeviceCommandId_t r
// hiding of sender needed so the service will handle it as
// unexpected Data, no matter what state (progress or completed)
// it is in
actionHelper.reportData(defaultRawReceiver, replyId, dataSet, true);
actionHelper.reportData(defaultRawReceiver, replyId, const_cast<SerializeIF*>(&dataSet),
true);
}
}
/* Unrequested or aperiodic replies */
// Unrequested or aperiodic replies
else {
DeviceTmReportingWrapper wrapper(getObjectId(), replyId, dataSet);
if (wiretappingMode == TM) {
actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
}
if (forceDirectTm and defaultRawReceiver != MessageQueueIF::NO_QUEUE) {
// sid_t setSid = sid_t(this->getObjectId(), replyId);
// LocalPoolDataSetBase* dataset = getDataSetHandle(setSid);
// if(dataset != nullptr) {
// poolManager.generateHousekeepingPacket(setSid, dataset, true);
// }
// hiding of sender needed so the service will handle it as
// unexpected Data, no matter what state (progress or completed)
// it is in
@ -1325,10 +1323,10 @@ ReturnValue_t DeviceHandlerBase::executeAction(ActionId_t actionId, MessageQueue
} else if (iter->second.isExecuting) {
result = COMMAND_ALREADY_SENT;
} else {
iter->second.sendReplyTo = commandedBy;
result = buildCommandFromCommand(actionId, data, size);
}
if (result == returnvalue::OK) {
iter->second.sendReplyTo = commandedBy;
iter->second.isExecuting = true;
cookieInfo.pendingCommand = iter;
cookieInfo.state = COOKIE_WRITE_READY;

View File

@ -1052,9 +1052,25 @@ class DeviceHandlerBase : public DeviceHandlerIF,
bool isAwaitingReply();
void handleDeviceTM(SerializeIF *dataSet, DeviceCommandId_t replyId, bool forceDirectTm = false);
// void handleDeviceTM(uint8_t* data, size_t dataSize, DeviceCommandId_t replyId,
// bool forceDirectTm);
/**
* Wrapper function for @handleDeviceTm which wraps the raw buffer with @SerialBufferAdapter.
* For interpreted data, prefer the other function.
* @param rawData
* @param rawDataLen
* @param replyId
* @param forceDirectTm
*/
void handleDeviceTm(const uint8_t *rawData, size_t rawDataLen, DeviceCommandId_t replyId,
bool forceDirectTm = false);
/**
* Can be used to handle Service 8 data replies. This will also generate the TM wiretapping
* packets accordingly.
* @param dataSet
* @param replyId
* @param forceDirectTm
*/
void handleDeviceTm(const SerializeIF &dataSet, DeviceCommandId_t replyId,
bool forceDirectTm = false);
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t *msToReachTheMode);

View File

@ -3,10 +3,10 @@
#include "fsfw/serialize/SerializeAdapter.h"
DeviceTmReportingWrapper::DeviceTmReportingWrapper(object_id_t objectId, ActionId_t actionId,
SerializeIF* data)
const SerializeIF& data)
: objectId(objectId), actionId(actionId), data(data) {}
DeviceTmReportingWrapper::~DeviceTmReportingWrapper() {}
DeviceTmReportingWrapper::~DeviceTmReportingWrapper() = default;
ReturnValue_t DeviceTmReportingWrapper::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const {
@ -19,22 +19,14 @@ ReturnValue_t DeviceTmReportingWrapper::serialize(uint8_t** buffer, size_t* size
if (result != returnvalue::OK) {
return result;
}
return data->serialize(buffer, size, maxSize, streamEndianness);
return data.serialize(buffer, size, maxSize, streamEndianness);
}
size_t DeviceTmReportingWrapper::getSerializedSize() const {
return sizeof(objectId) + sizeof(ActionId_t) + data->getSerializedSize();
return sizeof(objectId) + sizeof(ActionId_t) + data.getSerializedSize();
}
ReturnValue_t DeviceTmReportingWrapper::deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) {
ReturnValue_t result = SerializeAdapter::deSerialize(&objectId, buffer, size, streamEndianness);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&actionId, buffer, size, streamEndianness);
if (result != returnvalue::OK) {
return result;
}
return data->deSerialize(buffer, size, streamEndianness);
return returnvalue::FAILED;
}

View File

@ -7,21 +7,22 @@
class DeviceTmReportingWrapper : public SerializeIF {
public:
DeviceTmReportingWrapper(object_id_t objectId, ActionId_t actionId, SerializeIF* data);
virtual ~DeviceTmReportingWrapper();
DeviceTmReportingWrapper(object_id_t objectId, ActionId_t actionId, const SerializeIF& data);
~DeviceTmReportingWrapper() override;
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
virtual size_t getSerializedSize() const override;
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override;
[[nodiscard]] size_t getSerializedSize() const override;
private:
object_id_t objectId;
ActionId_t actionId;
SerializeIF* data;
const SerializeIF& data;
// Deserialization forbidden
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override;
};
#endif /* FSFW_DEVICEHANDLERS_DEVICETMREPORTINGWRAPPER_H_ */

View File

@ -4,8 +4,6 @@
#include <stdint.h>
#include "fwSubsystemIdRanges.h"
// could be moved to more suitable location
#include <events/subsystemIdRanges.h>
using EventId_t = uint16_t;
using EventSeverity_t = uint8_t;

View File

@ -12,7 +12,7 @@ MessageQueueMessage::MessageQueueMessage() : messageSize(getMinimumMessageSize()
MessageQueueMessage::MessageQueueMessage(uint8_t* data, size_t size)
: messageSize(MessageQueueMessage::HEADER_SIZE + size) {
if (size <= MessageQueueMessage::MAX_DATA_SIZE) {
std::memcpy(internalBuffer + MessageQueueMessage::HEADER_SIZE, data, size);
std::memcpy(MessageQueueMessage::getData(), data, size);
this->messageSize = MessageQueueMessage::HEADER_SIZE + size;
} else {
#if FSFW_CPP_OSTREAM_ENABLED == 1

View File

@ -8,7 +8,7 @@
#include "../serialize/SerialLinkedListAdapter.h"
#include "../serialize/SerializeElement.h"
#include "../serviceinterface/ServiceInterface.h"
#include "../timemanager/TimeStamperIF.h"
#include "../timemanager/TimeWriterIF.h"
#include "HasMonitorsIF.h"
#include "MonitoringIF.h"
#include "monitoringConf.h"
@ -34,9 +34,9 @@ class MonitoringReportContent : public SerialLinkedListAdapter<SerializeIF> {
SerializeElement<T> limitValue;
SerializeElement<ReturnValue_t> oldState;
SerializeElement<ReturnValue_t> newState;
uint8_t rawTimestamp[TimeStamperIF::MAXIMUM_TIMESTAMP_LEN] = {};
uint8_t rawTimestamp[TimeWriterIF::MAXIMUM_TIMESTAMP_LEN] = {};
SerializeElement<SerialBufferAdapter<uint8_t>> timestampSerializer;
TimeStamperIF* timeStamper;
TimeWriterIF* timeStamper;
MonitoringReportContent()
: SerialLinkedListAdapter<SerializeIF>(&parameterObjectId),
monitorId(0),
@ -79,7 +79,7 @@ class MonitoringReportContent : public SerialLinkedListAdapter<SerializeIF> {
}
bool checkAndSetStamper() {
if (timeStamper == nullptr) {
timeStamper = ObjectManager::instance()->get<TimeStamperIF>(timeStamperId);
timeStamper = ObjectManager::instance()->get<TimeWriterIF>(timeStamperId);
if (timeStamper == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MonitoringReportContent::checkAndSetStamper: "

View File

@ -161,7 +161,7 @@ void TcpTmTcServer::handleServerOperation(socket_t& connSocket) {
while (true) {
ssize_t retval = recv(connSocket, reinterpret_cast<char*>(receptionBuffer.data()),
receptionBuffer.capacity(), tcpConfig.tcpFlags);
receptionBuffer.size(), tcpConfig.tcpFlags);
if (retval == 0) {
size_t availableReadData = ringBuffer.getAvailableReadData();
if (availableReadData > lastRingBufferSize) {
@ -335,31 +335,27 @@ ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) {
}
ringBuffer.readData(receptionBuffer.data(), readAmount, true);
const uint8_t* bufPtr = receptionBuffer.data();
const uint8_t** bufPtrPtr = &bufPtr;
size_t startIdx = 0;
size_t foundSize = 0;
size_t readLen = 0;
while (readLen < readAmount) {
if (spacePacketParser == nullptr) {
return returnvalue::FAILED;
}
result =
spacePacketParser->parseSpacePackets(bufPtrPtr, readAmount, startIdx, foundSize, readLen);
SpacePacketParser::FoundPacketInfo info;
if (spacePacketParser == nullptr) {
return returnvalue::FAILED;
}
spacePacketParser->reset();
while (spacePacketParser->getAmountRead() < readAmount) {
result = spacePacketParser->parseSpacePackets(&bufPtr, readAmount, info);
switch (result) {
case (SpacePacketParser::NO_PACKET_FOUND):
case (SpacePacketParser::SPLIT_PACKET): {
break;
}
case (returnvalue::OK): {
result = handleTcReception(receptionBuffer.data() + startIdx, foundSize);
result = handleTcReception(receptionBuffer.data() + info.startIdx, info.sizeFound);
if (result != returnvalue::OK) {
status = result;
}
}
}
ringBuffer.deleteData(foundSize);
ringBuffer.deleteData(info.sizeFound);
lastRingBufferSize = ringBuffer.getAvailableReadData();
std::memset(receptionBuffer.data() + startIdx, 0, foundSize);
}
return status;
}

View File

@ -38,8 +38,9 @@ class Service11TelecommandScheduling final : public PusServiceBase {
static constexpr uint8_t CLASS_ID = CLASS_ID::PUS_SERVICE_11;
static constexpr ReturnValue_t INVALID_TYPE_TIME_WINDOW = returnvalue::makeCode(CLASS_ID, 1);
static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE = returnvalue::makeCode(CLASS_ID, 2);
static constexpr ReturnValue_t INVALID_RELATIVE_TIME = returnvalue::makeCode(CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_TIME_WINDOW = returnvalue::makeCode(CLASS_ID, 2);
static constexpr ReturnValue_t TIMESHIFTING_NOT_POSSIBLE = returnvalue::makeCode(CLASS_ID, 3);
static constexpr ReturnValue_t INVALID_RELATIVE_TIME = returnvalue::makeCode(CLASS_ID, 4);
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_11;

View File

@ -564,12 +564,17 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
if (result != returnvalue::OK) {
return result;
}
if (fromTimestamp > toTimestamp) {
return INVALID_TIME_WINDOW;
}
itBegin = telecommandMap.begin();
itEnd = telecommandMap.begin();
while (itBegin->first < fromTimestamp && itBegin != telecommandMap.end()) {
itBegin++;
}
// start looking for end beginning at begin
itEnd = itBegin;
while (itEnd->first <= toTimestamp && itEnd != telecommandMap.end()) {
itEnd++;
}
@ -579,16 +584,6 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
default:
return returnvalue::FAILED;
}
// additional security check, this should never be true
if (itBegin->first > itEnd->first) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
#else
sif::printError("11::GetMapFilterFromData: itBegin > itEnd\n");
#endif
return returnvalue::FAILED;
}
// the map range should now be set according to the sent filter.
return returnvalue::OK;
}

View File

@ -11,7 +11,7 @@ Service1TelecommandVerification::Service1TelecommandVerification(object_id_t obj
uint16_t apid, uint8_t serviceId,
object_id_t targetDestination,
uint16_t messageQueueDepth,
TimeStamperIF* timeStamper)
TimeWriterIF* timeStamper)
: SystemObject(objectId),
apid(apid),
serviceId(serviceId),
@ -134,7 +134,7 @@ ReturnValue_t Service1TelecommandVerification::initialize() {
storeHelper.setTmStore(*tmStore);
}
if (timeStamper == nullptr) {
timeStamper = ObjectManager::instance()->get<TimeStamperIF>(objects::TIME_STAMPER);
timeStamper = ObjectManager::instance()->get<TimeWriterIF>(objects::TIME_STAMPER);
if (timeStamper == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}

View File

@ -47,7 +47,7 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
Service1TelecommandVerification(object_id_t objectId, uint16_t apid, uint8_t serviceId,
object_id_t targetDestination, uint16_t messageQueueDepth,
TimeStamperIF* timeStamper = nullptr);
TimeWriterIF* timeStamper = nullptr);
~Service1TelecommandVerification() override;
/**
@ -87,7 +87,7 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
TmStoreHelper storeHelper;
TmStoreAndSendWrapper tmHelper;
InternalErrorReporterIF* errReporter = nullptr;
TimeStamperIF* timeStamper = nullptr;
TimeWriterIF* timeStamper = nullptr;
StorageManagerIF* tmStore = nullptr;
MessageQueueIF* tmQueue = nullptr;

View File

@ -1,8 +1,6 @@
#ifndef FSFW_RETURNVALUES_RETURNVALUE_H_
#define FSFW_RETURNVALUES_RETURNVALUE_H_
#include <returnvalues/classIds.h>
#include <cstdint>
#include "FwClassIds.h"

View File

@ -21,7 +21,7 @@ SerialBufferAdapter<count_t>::SerialBufferAdapter(uint8_t* buffer, count_t buffe
bufferLength(bufferLength) {}
template <typename count_t>
SerialBufferAdapter<count_t>::~SerialBufferAdapter() {}
SerialBufferAdapter<count_t>::~SerialBufferAdapter() = default;
template <typename count_t>
ReturnValue_t SerialBufferAdapter<count_t>::serialize(uint8_t** buffer, size_t* size,
@ -119,10 +119,10 @@ const uint8_t* SerialBufferAdapter<count_t>::getConstBuffer() const {
}
template <typename count_t>
void SerialBufferAdapter<count_t>::setBuffer(uint8_t* buffer, count_t bufferLength) {
this->buffer = buffer;
this->constBuffer = buffer;
this->bufferLength = bufferLength;
void SerialBufferAdapter<count_t>::setConstBuffer(const uint8_t* buf, count_t bufLen) {
this->buffer = nullptr;
this->bufferLength = bufLen;
this->constBuffer = buf;
}
// forward Template declaration for linker

View File

@ -21,6 +21,7 @@
template <typename count_t>
class SerialBufferAdapter : public SerializeIF {
public:
SerialBufferAdapter() = default;
/**
* Constructor for constant uint8_t buffer. Length field can be serialized optionally.
* Type of length can be supplied as template type.
@ -40,12 +41,12 @@ class SerialBufferAdapter : public SerializeIF {
*/
SerialBufferAdapter(uint8_t* buffer, count_t bufferLength, bool serializeLength = false);
virtual ~SerialBufferAdapter();
~SerialBufferAdapter() override;
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
virtual size_t getSerializedSize() const override;
[[nodiscard]] size_t getSerializedSize() const override;
/**
* @brief This function deserializes a buffer into the member buffer.
@ -59,12 +60,12 @@ class SerialBufferAdapter : public SerializeIF {
* @param bigEndian
* @return
*/
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override;
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
Endianness streamEndianness) override;
uint8_t* getBuffer();
const uint8_t* getConstBuffer() const;
void setBuffer(uint8_t* buffer, count_t bufferLength);
[[nodiscard]] const uint8_t* getConstBuffer() const;
void setConstBuffer(const uint8_t* buf, count_t bufLen);
private:
bool serializeLength = false;

View File

@ -1,8 +1,8 @@
#include "fsfw/serviceinterface/ServiceInterfaceBuffer.h"
#include "ServiceInterfaceBuffer.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1
#include <inttypes.h>
#include <cinttypes>
#include <cstring>
@ -16,8 +16,6 @@
// to be implemented by bsp
extern "C" void printChar(const char*, bool errStream);
#ifndef UT699
ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string setMessage, bool addCrToPreamble,
bool buffered, bool errStream, uint16_t port)
: isActive(true),
@ -58,6 +56,9 @@ ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string setMessage, bool addC
}
void ServiceInterfaceBuffer::putChars(char const* begin, char const* end) {
if (not isActive) {
return;
}
char array[BUF_SIZE];
uint32_t length = end - begin;
if (length > sizeof(array)) {
@ -74,8 +75,6 @@ void ServiceInterfaceBuffer::putChars(char const* begin, char const* end) {
}
}
#endif
int ServiceInterfaceBuffer::overflow(int c) {
if (not buffered and this->isActive) {
if (c != Traits::eof()) {
@ -169,89 +168,4 @@ void ServiceInterfaceBuffer::setAsciiColorPrefix(std::string colorPrefix) {
}
#endif
#ifdef UT699
#include "../osal/rtems/Interrupt.h"
ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string set_message, uint16_t port) {
this->log_message = set_message;
this->isActive = true;
setp(buf, buf + BUF_SIZE);
}
void ServiceInterfaceBuffer::putChars(char const* begin, char const* end) {
char array[BUF_SIZE];
uint32_t length = end - begin;
if (length > sizeof(array)) {
length = sizeof(array);
}
memcpy(array, begin, length);
if (!Interrupt::isInterruptInProgress()) {
std::cout << array;
} else {
// Uncomment the following line if you need ISR debug output.
// printk(array);
}
}
#endif // UT699
#ifdef ML505
#include <bsp_flp/network/networkconfig.h>
ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string set_message, uint16_t port)
: isActive(true),
log_message(set_message),
udpSocket(0),
remoteAddressLength(sizeof(remoteAddress)) {
setp(buf, buf + BUF_SIZE);
memset((uint8_t*)&remoteAddress, 0, sizeof(remoteAddress));
remoteAddress.sin_family = AF_INET;
remoteAddress.sin_port = htons(port);
remoteAddress.sin_addr.s_addr = htonl(inet_addr("192.168.250.100"));
}
void ServiceInterfaceBuffer::putChars(char const* begin, char const* end) {
char array[BUF_SIZE];
uint32_t length = end - begin;
if (length > sizeof(array)) {
length = sizeof(array);
}
memcpy(array, begin, length);
if (udpSocket <= 0) {
initSocket();
}
if (udpSocket > 0) {
sendto(udpSocket, array, length, 0, (sockaddr*)&remoteAddress, sizeof(remoteAddress));
}
}
void ServiceInterfaceBuffer::initSocket() {
sockaddr_in address;
memset((uint8_t*)&address, 0, sizeof(address));
address.sin_family = AF_INET;
address.sin_port = htons(0);
address.sin_addr.s_addr = htonl(INADDR_ANY);
udpSocket = socket(PF_INET, SOCK_DGRAM, 0);
if (socket < 0) {
printf("Error opening socket!\n");
return;
}
timeval timeout = {0, 20};
if (setsockopt(udpSocket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)) < 0) {
printf("Error setting SO_RCVTIMEO socket options!\n");
return;
}
if (setsockopt(udpSocket, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)) < 0) {
printf("Error setting SO_SNDTIMEO socket options!\n");
return;
}
if (bind(udpSocket, (sockaddr*)&address, sizeof(address)) < 0) {
printf("Error binding socket!\n");
}
}
#endif // ML505
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif

View File

@ -1,9 +1,8 @@
#ifndef FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACEBUFFER_H_
#define FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACEBUFFER_H_
#include <FSFWConfig.h>
#include "../returnvalues/returnvalue.h"
#include "fsfw/FSFW.h"
#include "fsfw/returnvalues/returnvalue.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -11,8 +10,6 @@
#include <iostream>
#include <sstream>
#ifndef UT699
/**
* @brief This is the underlying stream buffer which implements the
* streambuf class and overloads the overflow() and sync() methods
@ -77,85 +74,6 @@ class ServiceInterfaceBuffer : public std::streambuf {
bool crAdditionEnabled() const;
};
#endif
#ifdef UT699
class ServiceInterfaceBuffer : public std::basic_streambuf<char, std::char_traits<char> > {
friend class ServiceInterfaceStream;
public:
ServiceInterfaceBuffer(std::string set_message, uint16_t port);
protected:
bool isActive;
// This is called when buffer becomes full. If
// buffer is not used, then this is called every
// time when characters are put to stream.
virtual int overflow(int c = Traits::eof());
// This function is called when stream is flushed,
// for example when std::endl is put to stream.
virtual int sync(void);
private:
// For additional message information
std::string log_message;
// For EOF detection
typedef std::char_traits<char> Traits;
// Work in buffer mode. It is also possible to work without buffer.
static size_t const BUF_SIZE = 128;
char buf[BUF_SIZE];
// In this function, the characters are parsed.
void putChars(char const* begin, char const* end);
};
#endif // UT699
#ifdef ML505
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netinet/udp.h>
#include <sys/socket.h>
#include <sys/types.h>
class ServiceInterfaceBuffer : public std::basic_streambuf<char, std::char_traits<char> > {
friend class ServiceInterfaceStream;
public:
ServiceInterfaceBuffer(std::string set_message, uint16_t port);
protected:
bool isActive;
// This is called when buffer becomes full. If
// buffer is not used, then this is called every
// time when characters are put to stream.
virtual int overflow(int c = Traits::eof());
// This function is called when stream is flushed,
// for example when std::endl is put to stream.
virtual int sync(void);
private:
// For additional message information
std::string log_message;
// For EOF detection
typedef std::char_traits<char> Traits;
// Work in buffer mode. It is also possible to work without buffer.
static size_t const BUF_SIZE = 128;
char buf[BUF_SIZE];
// In this function, the characters are parsed.
void putChars(char const* begin, char const* end);
int udpSocket;
sockaddr_in remoteAddress;
socklen_t remoteAddressLength;
void initSocket();
};
#endif // ML505
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACEBUFFER_H_ */

View File

@ -5,7 +5,6 @@
#include "../returnvalues/returnvalue.h"
#include "../tmtcpacket/cfdp/CfdpPacketStored.h"
#include "../tmtcservices/AcceptsTelecommandsIF.h"
#include "../tmtcservices/VerificationReporter.h"
#include "CFDPDistributorIF.h"

View File

@ -1,13 +1,9 @@
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECKIF_H_
#define FSFW_TCDISTRIBUTION_TCPACKETCHECKIF_H_
<<<<<<< HEAD:src/fsfw/tcdistribution/CcsdsPacketCheckIF.h
#include <cstddef>
=======
#include "../returnvalues/returnvalue.h"
>>>>>>> origin/development:src/fsfw/tcdistribution/TcPacketCheckIF.h
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
class SpacePacketReader;

View File

@ -103,7 +103,7 @@ ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
if (queueStatus != returnvalue::OK) {
tcStatus = queueStatus;
}
if (tcStatus != RETURN_OK) {
if (tcStatus != returnvalue::OK) {
verifyChannel->sendFailureReport({tcverif::ACCEPTANCE_FAILURE, reader, tcStatus});
// A failed packet is deleted immediately after reporting,
// otherwise it will block memory.
@ -111,7 +111,7 @@ ReturnValue_t PusDistributor::callbackAfterSending(ReturnValue_t queueStatus) {
return returnvalue::FAILED;
} else {
verifyChannel->sendSuccessReport({tcverif::ACCEPTANCE_SUCCESS, reader});
return RETURN_OK;
return returnvalue::OK;
}
}

View File

@ -2,7 +2,7 @@
#define FSFW_TCDISTRIBUTION_TCPACKETCHECKPUS_H_
#include "fsfw/FSFW.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tmtcpacket/pus/defs.h"
#include "fsfw/tmtcservices/PusVerificationReport.h"

View File

@ -9,4 +9,3 @@ ReturnValue_t CfdpPacketChecker::checkPacket(const SpacePacketReader& currentPac
}
uint16_t CfdpPacketChecker::getApid() const { return apid; }

View File

@ -4,7 +4,7 @@
#include <cstdint>
#include "fsfw/returnvalues/FwClassIds.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
namespace tcdistrib {
static const uint8_t INTERFACE_ID = CLASS_ID::PACKET_CHECK;

View File

@ -39,13 +39,13 @@ class CCSDSTime {
* Struct for CDS day-segmented format.
*/
struct CDS_short {
uint8_t pField;
uint8_t dayMSB;
uint8_t dayLSB;
uint8_t msDay_hh;
uint8_t msDay_h;
uint8_t msDay_l;
uint8_t msDay_ll;
uint8_t pField = P_FIELD_CDS_SHORT;
uint8_t dayMSB = 0;
uint8_t dayLSB = 0;
uint8_t msDay_hh = 0;
uint8_t msDay_h = 0;
uint8_t msDay_l = 0;
uint8_t msDay_ll = 0;
};
/**
* Struct for the CCS fromat in day of month variation with max resolution

View File

@ -6,11 +6,6 @@
CdsShortTimeStamper::CdsShortTimeStamper(object_id_t objectId) : SystemObject(objectId) {}
ReturnValue_t CdsShortTimeStamper::addTimeStamp(uint8_t *buffer, const uint8_t maxSize) {
size_t serLen = 0;
return serialize(&buffer, &serLen, maxSize, SerializeIF::Endianness::NETWORK);
}
ReturnValue_t CdsShortTimeStamper::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
SerializeIF::Endianness streamEndianness) const {
if (*size + getSerializedSize() > maxSize) {
@ -33,15 +28,22 @@ size_t CdsShortTimeStamper::getSerializedSize() const { return getTimestampSize(
ReturnValue_t CdsShortTimeStamper::deSerialize(const uint8_t **buffer, size_t *size,
SerializeIF::Endianness streamEndianness) {
return returnvalue::FAILED;
}
ReturnValue_t CdsShortTimeStamper::readTimeStamp(const uint8_t *buffer, size_t maxSize) {
if (maxSize < getTimestampSize()) {
if (size == nullptr or buffer == nullptr) {
return returnvalue::FAILED;
}
if (*size < getTimestampSize()) {
return SerializeIF::STREAM_TOO_SHORT;
}
size_t foundLen = 0;
return CCSDSTime::convertFromCcsds(&readTime, buffer, &foundLen, maxSize);
if (((**buffer >> 4) & 0b111) != CCSDSTime::TimeCodeIdentification::CDS) {
return BAD_TIMESTAMP;
}
auto res = CCSDSTime::convertFromCcsds(&readTime, *buffer, &foundLen, *size);
if (res == returnvalue::OK) {
*size -= getSerializedSize();
*buffer += getSerializedSize();
}
return res;
}
timeval &CdsShortTimeStamper::getTime() { return readTime; }

View File

@ -3,7 +3,7 @@
#include "CCSDSTime.h"
#include "TimeReaderIF.h"
#include "TimeStamperIF.h"
#include "TimeWriterIF.h"
#include "fsfw/objectmanager/SystemObject.h"
/**
@ -15,7 +15,7 @@
* overriding the #addTimeStamp function.
* @ingroup utility
*/
class CdsShortTimeStamper : public TimeStamperIF, public TimeReaderIF, public SystemObject {
class CdsShortTimeStamper : public TimeWriterIF, public TimeReaderIF, public SystemObject {
public:
static constexpr size_t TIMESTAMP_LEN = 7;
/**
@ -25,20 +25,11 @@ class CdsShortTimeStamper : public TimeStamperIF, public TimeReaderIF, public Sy
*/
explicit CdsShortTimeStamper(object_id_t objectId);
/**
* Adds a CCSDS CDC short 8 byte timestamp to the given buffer.
* This function can be overriden to use a custom timestamp.
* @param buffer
* @param maxSize
* @return
*/
ReturnValue_t addTimeStamp(uint8_t *buffer, uint8_t maxSize) override;
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override;
[[nodiscard]] size_t getSerializedSize() const override;
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override;
ReturnValue_t readTimeStamp(const uint8_t *buffer, size_t maxSize) override;
timeval &getTime() override;
[[nodiscard]] size_t getTimestampSize() const override;

View File

@ -4,13 +4,29 @@
#include <cstdlib>
#include "TimeStampIF.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serialize/SerializeIF.h"
class TimeReaderIF : public TimeStampIF {
class TimeReaderIF : public SerializeIF, public TimeStampIF {
public:
~TimeReaderIF() override = default;
virtual ReturnValue_t readTimeStamp(const uint8_t* buffer, size_t maxSize) = 0;
virtual timeval& getTime() = 0;
[[nodiscard]] size_t getSerializedSize() const override { return getTimestampSize(); }
ReturnValue_t readTimeStamp(const uint8_t* buf, size_t maxSize) {
size_t dummy = 0;
return deSerialize(buf, dummy, maxSize, SerializeIF::Endianness::NETWORK);
}
private:
/**
* Forbidden, use dedicated IF @TimeWriterIF
*/
[[nodiscard]] ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override {
return returnvalue::FAILED;
}
};
#endif // FSFW_TIMEMANAGER_TIMEREADERIF_H

View File

@ -1,23 +0,0 @@
#ifndef FSFW_TIMEMANAGER_TIMESTAMPERIF_H_
#define FSFW_TIMEMANAGER_TIMESTAMPERIF_H_
#include "TimeStampIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serialize/SerializeIF.h"
/**
* A class implementing this IF provides facilities to add a time stamp to the
* buffer provided.
* Implementors need to ensure that calling the method is thread-safe, i.e.
* addTimeStamp may be called in parallel from a different context.
*/
class TimeStamperIF : public SerializeIF, public TimeStampIF {
public:
virtual ReturnValue_t addTimeStamp(uint8_t* buffer, uint8_t maxSize) = 0;
~TimeStamperIF() override = default;
size_t getTimestampSize() const override { return getSerializedSize(); }
protected:
};
#endif /* FSFW_TIMEMANAGER_TIMESTAMPERIF_H_ */

View File

@ -0,0 +1,34 @@
#ifndef FSFW_TIMEMANAGER_TIMESTAMPERIF_H_
#define FSFW_TIMEMANAGER_TIMESTAMPERIF_H_
#include "TimeStampIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serialize/SerializeIF.h"
/**
* A class implementing this IF provides facilities to add a time stamp to the
* buffer provided.
* Implementors need to ensure that calling the method is thread-safe, i.e.
* addTimeStamp may be called in parallel from a different context.
*/
class TimeWriterIF : public SerializeIF, public TimeStampIF {
public:
~TimeWriterIF() override = default;
[[nodiscard]] size_t getTimestampSize() const override { return getSerializedSize(); }
ReturnValue_t addTimeStamp(uint8_t *buf, size_t maxSize) {
size_t dummy = 0;
return serialize(buf, dummy, maxSize, SerializeIF::Endianness::NETWORK);
}
private:
/**
* Forbidden, use dedicated IF @TimeReaderIF
*/
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override {
return returnvalue::FAILED;
}
};
#endif /* FSFW_TIMEMANAGER_TIMESTAMPERIF_H_ */

View File

@ -7,7 +7,7 @@
#include "fsfw/serialize/SerialLinkedListAdapter.h"
#include "fsfw/serialize/SerializeElement.h"
#include "fsfw/timemanager/CCSDSTime.h"
#include "fsfw/timemanager/TimeStamperIF.h"
#include "fsfw/timemanager/TimeWriterIF.h"
#include "fsfw/tmtcpacket/pus/tm/PusTmMinimal.h"
#include "tmStorageConf.h"

View File

@ -3,7 +3,7 @@
#include <cstddef>
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tmtcpacket/ReadablePacketIF.h"
#include "fsfw/tmtcpacket/RedirectableDataPointerIF.h"
#include "fsfw/tmtcpacket/ccsds/defs.h"

View File

@ -7,11 +7,7 @@
#include "fsfw/tmtcpacket/pus/tm/PusTmIF.h"
#include "fsfw/tmtcpacket/pus/tm/PusTmMinimal.h"
<<<<<<< HEAD
class PacketMatchTree : public MatchTree<PusTmIF*> {
=======
class PacketMatchTree : public MatchTree<TmPacketMinimal*> {
>>>>>>> origin/development
public:
explicit PacketMatchTree(Node* root);
explicit PacketMatchTree(iterator root);

View File

@ -7,6 +7,6 @@ class CustomUserDataIF {
public:
virtual ~CustomUserDataIF() = default;
virtual ReturnValue_t setRawUserData(const uint8_t* data, size_t len) = 0;
virtual ReturnValue_t setSerializableUserData(SerializeIF& serializable) = 0;
virtual ReturnValue_t setSerializableUserData(const SerializeIF& serializable) = 0;
};
#endif // FSFW_TMTCPACKET_CREATORDATAIF_H

View File

@ -13,44 +13,6 @@ using PusChecksumT = uint16_t;
//! Version numbers according to ECSS-E-ST-70-41C p.439
enum PusVersion : uint8_t { PUS_A = 1, PUS_C = 2 };
struct RawData {
const uint8_t* data;
size_t len;
};
enum DataTypes { RAW, SERIALIZABLE };
union DataUnion {
RawData raw;
SerializeIF* serializable;
};
struct DataWrapper {
DataTypes type;
DataUnion dataUnion;
using BufPairT = std::pair<const uint8_t*, size_t>;
[[nodiscard]] size_t getLength() const {
if (type == DataTypes::RAW) {
return dataUnion.raw.len;
} else if (type == DataTypes::SERIALIZABLE and dataUnion.serializable != nullptr) {
return dataUnion.serializable->getSerializedSize();
}
return 0;
}
void setRawData(BufPairT bufPair) {
type = DataTypes::RAW;
dataUnion.raw.data = bufPair.first;
dataUnion.raw.len = bufPair.second;
}
void setSerializable(SerializeIF& serializable) {
type = DataTypes::SERIALIZABLE;
dataUnion.serializable = &serializable;
}
};
/**
* This struct defines the data structure of a Space Packet when accessed
* via a pointer.

View File

@ -14,7 +14,6 @@ PusTcCreator::PusTcCreator(SpacePacketParams spParams, PusTcParams pusParams)
ReturnValue_t PusTcCreator::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
SerializeIF::Endianness streamEndianness) const {
const uint8_t *start = *buffer;
size_t userDataLen = pusParams.dataWrapper.getLength();
if (*size + getSerializedSize() > maxSize) {
return SerializeIF::BUFFER_TOO_SHORT;
}
@ -37,17 +36,8 @@ ReturnValue_t PusTcCreator::serialize(uint8_t **buffer, size_t *size, size_t max
if (result != returnvalue::OK) {
return result;
}
if (pusParams.dataWrapper.type == ecss::DataTypes::RAW) {
const uint8_t *data = pusParams.dataWrapper.dataUnion.raw.data;
if (data != nullptr and userDataLen > 0) {
std::memcpy(*buffer, data, userDataLen);
*buffer += userDataLen;
*size += userDataLen;
}
} else if (pusParams.dataWrapper.type == ecss::DataTypes::SERIALIZABLE and
pusParams.dataWrapper.dataUnion.serializable != nullptr) {
result = pusParams.dataWrapper.dataUnion.serializable->serialize(buffer, size, maxSize,
streamEndianness);
if (pusParams.appData != nullptr) {
result = pusParams.appData->serialize(buffer, size, maxSize, streamEndianness);
if (result != returnvalue::OK) {
return result;
}
@ -58,8 +48,11 @@ ReturnValue_t PusTcCreator::serialize(uint8_t **buffer, size_t *size, size_t max
}
void PusTcCreator::updateSpLengthField() {
spCreator.setDataLen(ecss::PusTcDataFieldHeader::MIN_SIZE + pusParams.dataWrapper.getLength() +
1);
size_t len = ecss::PusTcDataFieldHeader::MIN_SIZE + 1;
if (pusParams.appData != nullptr) {
len += pusParams.appData->getSerializedSize();
}
spCreator.setDataLen(len);
}
size_t PusTcCreator::getSerializedSize() const { return spCreator.getFullPacketLen(); }
@ -91,14 +84,15 @@ SpacePacketParams &PusTcCreator::getSpParams() { return spCreator.getParams(); }
ReturnValue_t PusTcCreator::setRawUserData(const uint8_t *data, size_t len) {
// TODO: Check length field?
pusParams.dataWrapper.setRawData({data, len});
pusParams.bufAdapter.setConstBuffer(data, len);
pusParams.appData = &pusParams.bufAdapter;
updateSpLengthField();
return returnvalue::OK;
}
ReturnValue_t PusTcCreator::setSerializableUserData(SerializeIF &serializable) {
ReturnValue_t PusTcCreator::setSerializableUserData(const SerializeIF &serializable) {
// TODO: Check length field?
pusParams.dataWrapper.setSerializable(serializable);
pusParams.appData = &serializable;
updateSpLengthField();
return returnvalue::OK;
}

View File

@ -1,6 +1,7 @@
#ifndef FSFW_TMTCPACKET_TCPACKETDESERIALIZER_H
#define FSFW_TMTCPACKET_TCPACKETDESERIALIZER_H
#include "fsfw/serialize/SerialBufferAdapter.h"
#include "fsfw/tmtcpacket/RedirectableDataPointerIF.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketCreator.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketIF.h"
@ -11,11 +12,19 @@
struct PusTcParams {
PusTcParams(uint8_t service_, uint8_t subservice_) : service(service_), subservice(subservice_) {}
void setRawAppData(const uint8_t *data, size_t len) {
bufAdapter.setConstBuffer(data, len);
appData = &bufAdapter;
}
void setSerializableAppData(const SerializeIF &serializable) { appData = &serializable; }
uint8_t service;
uint8_t subservice;
uint8_t ackFlags = ecss::ACK_ALL;
uint16_t sourceId = 0;
ecss::DataWrapper dataWrapper{};
SerialBufferAdapter<uint8_t> bufAdapter;
const SerializeIF *appData = nullptr;
uint8_t pusVersion = ecss::PusVersion::PUS_C;
};
@ -51,7 +60,7 @@ class PusTcCreator : public PusTcIF, public SerializeIF, public CustomUserDataIF
[[nodiscard]] uint8_t getSubService() const override;
[[nodiscard]] uint16_t getSourceId() const override;
ReturnValue_t setRawUserData(const uint8_t *data, size_t len) override;
ReturnValue_t setSerializableUserData(SerializeIF &serializable) override;
ReturnValue_t setSerializableUserData(const SerializeIF &serializable) override;
// Load all big endian helpers into the class namespace
using SerializeIF::serializeBe;

View File

@ -3,7 +3,7 @@
#include <utility>
#include "fsfw/globalfunctions/CRC.h"
#include "fsfw/timemanager/TimeStamperIF.h"
#include "fsfw/timemanager/TimeWriterIF.h"
PusTmCreator::PusTmCreator(SpacePacketParams initSpParams, PusTmParams initPusParams)
: pusParams(initPusParams), spCreator(std::move(initSpParams)) {
@ -30,7 +30,7 @@ uint8_t PusTmCreator::getSubService() const { return pusParams.secHeader.subserv
PusTmParams& PusTmCreator::getParams() { return pusParams; }
void PusTmCreator::setTimeStamper(TimeStamperIF& timeStamper_) {
void PusTmCreator::setTimeStamper(TimeWriterIF& timeStamper_) {
pusParams.secHeader.timeStamper = &timeStamper_;
updateSpLengthField();
}
@ -51,7 +51,6 @@ ReturnValue_t PusTmCreator::serialize(uint8_t** buffer, size_t* size, size_t max
if (result != returnvalue::OK) {
return result;
}
size_t userDataLen = pusParams.dataWrapper.getLength();
**buffer =
((pusParams.secHeader.pusVersion << 4) & 0xF0) | (pusParams.secHeader.scTimeRefStatus & 0x0F);
*buffer += 1;
@ -77,15 +76,8 @@ ReturnValue_t PusTmCreator::serialize(uint8_t** buffer, size_t* size, size_t max
}
}
if (pusParams.dataWrapper.type == ecss::DataTypes::RAW and
pusParams.dataWrapper.dataUnion.raw.data != nullptr) {
std::memcpy(*buffer, pusParams.dataWrapper.dataUnion.raw.data, userDataLen);
*buffer += userDataLen;
*size += userDataLen;
} else if (pusParams.dataWrapper.type == ecss::DataTypes::SERIALIZABLE and
pusParams.dataWrapper.dataUnion.serializable != nullptr) {
result = pusParams.dataWrapper.dataUnion.serializable->serialize(buffer, size, maxSize,
streamEndianness);
if (pusParams.sourceData != nullptr) {
result = pusParams.sourceData->serialize(buffer, size, maxSize, streamEndianness);
if (result != returnvalue::OK) {
return result;
}
@ -106,13 +98,15 @@ ReturnValue_t PusTmCreator::deSerialize(const uint8_t** buffer, size_t* size,
return returnvalue::FAILED;
}
TimeStamperIF* PusTmCreator::getTimestamper() const { return pusParams.secHeader.timeStamper; }
TimeWriterIF* PusTmCreator::getTimestamper() const { return pusParams.secHeader.timeStamper; }
SpacePacketParams& PusTmCreator::getSpParams() { return spCreator.getParams(); }
void PusTmCreator::updateSpLengthField() {
size_t headerLen = PusTmIF::MIN_SEC_HEADER_LEN + pusParams.dataWrapper.getLength() +
sizeof(ecss::PusChecksumT) - 1;
size_t headerLen = PusTmIF::MIN_SEC_HEADER_LEN + sizeof(ecss::PusChecksumT) - 1;
if (pusParams.sourceData != nullptr) {
headerLen += pusParams.sourceData->getSerializedSize();
}
if (pusParams.secHeader.timeStamper != nullptr) {
headerLen += pusParams.secHeader.timeStamper->getSerializedSize();
}
@ -134,12 +128,17 @@ void PusTmCreator::setMessageTypeCounter(uint16_t messageTypeCounter) {
void PusTmCreator::setDestId(uint16_t destId) { pusParams.secHeader.destId = destId; }
ReturnValue_t PusTmCreator::setRawUserData(const uint8_t* data, size_t len) {
pusParams.dataWrapper.setRawData({data, len});
if (data == nullptr or len == 0) {
pusParams.sourceData = nullptr;
} else {
pusParams.adapter.setConstBuffer(data, len);
pusParams.sourceData = &pusParams.adapter;
}
updateSpLengthField();
return returnvalue::OK;
}
ReturnValue_t PusTmCreator::setSerializableUserData(SerializeIF& serializable) {
pusParams.dataWrapper.setSerializable(serializable);
ReturnValue_t PusTmCreator::setSerializableUserData(const SerializeIF& serializable) {
pusParams.sourceData = &serializable;
updateSpLengthField();
return returnvalue::OK;
}

View File

@ -2,17 +2,18 @@
#define FSFW_TMTCPACKET_TMPACKETCREATOR_H
#include "PusTmIF.h"
#include "fsfw/serialize/SerialBufferAdapter.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketCreator.h"
#include "fsfw/tmtcpacket/pus/CustomUserDataIF.h"
struct PusTmSecHeader {
PusTmSecHeader() = default;
PusTmSecHeader(uint8_t service, uint8_t subservice, TimeStamperIF* timeStamper)
PusTmSecHeader(uint8_t service, uint8_t subservice, TimeWriterIF* timeStamper)
: service(service), subservice(subservice), timeStamper(timeStamper) {}
uint8_t service = 0;
uint8_t subservice = 0;
TimeStamperIF* timeStamper = nullptr;
TimeWriterIF* timeStamper = nullptr;
uint8_t pusVersion = ecss::PusVersion::PUS_C;
uint8_t scTimeRefStatus = 0;
uint16_t messageTypeCounter = 0;
@ -22,22 +23,28 @@ struct PusTmSecHeader {
struct PusTmParams {
PusTmParams() = default;
explicit PusTmParams(PusTmSecHeader secHeader) : secHeader(secHeader){};
PusTmParams(PusTmSecHeader secHeader, ecss::DataWrapper dataWrapper)
: secHeader(secHeader), dataWrapper(dataWrapper) {}
PusTmParams(uint8_t service, uint8_t subservice, TimeStamperIF* timeStamper)
PusTmParams(PusTmSecHeader secHeader, const SerializeIF& data)
: secHeader(secHeader), sourceData(&data) {}
PusTmParams(PusTmSecHeader secHeader, const uint8_t* data, size_t dataLen)
: secHeader(secHeader), adapter(data, dataLen), sourceData(&adapter) {}
PusTmParams(uint8_t service, uint8_t subservice, TimeWriterIF* timeStamper)
: secHeader(service, subservice, timeStamper) {}
PusTmParams(uint8_t service, uint8_t subservice, TimeStamperIF* timeStamper,
ecss::DataWrapper dataWrapper_)
PusTmParams(uint8_t service, uint8_t subservice, TimeWriterIF* timeStamper,
const SerializeIF& data_)
: PusTmParams(service, subservice, timeStamper) {
dataWrapper = dataWrapper_;
sourceData = &data_;
}
PusTmParams(uint8_t service, uint8_t subservice, TimeWriterIF* timeStamper, const uint8_t* data,
size_t dataLen)
: secHeader(service, subservice, timeStamper), adapter(data, dataLen), sourceData(&adapter) {}
PusTmSecHeader secHeader;
ecss::DataWrapper dataWrapper{};
SerialBufferAdapter<uint8_t> adapter;
const SerializeIF* sourceData = nullptr;
};
class TimeStamperIF;
class TimeWriterIF;
/**
* This class provides a high-level interface to create PUS TM packets and then @serialize
@ -55,7 +62,7 @@ class PusTmCreator : public SerializeIF, public PusTmIF, public CustomUserDataIF
PusTmCreator(SpacePacketParams initSpParams, PusTmParams initPusParams);
~PusTmCreator() override = default;
void setTimeStamper(TimeStamperIF& timeStamper);
void setTimeStamper(TimeWriterIF& timeStamper);
/**
* This function disables the CRC16 calculation on serialization. This is useful to avoid
* duplicate calculation if some lower level component needs to update fields like the sequence
@ -85,9 +92,9 @@ class PusTmCreator : public SerializeIF, public PusTmIF, public CustomUserDataIF
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override;
[[nodiscard]] size_t getSerializedSize() const override;
[[nodiscard]] TimeStamperIF* getTimestamper() const;
[[nodiscard]] TimeWriterIF* getTimestamper() const;
ReturnValue_t setRawUserData(const uint8_t* data, size_t len) override;
ReturnValue_t setSerializableUserData(SerializeIF& serializable) override;
ReturnValue_t setSerializableUserData(const SerializeIF& serializable) override;
// Load all big endian (network endian) helpers into scope
using SerializeIF::serializeBe;

View File

@ -4,7 +4,7 @@
#include <cstddef>
#include <cstdint>
#include "fsfw/timemanager/TimeStamperIF.h"
#include "fsfw/timemanager/TimeWriterIF.h"
#include "fsfw/tmtcpacket/pus/PusIF.h"
#include "fsfw/tmtcpacket/pus/defs.h"

View File

@ -2,7 +2,7 @@
#define FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_
#include "PusTmIF.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#include "fsfw/tmtcpacket/pus/RawUserDataReaderIF.h"

View File

@ -104,7 +104,7 @@ ReturnValue_t CommandingServiceBase::initialize() {
// This avoids duplicate calculation of the CRC16
tmStoreHelper.disableCrcCalculation();
if (tmTimeStamper == nullptr) {
tmTimeStamper = ObjectManager::instance()->get<TimeStamperIF>(objects::TIME_STAMPER);
tmTimeStamper = ObjectManager::instance()->get<TimeWriterIF>(objects::TIME_STAMPER);
if (tmTimeStamper == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}

View File

@ -272,7 +272,7 @@ class CommandingServiceBase : public SystemObject,
MessageQueueIF* commandQueue = nullptr;
MessageQueueIF* requestQueue = nullptr;
TimeStamperIF* tmTimeStamper = nullptr;
TimeWriterIF* tmTimeStamper = nullptr;
VerificationReporterIF* verificationReporter;
InternalErrorReporterIF* errReporter = nullptr;

View File

@ -178,7 +178,7 @@ ReturnValue_t PusServiceBase::initializeTmStoreHelper(TmStoreHelper& tmStoreHelp
}
if (psbParams.timeStamper == nullptr) {
auto timerStamper = ObjectManager::instance()->get<TimeStamperIF>(objects::TIME_STAMPER);
auto timerStamper = ObjectManager::instance()->get<TimeWriterIF>(objects::TIME_STAMPER);
if (timerStamper != nullptr) {
tmStoreHelper.setTimeStamper(*timerStamper);
}

View File

@ -65,7 +65,7 @@ struct PsbParams {
* register itself at that object.
*/
PUSDistributorIF* pusDistributor = nullptr;
TimeStamperIF* timeStamper = nullptr;
TimeWriterIF* timeStamper = nullptr;
};
namespace Factory {

View File

@ -6,17 +6,9 @@
SpacePacketParser::SpacePacketParser(std::vector<uint16_t> validPacketIds)
: validPacketIds(validPacketIds) {}
ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t* buffer, const size_t maxSize,
size_t& startIndex, size_t& foundSize) {
const uint8_t** tempPtr = &buffer;
size_t readLen = 0;
return parseSpacePackets(tempPtr, maxSize, startIndex, foundSize, readLen);
}
ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t** buffer, const size_t maxSize,
size_t& startIndex, size_t& foundSize,
size_t& readLen) {
if (buffer == nullptr or maxSize < 5) {
FoundPacketInfo& packetInfo) {
if (buffer == nullptr or nextStartIdx > maxSize) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "SpacePacketParser::parseSpacePackets: Frame invalid" << std::endl;
#else
@ -26,35 +18,32 @@ ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t** buffer, const
}
const uint8_t* bufPtr = *buffer;
auto verifyLengthField = [&](size_t idx) {
uint16_t lengthField = bufPtr[idx + 4] << 8 | bufPtr[idx + 5];
auto verifyLengthField = [&](size_t localIdx) {
uint16_t lengthField = (bufPtr[localIdx + 4] << 8) | bufPtr[localIdx + 5];
size_t packetSize = lengthField + 7;
startIndex = idx;
ReturnValue_t result = returnvalue::OK;
if (lengthField == 0) {
// Skip whole header for now
foundSize = 6;
result = NO_PACKET_FOUND;
} else if (packetSize + idx > maxSize) {
if (packetSize + localIdx + amountRead > maxSize) {
// Don't increment buffer and read length here, user has to decide what to do
foundSize = packetSize;
packetInfo.sizeFound = packetSize;
return SPLIT_PACKET;
} else {
foundSize = packetSize;
packetInfo.sizeFound = packetSize;
}
*buffer += foundSize;
readLen += idx + foundSize;
*buffer += packetInfo.sizeFound;
packetInfo.startIdx = localIdx + amountRead;
nextStartIdx = localIdx + amountRead + packetInfo.sizeFound;
amountRead = nextStartIdx;
return result;
};
size_t idx = 0;
// Space packet ID as start marker
if (validPacketIds.size() > 0) {
while (idx < maxSize - 5) {
uint16_t currentPacketId = bufPtr[idx] << 8 | bufPtr[idx + 1];
while (idx + amountRead < maxSize - 5) {
uint16_t currentPacketId = (bufPtr[idx] << 8) | bufPtr[idx + 1];
if (std::find(validPacketIds.begin(), validPacketIds.end(), currentPacketId) !=
validPacketIds.end()) {
if (idx + 5 >= maxSize) {
if (idx + amountRead >= maxSize - 5) {
return SPLIT_PACKET;
}
return verifyLengthField(idx);
@ -62,10 +51,10 @@ ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t** buffer, const
idx++;
}
}
startIndex = 0;
foundSize = maxSize;
*buffer += foundSize;
readLen += foundSize;
nextStartIdx = maxSize;
packetInfo.sizeFound = maxSize;
amountRead = maxSize;
*buffer += maxSize;
return NO_PACKET_FOUND;
}
// Assume that the user verified a valid start of a space packet

View File

@ -17,9 +17,10 @@
*/
class SpacePacketParser {
public:
//! The first entry is the index inside the buffer while the second index
//! is the size of the PUS packet starting at that index.
using IndexSizePair = std::pair<size_t, size_t>;
struct FoundPacketInfo {
size_t startIdx = 0;
size_t sizeFound = 0;
};
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SPACE_PACKET_PARSER;
static constexpr ReturnValue_t NO_PACKET_FOUND = MAKE_RETURN_CODE(0x00);
@ -36,44 +37,30 @@ class SpacePacketParser {
SpacePacketParser(std::vector<uint16_t> validPacketIds);
/**
* Parse a given frame for space packets but also increment the given buffer and assign the
* total number of bytes read so far
* Parse a given frame for space packets but also increments the given buffer.
* @param buffer Parser will look for space packets in this buffer
* @param maxSize Maximum size of the buffer
* @param startIndex Start index of a found space packet
* @param foundSize Found size of the space packet
* @param readLen Length read so far. This value is incremented by the number of parsed
* bytes which also includes the size of a found packet
* -@c NO_PACKET_FOUND if no packet was found in the given buffer or the length field is
* invalid. foundSize will be set to the size of the space packet header. buffer and
* readLen will be incremented accordingly.
* -@c SPLIT_PACKET if a packet was found but the detected size exceeds maxSize. foundSize
* will be set to the detected packet size and startIndex will be set to the start of the
* detected packet. buffer and read length will not be incremented but the found length
* will be assigned.
* -@c returnvalue::OK if a packet was found
* @param packetInfo Information about packets found.
* -@c NO_PACKET_FOUND if no packet was found in the given buffer
* -@c SPLIT_PACKET if a packet was found but the detected size exceeds maxSize. packetInfo
* will contain the detected packet size and start index.
* -@c returnvalue::OK if a packet was found. Packet size and start index will be set in
* packetInfo
*/
ReturnValue_t parseSpacePackets(const uint8_t** buffer, const size_t maxSize, size_t& startIndex,
size_t& foundSize, size_t& readLen);
ReturnValue_t parseSpacePackets(const uint8_t** buffer, const size_t maxSize,
FoundPacketInfo& packetInfo);
/**
* Parse a given frame for space packets
* @param buffer Parser will look for space packets in this buffer
* @param maxSize Maximum size of the buffer
* @param startIndex Start index of a found space packet
* @param foundSize Found size of the space packet
* -@c NO_PACKET_FOUND if no packet was found in the given buffer or the length field is
* invalid. foundSize will be set to the size of the space packet header
* -@c SPLIT_PACKET if a packet was found but the detected size exceeds maxSize. foundSize
* will be set to the detected packet size and startIndex will be set to the start of the
* detected packet
* -@c returnvalue::OK if a packet was found
*/
ReturnValue_t parseSpacePackets(const uint8_t* buffer, const size_t maxSize, size_t& startIndex,
size_t& foundSize);
size_t getAmountRead() { return amountRead; }
void reset() {
nextStartIdx = 0;
amountRead = 0;
}
private:
std::vector<uint16_t> validPacketIds;
size_t nextStartIdx = 0;
size_t amountRead = 0;
};
#endif /* FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ */

View File

@ -5,7 +5,7 @@
#include "fsfw/internalerror/InternalErrorReporterIF.h"
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/ipc/messageQueueDefinitions.h"
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
class TmSendHelper {
public:

View File

@ -11,7 +11,7 @@ TmStoreHelper::TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore) :
}
TmStoreHelper::TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore,
TimeStamperIF& timeStamper)
TimeWriterIF& timeStamper)
: tmStore(&tmStore) {
creator.setApid(defaultApid);
creator.setTimeStamper(timeStamper);
@ -59,7 +59,7 @@ ReturnValue_t TmStoreHelper::addPacketToStore() {
SerializeIF::Endianness::NETWORK);
}
void TmStoreHelper::setTimeStamper(TimeStamperIF& timeStamper_) {
void TmStoreHelper::setTimeStamper(TimeWriterIF& timeStamper_) {
creator.setTimeStamper(timeStamper_);
}
@ -67,7 +67,7 @@ void TmStoreHelper::setApid(uint16_t apid) { creator.setApid(apid); }
PusTmCreator& TmStoreHelper::getCreatorRef() { return creator; }
TimeStamperIF* TmStoreHelper::getTimeStamper() const { return creator.getTimestamper(); }
TimeWriterIF* TmStoreHelper::getTimeStamper() const { return creator.getTimestamper(); }
uint16_t TmStoreHelper::getApid() const { return creator.getApid(); }

View File

@ -4,14 +4,14 @@
#include "fsfw/internalerror/InternalErrorReporterIF.h"
#include "fsfw/ipc/MessageQueueMessageIF.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/timemanager/TimeStamperIF.h"
#include "fsfw/timemanager/TimeWriterIF.h"
#include "fsfw/tmtcpacket/pus/tm/PusTmCreator.h"
class TmStoreHelper {
public:
explicit TmStoreHelper(uint16_t defaultApid);
TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore);
TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore, TimeStamperIF& timeStamper);
TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore, TimeWriterIF& timeStamper);
void disableCrcCalculation();
[[nodiscard]] bool crcCalculationEnabled() const;
@ -20,8 +20,8 @@ class TmStoreHelper {
PusTmCreator& getCreatorRef();
void setTimeStamper(TimeStamperIF& timeStamper);
[[nodiscard]] TimeStamperIF* getTimeStamper() const;
void setTimeStamper(TimeWriterIF& timeStamper);
[[nodiscard]] TimeWriterIF* getTimeStamper() const;
[[nodiscard]] StorageManagerIF* getTmStore() const;
void setTmStore(StorageManagerIF& store);

View File

@ -5,7 +5,7 @@
namespace tcverif {
enum VerifFlags : uint8_t {
enum VerificationFlags : uint8_t {
NONE = 0b0000,
ACCEPTANCE = 0b0001,
START = 0b0010,

View File

@ -1,7 +1,7 @@
#ifndef FSFW_TMTCSERVICES_TCHELPERS_H
#define FSFW_TMTCSERVICES_TCHELPERS_H
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tmtcpacket/pus/tc.h"

View File

@ -10,48 +10,33 @@ namespace telemetry {
class DataWithObjectIdPrefix : public SerializeIF {
public:
DataWithObjectIdPrefix(object_id_t objectId, const uint8_t* srcData, size_t srcDataLen)
: objectId(objectId) {
dataWrapper.type = ecss::DataTypes::RAW;
dataWrapper.dataUnion.raw.data = srcData;
dataWrapper.dataUnion.raw.len = srcDataLen;
}
: objectId(objectId), bufAdapter(srcData, srcDataLen), userData(&bufAdapter) {}
DataWithObjectIdPrefix(object_id_t objectId, SerializeIF& serializable) : objectId(objectId) {
dataWrapper.type = ecss::DataTypes::SERIALIZABLE;
dataWrapper.dataUnion.serializable = &serializable;
}
DataWithObjectIdPrefix(object_id_t objectId, const SerializeIF& serializable)
: objectId(objectId), userData(&serializable) {}
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override {
if (*size + getSerializedSize() > maxSize) {
return SerializeIF::BUFFER_TOO_SHORT;
}
if (dataWrapper.type != ecss::DataTypes::RAW) {
if ((dataWrapper.dataUnion.raw.data == nullptr) and (dataWrapper.dataUnion.raw.len > 0)) {
return returnvalue::FAILED;
}
} else if (dataWrapper.type == ecss::DataTypes::SERIALIZABLE) {
if (dataWrapper.dataUnion.serializable == nullptr) {
return returnvalue::FAILED;
}
}
ReturnValue_t result =
SerializeAdapter::serialize(&objectId, buffer, size, maxSize, streamEndianness);
if (result != returnvalue::OK) {
return result;
}
if (dataWrapper.type != ecss::DataTypes::RAW) {
std::memcpy(*buffer, dataWrapper.dataUnion.raw.data, dataWrapper.dataUnion.raw.len);
*buffer += dataWrapper.dataUnion.raw.len;
*size += dataWrapper.dataUnion.raw.len;
} else {
return dataWrapper.dataUnion.serializable->serialize(buffer, size, maxSize, streamEndianness);
if (userData != nullptr) {
return userData->serialize(buffer, size, maxSize, streamEndianness);
}
return returnvalue::OK;
}
[[nodiscard]] size_t getSerializedSize() const override {
return sizeof(objectId) + dataWrapper.getLength();
size_t len = 0;
if (userData != nullptr) {
len += userData->getSerializedSize();
}
return len;
}
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
@ -63,7 +48,8 @@ class DataWithObjectIdPrefix : public SerializeIF {
private:
object_id_t objectId;
ecss::DataWrapper dataWrapper{};
SerialBufferAdapter<uint8_t> bufAdapter;
const SerializeIF* userData = nullptr;
};
} // namespace telemetry

View File

@ -1 +1,3 @@
add_subdirectory(gpio)
target_sources(${LIB_FSFW_NAME} PRIVATE printChar.c)

View File

@ -0,0 +1,10 @@
#include <stdio.h>
#include <stdbool.h>
void __attribute__((weak)) printChar(const char* character, bool errStream) {
if (errStream) {
fprintf(stderr, "%c", *character);
} else {
printf("%c", *character);
}
}

View File

@ -2,7 +2,6 @@
#define MISSION_DEVICES_MGMLIS3MDLHANDLER_H_
#include "devicedefinitions/MgmLIS3HandlerDefs.h"
#include "events/subsystemIdRanges.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "fsfw/globalfunctions/PeriodicOperationDivider.h"

View File

@ -18,6 +18,7 @@ add_subdirectory(power)
add_subdirectory(util)
add_subdirectory(container)
add_subdirectory(osal)
add_subdirectory(pus)
add_subdirectory(serialize)
add_subdirectory(datapoollocal)
add_subdirectory(storagemanager)

View File

@ -4,9 +4,9 @@
#include <array>
#include "fsfw/timemanager/TimeReaderIF.h"
#include "fsfw/timemanager/TimeStamperIF.h"
#include "fsfw/timemanager/TimeWriterIF.h"
class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF {
class CdsShortTimestamperMock : public TimeWriterIF, public TimeReaderIF {
public:
unsigned int serializeCallCount = 0;
unsigned int deserializeCallCount = 0;
@ -61,7 +61,6 @@ class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF {
}
[[nodiscard]] size_t getTimestampSize() const override { return getSerializedSize(); }
ReturnValue_t addTimeStamp(uint8_t *buffer, uint8_t maxSize) override { return 0; }
void reset() {
serializeCallCount = 0;
@ -75,9 +74,6 @@ class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF {
serFailRetval = returnvalue::FAILED;
}
ReturnValue_t readTimeStamp(const uint8_t *buffer, size_t maxSize) override {
return deSerialize(&buffer, &maxSize, SerializeIF::Endianness::NETWORK);
}
timeval &getTime() override { return dummyTime; }
private:

View File

@ -0,0 +1,3 @@
target_sources(${FSFW_TEST_TGT} PRIVATE
testService11.cpp
)

View File

@ -0,0 +1,14 @@
#include <fsfw/pus/Service11TelecommandScheduling.h>
#include <catch2/catch_test_macros.hpp>
#include "objects/systemObjectList.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
TEST_CASE("PUS Service 11", "[pus-srvc11]") {
Service11TelecommandScheduling<13> pusService11(
{objects::PUS_SERVICE_11_TC_SCHEDULER, apid::DEFAULT_APID, pus::PUS_SERVICE_11}, nullptr);
// TODO test something...
}

View File

@ -64,7 +64,8 @@ TEST_CASE("Serial Buffer Adapter", "[single-file]") {
SECTION("Test set buffer function") {
SerialBufferAdapter<uint8_t> tv_serial_buffer_adapter_loc =
SerialBufferAdapter<uint8_t>((uint8_t*)nullptr, 0, true);
tv_serial_buffer_adapter_loc.setBuffer(test_serial_buffer.data(), test_serial_buffer.size());
tv_serial_buffer_adapter_loc.setConstBuffer(test_serial_buffer.data(),
test_serial_buffer.size());
serialized_size = 0;
arrayPtr = testArray.data();
SerializeAdapter::serialize(&test_value_bool, &arrayPtr, &serialized_size, testArray.size(),

View File

@ -71,7 +71,7 @@ TEST_CASE("PUS TC Creator", "[pus-tc-creator]") {
SECTION("Test with Application Data Raw") {
auto& params = creator.getPusParams();
std::array<uint8_t, 3> data{1, 2, 3};
params.dataWrapper.setRawData({data.data(), data.size()});
params.setRawAppData(data.data(), data.size());
// To get correct size information, the SP length field needs to be updated automatically
REQUIRE(creator.getSerializedSize() == 13);
creator.updateSpLengthField();

View File

@ -44,9 +44,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
REQUIRE(creator.getSubService() == 2);
REQUIRE(creator.getService() == 17);
auto& params = creator.getParams();
REQUIRE(params.dataWrapper.type == ecss::DataTypes::RAW);
REQUIRE(params.dataWrapper.dataUnion.raw.data == nullptr);
REQUIRE(params.dataWrapper.dataUnion.raw.len == 0);
REQUIRE(params.sourceData == nullptr);
REQUIRE(tmHelper.sendCounter == 0);
REQUIRE(tmHelper.storeAndSendTmPacket() == returnvalue::OK);
REQUIRE(tmHelper.sendCounter == 1);
@ -65,9 +63,9 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
REQUIRE(tmHelper.prepareTmPacket(2, data.data(), data.size()) == returnvalue::OK);
auto& creator = storeHelper.getCreatorRef();
auto& params = creator.getParams();
REQUIRE(params.dataWrapper.type == ecss::DataTypes::RAW);
REQUIRE(params.dataWrapper.dataUnion.raw.data == data.data());
REQUIRE(params.dataWrapper.dataUnion.raw.len == data.size());
REQUIRE(params.sourceData != nullptr);
REQUIRE(params.sourceData->getSerializedSize() == data.size());
REQUIRE(params.adapter.getConstBuffer() == data.data());
}
SECTION("Serializable Helper") {
@ -75,8 +73,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
REQUIRE(tmHelper.prepareTmPacket(2, simpleSer) == returnvalue::OK);
auto& creator = storeHelper.getCreatorRef();
auto& params = creator.getParams();
REQUIRE(params.dataWrapper.type == ecss::DataTypes::SERIALIZABLE);
REQUIRE(params.dataWrapper.dataUnion.serializable == &simpleSer);
REQUIRE(params.sourceData == &simpleSer);
}
SECTION("Object ID prefix Helper") {
@ -86,8 +83,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
REQUIRE(tmHelper.prepareTmPacket(2, dataWithObjId) == returnvalue::OK);
auto& creator = storeHelper.getCreatorRef();
auto& params = creator.getParams();
REQUIRE(params.dataWrapper.type == ecss::DataTypes::SERIALIZABLE);
REQUIRE(params.dataWrapper.dataUnion.serializable == &dataWithObjId);
REQUIRE(params.sourceData == &dataWithObjId);
}
// TODO: Error handling