Compare commits

...

285 Commits

Author SHA1 Message Date
f805667779 afmt 2022-10-28 10:16:59 +02:00
bddc7a7ca6 minimal first version 2022-10-26 13:22:16 +02:00
11a22577be defaultconfig did not build anymore 2022-10-25 11:28:13 +02:00
94f1f1f908 Merge pull request 'Refactor TM and TC acceptor interfaces' (#684) from mueller/refactor-accepts-tc-tm-if into development
Reviewed-on: fsfw/fsfw#684
2022-10-24 17:10:03 +02:00
955579c856 Merge branch 'development' into mueller/refactor-accepts-tc-tm-if 2022-10-24 14:57:38 +02:00
c6585c8645 Merge pull request 'important bugfix for linux i2c device com IF' (#700) from eive/fsfw:mueller/i2c-com-if-bugfix into development
Reviewed-on: fsfw/fsfw#700
2022-10-24 14:35:01 +02:00
d8a4675842 bump changelog 2022-10-24 14:30:14 +02:00
1164c21ddd iter not a member anymore, more bugfixes 2022-10-24 14:23:43 +02:00
77b1a85b47 important bugfix for i2c device com IF 2022-10-20 14:24:40 +02:00
f3e9277e59 Merge branch 'development' into mueller/refactor-accepts-tc-tm-if 2022-10-10 15:45:05 +02:00
d592f1ecbc Merge pull request 'Minor API tweak' (#689) from eive/fsfw:mueller/smaller-tweaks into development
Reviewed-on: fsfw/fsfw#689
2022-10-10 15:10:57 +02:00
6ec18171a8 Merge pull request 'now that doc server is up, remove markdown files' (#688) from mueller/remove-markdown-docs into development
Reviewed-on: fsfw/fsfw#688
2022-10-10 15:04:11 +02:00
518dcdef4b Merge branch 'development' into mueller/smaller-tweaks 2022-10-10 15:03:04 +02:00
d9730032fd Merge pull request 'DHB Countdown Bug' (#693) from eive/fsfw:mueller/dhb-countdown-bug into development
Reviewed-on: fsfw/fsfw#693
2022-10-10 14:55:43 +02:00
b3ac72b7db Merge pull request 'missing retval conv' (#697) from mueller/missing-retval-conversion into development
Reviewed-on: fsfw/fsfw#697
2022-10-10 14:54:26 +02:00
cd0cb43412 Merge branch 'development' into mueller/missing-retval-conversion 2022-10-10 14:46:10 +02:00
32c12b3dbf Merge pull request 'small fix for helper' (#698) from mueller/small-helper-script-fix into development
Reviewed-on: fsfw/fsfw#698
2022-10-10 14:43:59 +02:00
3e9acf476e Merge branch 'development' into mueller/small-helper-script-fix 2022-10-10 14:25:49 +02:00
99101ce2bf Merge pull request 'hotfix' (#699) from eive/fsfw:mueller/dhb-some-more-fixes into development
Reviewed-on: fsfw/fsfw#699
2022-10-10 14:22:30 +02:00
6b991045f7 Merge branch 'development' into mueller/smaller-tweaks 2022-10-10 13:41:47 +02:00
337cb0d6c9 hotfix 2022-10-10 10:21:17 +02:00
c283e0c988 okay this is correct 2022-10-04 11:02:08 +02:00
448d20f3bd small fix for helper 2022-10-04 10:55:46 +02:00
2316728d74 Merge branch 'development' into mueller/dhb-countdown-bug 2022-10-04 10:53:26 +02:00
6f562e5f3e missing retval conv 2022-10-04 10:25:58 +02:00
176f243194 Merge pull request 'Switch to new documentation server' (#694) from mohr/documentation_ci into development
Reviewed-on: fsfw/fsfw#694
2022-09-30 15:05:16 +02:00
d964fa2107 Merge branch 'development' into mohr/documentation_ci 2022-09-30 14:50:20 +02:00
7b5ae6a445 done? 2022-09-30 14:40:59 +02:00
8e362a000c Revert "one last check"
This reverts commit 7877776e24.
2022-09-30 14:36:25 +02:00
7877776e24 one last check 2022-09-30 14:34:25 +02:00
3de0ae5a48 DHB bug 2022-09-29 17:22:44 +02:00
95ac53c417 Merge branch 'development' into mueller/smaller-tweaks 2022-09-26 14:40:29 +02:00
62f638a3d2 Merge pull request 'doc corrections' (#687) from mueller/doc-corrections into development
Reviewed-on: fsfw/fsfw#687
2022-09-26 14:38:39 +02:00
bd64591f30 Merge branch 'development' into mueller/smaller-tweaks 2022-09-26 14:34:38 +02:00
e6a877f048 Merge branch 'development' into mueller/doc-corrections 2022-09-26 14:26:48 +02:00
ea8c557ee8 Merge pull request 'better error printout' (#686) from eive/fsfw:mueller/local-pool-obj-base-better-warning into development
Reviewed-on: fsfw/fsfw#686
2022-09-26 14:26:20 +02:00
0bdd780f82 Merge branch 'development' into mueller/doc-corrections 2022-09-26 14:17:24 +02:00
9ec397c8b7 Merge branch 'development' into mueller/local-pool-obj-base-better-warning 2022-09-26 14:17:19 +02:00
c54d9d7ba6 add some tests 2022-09-26 14:15:11 +02:00
30c03c110c Merge pull request 'include correction' (#683) from mueller/service-interface-include-correction into development
Reviewed-on: fsfw/fsfw#683
2022-09-26 14:14:57 +02:00
69f1be263a Merge branch 'development' into mueller/local-pool-obj-base-better-warning 2022-09-26 14:10:21 +02:00
c7b5309dcb Merge branch 'development' into mueller/service-interface-include-correction 2022-09-26 14:08:38 +02:00
775d5632de update to ssh connection to doc server 2022-09-23 20:26:45 +02:00
4f3361eb2b another ci check 2022-09-23 18:33:47 +02:00
9e6c1d60e5 another ci check 2022-09-23 17:54:41 +02:00
12d0c23c13 Revert "testing deployment of documentation"
This reverts commit 5488ee715f.
2022-09-23 17:31:17 +02:00
5c3bb13834 Revert "testing deployment of both development and master doc"
This reverts commit c0000a8635.
2022-09-23 17:31:07 +02:00
292fe3e5e4 forgot epilog file 2022-09-23 17:11:57 +02:00
33530f2819 adding Impressum and Datenschutz to lcov output 2022-09-23 17:04:35 +02:00
c0000a8635 testing deployment of both development and master doc 2022-09-23 14:14:10 +02:00
5488ee715f testing deployment of documentation 2022-09-23 14:07:12 +02:00
0fea22d031 switching to rsync and deploying to web documentation 2022-09-23 14:06:28 +02:00
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
558550ecb9 Merge branch 'development' into mueller/smaller-tweaks 2022-09-16 18:37:39 +02:00
72172a972b update changelog 2022-09-16 18:24:23 +02:00
b4b11ebd3b fixes and tweaks 2022-09-16 18:20:42 +02:00
bcbbc9763a markdown update not required, will be removed 2022-09-15 14:00:01 +02:00
0042372cb6 now that doc server is up, remove markdown files 2022-09-15 13:58:13 +02:00
8dea13742f update rst file 2022-09-15 13:57:39 +02:00
0f027d29d2 doc corrections 2022-09-15 13:53:42 +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
ce7146e468 printout tweak 2022-09-15 13:40:12 +02:00
a681a4a797 better error printout 2022-09-15 13:38:38 +02:00
83b7b8707c Merge remote-tracking branch 'origin/development' into mueller/refactor-accepts-tc-tm-if 2022-09-15 11:01:19 +02:00
4002b74ea2 Merge branch 'development' into mueller/service-interface-include-correction 2022-09-15 11:01:06 +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
8501477a78 Merge remote-tracking branch 'origin/development' into mueller/refactor-accepts-tc-tm-if 2022-09-15 10:48:42 +02:00
6eea711d9f Merge branch 'development' into mueller/service-interface-include-correction 2022-09-15 10:48:28 +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
1efc0d2855 update changelog 2022-09-15 10:38:40 +02:00
237e29cc59 all necessary modifications 2022-09-14 20:21:03 +02:00
0849c8a08d adding files manually 2022-09-14 20:10:41 +02:00
9d626e0a5d include correction 2022-09-14 19:59:02 +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
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
a46d8c34d9 small changelog update 2022-08-22 16:37:53 +02:00
ba5c6410d6 tests running again 2022-08-22 16:23:36 +02:00
10f34e5a48 Merge remote-tracking branch 'origin/development' into mueller/refactor-tmtc-stack-with-retval-refactoring 2022-08-22 15:57:22 +02:00
dab1b1d067 apply auto-formatter 2022-08-22 15:02:53 +02:00
2a4ab0af7b Merge branch 'mueller/refactor-tmtc-stack' into mueller/refactor-tmtc-stack-with-retval-refactoring 2022-08-22 14:17:24 +02:00
ff6de8e378 important bugfix for verif reporter 2022-08-18 11:20:27 +02:00
239d053562 update changelog 2022-08-16 17:23:10 +02:00
875174c4ad better name for global object 2022-08-16 17:17:45 +02:00
8fd8a37f59 flip verif reporter ctor arguments 2022-08-16 17:10:48 +02:00
1037102349 merge retval refactoring 2022-08-16 01:08:26 +02:00
9e064fe800 fix unittests 2022-08-15 19:16:31 +02:00
d7ec04bf4b Merge remote-tracking branch 'origin/development' into mueller/refactor-tmtc-stack 2022-08-15 19:05:50 +02:00
9796abfc7d Merge branch 'development' into mueller/refactor-tmtc-stack 2022-08-09 13:06:08 +02:00
da106fd96f do not use TC info for failed TC retrieval 2022-07-29 10:23:59 +02:00
fc3412fa35 set sec header flag and add unit test for it 2022-07-28 15:13:27 +02:00
8f6f0e1d45 some more fail tests 2022-07-28 13:42:34 +02:00
1b5fa2a8fa test no crc generation 2022-07-28 13:37:07 +02:00
cb118176a0 completed ZcWriter unittests 2022-07-28 13:24:50 +02:00
30ba9ab916 some more fixes 2022-07-28 13:00:53 +02:00
fb4ba487b5 Merge remote-tracking branch 'origin/mueller/expand-retval-if' into mueller/refactor-tmtc-stack 2022-07-28 12:55:42 +02:00
72bc5d4d60 add tm zc test 2022-07-28 12:52:20 +02:00
b485afea57 Simple SerializeIF adaptions
- Returns serialized or deserialized size
2022-07-27 21:29:05 +02:00
5bb7023ff3 improvements for creator API 2022-07-27 21:11:12 +02:00
85dbef20b0 update serialize IF 2022-07-27 21:07:34 +02:00
93acac02f5 tests running again 2022-07-27 21:06:23 +02:00
7e8afcc12f remove nullptr check 2022-07-27 20:37:21 +02:00
f03b7cd660 another bugfix in CSB 2022-07-27 20:10:15 +02:00
d641d63531 set queue of tm send helper 2022-07-27 19:56:11 +02:00
4e571e5082 some more minor fixes 2022-07-27 19:40:54 +02:00
356d778743 afmt 2022-07-27 18:03:17 +02:00
0a38d2e22d small bugfix 2022-07-27 17:56:16 +02:00
234ccdf764 send time stampers properly now 2022-07-27 17:48:59 +02:00
f591b9793c pass timeReader to Pus ZC writer 2022-07-27 17:33:39 +02:00
c5ad9b5fa9 switch off debugging switches 2022-07-27 17:13:42 +02:00
083d08ae2a various bugs and improvements 2022-07-27 17:00:43 +02:00
740644f2c8 updates for PusDistributor 2022-07-27 14:40:51 +02:00
059fb10558 add helper methods to disable crc calculation 2022-07-27 11:41:06 +02:00
86692e202d this gets rid of some warnings 2022-07-27 11:35:35 +02:00
064b195c75 some of the deprecation warnings run amok 2022-07-27 11:33:19 +02:00
18ee2ab903 example compiles again 2022-07-27 11:26:47 +02:00
9eb652e585 some printout fixes 2022-07-27 10:49:49 +02:00
681738dcc6 PSB unittests complete 2022-07-26 19:08:12 +02:00
152c01b2ec psb unittests almost complete 2022-07-26 18:58:36 +02:00
8bf0fb9885 test auto-initializers 2022-07-26 18:46:28 +02:00
1954ce0ea4 default PUS receiver set automatically now 2022-07-26 17:41:10 +02:00
d98b79cf5e adapt PSB so it can be unittested properly 2022-07-26 16:49:46 +02:00
f14c812aff removed some obsolete code 2022-07-26 14:14:00 +02:00
146a0e3828 created PSB mock 2022-07-26 14:10:24 +02:00
75c824ec80 add new VerificationReporterIF 2022-07-26 13:59:09 +02:00
332e9dbfd5 add new tests 2022-07-26 11:19:36 +02:00
f1c37203a4 some more API improvements and replacements 2022-07-26 11:14:40 +02:00
500a5602bd added additional TM store and send helper 2022-07-26 11:09:57 +02:00
4ed028000d Merge branch 'mueller/expand-retval-if' into mueller/refactor-tmtc-stack 2022-07-26 10:29:51 +02:00
bdf71d4e66 add new HasReturnvaluesIF features 2022-07-26 10:21:16 +02:00
e48b6f1432 possible double delete 2022-07-25 22:36:53 +02:00
747243684d more leaks 2022-07-25 22:29:18 +02:00
db33f9cc7e maybe this teardown fixes the leak 2022-07-25 22:22:08 +02:00
c12669fe50 this should fix the mmeory leak 2022-07-25 22:10:20 +02:00
6d00fc65c0 fix memory leak 2022-07-25 21:08:04 +02:00
7d87274844 add old api but mark it deprecated 2022-07-25 20:53:18 +02:00
c83f75c515 some more tests using TM send helper 2022-07-25 20:41:01 +02:00
586993c081 completed send helper tests 2022-07-25 20:31:06 +02:00
a88f767cca all tests running again 2022-07-25 19:49:19 +02:00
935e135f1c normal queue sufficient 2022-07-25 19:42:05 +02:00
6d0fa36f8a cleaning up message queue mock and subscription API 2022-07-25 19:36:56 +02:00
5fd5d488ff Merge remote-tracking branch 'origin/development' into mueller/refactor-tmtc-stack 2022-07-25 14:57:28 +02:00
9ee6da47e9 improving mocks 2022-07-25 14:31:57 +02:00
1a7d7b172b set up new internal error reporter mock 2022-07-25 14:04:06 +02:00
36e3956efb finished tm store helper tests 2022-07-25 13:39:07 +02:00
ca1e921b94 Merge branch 'mueller/expand-serialize-if' into mueller/refactor-tmtc-stack 2022-07-25 11:35:32 +02:00
e2ad37e3e6 more ref replacements 2022-07-25 11:26:45 +02:00
973d4ee8a5 some more ref replacements 2022-07-25 11:24:13 +02:00
899d021e00 using uint32_t as store_address requires explicit cast 2022-07-25 11:15:45 +02:00
4989bd0f02 fixes for Linux OSAL clock 2022-07-25 10:56:19 +02:00
832367fb30 replace some API components with references 2022-07-25 10:50:52 +02:00
63ee88af17 added base for tm store test 2022-07-25 10:38:44 +02:00
4921527022 replace c include 2022-07-25 10:31:49 +02:00
f0c8fd2688 some renaming 2022-07-25 10:24:43 +02:00
d474c4a7ee store helper 2022-07-23 11:43:48 +02:00
f629d60aaf Merge branch 'mueller/expand-serialize-if' into mueller/refactor-tmtc-stack 2022-07-23 11:15:20 +02:00
b66fd63cb4 remove doubly defines 2022-07-23 10:29:19 +02:00
fd55de9e95 Merge branch 'mueller/expand-serialize-if' into mueller/refactor-tmtc-stack 2022-07-23 10:28:13 +02:00
55a238d553 extended serialize if further 2022-07-23 10:24:56 +02:00
9ccd9fd775 Merge branch 'mueller/expand-serialize-if' into mueller/refactor-tmtc-stack 2022-07-23 10:07:10 +02:00
99aaf7068d some tests 2022-07-23 10:05:57 +02:00
c9d37e8d62 Merge branch 'mueller/expand-serialize-if' into mueller/refactor-tmtc-stack 2022-07-23 10:05:14 +02:00
133894f4ba add basic CCSDS tests 2022-07-22 18:46:58 +02:00
cb05329dd9 completed baseline PUS TM unittests 2022-07-22 18:31:00 +02:00
b350018cad completed basic test set 2022-07-22 18:22:35 +02:00
2dfbce6174 start TM reader unittests 2022-07-22 17:11:55 +02:00
cecaec6007 PUS TM creator tests done 2022-07-22 17:09:44 +02:00
f28b9ea61b APID getter bugfix 2022-07-22 16:41:32 +02:00
9275ccb79b added some missing implementations 2022-07-22 16:09:18 +02:00
67776241de verify successfull TM serialization 2022-07-22 16:06:31 +02:00
bfee4fd90a add empty test files 2022-07-21 19:16:44 +02:00
0dfaba81f9 finished basic TC unittests 2022-07-21 19:10:15 +02:00
affde6bad5 rename namespace 2022-07-21 18:21:10 +02:00
0981ee6f7e minor changes, virtual dtors added 2022-07-21 18:17:37 +02:00
61bc867bed delete code which is not used anymore 2022-07-21 17:57:31 +02:00
5af3138e81 fnished PUS TC creator unittests 2022-07-21 17:48:11 +02:00
08e0b0f1a0 added sp reader unittests 2022-07-21 14:40:00 +02:00
23f264096c delete a few old classes 2022-07-21 14:05:31 +02:00
e5ee96259d some fixes 2022-07-21 13:48:58 +02:00
d8b6cb39ac various bugfixes and improvements 2022-07-21 11:34:11 +02:00
be35bd53a6 switched to new tmtc stack API 2022-07-20 22:21:15 +02:00
9860061fc6 create new TmSendHelper 2022-07-20 11:45:50 +02:00
d80941514f start refactoring PUS TM handling 2022-07-20 11:43:16 +02:00
6c636661b6 a lot of refactoring 2022-07-19 18:13:25 +02:00
5fffbd4a90 start PUS TC refactoring 2022-07-18 18:36:41 +02:00
95b476d4bd start ccsds reader unittests 2022-07-18 16:21:00 +02:00
3d2af203f2 finished creator unittests 2022-07-18 16:18:04 +02:00
ddf38b65c3 apply auto-formatter 2022-07-18 16:07:26 +02:00
490a80e49f Merge remote-tracking branch 'origin/development' into mueller/refactor-tmtc-stack 2022-07-18 15:26:31 +02:00
e4d7182d93 update changelog 2022-07-18 14:58:47 +02:00
7e2fdc06cd hmm this is problematic 2022-07-18 14:05:43 +02:00
3c72a42ce1 added basic sp creator test 2022-07-18 13:51:02 +02:00
0c5f623780 additional ctor for space packet creator 2022-07-18 10:53:55 +02:00
d7a2eada94 add space packet creator class 2022-07-18 10:42:56 +02:00
546e173cef add new PUS TC IF 2022-07-18 10:29:39 +02:00
0a7f2c6646 refactored space packet interface 2022-07-18 10:20:26 +02:00
320 changed files with 7396 additions and 5483 deletions

View File

@ -8,17 +8,60 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [unreleased]
## Changes
# [v6.0.0]
- Removed `HasReturnvaluesIF` class in favor of `returnvalue` namespace with `OK` and `FAILED`
constants.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/659
## Fixes
- I2C Bugfixes: Do not keep iterator as member and fix some incorrect handling with the iterator.
Also properly reset the reply size for successfull transfers and erroneous transfers.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/700
- 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
- Add new `UnsignedByteField` class
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/660
## Changes
- Remove default secondary header argument for
`uint16_t getTcSpacePacketIdFromApid(uint16_t apid, bool secondaryHeaderFlag)` and
`uint16_t getTmSpacePacketIdFromApid(uint16_t apid, bool secondaryHeaderFlag)`
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/689
- Removed `HasReturnvaluesIF` class in favor of `returnvalue` namespace with `OK` and `FAILED`
constants.
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/659
- Overhaul of the TMTC stack, including various changes and improvements
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
- Improvements for `AcceptsTelemetryIF` and `AcceptsTelecommandsIF`:
- Make functions `const` where it makes sense
- Add `const char* getName const` abstract function
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/684
# [v5.0.0] 25.07.2022
## Changes

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:
@ -326,7 +326,8 @@ if(FSFW_BUILD_TESTS)
"/usr/local/include/*"
"*/fsfw_tests/*"
"*/catch2-src/*"
"*/fsfw_hal/*")
"*/fsfw_hal/*"
"unittests/*")
endif()
target_link_options(${FSFW_TEST_TGT} PRIVATE -fprofile-arcs
@ -344,8 +345,15 @@ if(FSFW_BUILD_TESTS)
DEPENDENCIES ${FSFW_TEST_TGT})
else()
setup_target_for_coverage_lcov(
NAME ${FSFW_TEST_TGT}_coverage EXECUTABLE ${FSFW_TEST_TGT}
DEPENDENCIES ${FSFW_TEST_TGT})
NAME
${FSFW_TEST_TGT}_coverage
EXECUTABLE
${FSFW_TEST_TGT}
DEPENDENCIES
${FSFW_TEST_TGT}
GENHTML_ARGS
--html-epilog
${CMAKE_SOURCE_DIR}/unittests/lcov_epilog.html)
endif()
endif()
endif()
@ -360,7 +368,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,11 +5,13 @@ 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 && \
git checkout v3.1.0 && \
cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
cmake --build build/ --target install
@ -18,3 +20,10 @@ RUN git clone https://github.com/ETLCPP/etl.git && \
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 = 'build-tests'
BUILDDIR = 'cmake-build-tests'
DOCDDIR = 'cmake-build-documentation'
}
agent {
docker { image 'fsfw-ci:d3'}
docker {
image 'fsfw-ci:d6'
args '--network host'
}
}
stages {
stage('Clean') {
@ -39,5 +43,43 @@ 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 'rsync -r --delete docs/sphinx/* buildfix@documentation.irs.uni-stuttgart.de:/fsfw/development'
}
}
dir(BUILDDIR) {
sshagent(credentials: ['documentation-buildfix']) {
sh 'rsync -r --delete fsfw-tests_coverage/* buildfix@documentation.irs.uni-stuttgart.de:/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 'rsync -r --delete docs/sphinx/* buildfix@documentation.irs.uni-stuttgart.de:/fsfw/master'
}
}
dir(BUILDDIR) {
sshagent(credentials: ['documentation-buildfix']) {
sh 'rsync -r --delete fsfw-tests_coverage/* buildfix@documentation.irs.uni-stuttgart.de:/fsfw/coverage/master'
}
}
}
}
}
}

View File

@ -1,40 +0,0 @@
Configuring the FSFW
======
The FSFW can be configured via the `fsfwconfig` folder. A template folder has
been provided to have a starting point for this. The folder should be added
to the include path. The primary configuration file is the `FSFWConfig.h` folder. Some
of the available options will be explained in more detail here.
# Auto-Translation of Events
The FSFW allows the automatic translation of events, which allows developers to track triggered
events directly via console output. Using this feature requires:
1. `FSFW_OBJ_EVENT_TRANSLATION` set to 1 in the configuration file.
2. Special auto-generated translation files which translate event IDs and object IDs into
human readable strings. These files can be generated using the
[modgen Python scripts](https://git.ksat-stuttgart.de/source/modgen.git).
3. The generated translation files for the object IDs should be named `translatesObjects.cpp`
and `translateObjects.h` and should be copied to the `fsfwconfig/objects` folder
4. The generated translation files for the event IDs should be named `translateEvents.cpp` and
`translateEvents.h` and should be copied to the `fsfwconfig/events` folder
An example implementations of these translation file generators can be found as part
of the [SOURCE project here](https://git.ksat-stuttgart.de/source/sourceobsw/-/tree/development/generators)
or the [FSFW example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example_public/src/branch/master/generators)
## Configuring the Event Manager
The number of allowed subscriptions can be modified with the following
parameters:
``` c++
namespace fsfwconfig {
//! Configure the allocated pool sizes for the event manager.
static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240;
static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120;
static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
}
```

View File

@ -1 +0,0 @@
## Controllers

View File

@ -1,55 +0,0 @@
## FSFW Core Modules
These core modules provide the most important functionalities of the
Flight Software Framework
### Clock
* This is a class of static functions that can be used at anytime
* Leap Seconds must be set if any time conversions from UTC to other times is used
### ObjectManager
* Must be created during program startup
* The component which handles all references. All SystemObjects register at this component.
* Any SystemObject needs to have a unique ObjectId. Those can be managed like objects::framework_objects.
* A reference to an object can be get by calling the following function. T must be the specific Interface you want to call.
A nullptr check of the returning Pointer must be done. This function is based on Run-time type information.
```cpp
template <typename T> T* ObjectManagerIF::get( object_id_t id )
```
* A typical way to create all objects on startup is a handing a static produce function to the
ObjectManager on creation. By calling objectManager->initialize() the produce function will be
called and all SystemObjects will be initialized afterwards.
### Event Manager
* Component which allows routing of events
* Other objects can subscribe to specific events, ranges of events or all events of an object.
* Subscriptions can be done during runtime but should be done during initialization
* Amounts of allowed subscriptions can be configured in `FSFWConfig.h`
### Health Table
* A component which holds every health state
* Provides a thread safe way to access all health states without the need of message exchanges
### Stores
* The message based communication can only exchange a few bytes of information inside the message
itself. Therefore, additional information can be exchanged with Stores. With this, only the
store address must be exchanged in the message.
* Internally, the FSFW uses an IPC Store to exchange data between processes. For incoming TCs a TC
Store is used. For outgoing TM a TM store is used.
* All of them should use the Thread Safe Class storagemanager/PoolManager
### Tasks
There are two different types of tasks:
* The PeriodicTask just executes objects that are of type ExecutableObjectIF in the order of the
insertion to the Tasks.
* FixedTimeslotTask executes a list of calls in the order of the given list. This is intended for
DeviceHandlers, where polling should be in a defined order. An example can be found in
`defaultcfg/fsfwconfig/pollingSequence` folder

View File

@ -1 +0,0 @@
## Device Handlers

View File

@ -1,135 +0,0 @@
High-level overview
======
# Structure
The general structure is driven by the usage of interfaces provided by objects.
The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be
widely available, even with older compilers.
The FSFW uses dynamic allocation during the initialization but provides static containers during runtime.
This simplifies the instantiation of objects and allows the usage of some standard containers.
Dynamic Allocation after initialization is discouraged and different solutions are provided in the
FSFW to achieve that. The fsfw uses run-time type information but exceptions are not allowed.
# Failure Handling
Functions should return a defined `ReturnValue_t` to signal to the caller that something has
gone wrong. Returnvalues must be unique. For this the function `returnvalue::makeCode`
or the macro `MAKE_RETURN` can be used. The `CLASS_ID` is a unique id for that type of object.
See `returnvalues/FwClassIds` folder. The user can add custom `CLASS_ID`s via the
`fsfwconfig` folder.
# OSAL
The FSFW provides operation system abstraction layers for Linux, FreeRTOS and RTEMS.
The OSAL provides periodic tasks, message queues, clocks and semaphores as well as mutexes.
The [OSAL README](doc/README-osal.md#top) provides more detailed information on provided components
and how to use them.
# Core Components
The FSFW has following core components. More detailed informations can be found in the
[core component section](doc/README-core.md#top):
1. Tasks: Abstraction for different (periodic) task types like periodic tasks or tasks
with fixed timeslots
2. ObjectManager: This module stores all `SystemObjects` by mapping a provided unique object ID
to the object handles.
3. Static Stores: Different stores are provided to store data of variable size (like telecommands
or small telemetry) in a pool structure without using dynamic memory allocation.
These pools are allocated up front.
3. Clock: This module provided common time related functions
4. EventManager: This module allows routing of events generated by `SystemObjects`
5. HealthTable: A component which stores the health states of objects
# Static IDs in the framework
Some parts of the framework use a static routing address for communication.
An example setup of ids can be found in the example config in `defaultcft/fsfwconfig/objects`
inside the function `Factory::setStaticFrameworkObjectIds()`.
# Events
Events are tied to objects. EventIds can be generated by calling the Macro MAKE_EVENT.
This works analog to the returnvalues. Every object that needs own EventIds has to get a
unique SUBSYSTEM_ID. Every SystemObject can call triggerEvent from the parent class.
Therefore, event messages contain the specific EventId and the objectId of the object that
has triggered.
# Internal Communication
Components communicate mostly via Messages through Queues.
Those queues are created by calling the singleton `QueueFactory::instance()->create()` which
will create `MessageQueue` instances for the used OSAL.
# External Communication
The external communication with the mission control system is mostly up to the user implementation.
The FSFW provides PUS Services which can be used to but don't need to be used.
The services can be seen as a conversion from a TC to a message based communication and back.
## TMTC Communication
The FSFW provides some components to facilitate TMTC handling via the PUS commands.
For example, a UDP or TCP PUS server socket can be opened on a specific port using the
files located in `osal/common`. The FSFW example uses this functionality to allow sending telecommands
and receiving telemetry using the [TMTC commander application](https://github.com/spacefisch/tmtccmd).
Simple commands like the PUS Service 17 ping service can be tested by simply running the
`tmtc_client_cli.py` or `tmtc_client_gui.py` utility in
the [example tmtc folder](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example_public/src/branch/master/tmtc)
while the `fsfw_example` application is running.
More generally, any class responsible for handling incoming telecommands and sending telemetry
can implement the generic `TmTcBridge` class located in `tmtcservices`. Many applications
also use a dedicated polling task for reading telecommands which passes telecommands
to the `TmTcBridge` implementation.
## CCSDS Frames, CCSDS Space Packets and PUS
If the communication is based on CCSDS Frames and Space Packets, several classes can be used to
distributed the packets to the corresponding services. Those can be found in `tcdistribution`.
If Space Packets are used, a timestamper has to be provided by the user.
An example can be found in the `timemanager` folder, which uses `CCSDSTime::CDS_short`.
# Device Handlers
DeviceHandlers are another important component of the FSFW.
The idea is, to have a software counterpart of every physical device to provide a simple mode,
health and commanding interface. By separating the underlying Communication Interface with
`DeviceCommunicationIF`, a device handler (DH) can be tested on different hardware.
The DH has mechanisms to monitor the communication with the physical device which allow
for FDIR reaction. Device Handlers can be created by implementing `DeviceHandlerBase`.
A standard FDIR component for the DH will be created automatically but can
be overwritten by the user. More information on DeviceHandlers can be found in the
related [documentation section](doc/README-devicehandlers.md#top).
# Modes and Health
The two interfaces `HasModesIF` and `HasHealthIF` provide access for commanding and monitoring
of components. On-board Mode Management is implement in hierarchy system.
DeviceHandlers and Controllers are the lowest part of the hierarchy.
The next layer are Assemblies. Those assemblies act as a component which handle
redundancies of handlers. Assemblies share a common core with the next level which
are the Subsystems.
Those Assemblies are intended to act as auto-generated components from a database which describes
the subsystem modes. The definitions contain transition and target tables which contain the DH,
Assembly and Controller Modes to be commanded.
Transition tables contain as many steps as needed to reach the mode from any other mode, e.g. a
switch into any higher AOCS mode might first turn on the sensors, than the actuators and the
controller as last component.
The target table is used to describe the state that is checked continuously by the subsystem.
All of this allows System Modes to be generated as Subsystem object as well from the same database.
This System contains list of subsystem modes in the transition and target tables.
Therefore, it allows a modular system to create system modes and easy commanding of those, because
only the highest components must be commanded.
The health state represents if the component is able to perform its tasks.
This can be used to signal the system to avoid using this component instead of a redundant one.
The on-board FDIR uses the health state for isolation and recovery.
# Unit Tests
Unit Tests are provided in the unittest folder. Those use the catch2 framework but do not include
catch2 itself. More information on how to run these tests can be found in the separate
[`fsfw_tests` reposoitory](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_tests)

View File

@ -1,174 +0,0 @@
## Local Data Pools Developer Information
The following text is targeted towards mission software developers which would like
to use the local data pools provided by the FSFW to store data like sensor values so they can be
used by other software objects like controllers as well. If a custom class should have a local
pool which can be used by other software objects as well, following steps have to be performed:
1. Create a `LocalDataPoolManager` member object in the custom class
2. Implement the `HasLocalDataPoolIF` with specifies the interface between the local pool manager
and the class owning the local pool.
The local data pool manager is also able to process housekeeping service requests in form
of messages, generate periodic housekeeping packet, generate notification and snapshots of changed
variables and datasets and process notifications and snapshots coming from other objects.
The two former tasks are related to the external interface using telemetry and telecommands (TMTC)
while the later two are related to data consumers like controllers only acting on data change
detected by the data creator instead of checking the data manually each cycle. Two important
framework classes `DeviceHandlerBase` and `ExtendedControllerBase` already perform the two steps
shown above so the steps required are altered slightly.
### Storing and Accessing pool data
The pool manager is responsible for thread-safe access of the pool data, but the actual
access to the pool data from the point of view of a mission software developer happens via proxy
classes like pool variable classes. These classes store a copy
of the pool variable with the matching datatype and copy the actual data from the local pool
on a `read` call. Changed variables can then be written to the local pool with a `commit` call.
The `read` and `commit` calls are thread-safe and can be called concurrently from data creators
and data consumers. Generally, a user will create a dataset class which in turn groups all
cohesive pool variables. These sets simply iterator over the list of variables and call the
`read` and `commit` functions of each variable. The following diagram shows the
high-level architecture of the local data pools.
.. image:: ../misc/logo/FSFW_Logo_V3_bw.png
:alt: FSFW Logo
An example is shown for using the local data pools with a Gyroscope.
For example, the following code shows an implementation to access data from a Gyroscope taken
from the SOURCE CubeSat project:
```cpp
class GyroPrimaryDataset: public StaticLocalDataSet<3 * sizeof(float)> {
public:
/**
* Constructor for data users
* @param gyroId
*/
GyroPrimaryDataset(object_id_t gyroId):
StaticLocalDataSet(sid_t(gyroId, gyrodefs::GYRO_DATA_SET_ID)) {
setAllVariablesReadOnly();
}
lp_var_t<float> angVelocityX = lp_var_t<float>(sid.objectId,
gyrodefs::ANGULAR_VELOCITY_X, this);
lp_var_t<float> angVelocityY = lp_var_t<float>(sid.objectId,
gyrodefs::ANGULAR_VELOCITY_Y, this);
lp_var_t<float> angVelocityZ = lp_var_t<float>(sid.objectId,
gyrodefs::ANGULAR_VELOCITY_Z, this);
private:
friend class GyroHandler;
/**
* Constructor for data creator
* @param hkOwner
*/
GyroPrimaryDataset(HasLocalDataPoolIF* hkOwner):
StaticLocalDataSet(hkOwner, gyrodefs::GYRO_DATA_SET_ID) {}
};
```
There is a public constructor for users which sets all variables to read-only and there is a
constructor for the GyroHandler data creator by marking it private and declaring the `GyroHandler`
as a friend class. Both the atittude controller and the `GyroHandler` can now
use the same class definition to access the pool variables with `read` and `commit` semantics
in a thread-safe way. Generally, each class requiring access will have the set class as a member
class. The data creator will also be generally a `DeviceHandlerBase` subclass and some additional
steps are necessary to expose the set for housekeeping purposes.
### Using the local data pools in a `DeviceHandlerBase` subclass
It is very common to store data generated by devices like a sensor into a pool which can
then be used by other objects. Therefore, the `DeviceHandlerBase` already has a
local pool. Using the aforementioned example, our `GyroHandler` will now have the set class
as a member:
```cpp
class GyroHandler: ... {
public:
...
private:
...
GyroPrimaryDataset gyroData;
...
};
```
The constructor used for the creators expects the owner class as a parameter, so we initialize
the object in the `GyroHandler` constructor like this:
```cpp
GyroHandler::GyroHandler(object_id_t objectId, object_id_t comIF,
CookieIF *comCookie, uint8_t switchId):
DeviceHandlerBase(objectId, comIF, comCookie), switchId(switchId),
gyroData(this) {}
```
We need to assign the set to a reply ID used in the `DeviceHandlerBase`.
The combination of the `GyroHandler` object ID and the reply ID will be the 64-bit structure ID
`sid_t` and is used to globally identify the set, for example when requesting housekeeping data or
generating update messages. We need to assign our custom set class in some way so that the local
pool manager can access the custom data sets as well.
By default, the `getDataSetHandle` will take care of this tasks. The default implementation for a
`DeviceHandlerBase` subclass will use the internal command map to retrieve
a handle to a dataset from a given reply ID. Therefore,
we assign the set in the `fillCommandAndReplyMap` function:
```cpp
void GyroHandler::fillCommandAndReplyMap() {
...
this->insertInCommandAndReplyMap(gyrodefs::GYRO_DATA, 3, &gyroData);
...
}
```
Now, we need to create the actual pool entries as well, using the `initializeLocalDataPool`
function. Here, we also immediately subscribe for periodic housekeeping packets
with an interval of 4 seconds. They are still disabled in this example and can be enabled
with a housekeeping service command.
```cpp
ReturnValue_t GyroHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(gyrodefs::ANGULAR_VELOCITY_X,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(gyrodefs::ANGULAR_VELOCITY_Y,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(gyrodefs::ANGULAR_VELOCITY_Z,
new PoolEntry<float>({0.0}));
localDataPoolMap.emplace(gyrodefs::GENERAL_CONFIG_REG42,
new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(gyrodefs::RANGE_CONFIG_REG43,
new PoolEntry<uint8_t>({0}));
poolManager.subscribeForPeriodicPacket(gyroData.getSid(), false, 4.0, false);
return returnvalue::OK;
}
```
Now, if we receive some sensor data and converted them into the right format,
we can write it into the pool like this, using a guard class to ensure the set is commited back
in any case:
```cpp
PoolReadGuard readHelper(&gyroData);
if(readHelper.getReadResult() == returnvalue::OK) {
if(not gyroData.isValid()) {
gyroData.setValidity(true, true);
}
gyroData.angVelocityX = angularVelocityX;
gyroData.angVelocityY = angularVelocityY;
gyroData.angVelocityZ = angularVelocityZ;
}
```
The guard class will commit the changed data on destruction automatically.
### Using the local data pools in a `ExtendedControllerBase` subclass
Coming soon

View File

@ -1,32 +0,0 @@
# Operating System Abstraction Layer (OSAL)
Some specific information on the provided OSALs are provided.
## Linux OSAL
This OSAL can be used to compile for Linux host systems like Ubuntu 20.04 or for
embedded Linux targets like the Raspberry Pi. This OSAL generally requires threading support
and real-time functionalities. For most UNIX systems, this is done by adding `-lrt` and `-lpthread` to the linked libraries in the compilation process. The CMake build support provided will do this automatically for the `fsfw` target. It should be noted that most UNIX systems need to be configured specifically to allow the real-time functionalities required by the FSFW.
More information on how to set up a Linux system accordingly can be found in the
[Linux README of the FSFW example application](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example/src/branch/master/doc/README-linux.md#top)
## Hosted OSAL
This is the newest OSAL. Support for Semaphores has not been implemented yet and will propably be implemented as soon as C++20 with Semaphore support has matured. This OSAL can be used to run the FSFW on any host system, but currently has only been tested on Windows 10 and Ubuntu 20.04. Unlike the other OSALs, it uses dynamic memory allocation (e.g. for the message queue implementation). Cross-platform serial port (USB) support might be added soon.
## FreeRTOS OSAL
FreeRTOS is not included and the developer needs to take care of compiling the FreeRTOS sources and adding the `FreeRTOSConfig.h` file location to the include path. This OSAL has only been tested extensively with the pre-emptive scheduler configuration so far but it should in principle also be possible to use a cooperative scheduler. It is recommended to use the `heap_4` allocation scheme. When using newlib (nano), it is also recommended to add `#define configUSE_NEWLIB_REENTRANT` to the FreeRTOS configuration file to ensure thread-safety.
When using this OSAL, developers also need to provide an implementation for the `vRequestContextSwitchFromISR` function. This has been done because the call to request a context switch from an ISR is generally located in the `portmacro.h` header and is different depending on the target architecture or device.
## RTEMS OSAL
The RTEMS OSAL was the first implemented OSAL which is also used on the active satellite Flying Laptop.
## TCP/IP socket abstraction
The Linux and Host OSAL provide abstraction layers for the socket API. Currently, only UDP sockets have been imlemented. This is very useful to test TMTC handling either on the host computer directly (targeting localhost with a TMTC application) or on embedded Linux devices, sending TMTC packets via Ethernet.

View File

@ -1 +0,0 @@
## PUS Services

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

@ -7,12 +7,13 @@ Structure
----------
The general structure is driven by the usage of interfaces provided by objects.
The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be
widely available, even with older compilers.
The FSFW uses dynamic allocation during the initialization but provides static containers during runtime.
This simplifies the instantiation of objects and allows the usage of some standard containers.
Dynamic Allocation after initialization is discouraged and different solutions are provided in the
FSFW to achieve that. The fsfw uses run-time type information but exceptions are not allowed.
The FSFW uses C++17 as baseline. Most modern compilers like GCC should have support for this
standard, even for micocontrollers.
The FSFW might use dynamic allocation during program initialization but not during runtime.
It offers pool objects, static containers and it also exposes the
`Embedded Template Library <https://www.etlcpp.com/>`_ to allow writing code which does not perform
allocation during runtime. The fsfw uses run-time type information but will not throw exceptions.
Failure Handling
-----------------

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

@ -4,7 +4,6 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw/events/EventManager.h>
#include <fsfw/health/HealthTable.h>
#include <fsfw/tmtcpacket/pus/tm/TmPacketStored.h>
#include <fsfw/tmtcservices/CommandingServiceBase.h>
#include <fsfw/tmtcservices/PusServiceBase.h>
#include <fsfw/internalerror/InternalErrorReporter.h>
@ -35,19 +34,15 @@ void Factory::produceFsfwObjects(void) {
}
void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::NO_OBJECT;
PusServiceBase::packetDestination = objects::NO_OBJECT;
PusServiceBase::PUS_DISTRIBUTOR = objects::NO_OBJECT;
PusServiceBase::PACKET_DESTINATION = objects::NO_OBJECT;
CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT;
VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION;
DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
DeviceHandlerBase::rawDataReceiverId = objects::PUS_SERVICE_2_DEVICE_ACCESS;
DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT;
TmPacketBase::timeStamperId = objects::NO_OBJECT;
}

View File

@ -13,7 +13,7 @@ from shutil import which
from typing import List
UNITTEST_FOLDER_NAME = "build-tests"
UNITTEST_FOLDER_NAME = "cmake-build-tests"
DOCS_FOLDER_NAME = "build-docs"
@ -199,7 +199,7 @@ def check_for_cmake_build_dir(build_dir_list: list) -> list:
def perform_lcov_operation(directory: str, chdir: bool):
if chdir:
os.chdir(directory)
cmd_runner("cmake --build . -- fsfw-tests_coverage -j")
cmd_runner("cmake --build . -j -- fsfw-tests_coverage")
def determine_build_dir(build_dir_list: List[str]):

View File

@ -1,17 +0,0 @@
#include "CFDPMessage.h"
CFDPMessage::CFDPMessage() {}
CFDPMessage::~CFDPMessage() {}
void CFDPMessage::setCommand(CommandMessage *message, store_address_t cfdpPacket) {
message->setParameter(cfdpPacket.raw);
}
store_address_t CFDPMessage::getStoreId(const CommandMessage *message) {
store_address_t storeAddressCFDPPacket;
storeAddressCFDPPacket = message->getParameter();
return storeAddressCFDPPacket;
}
void CFDPMessage::clear(CommandMessage *message) {}

View File

@ -1,4 +1,4 @@
target_sources(${LIB_FSFW_NAME} PRIVATE CFDPHandler.cpp CFDPMessage.cpp)
target_sources(${LIB_FSFW_NAME} PRIVATE CfdpHandler.cpp CfdpMessage.cpp)
add_subdirectory(pdu)
add_subdirectory(tlv)

View File

@ -1,24 +1,23 @@
#include "fsfw/cfdp/CFDPHandler.h"
#include "fsfw/cfdp/CfdpHandler.h"
#include "fsfw/cfdp/CFDPMessage.h"
#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"
object_id_t CFDPHandler::packetSource = 0;
object_id_t CFDPHandler::packetDestination = 0;
object_id_t CfdpHandler::packetSource = 0;
object_id_t CfdpHandler::packetDestination = 0;
CFDPHandler::CFDPHandler(object_id_t setObjectId, CFDPDistributor* dist)
CfdpHandler::CfdpHandler(object_id_t setObjectId, CFDPDistributor* dist)
: SystemObject(setObjectId) {
requestQueue = QueueFactory::instance()->createMessageQueue(CFDP_HANDLER_MAX_RECEPTION);
distributor = dist;
}
CFDPHandler::~CFDPHandler() {}
CfdpHandler::~CfdpHandler() = default;
ReturnValue_t CFDPHandler::initialize() {
ReturnValue_t CfdpHandler::initialize() {
ReturnValue_t result = SystemObject::initialize();
if (result != returnvalue::OK) {
return result;
@ -27,7 +26,7 @@ ReturnValue_t CFDPHandler::initialize() {
return returnvalue::OK;
}
ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) {
ReturnValue_t CfdpHandler::handleRequest(store_address_t storeId) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "CFDPHandler::handleRequest" << std::endl;
@ -41,17 +40,17 @@ ReturnValue_t CFDPHandler::handleRequest(store_address_t storeId) {
return returnvalue::OK;
}
ReturnValue_t CFDPHandler::performOperation(uint8_t opCode) {
ReturnValue_t CfdpHandler::performOperation(uint8_t opCode) {
ReturnValue_t status = returnvalue::OK;
CommandMessage currentMessage;
for (status = this->requestQueue->receiveMessage(&currentMessage); status == returnvalue::OK;
status = this->requestQueue->receiveMessage(&currentMessage)) {
store_address_t storeId = CFDPMessage::getStoreId(&currentMessage);
store_address_t storeId = CfdpMessage::getStoreId(&currentMessage);
this->handleRequest(storeId);
}
return returnvalue::OK;
}
uint16_t CFDPHandler::getIdentifier() { return 0; }
uint32_t CfdpHandler::getIdentifier() const { return 0; }
MessageQueueId_t CFDPHandler::getRequestQueue() { return this->requestQueue->getId(); }
MessageQueueId_t CfdpHandler::getRequestQueue() const { return this->requestQueue->getId(); }

View File

@ -12,21 +12,21 @@ namespace Factory {
void setStaticFrameworkObjectIds();
}
class CFDPHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, public SystemObject {
class CfdpHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, public SystemObject {
friend void(Factory::setStaticFrameworkObjectIds)();
public:
CFDPHandler(object_id_t setObjectId, CFDPDistributor* distributor);
CfdpHandler(object_id_t setObjectId, CFDPDistributor* distributor);
/**
* The destructor is empty.
*/
virtual ~CFDPHandler();
virtual ~CfdpHandler();
virtual ReturnValue_t handleRequest(store_address_t storeId);
virtual ReturnValue_t initialize() override;
virtual uint16_t getIdentifier() override;
MessageQueueId_t getRequestQueue() override;
uint32_t getIdentifier() const override;
MessageQueueId_t getRequestQueue() const override;
ReturnValue_t performOperation(uint8_t opCode) override;
protected:
@ -42,7 +42,7 @@ class CFDPHandler : public ExecutableObjectIF, public AcceptsTelecommandsIF, pub
* The current CFDP packet to be processed.
* It is deleted after handleRequest was executed.
*/
CFDPPacketStored currentPacket;
CfdpPacketStored currentPacket;
static object_id_t packetSource;

View File

@ -0,0 +1,17 @@
#include "CfdpMessage.h"
CfdpMessage::CfdpMessage() = default;
CfdpMessage::~CfdpMessage() = default;
void CfdpMessage::setCommand(CommandMessage *message, store_address_t cfdpPacket) {
message->setParameter(cfdpPacket.raw);
}
store_address_t CfdpMessage::getStoreId(const CommandMessage *message) {
store_address_t storeId;
storeId = static_cast<store_address_t>(message->getParameter());
return storeId;
}
void CfdpMessage::clear(CommandMessage *message) {}

View File

@ -5,14 +5,14 @@
#include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
class CFDPMessage {
class CfdpMessage {
private:
CFDPMessage();
CfdpMessage();
public:
static const uint8_t MESSAGE_ID = messagetypes::CFDP;
virtual ~CFDPMessage();
virtual ~CfdpMessage();
static void setCommand(CommandMessage* message, store_address_t cfdpPacket);
static store_address_t getStoreId(const CommandMessage* message);

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

@ -6,7 +6,7 @@
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tmtcpacket/SpacePacketBase.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
#include "fsfw/tmtcservices/TmTcMessage.h"

View File

@ -79,8 +79,7 @@ class HasLocalDataPoolIF {
* @param clearMessage If this is set to true, the pool manager will take care of
* clearing the store automatically
*/
virtual void handleChangedDataset(sid_t sid,
store_address_t storeId = storeId::INVALID_STORE_ADDRESS,
virtual void handleChangedDataset(sid_t sid, store_address_t storeId = store_address_t::invalid(),
bool* clearMessage = nullptr) {
if (clearMessage != nullptr) {
*clearMessage = true;
@ -100,7 +99,7 @@ class HasLocalDataPoolIF {
* after the callback.
*/
virtual void handleChangedPoolVariable(gp_id_t gpid,
store_address_t storeId = storeId::INVALID_STORE_ADDRESS,
store_address_t storeId = store_address_t::invalid(),
bool* clearMessage = nullptr) {
if (clearMessage != nullptr) {
*clearMessage = true;

View File

@ -1,6 +1,5 @@
#include "fsfw/datapoollocal/LocalDataPoolManager.h"
#include <array>
#include <cmath>
#include "fsfw/datapoollocal.h"
@ -15,6 +14,7 @@
#include "internal/HasLocalDpIFManagerAttorney.h"
#include "internal/LocalPoolDataSetAttorney.h"
// TODO: Get rid of this. This should be a constructor argument, not something hardcoded in any way
object_id_t LocalDataPoolManager::defaultHkDestination = objects::PUS_SERVICE_3_HOUSEKEEPING;
LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse,
@ -57,7 +57,7 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
}
if (defaultHkDestination != objects::NO_OBJECT) {
AcceptsHkPacketsIF* hkPacketReceiver =
auto* hkPacketReceiver =
ObjectManager::instance()->get<AcceptsHkPacketsIF>(defaultHkDestination);
if (hkPacketReceiver != nullptr) {
hkDestinationId = hkPacketReceiver->getHkQueue();
@ -209,9 +209,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
}
/* Prepare and send update snapshot */
timeval now;
timeval now{};
Clock::getClock_timeval(&now);
CCSDSTime::CDS_short cds;
CCSDSTime::CDS_short cds{};
CCSDSTime::convertToCcsds(&cds, &now);
HousekeepingSnapshot updatePacket(
reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
@ -245,9 +245,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
}
/* Prepare and send update snapshot */
timeval now;
timeval now{};
Clock::getClock_timeval(&now);
CCSDSTime::CDS_short cds;
CCSDSTime::CDS_short cds{};
CCSDSTime::convertToCcsds(&cds, &now);
HousekeepingSnapshot updatePacket(
reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
@ -291,12 +291,7 @@ ReturnValue_t LocalDataPoolManager::addUpdateToStore(HousekeepingSnapshot& updat
void LocalDataPoolManager::handleChangeResetLogic(DataType type, DataId dataId,
MarkChangedIF* toReset) {
if (hkUpdateResetList == nullptr) {
/* Config error */
return;
}
HkUpdateResetList& listRef = *hkUpdateResetList;
for (auto& changeInfo : listRef) {
for (auto& changeInfo : hkUpdateResetList) {
if (changeInfo.dataType != type) {
continue;
}
@ -326,38 +321,37 @@ void LocalDataPoolManager::handleChangeResetLogic(DataType type, DataId dataId,
}
void LocalDataPoolManager::resetHkUpdateResetHelper() {
if (hkUpdateResetList == nullptr) {
return;
}
for (auto& changeInfo : *hkUpdateResetList) {
for (auto& changeInfo : hkUpdateResetList) {
changeInfo.currentUpdateCounter = changeInfo.updateCounter;
}
}
ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool enableReporting,
float collectionInterval,
bool isDiagnostics,
object_id_t packetDestination) {
AcceptsHkPacketsIF* hkReceiverObject =
ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
if (hkReceiverObject == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
QUEUE_OR_DESTINATION_INVALID);
return QUEUE_OR_DESTINATION_INVALID;
}
ReturnValue_t LocalDataPoolManager::subscribeForRegularPeriodicPacket(
subdp::RegularHkPeriodicParams params) {
return subscribeForPeriodicPacket(params);
}
ReturnValue_t LocalDataPoolManager::subscribeForDiagPeriodicPacket(
subdp::DiagnosticsHkPeriodicParams params) {
return subscribeForPeriodicPacket(params);
}
ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(subdp::ParamsBase& params) {
struct HkReceiver hkReceiver;
hkReceiver.dataId.sid = sid;
hkReceiver.dataId.sid = params.sid;
hkReceiver.reportingType = ReportingType::PERIODIC;
hkReceiver.dataType = DataType::DATA_SET;
hkReceiver.destinationQueue = hkReceiverObject->getHkQueue();
if (params.receiver == MessageQueueIF::NO_QUEUE) {
hkReceiver.destinationQueue = hkDestinationId;
} else {
hkReceiver.destinationQueue = params.receiver;
}
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, params.sid);
if (dataSet != nullptr) {
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enableReporting);
LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics);
LocalPoolDataSetAttorney::initializePeriodicHelper(*dataSet, collectionInterval,
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, params.enableReporting);
LocalPoolDataSetAttorney::setDiagnostic(*dataSet, params.isDiagnostics());
LocalPoolDataSetAttorney::initializePeriodicHelper(*dataSet, params.collectionInterval,
owner->getPeriodicOperationFrequency());
}
@ -365,27 +359,30 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool e
return returnvalue::OK;
}
ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, bool isDiagnostics,
bool reportingEnabled,
object_id_t packetDestination) {
AcceptsHkPacketsIF* hkReceiverObject =
ObjectManager::instance()->get<AcceptsHkPacketsIF>(packetDestination);
if (hkReceiverObject == nullptr) {
printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket",
QUEUE_OR_DESTINATION_INVALID);
return QUEUE_OR_DESTINATION_INVALID;
}
ReturnValue_t LocalDataPoolManager::subscribeForRegularUpdatePacket(
subdp::RegularHkUpdateParams params) {
return subscribeForUpdatePacket(params);
}
ReturnValue_t LocalDataPoolManager::subscribeForDiagUpdatePacket(
subdp::DiagnosticsHkUpdateParams params) {
return subscribeForUpdatePacket(params);
}
ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(subdp::ParamsBase& params) {
struct HkReceiver hkReceiver;
hkReceiver.dataId.sid = sid;
hkReceiver.dataId.sid = params.sid;
hkReceiver.reportingType = ReportingType::UPDATE_HK;
hkReceiver.dataType = DataType::DATA_SET;
hkReceiver.destinationQueue = hkReceiverObject->getHkQueue();
if (params.receiver == MessageQueueIF::NO_QUEUE) {
hkReceiver.destinationQueue = hkDestinationId;
} else {
hkReceiver.destinationQueue = params.receiver;
}
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, params.sid);
if (dataSet != nullptr) {
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, true);
LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics);
LocalPoolDataSetAttorney::setDiagnostic(*dataSet, params.isDiagnostics());
}
hkReceivers.push_back(hkReceiver);
@ -436,11 +433,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForVariableUpdateMessage(
}
void LocalDataPoolManager::handleHkUpdateResetListInsertion(DataType dataType, DataId dataId) {
if (hkUpdateResetList == nullptr) {
hkUpdateResetList = new std::vector<struct HkUpdateResetHelper>();
}
for (auto& updateResetStruct : *hkUpdateResetList) {
for (auto& updateResetStruct : hkUpdateResetList) {
if (dataType == DataType::DATA_SET) {
if (updateResetStruct.dataId.sid == dataId.sid) {
updateResetStruct.updateCounter++;
@ -464,7 +457,7 @@ void LocalDataPoolManager::handleHkUpdateResetListInsertion(DataType dataType, D
} else {
hkUpdateResetHelper.dataId.localPoolId = dataId.localPoolId;
}
hkUpdateResetList->push_back(hkUpdateResetHelper);
hkUpdateResetList.push_back(hkUpdateResetHelper);
}
ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(CommandMessage* message) {
@ -639,6 +632,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
/* Error, all destinations invalid */
printWarningOrError(sif::OutputTypes::OUT_WARNING, "generateHousekeepingPacket",
QUEUE_OR_DESTINATION_INVALID);
return QUEUE_OR_DESTINATION_INVALID;
}
destination = hkDestinationId;
}
@ -815,9 +809,7 @@ void LocalDataPoolManager::clearReceiversList() {
/* Clear the vector completely and releases allocated memory. */
HkReceivers().swap(hkReceivers);
/* Also clear the reset helper if it exists */
if (hkUpdateResetList != nullptr) {
HkUpdateResetList().swap(*hkUpdateResetList);
}
HkUpdateResetList().swap(hkUpdateResetList);
}
MutexIF* LocalDataPoolManager::getLocalPoolMutex() { return this->mutex; }
@ -877,3 +869,7 @@ void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType,
}
LocalDataPoolManager* LocalDataPoolManager::getPoolManagerHandle() { return this; }
void LocalDataPoolManager::setHkDestinationId(MessageQueueId_t hkDestId) {
hkDestinationId = hkDestId;
}

View File

@ -8,6 +8,7 @@
#include "ProvidesDataPoolSubscriptionIF.h"
#include "fsfw/datapool/DataSetIF.h"
#include "fsfw/datapool/PoolEntry.h"
#include "fsfw/housekeeping/AcceptsHkPacketsIF.h"
#include "fsfw/housekeeping/HousekeepingMessage.h"
#include "fsfw/housekeeping/HousekeepingPacketDownlink.h"
#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h"
@ -80,7 +81,9 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/
LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse,
bool appendValidityBuffer = true);
virtual ~LocalDataPoolManager();
~LocalDataPoolManager() override;
void setHkDestinationId(MessageQueueId_t hkDestId);
/**
* Assigns the queue to use. Make sure to call this in the #initialize
@ -112,31 +115,6 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/
virtual ReturnValue_t performHkOperation();
/**
* @brief Subscribe for the generation of periodic packets.
* @details
* This subscription mechanism will generally be used by the data creator
* to generate housekeeping packets which are downlinked directly.
* @return
*/
ReturnValue_t subscribeForPeriodicPacket(
sid_t sid, bool enableReporting, float collectionInterval, bool isDiagnostics,
object_id_t packetDestination = defaultHkDestination) override;
/**
* @brief Subscribe for the generation of packets if the dataset
* is marked as changed.
* @details
* This subscription mechanism will generally be used by the data creator.
* @param sid
* @param isDiagnostics
* @param packetDestination
* @return
*/
ReturnValue_t subscribeForUpdatePacket(
sid_t sid, bool reportingEnabled, bool isDiagnostics,
object_id_t packetDestination = defaultHkDestination) override;
/**
* @brief Subscribe for a notification message which will be sent
* if a dataset has changed.
@ -151,7 +129,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
* Otherwise, only an notification message is sent.
* @return
*/
ReturnValue_t subscribeForSetUpdateMessage(const uint32_t setId, object_id_t destinationObject,
ReturnValue_t subscribeForSetUpdateMessage(uint32_t setId, object_id_t destinationObject,
MessageQueueId_t targetQueueId,
bool generateSnapshot) override;
@ -169,7 +147,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
* Otherwise, only an notification message is sent.
* @return
*/
ReturnValue_t subscribeForVariableUpdateMessage(const lp_id_t localPoolId,
ReturnValue_t subscribeForVariableUpdateMessage(lp_id_t localPoolId,
object_id_t destinationObject,
MessageQueueId_t targetQueueId,
bool generateSnapshot) override;
@ -252,7 +230,7 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/
void clearReceiversList();
object_id_t getCreatorObjectId() const;
[[nodiscard]] object_id_t getCreatorObjectId() const;
/**
* Get the pointer to the mutex. Can be used to lock the data pool
@ -262,9 +240,17 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
*/
MutexIF* getMutexHandle();
virtual LocalDataPoolManager* getPoolManagerHandle() override;
LocalDataPoolManager* getPoolManagerHandle() override;
ReturnValue_t subscribeForRegularPeriodicPacket(subdp::RegularHkPeriodicParams params) override;
ReturnValue_t subscribeForDiagPeriodicPacket(subdp::DiagnosticsHkPeriodicParams params) override;
ReturnValue_t subscribeForRegularUpdatePacket(subdp::RegularHkUpdateParams params) override;
ReturnValue_t subscribeForDiagUpdatePacket(subdp::DiagnosticsHkUpdateParams params) override;
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
@ -312,8 +298,8 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
using HkUpdateResetList = std::vector<struct HkUpdateResetHelper>;
/** This list is used to manage creating multiple update packets and only resetting
the update flag if all of them were created. Will only be created when needed. */
HkUpdateResetList* hkUpdateResetList = nullptr;
the update flag if all of them were created. */
HkUpdateResetList hkUpdateResetList = HkUpdateResetList();
/** This is the map holding the actual data. Should only be initialized
* once ! */

View File

@ -48,12 +48,12 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
if (hkOwner == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "LocalPoolVariable: The supplied pool owner 0x" << std::hex << poolOwner
<< std::dec << " did not implement the correct interface "
<< std::dec << " does not exist or does not implement the correct interface "
<< "HasLocalDataPoolIF" << std::endl;
#else
sif::printError(
"LocalPoolVariable: The supplied pool owner 0x%08x did not implement the correct "
"interface HasLocalDataPoolIF\n",
"LocalPoolVariable: The supplied pool owner 0x%08x does not exist or does not implement "
"the correct interface HasLocalDataPoolIF\n",
poolOwner);
#endif
return;

View File

@ -1,24 +1,90 @@
#ifndef FSFW_DATAPOOLLOCAL_PROVIDESDATAPOOLSUBSCRIPTION_H_
#define FSFW_DATAPOOLLOCAL_PROVIDESDATAPOOLSUBSCRIPTION_H_
#include "../ipc/messageQueueDefinitions.h"
#include "../returnvalues/returnvalue.h"
#include "fsfw/housekeeping/AcceptsHkPacketsIF.h"
#include "fsfw/ipc/MessageQueueIF.h"
#include "fsfw/ipc/messageQueueDefinitions.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "localPoolDefinitions.h"
namespace subdp {
struct ParamsBase {
ParamsBase(sid_t sid, bool enableReporting, float collectionInterval, bool diagnostics)
: sid(sid),
enableReporting(enableReporting),
collectionInterval(collectionInterval),
diagnostics(diagnostics) {}
[[nodiscard]] bool isDiagnostics() const { return diagnostics; }
sid_t sid;
bool enableReporting;
float collectionInterval;
MessageQueueId_t receiver = MessageQueueIF::NO_QUEUE;
protected:
bool diagnostics;
};
struct RegularHkPeriodicParams : public ParamsBase {
RegularHkPeriodicParams(sid_t sid, bool enableReporting, float collectionInterval)
: ParamsBase(sid, enableReporting, collectionInterval, false) {}
};
struct DiagnosticsHkPeriodicParams : public ParamsBase {
DiagnosticsHkPeriodicParams(sid_t sid, bool enableReporting, float collectionInterval)
: ParamsBase(sid, enableReporting, collectionInterval, true) {}
};
struct RegularHkUpdateParams : public ParamsBase {
RegularHkUpdateParams(sid_t sid, bool enableReporting)
: ParamsBase(sid, enableReporting, 0.0, false) {}
};
struct DiagnosticsHkUpdateParams : public ParamsBase {
DiagnosticsHkUpdateParams(sid_t sid, bool enableReporting)
: ParamsBase(sid, enableReporting, 0.0, true) {}
};
} // namespace subdp
class ProvidesDataPoolSubscriptionIF {
public:
virtual ~ProvidesDataPoolSubscriptionIF(){};
virtual ~ProvidesDataPoolSubscriptionIF() = default;
/**
* @brief Subscribe for the generation of periodic packets.
* @brief Subscribe for the generation of periodic packets. Used for regular HK packets
* @details
* This subscription mechanism will generally be used by the data creator
* to generate housekeeping packets which are downlinked directly.
* @return
*/
virtual ReturnValue_t subscribeForPeriodicPacket(sid_t sid, bool enableReporting,
float collectionInterval, bool isDiagnostics,
object_id_t packetDestination) = 0;
virtual ReturnValue_t subscribeForRegularPeriodicPacket(
subdp::RegularHkPeriodicParams params) = 0;
/**
* @brief Subscribe for the generation of periodic packets. Used for diagnostic packets
* @details
* This subscription mechanism will generally be used by the data creator
* to generate housekeeping packets which are downlinked directly.
* @return
*/
virtual ReturnValue_t subscribeForDiagPeriodicPacket(
subdp::DiagnosticsHkPeriodicParams params) = 0;
[[deprecated(
"Please use the new API which takes all arguments as one wrapper "
"struct")]] virtual ReturnValue_t
subscribeForPeriodicPacket(sid_t sid, bool enableReporting, float collectionInterval,
bool isDiagnostics,
object_id_t packetDestination = objects::NO_OBJECT) {
if (isDiagnostics) {
subdp::DiagnosticsHkPeriodicParams params(sid, enableReporting, collectionInterval);
return subscribeForDiagPeriodicPacket(params);
} else {
subdp::RegularHkPeriodicParams params(sid, enableReporting, collectionInterval);
return subscribeForRegularPeriodicPacket(params);
}
}
/**
* @brief Subscribe for the generation of packets if the dataset
* is marked as changed.
@ -29,9 +95,28 @@ class ProvidesDataPoolSubscriptionIF {
* @param packetDestination
* @return
*/
virtual ReturnValue_t subscribeForUpdatePacket(sid_t sid, bool reportingEnabled,
bool isDiagnostics,
object_id_t packetDestination) = 0;
virtual ReturnValue_t subscribeForRegularUpdatePacket(subdp::RegularHkUpdateParams params) = 0;
virtual ReturnValue_t subscribeForDiagUpdatePacket(subdp::DiagnosticsHkUpdateParams params) = 0;
// virtual ReturnValue_t
// subscribeForUpdatePacket(sid_t sid, bool reportingEnabled, bool isDiagnostics) {
// return subscribeForUpdatePacket(sid, reportingEnabled, isDiagnostics, objects::NO_OBJECT);
// }
[[deprecated(
"Please use the new API which takes all arguments as one wrapper "
"struct")]] virtual ReturnValue_t
subscribeForUpdatePacket(sid_t sid, bool reportingEnabled, bool isDiagnostics,
object_id_t packetDestination = objects::NO_OBJECT) {
if (isDiagnostics) {
subdp::DiagnosticsHkUpdateParams params(sid, reportingEnabled);
return subscribeForDiagUpdatePacket(params);
} else {
subdp::RegularHkUpdateParams params(sid, reportingEnabled);
return subscribeForRegularUpdatePacket(params);
}
}
/**
* @brief Subscribe for a notification message which will be sent
* if a dataset has changed.
@ -46,8 +131,7 @@ class ProvidesDataPoolSubscriptionIF {
* Otherwise, only an notification message is sent.
* @return
*/
virtual ReturnValue_t subscribeForSetUpdateMessage(const uint32_t setId,
object_id_t destinationObject,
virtual ReturnValue_t subscribeForSetUpdateMessage(uint32_t setId, object_id_t destinationObject,
MessageQueueId_t targetQueueId,
bool generateSnapshot) = 0;
/**
@ -64,7 +148,7 @@ class ProvidesDataPoolSubscriptionIF {
* only an notification message is sent.
* @return
*/
virtual ReturnValue_t subscribeForVariableUpdateMessage(const lp_id_t localPoolId,
virtual ReturnValue_t subscribeForVariableUpdateMessage(lp_id_t localPoolId,
object_id_t destinationObject,
MessageQueueId_t targetQueueId,
bool generateSnapshot) = 0;

View File

@ -22,8 +22,6 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device
CookieIF* comCookie, FailureIsolationBase* fdirInstance,
size_t cmdQueueSize)
: SystemObject(setObjectId),
mode(MODE_OFF),
submode(SUBMODE_NONE),
wiretappingMode(OFF),
storedRawData(StorageManagerIF::INVALID_ADDRESS),
deviceCommunicationId(deviceCommunication),
@ -38,6 +36,8 @@ DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId, object_id_t device
defaultFDIRUsed(fdirInstance == nullptr),
switchOffWasReported(false),
childTransitionDelay(5000),
mode(MODE_OFF),
submode(SUBMODE_NONE),
transitionSourceMode(_MODE_POWER_DOWN),
transitionSourceSubMode(SUBMODE_NONE) {
commandQueue = QueueFactory::instance()->createMessageQueue(
@ -352,7 +352,6 @@ void DeviceHandlerBase::doStateMachine() {
currentUptime - timeoutStart >= powerSwitcher->getSwitchDelayMs()) {
triggerEvent(MODE_TRANSITION_FAILED, PowerSwitchIF::SWITCH_TIMEOUT, 0);
setMode(_MODE_POWER_DOWN);
callChildStatemachine();
break;
}
ReturnValue_t switchState = getStateOfSwitches();
@ -458,7 +457,7 @@ ReturnValue_t DeviceHandlerBase::insertInCommandMap(DeviceCommandId_t deviceComm
info.expectedReplies = 0;
info.isExecuting = false;
info.sendReplyTo = NO_COMMANDER;
info.useAlternativeReplyId = alternativeReplyId;
info.useAlternativeReplyId = useAlternativeReply;
info.alternativeReplyId = alternativeReplyId;
auto resultPair = deviceCommandMap.emplace(deviceCommand, info);
if (resultPair.second) {
@ -517,16 +516,16 @@ ReturnValue_t DeviceHandlerBase::updatePeriodicReply(bool enable, DeviceCommandI
if (enable) {
info->active = true;
if (info->countdown != nullptr) {
info->delayCycles = info->maxDelayCycles;
} else {
info->countdown->resetTimer();
} else {
info->delayCycles = info->maxDelayCycles;
}
} else {
info->active = false;
if (info->countdown != nullptr) {
info->delayCycles = 0;
} else {
info->countdown->timeOut();
} else {
info->delayCycles = 0;
}
}
}
@ -567,11 +566,23 @@ void DeviceHandlerBase::setTransition(Mode_t modeTo, Submode_t submodeTo) {
void DeviceHandlerBase::setMode(Mode_t newMode, uint8_t newSubmode) {
/* TODO: This will probably be done by the LocalDataPoolManager now */
// changeHK(mode, submode, false);
/**
* handle transition from OFF to NORMAL by continuing towards normal when ON is reached
*/
if (newMode == MODE_ON and continueToNormal) {
continueToNormal = false;
mode = _MODE_TO_NORMAL;
return;
}
submode = newSubmode;
mode = newMode;
modeChanged();
setNormalDatapoolEntriesInvalid();
if (!isTransitionalMode()) {
// clear this flag when a non-transitional Mode is reached to be safe
continueToNormal = false;
modeHelper.modeChanged(newMode, newSubmode);
announceMode(false);
}
@ -1056,8 +1067,7 @@ Mode_t DeviceHandlerBase::getBaseMode(Mode_t transitionMode) {
return transitionMode & ~(TRANSITION_MODE_BASE_ACTION_MASK | TRANSITION_MODE_CHILD_ACTION_MASK);
}
// SHOULDDO: Allow transition from OFF to NORMAL to reduce complexity in assemblies. And, by the
// way, throw away DHB and write a new one:
// SHOULDDO: throw away DHB and write a new one:
// - Include power and thermal completely, but more modular :-)
// - Don't use modes for state transitions, reduce FSM (Finte State Machine) complexity.
// - Modularization?
@ -1069,11 +1079,10 @@ ReturnValue_t DeviceHandlerBase::checkModeCommand(Mode_t commandedMode, Submode_
if ((mode == MODE_ERROR_ON) && (commandedMode != MODE_OFF)) {
return TRANS_NOT_ALLOWED;
}
if ((commandedMode == MODE_NORMAL) && (mode == MODE_OFF)) {
return TRANS_NOT_ALLOWED;
}
if ((commandedMode == MODE_ON) && (mode == MODE_OFF) and (thermalSet != nullptr)) {
// Do not check thermal state for MODE_RAW
if ((mode == MODE_OFF) and ((commandedMode == MODE_ON) or (commandedMode == MODE_NORMAL)) and
(thermalSet != nullptr)) {
ReturnValue_t result = thermalSet->read();
if (result == returnvalue::OK) {
if ((thermalSet->heaterRequest.value != ThermalComponentIF::STATE_REQUEST_IGNORE) and
@ -1088,6 +1097,7 @@ ReturnValue_t DeviceHandlerBase::checkModeCommand(Mode_t commandedMode, Submode_
}
void DeviceHandlerBase::startTransition(Mode_t commandedMode, Submode_t commandedSubmode) {
continueToNormal = false;
switch (commandedMode) {
case MODE_ON:
handleTransitionToOnMode(commandedMode, commandedSubmode);
@ -1117,8 +1127,9 @@ void DeviceHandlerBase::startTransition(Mode_t commandedMode, Submode_t commande
case MODE_NORMAL:
if (mode != MODE_OFF) {
setTransition(MODE_NORMAL, commandedSubmode);
} else {
replyReturnvalueToCommand(HasModesIF::TRANS_NOT_ALLOWED);
} else { // mode is off
continueToNormal = true;
handleTransitionToOnMode(MODE_NORMAL, commandedSubmode);
}
break;
}
@ -1323,10 +1334,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

@ -102,6 +102,53 @@ class DeviceHandlerBase : public DeviceHandlerIF,
DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, CookieIF *comCookie,
FailureIsolationBase *fdirInstance = nullptr, size_t cmdQueueSize = 20);
/**
* extending the modes of DeviceHandler IF for internal state machine
*/
static constexpr uint8_t TRANSITION_MODE_CHILD_ACTION_MASK = 0x20;
static constexpr uint8_t TRANSITION_MODE_BASE_ACTION_MASK = 0x10;
//! This is a transitional state which can not be commanded. The device
//! handler performs all commands to get the device in a state ready to
//! perform commands. When this is completed, the mode changes to @c MODE_ON.
static const Mode_t _MODE_START_UP = TRANSITION_MODE_CHILD_ACTION_MASK | 5;
//! This is a transitional state which can not be commanded.
//! The device handler performs all actions and commands to get the device
//! shut down. When the device is off, the mode changes to @c MODE_OFF.
//! It is possible to set the mode to _MODE_SHUT_DOWN to use the to off
//! transition if available.
static const Mode_t _MODE_SHUT_DOWN = TRANSITION_MODE_CHILD_ACTION_MASK | 6;
//! It is possible to set the mode to _MODE_TO_ON to use the to on
//! transition if available.
static const Mode_t _MODE_TO_ON = TRANSITION_MODE_CHILD_ACTION_MASK | HasModesIF::MODE_ON;
//! It is possible to set the mode to _MODE_TO_RAW to use the to raw
//! transition if available.
static const Mode_t _MODE_TO_RAW = TRANSITION_MODE_CHILD_ACTION_MASK | MODE_RAW;
//! It is possible to set the mode to _MODE_TO_NORMAL to use the to normal
//! transition if available.
static const Mode_t _MODE_TO_NORMAL = TRANSITION_MODE_CHILD_ACTION_MASK | MODE_NORMAL;
//! This is a transitional state which can not be commanded.
//! The device is shut down and ready to be switched off.
//! After the command to set the switch off has been sent,
//! the mode changes to @c _MODE_WAIT_OFF
static const Mode_t _MODE_POWER_DOWN = TRANSITION_MODE_BASE_ACTION_MASK | 1;
//! This is a transitional state which can not be commanded. The device
//! will be switched on in this state. After the command to set the switch
//! on has been sent, the mode changes to @c _MODE_WAIT_ON.
static const Mode_t _MODE_POWER_ON = TRANSITION_MODE_BASE_ACTION_MASK | 2;
//! This is a transitional state which can not be commanded. The switch has
//! been commanded off and the handler waits for it to be off.
//! When the switch is off, the mode changes to @c MODE_OFF.
static const Mode_t _MODE_WAIT_OFF = TRANSITION_MODE_BASE_ACTION_MASK | 3;
//! This is a transitional state which can not be commanded. The switch
//! has been commanded on and the handler waits for it to be on.
//! When the switch is on, the mode changes to @c _MODE_TO_ON.
static const Mode_t _MODE_WAIT_ON = TRANSITION_MODE_BASE_ACTION_MASK | 4;
//! This is a transitional state which can not be commanded. The switch has
//! been commanded off and is off now. This state is only to do an RMAP
//! cycle once more where the doSendRead() function will set the mode to
//! MODE_OFF. The reason to do this is to get rid of stuck packets in the IO Board.
static const Mode_t _MODE_SWITCH_IS_OFF = TRANSITION_MODE_BASE_ACTION_MASK | 5;
void setHkDestination(object_id_t hkDestination);
/**
@ -684,15 +731,18 @@ class DeviceHandlerBase : public DeviceHandlerIF,
size_t rawPacketLen = 0;
/**
* The mode the device handler is currently in.
* This should never be changed directly but only with setMode()
* Get the current mode
*
* set via setMode()
*/
Mode_t mode;
Mode_t getMode();
/**
* The submode the device handler is currently in.
* This should never be changed directly but only with setMode()
* Get the current Submode
*
* set via setMode()
*/
Submode_t submode;
Submode_t getSubmode;
/** This is the counter value from performOperation(). */
uint8_t pstStep = 0;
@ -873,8 +923,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
* Do the transition to the main modes (MODE_ON, MODE_NORMAL and MODE_RAW).
*
* If the transition is complete, the mode should be set to the target mode,
* which can be deduced from the current mode which is
* [_MODE_TO_ON, _MODE_TO_NORMAL, _MODE_TO_RAW]
* which can be deduced from the current mode (which is
* [_MODE_TO_ON, _MODE_TO_NORMAL, _MODE_TO_RAW]) using getBaseMode()
*
* The intended target submode is already set.
* The origin submode can be read in subModeFrom.
@ -1052,8 +1102,23 @@ class DeviceHandlerBase : public DeviceHandlerIF,
bool isAwaitingReply();
/**
* 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);
@ -1155,6 +1220,18 @@ class DeviceHandlerBase : public DeviceHandlerIF,
*/
uint32_t childTransitionDelay;
/**
* The mode the device handler is currently in.
* This should not be changed directly but only with setMode()
*/
Mode_t mode;
/**
* The submode the device handler is currently in.
* This should not be changed directly but only with setMode()
*/
Submode_t submode;
/**
* @brief The mode the current transition originated from
*
@ -1172,6 +1249,15 @@ class DeviceHandlerBase : public DeviceHandlerIF,
*/
Submode_t transitionSourceSubMode;
/**
* used to make the state machine continue from ON to NOMAL when
* a Device is commanded to NORMAL in OFF mode
*
* set in startTransition()
* evaluated in setMode() to continue to NORMAL when ON is reached
*/
bool continueToNormal;
/**
* read the command queue
*/

View File

@ -24,9 +24,6 @@ class DeviceHandlerIF {
static const DeviceCommandId_t RAW_COMMAND_ID = -1;
static const DeviceCommandId_t NO_COMMAND_ID = -2;
static constexpr uint8_t TRANSITION_MODE_CHILD_ACTION_MASK = 0x20;
static constexpr uint8_t TRANSITION_MODE_BASE_ACTION_MASK = 0x10;
using dh_heater_request_t = uint8_t;
using dh_thermal_state_t = int8_t;
@ -54,47 +51,6 @@ class DeviceHandlerIF {
//! device still is powered. In this mode, only a mode change to @c MODE_OFF
//! can be commanded, which tries to switch off the device again.
static const Mode_t MODE_ERROR_ON = 4;
//! This is a transitional state which can not be commanded. The device
//! handler performs all commands to get the device in a state ready to
//! perform commands. When this is completed, the mode changes to @c MODE_ON.
static const Mode_t _MODE_START_UP = TRANSITION_MODE_CHILD_ACTION_MASK | 5;
//! This is a transitional state which can not be commanded.
//! The device handler performs all actions and commands to get the device
//! shut down. When the device is off, the mode changes to @c MODE_OFF.
//! It is possible to set the mode to _MODE_SHUT_DOWN to use the to off
//! transition if available.
static const Mode_t _MODE_SHUT_DOWN = TRANSITION_MODE_CHILD_ACTION_MASK | 6;
//! It is possible to set the mode to _MODE_TO_ON to use the to on
//! transition if available.
static const Mode_t _MODE_TO_ON = TRANSITION_MODE_CHILD_ACTION_MASK | HasModesIF::MODE_ON;
//! It is possible to set the mode to _MODE_TO_RAW to use the to raw
//! transition if available.
static const Mode_t _MODE_TO_RAW = TRANSITION_MODE_CHILD_ACTION_MASK | MODE_RAW;
//! It is possible to set the mode to _MODE_TO_NORMAL to use the to normal
//! transition if available.
static const Mode_t _MODE_TO_NORMAL = TRANSITION_MODE_CHILD_ACTION_MASK | MODE_NORMAL;
//! This is a transitional state which can not be commanded.
//! The device is shut down and ready to be switched off.
//! After the command to set the switch off has been sent,
//! the mode changes to @c MODE_WAIT_OFF
static const Mode_t _MODE_POWER_DOWN = TRANSITION_MODE_BASE_ACTION_MASK | 1;
//! This is a transitional state which can not be commanded. The device
//! will be switched on in this state. After the command to set the switch
//! on has been sent, the mode changes to @c MODE_WAIT_ON.
static const Mode_t _MODE_POWER_ON = TRANSITION_MODE_BASE_ACTION_MASK | 2;
//! This is a transitional state which can not be commanded. The switch has
//! been commanded off and the handler waits for it to be off.
//! When the switch is off, the mode changes to @c MODE_OFF.
static const Mode_t _MODE_WAIT_OFF = TRANSITION_MODE_BASE_ACTION_MASK | 3;
//! This is a transitional state which can not be commanded. The switch
//! has been commanded on and the handler waits for it to be on.
//! When the switch is on, the mode changes to @c MODE_TO_ON.
static const Mode_t _MODE_WAIT_ON = TRANSITION_MODE_BASE_ACTION_MASK | 4;
//! This is a transitional state which can not be commanded. The switch has
//! been commanded off and is off now. This state is only to do an RMAP
//! cycle once more where the doSendRead() function will set the mode to
//! MODE_OFF. The reason to do this is to get rid of stuck packets in the IO Board.
static const Mode_t _MODE_SWITCH_IS_OFF = TRANSITION_MODE_BASE_ACTION_MASK | 5;
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::CDH;
static const Event DEVICE_BUILDING_COMMAND_FAILED = MAKE_EVENT(0, severity::LOW);

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

@ -9,8 +9,8 @@
class HealthTable : public HealthTableIF, public SystemObject {
public:
HealthTable(object_id_t objectid);
virtual ~HealthTable();
explicit HealthTable(object_id_t objectid);
~HealthTable() override;
void setMutexTimeout(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs);

View File

@ -1,12 +1,12 @@
#ifndef FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_
#define FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_
#include "../ipc/MessageQueueMessageIF.h"
#include "fsfw/ipc/MessageQueueMessageIF.h"
class AcceptsHkPacketsIF {
public:
virtual ~AcceptsHkPacketsIF(){};
virtual MessageQueueId_t getHkQueue() const = 0;
virtual ~AcceptsHkPacketsIF() = default;
[[nodiscard]] virtual MessageQueueId_t getHkQueue() const = 0;
};
#endif /* FRAMEWORK_HOUSEKEEPING_ACCEPTSHKPACKETSIF_H_ */

View File

@ -126,11 +126,12 @@ MessageQueueId_t InternalErrorReporter::getCommandQueue() const {
ReturnValue_t InternalErrorReporter::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
localDataPoolMap.emplace(errorPoolIds::TM_HITS, new PoolEntry<uint32_t>());
localDataPoolMap.emplace(errorPoolIds::QUEUE_HITS, new PoolEntry<uint32_t>());
localDataPoolMap.emplace(errorPoolIds::STORE_HITS, new PoolEntry<uint32_t>());
poolManager.subscribeForPeriodicPacket(internalErrorSid, false, getPeriodicOperationFrequency(),
true);
localDataPoolMap.emplace(errorPoolIds::TM_HITS, &tmHitsEntry);
localDataPoolMap.emplace(errorPoolIds::QUEUE_HITS, &queueHitsEntry);
localDataPoolMap.emplace(errorPoolIds::STORE_HITS, &storeHitsEntry);
poolManager.subscribeForDiagPeriodicPacket(subdp::DiagnosticsHkPeriodicParams(
internalErrorSid, false,
static_cast<float>(getPeriodicOperationFrequency()) / static_cast<float>(1000.0)));
internalErrorDataset.setValidity(true, true);
return returnvalue::OK;
}

View File

@ -72,6 +72,9 @@ class InternalErrorReporter : public SystemObject,
uint32_t queueHits = 0;
uint32_t tmHits = 0;
uint32_t storeHits = 0;
PoolEntry<uint32_t> tmHitsEntry = PoolEntry<uint32_t>();
PoolEntry<uint32_t> storeHitsEntry = PoolEntry<uint32_t>();
PoolEntry<uint32_t> queueHitsEntry = PoolEntry<uint32_t>();
uint32_t getAndResetQueueHits();
void incrementQueueHits();

View File

@ -12,7 +12,7 @@
*/
class InternalErrorReporterIF {
public:
virtual ~InternalErrorReporterIF() {}
virtual ~InternalErrorReporterIF() = default;
/**
* @brief Function to be called if a message queue could not be sent.
* @details OSAL Implementations should call this function to indicate that

View File

@ -8,7 +8,7 @@ MessageQueueBase::MessageQueueBase(MessageQueueId_t id, MessageQueueId_t default
}
}
MessageQueueBase::~MessageQueueBase() {}
MessageQueueBase::~MessageQueueBase() = default;
ReturnValue_t MessageQueueBase::sendToDefault(MessageQueueMessageIF* message) {
return sendToDefaultFrom(message, this->getId(), false);

View File

@ -7,28 +7,28 @@
class MessageQueueBase : public MessageQueueIF {
public:
MessageQueueBase(MessageQueueId_t id, MessageQueueId_t defaultDest, MqArgs* mqArgs);
virtual ~MessageQueueBase();
~MessageQueueBase() override;
// Default implementations for MessageQueueIF where possible
virtual MessageQueueId_t getLastPartner() const override;
virtual MessageQueueId_t getId() const override;
virtual MqArgs& getMqArgs() override;
virtual void setDefaultDestination(MessageQueueId_t defaultDestination) override;
virtual MessageQueueId_t getDefaultDestination() const override;
virtual bool isDefaultDestinationSet() const override;
virtual ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
[[nodiscard]] MessageQueueId_t getLastPartner() const override;
[[nodiscard]] MessageQueueId_t getId() const override;
MqArgs& getMqArgs() override;
void setDefaultDestination(MessageQueueId_t defaultDestination) override;
[[nodiscard]] MessageQueueId_t getDefaultDestination() const override;
[[nodiscard]] bool isDefaultDestinationSet() const override;
ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
bool ignoreFault) override;
virtual ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override;
virtual ReturnValue_t reply(MessageQueueMessageIF* message) override;
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override;
ReturnValue_t reply(MessageQueueMessageIF* message) override;
ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
MessageQueueId_t* receivedFrom) override;
virtual ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
ReturnValue_t sendToDefaultFrom(MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
bool ignoreFault = false) override;
// OSAL specific, forward the abstract function
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message) = 0;
virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
MessageQueueId_t sentFrom, bool ignoreFault = false) = 0;
ReturnValue_t receiveMessage(MessageQueueMessageIF* message) override = 0;
ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
MessageQueueId_t sentFrom, bool ignoreFault = false) override = 0;
protected:
MessageQueueId_t id = MessageQueueIF::NO_QUEUE;

View File

@ -30,7 +30,7 @@ class MessageQueueIF {
//! [EXPORT] : [COMMENT] Returned if the target destination is invalid.
static constexpr ReturnValue_t DESTINATION_INVALID = MAKE_RETURN_CODE(4);
virtual ~MessageQueueIF() {}
virtual ~MessageQueueIF() = default;
/**
* @brief This operation sends a message to the last communication partner.
* @details
@ -82,11 +82,11 @@ class MessageQueueIF {
/**
* @brief This method returns the message queue ID of the last communication partner.
*/
virtual MessageQueueId_t getLastPartner() const = 0;
[[nodiscard]] virtual MessageQueueId_t getLastPartner() const = 0;
/**
* @brief This method returns the message queue ID of this class's message queue.
*/
virtual MessageQueueId_t getId() const = 0;
[[nodiscard]] virtual MessageQueueId_t getId() const = 0;
/**
* @brief With the sendMessage call, a queue message is sent to a receiving queue.
@ -159,9 +159,9 @@ class MessageQueueIF {
/**
* @brief This method is a simple getter for the default destination.
*/
virtual MessageQueueId_t getDefaultDestination() const = 0;
[[nodiscard]] virtual MessageQueueId_t getDefaultDestination() const = 0;
virtual bool isDefaultDestinationSet() const = 0;
[[nodiscard]] virtual bool isDefaultDestinationSet() const = 0;
virtual MqArgs& getMqArgs() = 0;
};

View File

@ -10,10 +10,10 @@ MessageQueueMessage::MessageQueueMessage() : messageSize(getMinimumMessageSize()
}
MessageQueueMessage::MessageQueueMessage(uint8_t* data, size_t size)
: messageSize(this->HEADER_SIZE + size) {
if (size <= this->MAX_DATA_SIZE) {
memcpy(this->getData(), data, size);
this->messageSize = this->HEADER_SIZE + size;
: messageSize(MessageQueueMessage::HEADER_SIZE + size) {
if (size <= MessageQueueMessage::MAX_DATA_SIZE) {
std::memcpy(MessageQueueMessage::getData(), data, size);
this->messageSize = MessageQueueMessage::HEADER_SIZE + size;
} else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "MessageQueueMessage: Passed size larger than maximum"
@ -21,21 +21,23 @@ MessageQueueMessage::MessageQueueMessage(uint8_t* data, size_t size)
<< std::endl;
#endif
memset(this->internalBuffer, 0, sizeof(this->internalBuffer));
this->messageSize = this->HEADER_SIZE;
this->messageSize = MessageQueueMessage::HEADER_SIZE;
}
}
MessageQueueMessage::~MessageQueueMessage() {}
MessageQueueMessage::~MessageQueueMessage() = default;
const uint8_t* MessageQueueMessage::getBuffer() const { return this->internalBuffer; }
uint8_t* MessageQueueMessage::getBuffer() { return this->internalBuffer; }
const uint8_t* MessageQueueMessage::getData() const {
return this->internalBuffer + this->HEADER_SIZE;
return this->internalBuffer + MessageQueueMessage::HEADER_SIZE;
}
uint8_t* MessageQueueMessage::getData() { return this->internalBuffer + this->HEADER_SIZE; }
uint8_t* MessageQueueMessage::getData() {
return this->internalBuffer + MessageQueueMessage::HEADER_SIZE;
}
MessageQueueId_t MessageQueueMessage::getSender() const {
MessageQueueId_t temp_id;
@ -58,14 +60,22 @@ void MessageQueueMessage::print(bool printWholeMessage) {
}
}
void MessageQueueMessage::clear() { memset(this->getBuffer(), 0, this->MAX_MESSAGE_SIZE); }
void MessageQueueMessage::clear() {
memset(this->getBuffer(), 0, MessageQueueMessage::MAX_MESSAGE_SIZE);
}
size_t MessageQueueMessage::getMessageSize() const { return this->messageSize; }
void MessageQueueMessage::setMessageSize(size_t messageSize) { this->messageSize = messageSize; }
void MessageQueueMessage::setMessageSize(size_t messageSize_) { this->messageSize = messageSize_; }
size_t MessageQueueMessage::getMinimumMessageSize() const { return this->MIN_MESSAGE_SIZE; }
size_t MessageQueueMessage::getMinimumMessageSize() const {
return MessageQueueMessage::MIN_MESSAGE_SIZE;
}
size_t MessageQueueMessage::getMaximumMessageSize() const { return this->MAX_MESSAGE_SIZE; }
size_t MessageQueueMessage::getMaximumMessageSize() const {
return MessageQueueMessage::MAX_MESSAGE_SIZE;
}
size_t MessageQueueMessage::getMaximumDataSize() const { return this->MAX_DATA_SIZE; }
size_t MessageQueueMessage::getMaximumDataSize() const {
return MessageQueueMessage::MAX_DATA_SIZE;
}

View File

@ -25,6 +25,30 @@
*/
class MessageQueueMessage : public MessageQueueMessageIF {
public:
/**
* @brief This constant defines the maximum size of the data content,
* excluding the header.
* @details
* It may be changed if necessary, but in general should be kept
* as small as possible.
*/
static const size_t MAX_DATA_SIZE = 24;
/**
* @brief This constant defines the maximum total size in bytes
* of a sent message.
* @details
* It is the sum of the maximum data and the header size. Be aware that
* this constant is used to define the buffer sizes for every message
* queue in the system. So, a change here may have significant impact on
* the required resources.
*/
static constexpr size_t MAX_MESSAGE_SIZE = MAX_DATA_SIZE + HEADER_SIZE;
/**
* @brief Defines the minimum size of a message where only the
* header is included
*/
static constexpr size_t MIN_MESSAGE_SIZE = HEADER_SIZE;
/**
* @brief The class is initialized empty with this constructor.
* @details
@ -50,59 +74,12 @@ class MessageQueueMessage : public MessageQueueMessageIF {
* @brief As no memory is allocated in this class,
* the destructor is empty.
*/
virtual ~MessageQueueMessage();
~MessageQueueMessage() override;
/**
* @brief The size information of each message is stored in
* this attribute.
* @details
* It is public to simplify usage and to allow for passing the size
* address as a pointer. Care must be taken when inheriting from this class,
* as every child class is responsible for managing the size information by
* itself. When using the class to receive a message, the size information
* is updated automatically.
*
* Please note that the minimum size is limited by the size of the header
* while the maximum size is limited by the maximum allowed message size.
*/
size_t messageSize;
/**
* @brief This constant defines the maximum size of the data content,
* excluding the header.
* @details
* It may be changed if necessary, but in general should be kept
* as small as possible.
*/
static const size_t MAX_DATA_SIZE = 24;
/**
* @brief This constant defines the maximum total size in bytes
* of a sent message.
* @details
* It is the sum of the maximum data and the header size. Be aware that
* this constant is used to define the buffer sizes for every message
* queue in the system. So, a change here may have significant impact on
* the required resources.
*/
static constexpr size_t MAX_MESSAGE_SIZE = MAX_DATA_SIZE + HEADER_SIZE;
/**
* @brief Defines the minimum size of a message where only the
* header is included
*/
static constexpr size_t MIN_MESSAGE_SIZE = HEADER_SIZE;
private:
/**
* @brief This is the internal buffer that contains the
* actual message data.
*/
uint8_t internalBuffer[MAX_MESSAGE_SIZE];
public:
/**
* @brief This method is used to get the complete data of the message.
*/
const uint8_t* getBuffer() const override;
[[nodiscard]] const uint8_t* getBuffer() const override;
/**
* @brief This method is used to get the complete data of the message.
*/
@ -112,7 +89,7 @@ class MessageQueueMessage : public MessageQueueMessageIF {
* @details
* It shall be used by child classes to add data at the right position.
*/
const uint8_t* getData() const override;
[[nodiscard]] const uint8_t* getData() const override;
/**
* @brief This method is used to fetch the data content of the message.
* @details
@ -123,7 +100,7 @@ class MessageQueueMessage : public MessageQueueMessageIF {
* @brief This method is used to extract the sender's message
* queue id information from a received message.
*/
MessageQueueId_t getSender() const override;
[[nodiscard]] MessageQueueId_t getSender() const override;
/**
* @brief With this method, the whole content
* and the message size is set to zero.
@ -138,16 +115,40 @@ class MessageQueueMessage : public MessageQueueMessageIF {
*/
void setSender(MessageQueueId_t setId) override;
virtual size_t getMessageSize() const override;
virtual void setMessageSize(size_t messageSize) override;
virtual size_t getMinimumMessageSize() const override;
virtual size_t getMaximumMessageSize() const override;
virtual size_t getMaximumDataSize() const override;
[[nodiscard]] size_t getMessageSize() const override;
void setMessageSize(size_t messageSize) override;
[[nodiscard]] size_t getMinimumMessageSize() const override;
[[nodiscard]] size_t getMaximumMessageSize() const override;
[[nodiscard]] size_t getMaximumDataSize() const override;
/**
* @brief This is a debug method that prints the content.
*/
void print(bool printWholeMessage);
/**
* TODO: This really should not be public. If it should be possible to pass size address as a
* pointer, add a getter function returning a const reference to the size
* @brief The size information of each message is stored in
* this attribute.
* @details
* It is public to simplify usage and to allow for passing the size
* address as a pointer. Care must be taken when inheriting from this class,
* as every child class is responsible for managing the size information by
* itself. When using the class to receive a message, the size information
* is updated automatically.
*
* Please note that the minimum size is limited by the size of the header
* while the maximum size is limited by the maximum allowed message size.
*/
size_t messageSize;
private:
/**
* @brief This is the internal buffer that contains the
* actual message data.
*/
uint8_t internalBuffer[MAX_MESSAGE_SIZE] = {};
};
#endif /* FSFW_IPC_MESSAGEQUEUEMESSAGE_H_ */

View File

@ -14,7 +14,7 @@ class MessageQueueMessageIF {
*/
static const size_t HEADER_SIZE = sizeof(MessageQueueId_t);
virtual ~MessageQueueMessageIF(){};
virtual ~MessageQueueMessageIF() = default;
/**
* @brief With this method, the whole content and the message
@ -29,7 +29,7 @@ class MessageQueueMessageIF {
* @brief Get read-only pointer to the complete data of the message.
* @return
*/
virtual const uint8_t* getBuffer() const = 0;
[[nodiscard]] virtual const uint8_t* getBuffer() const = 0;
/**
* @brief This method is used to get the complete data of the message.
@ -48,14 +48,14 @@ class MessageQueueMessageIF {
* @brief This method is used to extract the sender's message queue id
* information from a received message.
*/
virtual MessageQueueId_t getSender() const = 0;
[[nodiscard]] virtual MessageQueueId_t getSender() const = 0;
/**
* @brief This method is used to fetch the data content of the message.
* @details
* It shall be used by child classes to add data at the right position.
*/
virtual const uint8_t* getData() const = 0;
[[nodiscard]] virtual const uint8_t* getData() const = 0;
/**
* @brief This method is used to fetch the data content of the message.
* @details
@ -67,12 +67,28 @@ class MessageQueueMessageIF {
* Get constant message size of current message implementation.
* @return
*/
virtual size_t getMessageSize() const = 0;
[[nodiscard]] virtual size_t getMessageSize() const = 0;
/**
* Sets the current message size of a given message
* @param messageSize
*/
virtual void setMessageSize(size_t messageSize) = 0;
virtual size_t getMinimumMessageSize() const = 0;
virtual size_t getMaximumMessageSize() const = 0;
virtual size_t getMaximumDataSize() const = 0;
/**
* Returns the smallest possible message size, including any headers
* @return
*/
[[nodiscard]] virtual size_t getMinimumMessageSize() const = 0;
/**
* Returns the largest possible message size, including any headers
* @return
*/
[[nodiscard]] virtual size_t getMaximumMessageSize() const = 0;
/**
* Returns the largest possible data size without any headers
* @return
*/
[[nodiscard]] virtual size_t getMaximumDataSize() const = 0;
};
#endif /* FRAMEWORK_IPC_MESSAGEQUEUEMESSAGEIF_H_ */

View File

@ -1,14 +1,14 @@
#ifndef FSFW_IPC_MESSAGEQUEUESENDERIF_H_
#define FSFW_IPC_MESSAGEQUEUESENDERIF_H_
#include "../objectmanager/ObjectManagerIF.h"
#include "MessageQueueIF.h"
#include "MessageQueueMessageIF.h"
#include "fsfw/objectmanager/ObjectManagerIF.h"
class MessageQueueSenderIF {
public:
virtual ~MessageQueueSenderIF() {}
virtual ~MessageQueueSenderIF() = default;
MessageQueueSenderIF() = delete;
/**
* Allows sending messages without actually "owning" a message queue.
* Not sure whether this is actually a good idea.
@ -16,9 +16,6 @@ class MessageQueueSenderIF {
static ReturnValue_t sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
MessageQueueId_t sentFrom = MessageQueueIF::NO_QUEUE,
bool ignoreFault = false);
private:
MessageQueueSenderIF() {}
};
#endif /* FSFW_IPC_MESSAGEQUEUESENDERIF_H_ */

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::MISSION_TIMESTAMP_SIZE] = {};
uint8_t rawTimestamp[TimeWriterIF::MAXIMUM_TIMESTAMP_LEN] = {};
SerializeElement<SerialBufferAdapter<uint8_t>> timestampSerializer;
TimeStamperIF* timeStamper;
TimeWriterIF* timeStamper;
MonitoringReportContent()
: SerialLinkedListAdapter<SerializeIF>(&parameterObjectId),
monitorId(0),
@ -47,7 +47,7 @@ class MonitoringReportContent : public SerialLinkedListAdapter<SerializeIF> {
oldState(0),
newState(0),
timestampSerializer(rawTimestamp, sizeof(rawTimestamp)),
timeStamper(NULL) {
timeStamper(nullptr) {
setAllNext();
}
MonitoringReportContent(gp_id_t globalPoolId, T value, T limitValue, ReturnValue_t oldState,
@ -61,7 +61,7 @@ class MonitoringReportContent : public SerialLinkedListAdapter<SerializeIF> {
oldState(oldState),
newState(newState),
timestampSerializer(rawTimestamp, sizeof(rawTimestamp)),
timeStamper(NULL) {
timeStamper(nullptr) {
setAllNext();
if (checkAndSetStamper()) {
timeStamper->addTimeStamp(rawTimestamp, sizeof(rawTimestamp));
@ -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

@ -21,7 +21,7 @@ void ObjectManager::setObjectFactoryFunction(produce_function_t objFactoryFunc,
this->factoryArgs = factoryArgs;
}
ObjectManager::ObjectManager() {}
ObjectManager::ObjectManager() = default;
ObjectManager::~ObjectManager() {
for (auto const& iter : objectList) {
@ -53,7 +53,7 @@ ReturnValue_t ObjectManager::insert(object_id_t id, SystemObjectIF* object) {
}
ReturnValue_t ObjectManager::remove(object_id_t id) {
if (this->getSystemObject(id) != NULL) {
if (this->getSystemObject(id) != nullptr) {
this->objectList.erase(id);
#if FSFW_CPP_OSTREAM_ENABLED == 1
// sif::debug << "ObjectManager::removeObject: Object " << std::hex

View File

@ -38,7 +38,7 @@ class ObjectManager : public ObjectManagerIF {
/**
* @brief In the class's destructor, all objects in the list are deleted.
*/
virtual ~ObjectManager();
~ObjectManager() override;
ReturnValue_t insert(object_id_t id, SystemObjectIF* object) override;
ReturnValue_t remove(object_id_t id) override;
void initialize() override;

View File

@ -33,6 +33,7 @@ enum framework_objects : object_id_t {
TC_STORE = 0x534f0100,
TM_STORE = 0x534f0200,
TIME_STAMPER = 0x53500010,
VERIFICATION_REPORTER = 0x53500020,
FSFW_OBJECTS_END = 0x53ffffff,
NO_OBJECT = 0xFFFFFFFF

View File

@ -18,7 +18,7 @@
TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId,
object_id_t tcStoreId)
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
: TmTcBridge("TCP TMTC Bridge", objectId, tcDestination, tmStoreId, tcStoreId) {
mutex = MutexFactory::instance()->createMutex();
// Connection is always up, TM is requested by connecting to server and receiving packets
registerCommConnect();

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) {
SpacePacketParser::FoundPacketInfo info;
if (spacePacketParser == nullptr) {
return returnvalue::FAILED;
}
result =
spacePacketParser->parseSpacePackets(bufPtrPtr, readAmount, startIdx, foundSize, readLen);
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

@ -22,7 +22,7 @@ const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_POR
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
const std::string &udpServerPort_, object_id_t tmStoreId,
object_id_t tcStoreId)
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
: TmTcBridge("UDP TMTC Bridge", objectId, tcDestination, tmStoreId, tcStoreId) {
if (udpServerPort_.empty()) {
udpServerPort = DEFAULT_SERVER_PORT;
} else {

View File

@ -146,7 +146,7 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
}
ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval* to) {
struct tm time_tm;
struct tm time_tm {};
time_tm.tm_year = from->year - 1900;
time_tm.tm_mon = from->month - 1;

View File

@ -65,11 +65,11 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
// But I will still return a failure here.
return returnvalue::FAILED;
}
MessageQueue* targetQueue =
auto* targetQueue =
dynamic_cast<MessageQueue*>(QueueMapManager::instance()->getMessageQueue(sendTo));
if (targetQueue == nullptr) {
if (not ignoreFault) {
InternalErrorReporterIF* internalErrorReporter =
auto* internalErrorReporter =
ObjectManager::instance()->get<InternalErrorReporterIF>(objects::INTERNAL_ERROR_REPORTER);
if (internalErrorReporter != nullptr) {
internalErrorReporter->queueMessageNotSent();
@ -84,7 +84,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
message->getMaximumMessageSize());
} else {
if (not ignoreFault) {
InternalErrorReporterIF* internalErrorReporter =
auto* internalErrorReporter =
ObjectManager::instance()->get<InternalErrorReporterIF>(objects::INTERNAL_ERROR_REPORTER);
if (internalErrorReporter != nullptr) {
internalErrorReporter->queueMessageNotSent();

View File

@ -68,7 +68,7 @@ class MessageQueue : public MessageQueueBase {
* @details This is accomplished by using the delete call provided
* by the operating system.
*/
virtual ~MessageQueue();
~MessageQueue() override;
// Implement non-generic MessageQueueIF functions not handled by MessageQueueBase
virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, MessageQueueMessageIF* message,
@ -111,8 +111,6 @@ class MessageQueue : public MessageQueueBase {
size_t messageDepth = 0;
MutexIF* queueLock;
MessageQueueId_t defaultDestination = MessageQueueIF::NO_QUEUE;
};
#endif /* FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_ */

View File

@ -13,7 +13,6 @@ ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
MessageQueueMessageIF* message,
MessageQueueId_t sentFrom, bool ignoreFault) {
return MessageQueue::sendMessageFromMessageQueue(sendTo, message, sentFrom, ignoreFault);
return returnvalue::OK;
}
QueueFactory* QueueFactory::instance() {
@ -23,9 +22,9 @@ QueueFactory* QueueFactory::instance() {
return factoryInstance;
}
QueueFactory::QueueFactory() {}
QueueFactory::QueueFactory() = default;
QueueFactory::~QueueFactory() {}
QueueFactory::~QueueFactory() = default;
MessageQueueIF* QueueFactory::createMessageQueue(uint32_t messageDepth, size_t maxMessageSize,
MqArgs* args) {

View File

@ -54,7 +54,7 @@ MessageQueueIF* QueueMapManager::getMessageQueue(MessageQueueId_t messageQueueId
} else {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "QueueMapManager::getQueueHandle: The ID " << messageQueueId
<< " does not exists in the map!" << std::endl;
<< " does not exist in the map" << std::endl;
#else
sif::printWarning("QueueMapManager::getQueueHandle: The ID %d does not exist in the map!\n",
messageQueueId);

View File

@ -2,23 +2,22 @@
#include <linux/sysinfo.h>
#include <sys/sysinfo.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include <ctime>
#include <fstream>
#include "fsfw/ipc/MutexGuard.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
uint32_t Clock::getTicksPerSecond(void) {
uint32_t Clock::getTicksPerSecond() {
uint32_t ticks = sysconf(_SC_CLK_TCK);
return ticks;
}
ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
timespec timeUnix;
timeval timeTimeval;
timespec timeUnix{};
timeval timeTimeval{};
convertTimeOfDayToTimeval(time, &timeTimeval);
timeUnix.tv_sec = timeTimeval.tv_sec;
timeUnix.tv_nsec = (__syscall_slong_t)timeTimeval.tv_usec * 1000;
@ -32,7 +31,7 @@ ReturnValue_t Clock::setClock(const TimeOfDay_t* time) {
}
ReturnValue_t Clock::setClock(const timeval* time) {
timespec timeUnix;
timespec timeUnix{};
timeUnix.tv_sec = time->tv_sec;
timeUnix.tv_nsec = (__syscall_slong_t)time->tv_usec * 1000;
int status = clock_settime(CLOCK_REALTIME, &timeUnix);
@ -44,7 +43,7 @@ ReturnValue_t Clock::setClock(const timeval* time) {
}
ReturnValue_t Clock::getClock_timeval(timeval* time) {
timespec timeUnix;
timespec timeUnix{};
int status = clock_gettime(CLOCK_REALTIME, &timeUnix);
if (status != 0) {
return returnvalue::FAILED;
@ -55,18 +54,18 @@ ReturnValue_t Clock::getClock_timeval(timeval* time) {
}
ReturnValue_t Clock::getClock_usecs(uint64_t* time) {
timeval timeVal;
timeval timeVal{};
ReturnValue_t result = getClock_timeval(&timeVal);
if (result != returnvalue::OK) {
return result;
}
*time = (uint64_t)timeVal.tv_sec * 1e6 + timeVal.tv_usec;
*time = static_cast<uint64_t>(timeVal.tv_sec) * 1e6 + timeVal.tv_usec;
return returnvalue::OK;
}
timeval Clock::getUptime() {
timeval uptime;
timeval uptime{};
auto result = getUptime(&uptime);
if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -99,7 +98,7 @@ ReturnValue_t Clock::getUptime(timeval* uptime) {
//}
ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
timeval uptime;
timeval uptime{};
ReturnValue_t result = getUptime(&uptime);
if (result != returnvalue::OK) {
return result;
@ -109,7 +108,7 @@ ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) {
}
ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
timespec timeUnix;
timespec timeUnix{};
int status = clock_gettime(CLOCK_REALTIME, &timeUnix);
if (status != 0) {
// TODO errno
@ -122,7 +121,7 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
MutexGuard helper(timeMutex);
// gmtime writes its output in a global buffer which is not Thread Safe
// Therefore we have to use a Mutex here
struct tm* timeInfo;
struct std::tm* timeInfo;
timeInfo = gmtime(&timeUnix.tv_sec);
time->year = timeInfo->tm_year + 1900;
time->month = timeInfo->tm_mon + 1;
@ -136,7 +135,7 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) {
}
ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval* to) {
tm fromTm;
std::tm fromTm{};
// Note: Fails for years before AD
fromTm.tm_year = from->year - 1900;
fromTm.tm_mon = from->month - 1;

View File

@ -44,7 +44,7 @@ store_address_t ParameterMessage::getParameterLoadCommand(const CommandMessage*
*pfc = packedParamSettings >> 16 & 0xff;
*rows = packedParamSettings >> 8 & 0xff;
*columns = packedParamSettings & 0xff;
return message->getParameter2();
return static_cast<store_address_t>(message->getParameter2());
}
void ParameterMessage::clear(CommandMessage* message) {

View File

@ -10,8 +10,8 @@
CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid,
uint8_t serviceId, uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
}
: CommandingServiceBase(objectId, apid, "PUS 200 Mode MGMT", serviceId, numParallelCommands,
commandTimeoutSeconds) {}
CService200ModeCommanding::~CService200ModeCommanding() {}
@ -41,7 +41,7 @@ ReturnValue_t CService200ModeCommanding::getMessageQueueAndObject(uint8_t subser
ReturnValue_t CService200ModeCommanding::checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t *messageQueueToSet, object_id_t *objectId) {
HasModesIF *destination = ObjectManager::instance()->get<HasModesIF>(*objectId);
auto *destination = ObjectManager::instance()->get<HasModesIF>(*objectId);
if (destination == nullptr) {
return CommandingServiceBase::INVALID_OBJECT;
}
@ -96,13 +96,13 @@ ReturnValue_t CService200ModeCommanding::handleReply(const CommandMessage *reply
ReturnValue_t CService200ModeCommanding::prepareModeReply(const CommandMessage *reply,
object_id_t objectId) {
ModePacket modeReplyPacket(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply));
return sendTmPacket(Subservice::REPLY_MODE_REPLY, &modeReplyPacket);
return sendTmPacket(Subservice::REPLY_MODE_REPLY, modeReplyPacket);
}
ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMessage *reply,
object_id_t objectId) {
ModePacket wrongModeReply(objectId, ModeMessage::getMode(reply), ModeMessage::getSubmode(reply));
ReturnValue_t result = sendTmPacket(Subservice::REPLY_WRONG_MODE_REPLY, &wrongModeReply);
ReturnValue_t result = sendTmPacket(Subservice::REPLY_WRONG_MODE_REPLY, wrongModeReply);
if (result == returnvalue::OK) {
// We want to produce an error here in any case because the mode was not correct
return returnvalue::FAILED;
@ -113,7 +113,7 @@ ReturnValue_t CService200ModeCommanding::prepareWrongModeReply(const CommandMess
ReturnValue_t CService200ModeCommanding::prepareCantReachModeReply(const CommandMessage *reply,
object_id_t objectId) {
CantReachModePacket cantReachModePacket(objectId, ModeMessage::getCantReachModeReason(reply));
ReturnValue_t result = sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, &cantReachModePacket);
ReturnValue_t result = sendTmPacket(Subservice::REPLY_CANT_REACH_MODE, cantReachModePacket);
if (result == returnvalue::OK) {
// We want to produce an error here in any case because the mode was not reached
return returnvalue::FAILED;

View File

@ -10,8 +10,8 @@ CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, u
uint8_t serviceId,
uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
}
: CommandingServiceBase(objectId, apid, "PUS 201 Health MGMT", serviceId, numParallelCommands,
commandTimeoutSeconds) {}
ReturnValue_t CService201HealthCommanding::isValidSubservice(uint8_t subservice) {
switch (subservice) {
@ -102,5 +102,5 @@ ReturnValue_t CService201HealthCommanding::handleReply(const CommandMessage *rep
auto health = static_cast<uint8_t>(HealthMessage::getHealth(reply));
auto oldHealth = static_cast<uint8_t>(HealthMessage::getOldHealth(reply));
HealthSetReply healthSetReply(health, oldHealth);
return sendTmPacket(Subservice::REPLY_HEALTH_SET, &healthSetReply);
return sendTmPacket(Subservice::REPLY_HEALTH_SET, healthSetReply);
}

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;
@ -71,8 +72,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
TO_TIMETAG = 3
};
Service11TelecommandScheduling(object_id_t objectId, uint16_t apid, uint8_t serviceId,
AcceptsTelecommandsIF* tcRecipient,
Service11TelecommandScheduling(PsbParams params, AcceptsTelecommandsIF* tcRecipient,
uint16_t releaseTimeMarginSeconds = DEFAULT_RELEASE_TIME_MARGIN,
bool debugMode = false);
@ -156,7 +156,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
* @param data The Application data of the TC (get via getApplicationData()).
* @return requestId
*/
uint64_t getRequestIdFromDataTC(const uint8_t* data) const;
[[nodiscard]] uint64_t getRequestIdFromTc() const;
/**
* @brief Extracts the Request ID from the Application Data directly, assuming it is packed

View File

@ -11,12 +11,14 @@ static constexpr auto DEF_END = SerializeIF::Endianness::BIG;
template <size_t MAX_NUM_TCS>
inline Service11TelecommandScheduling<MAX_NUM_TCS>::Service11TelecommandScheduling(
object_id_t objectId, uint16_t apid, uint8_t serviceId, AcceptsTelecommandsIF *tcRecipient,
uint16_t releaseTimeMarginSeconds, bool debugMode)
: PusServiceBase(objectId, apid, serviceId),
PsbParams params, AcceptsTelecommandsIF *tcRecipient, uint16_t releaseTimeMarginSeconds,
bool debugMode)
: PusServiceBase(params),
RELEASE_TIME_MARGIN_SECONDS(releaseTimeMarginSeconds),
debugMode(debugMode),
tcRecipient(tcRecipient) {}
tcRecipient(tcRecipient) {
params.name = "PUS 11 TC Scheduling";
}
template <size_t MAX_NUM_TCS>
inline Service11TelecommandScheduling<MAX_NUM_TCS>::~Service11TelecommandScheduling() = default;
@ -32,11 +34,8 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleRequest(
#endif
}
// Get de-serialized Timestamp
const uint8_t *data = currentPacket.getApplicationData();
size_t size = currentPacket.getApplicationDataSize();
if (data == nullptr) {
return handleInvalidData("handleRequest");
}
const uint8_t *data = currentPacket.getUserData();
size_t size = currentPacket.getUserDataLen();
switch (subservice) {
case Subservice::ENABLE_SCHEDULING: {
schedulingEnabled = true;
@ -82,7 +81,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::performService
if (schedulingEnabled) {
// release tc
TmTcMessage releaseMsg(it->second.storeAddr);
auto sendRet = this->requestQueue->sendMessage(recipientMsgQueueId, &releaseMsg, false);
auto sendRet = psbParams.reqQueue->sendMessage(recipientMsgQueueId, &releaseMsg, false);
if (sendRet != returnvalue::OK) {
return sendRet;
@ -175,7 +174,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivi
// store currentPacket and receive the store address
store_address_t addr{};
if (tcStore->addData(&addr, data, size) != returnvalue::OK ||
addr.raw == storeId::INVALID_STORE_ADDRESS) {
addr.raw == store_address_t::INVALID_RAW) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service11TelecommandScheduling::doInsertActivity: Adding data to TC Store failed"
<< std::endl;
@ -190,8 +189,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivi
TelecommandStruct tc;
tc.seconds = timestamp;
tc.storeAddr = addr;
tc.requestId =
getRequestIdFromDataTC(data); // TODO: Missing sanity check of the returned request id
tc.requestId = getRequestIdFromTc(); // TODO: Missing sanity check of the returned request id
auto it = telecommandMap.insert(std::pair<uint32_t, TelecommandStruct>(timestamp, tc));
if (it == telecommandMap.end()) {
@ -455,13 +453,10 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doFilterTimesh
}
template <size_t MAX_NUM_TCS>
inline uint64_t Service11TelecommandScheduling<MAX_NUM_TCS>::getRequestIdFromDataTC(
const uint8_t *data) const {
TcPacketPus mask(data);
uint32_t sourceId = mask.getSourceId();
uint16_t apid = mask.getAPID();
uint16_t sequenceCount = mask.getPacketSequenceCount();
inline uint64_t Service11TelecommandScheduling<MAX_NUM_TCS>::getRequestIdFromTc() const {
uint32_t sourceId = currentPacket.getSourceId();
uint16_t apid = currentPacket.getApid();
uint16_t sequenceCount = currentPacket.getSequenceCount();
return buildRequestId(sourceId, apid, sequenceCount);
}
@ -571,12 +566,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++;
}
@ -586,17 +586,6 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
default:
return returnvalue::FAILED;
}
// additional security check, this should never be true
if (itBegin > itEnd) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "11::getMapFilterFromData: itBegin > itEnd\n" << std::endl;
#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

@ -1,39 +1,35 @@
#include "fsfw/pus/Service17Test.h"
#include "fsfw/FSFW.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
#include "fsfw/tmtcservices/tmHelpers.h"
Service17Test::Service17Test(object_id_t objectId, uint16_t apid, uint8_t serviceId)
: PusServiceBase(objectId, apid, serviceId), packetSubCounter(0) {}
Service17Test::Service17Test(PsbParams params)
: PusServiceBase(params),
storeHelper(params.apid),
tmHelper(params.serviceId, storeHelper, sendHelper) {
params.name = "PUS 17 Test";
}
Service17Test::~Service17Test() {}
Service17Test::~Service17Test() = default;
ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
switch (subservice) {
case Subservice::CONNECTION_TEST: {
#if FSFW_USE_PUS_C_TELEMETRY == 0
TmPacketStoredPusA connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT,
packetSubCounter++);
#else
TmPacketStoredPusC connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT,
packetSubCounter++);
#endif
connectionPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId());
return returnvalue::OK;
ReturnValue_t result = tmHelper.prepareTmPacket(Subservice::CONNECTION_TEST_REPORT);
if (result != returnvalue::OK) {
return result;
}
return tmHelper.storeAndSendTmPacket();
}
case Subservice::EVENT_TRIGGER_TEST: {
#if FSFW_USE_PUS_C_TELEMETRY == 0
TmPacketStoredPusA connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT,
packetSubCounter++);
#else
TmPacketStoredPusC connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT,
packetSubCounter++);
#endif
connectionPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId());
triggerEvent(TEST, 1234, 5678);
return returnvalue::OK;
ReturnValue_t result = tmHelper.prepareTmPacket(Subservice::EVENT_TRIGGER_TEST);
if (result != returnvalue::OK) {
return result;
}
return tmHelper.storeAndSendTmPacket();
}
default:
return AcceptsTelecommandsIF::INVALID_SUBSERVICE;
@ -41,3 +37,23 @@ ReturnValue_t Service17Test::handleRequest(uint8_t subservice) {
}
ReturnValue_t Service17Test::performService() { return returnvalue::OK; }
ReturnValue_t Service17Test::initialize() {
ReturnValue_t result = PusServiceBase::initialize();
if (result != returnvalue::OK) {
return result;
}
initializeTmHelpers(sendHelper, storeHelper);
if (storeHelper.getTmStore() == nullptr) {
auto* tmStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE);
if (tmStore == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
storeHelper.setTmStore(*tmStore);
}
return result;
}
void Service17Test::setCustomTmStore(StorageManagerIF& tmStore_) {
storeHelper.setTmStore(tmStore_);
}

View File

@ -3,6 +3,8 @@
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
/**
* @brief Test Service
@ -32,13 +34,19 @@ class Service17Test : public PusServiceBase {
EVENT_TRIGGER_TEST = 128,
};
Service17Test(object_id_t objectId, uint16_t apid, uint8_t serviceId);
virtual ~Service17Test();
virtual ReturnValue_t handleRequest(uint8_t subservice) override;
virtual ReturnValue_t performService() override;
explicit Service17Test(PsbParams params);
void setCustomTmStore(StorageManagerIF& tmStore);
~Service17Test() override;
ReturnValue_t handleRequest(uint8_t subservice) override;
ReturnValue_t performService() override;
ReturnValue_t initialize() override;
protected:
uint16_t packetSubCounter = 0;
TmStoreHelper storeHelper;
TmSendHelper sendHelper;
TmStoreAndSendWrapper tmHelper;
};
#endif /* FSFW_PUS_SERVICE17TEST_H_ */

View File

@ -3,19 +3,21 @@
#include "fsfw/ipc/QueueFactory.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/pus/servicepackets/Service1Packets.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
#include "fsfw/tmtcservices/PusVerificationReport.h"
#include "fsfw/tmtcservices/tmHelpers.h"
Service1TelecommandVerification::Service1TelecommandVerification(object_id_t objectId,
uint16_t apid, uint8_t serviceId,
object_id_t targetDestination,
uint16_t messageQueueDepth)
uint16_t messageQueueDepth,
TimeWriterIF* timeStamper)
: SystemObject(objectId),
apid(apid),
serviceId(serviceId),
targetDestination(targetDestination) {
targetDestination(targetDestination),
storeHelper(apid),
tmHelper(serviceId, storeHelper, sendHelper) {
tmQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
}
@ -47,6 +49,19 @@ ReturnValue_t Service1TelecommandVerification::performOperation(uint8_t operatio
ReturnValue_t Service1TelecommandVerification::sendVerificationReport(
PusVerificationMessage* message) {
ReturnValue_t result;
uint8_t reportId = message->getReportId();
if (reportId == 0 or reportId > 8) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service1TelecommandVerification::sendVerificationReport: Invalid report ID "
<< static_cast<int>(reportId) << " detected" << std::endl;
#else
sif::printError(
"Service1TelecommandVerification::sendVerificationReport: Invalid report ID "
"%d detected\n",
reportId);
#endif
return returnvalue::FAILED;
}
if (message->getReportId() % 2 == 0) {
result = generateFailureReport(message);
} else {
@ -67,32 +82,37 @@ ReturnValue_t Service1TelecommandVerification::generateFailureReport(
FailureReport report(message->getReportId(), message->getTcPacketId(),
message->getTcSequenceControl(), message->getStep(), message->getErrorCode(),
message->getParameter1(), message->getParameter2());
#if FSFW_USE_PUS_C_TELEMETRY == 0
TmPacketStoredPusA tmPacket(apid, serviceId, message->getReportId(), packetSubCounter++, &report);
#else
TmPacketStoredPusC tmPacket(apid, serviceId, message->getReportId(), packetSubCounter++, &report);
#endif
ReturnValue_t result = tmPacket.sendPacket(tmQueue->getDefaultDestination(), tmQueue->getId());
ReturnValue_t result =
storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++);
if (result != returnvalue::OK) {
return result;
}
result = storeHelper.setSourceDataSerializable(report);
if (result != returnvalue::OK) {
return result;
}
return tmHelper.storeAndSendTmPacket();
}
ReturnValue_t Service1TelecommandVerification::generateSuccessReport(
PusVerificationMessage* message) {
SuccessReport report(message->getReportId(), message->getTcPacketId(),
message->getTcSequenceControl(), message->getStep());
#if FSFW_USE_PUS_C_TELEMETRY == 0
TmPacketStoredPusA tmPacket(apid, serviceId, message->getReportId(), packetSubCounter++, &report);
#else
TmPacketStoredPusC tmPacket(apid, serviceId, message->getReportId(), packetSubCounter++, &report);
#endif
ReturnValue_t result = tmPacket.sendPacket(tmQueue->getDefaultDestination(), tmQueue->getId());
ReturnValue_t result =
storeHelper.preparePacket(serviceId, message->getReportId(), packetSubCounter++);
if (result != returnvalue::OK) {
return result;
}
result = storeHelper.setSourceDataSerializable(report);
if (result != returnvalue::OK) {
return result;
}
return tmHelper.storeAndSendTmPacket();
}
ReturnValue_t Service1TelecommandVerification::initialize() {
// Get target object for TC verification messages
AcceptsTelemetryIF* funnel =
ObjectManager::instance()->get<AcceptsTelemetryIF>(targetDestination);
auto* funnel = ObjectManager::instance()->get<AcceptsTelemetryIF>(targetDestination);
if (funnel == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service1TelecommandVerification::initialize: Specified"
@ -102,6 +122,33 @@ ReturnValue_t Service1TelecommandVerification::initialize() {
#endif
return ObjectManagerIF::CHILD_INIT_FAILED;
}
if (tmQueue == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
tmQueue->setDefaultDestination(funnel->getReportReceptionQueue());
if (tmStore == nullptr) {
tmStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE);
if (tmStore == nullptr) {
return ObjectManager::CHILD_INIT_FAILED;
}
storeHelper.setTmStore(*tmStore);
}
if (timeStamper == nullptr) {
timeStamper = ObjectManager::instance()->get<TimeWriterIF>(objects::TIME_STAMPER);
if (timeStamper == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
} else {
}
storeHelper.setTimeStamper(*timeStamper);
sendHelper.setMsgQueue(*tmQueue);
if (errReporter == nullptr) {
errReporter =
ObjectManager::instance()->get<InternalErrorReporterIF>(objects::INTERNAL_ERROR_REPORTER);
if (errReporter != nullptr) {
sendHelper.setInternalErrorReporter(*errReporter);
}
}
return SystemObject::initialize();
}

View File

@ -7,6 +7,9 @@
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/tmtcservices/AcceptsVerifyMessageIF.h"
#include "fsfw/tmtcservices/PusVerificationReport.h"
#include "fsfw/tmtcservices/TmSendHelper.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
#include "fsfw/tmtcservices/TmStoreHelper.h"
/**
* @brief Verify TC acceptance, start, progress and execution.
@ -43,14 +46,15 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_1;
Service1TelecommandVerification(object_id_t objectId, uint16_t apid, uint8_t serviceId,
object_id_t targetDestination, uint16_t messageQueueDepth);
virtual ~Service1TelecommandVerification();
object_id_t targetDestination, uint16_t messageQueueDepth,
TimeWriterIF* timeStamper = nullptr);
~Service1TelecommandVerification() override;
/**
*
* @return ID of Verification Queue
*/
virtual MessageQueueId_t getVerificationQueue() override;
MessageQueueId_t getVerificationQueue() override;
/**
* Performs the service periodically as specified in init_mission().
@ -58,7 +62,7 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
* @param operationCode
* @return
*/
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t performOperation(uint8_t operationCode) override;
/**
* Initializes the destination for TC verification messages and initializes
@ -79,6 +83,12 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
uint16_t packetSubCounter = 0;
TmSendHelper sendHelper;
TmStoreHelper storeHelper;
TmStoreAndSendWrapper tmHelper;
InternalErrorReporterIF* errReporter = nullptr;
TimeWriterIF* timeStamper = nullptr;
StorageManagerIF* tmStore = nullptr;
MessageQueueIF* tmQueue = nullptr;
enum class Subservice : uint8_t {

View File

@ -11,10 +11,10 @@ Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId,
uint8_t serviceId,
uint8_t numberOfParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
commandTimeoutSeconds) {}
: CommandingServiceBase(objectId, apid, "PUS 20 Parameter MGMT", serviceId,
numberOfParallelCommands, commandTimeoutSeconds) {}
Service20ParameterManagement::~Service20ParameterManagement() {}
Service20ParameterManagement::~Service20ParameterManagement() = default;
ReturnValue_t Service20ParameterManagement::isValidSubservice(uint8_t subservice) {
switch (static_cast<Subservice>(subservice)) {
@ -64,8 +64,7 @@ ReturnValue_t Service20ParameterManagement::checkAndAcquireTargetID(object_id_t*
ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue(
MessageQueueId_t* messageQueueToSet, object_id_t* objectId) {
// check ReceivesParameterMessagesIF property of target
ReceivesParameterMessagesIF* possibleTarget =
ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
auto* possibleTarget = ObjectManager::instance()->get<ReceivesParameterMessagesIF>(*objectId);
if (possibleTarget == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service20ParameterManagement::checkInterfaceAndAcquire"
@ -137,7 +136,7 @@ ReturnValue_t Service20ParameterManagement::prepareLoadCommand(CommandMessage* m
if (parameterDataLen == 0) {
return CommandingServiceBase::INVALID_TC;
}
ReturnValue_t result = IPCStore->getFreeElement(&storeAddress, parameterDataLen, &storePointer);
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, parameterDataLen, &storePointer);
if (result != returnvalue::OK) {
return result;
}
@ -169,7 +168,7 @@ ReturnValue_t Service20ParameterManagement::handleReply(const CommandMessage* re
switch (replyId) {
case ParameterMessage::REPLY_PARAMETER_DUMP: {
ConstAccessorPair parameterData = IPCStore->getData(ParameterMessage::getStoreId(reply));
ConstAccessorPair parameterData = ipcStore->getData(ParameterMessage::getStoreId(reply));
if (parameterData.first != returnvalue::OK) {
return returnvalue::FAILED;
}
@ -177,8 +176,7 @@ ReturnValue_t Service20ParameterManagement::handleReply(const CommandMessage* re
ParameterId_t parameterId = ParameterMessage::getParameterId(reply);
ParameterDumpReply parameterReply(objectId, parameterId, parameterData.second.data(),
parameterData.second.size());
sendTmPacket(static_cast<uint8_t>(Subservice::PARAMETER_DUMP_REPLY), &parameterReply);
return returnvalue::OK;
return sendTmPacket(static_cast<uint8_t>(Subservice::PARAMETER_DUMP_REPLY), parameterReply);
}
default:
return CommandingServiceBase::INVALID_REPLY;

View File

@ -14,8 +14,8 @@
Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId,
uint8_t numberOfParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numberOfParallelCommands,
commandTimeoutSeconds) {}
: CommandingServiceBase(objectId, apid, "PUS 2 Raw Commanding", serviceId,
numberOfParallelCommands, commandTimeoutSeconds) {}
Service2DeviceAccess::~Service2DeviceAccess() {}
@ -75,7 +75,7 @@ ReturnValue_t Service2DeviceAccess::prepareRawCommand(CommandMessage* messageToS
// store command into the Inter Process Communication Store
store_address_t storeAddress;
ReturnValue_t result =
IPCStore->addData(&storeAddress, RawCommand.getCommand(), RawCommand.getCommandSize());
ipcStore->addData(&storeAddress, RawCommand.getCommand(), RawCommand.getCommandSize());
DeviceHandlerMessage::setDeviceHandlerRawCommandMessage(messageToSet, storeAddress);
return result;
}
@ -135,7 +135,7 @@ void Service2DeviceAccess::sendWiretappingTm(CommandMessage* reply, uint8_t subs
store_address_t storeAddress = DeviceHandlerMessage::getStoreAddress(reply);
const uint8_t* data = nullptr;
size_t size = 0;
ReturnValue_t result = IPCStore->getData(storeAddress, &data, &size);
ReturnValue_t result = ipcStore->getData(storeAddress, &data, &size);
if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service2DeviceAccess::sendWiretappingTm: Data Lost in "
@ -147,10 +147,12 @@ void Service2DeviceAccess::sendWiretappingTm(CommandMessage* reply, uint8_t subs
// Init our dummy packet and correct endianness of object ID before
// sending it back.
WiretappingPacket TmPacket(DeviceHandlerMessage::getDeviceObjectId(reply), data);
TmPacket.objectId = EndianConverter::convertBigEndian(TmPacket.objectId);
sendTmPacket(subservice, TmPacket.data, size, reinterpret_cast<uint8_t*>(&TmPacket.objectId),
sizeof(TmPacket.objectId));
WiretappingPacket tmPacket(DeviceHandlerMessage::getDeviceObjectId(reply), data);
result = sendTmPacket(subservice, tmPacket.objectId, tmPacket.data, size);
if (result != returnvalue::OK) {
// TODO: Warning
return;
}
}
MessageQueueId_t Service2DeviceAccess::getDeviceQueue() { return commandQueue->getId(); }

View File

@ -5,7 +5,7 @@
#include "fsfw/pus/servicepackets/Service3Packets.h"
Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId)
: CommandingServiceBase(objectId, apid, serviceId, NUM_OF_PARALLEL_COMMANDS,
: CommandingServiceBase(objectId, apid, "PUS 3 HK", serviceId, NUM_OF_PARALLEL_COMMANDS,
COMMAND_TIMEOUT_SECONDS) {}
Service3Housekeeping::~Service3Housekeeping() {}
@ -284,14 +284,13 @@ ReturnValue_t Service3Housekeeping::generateHkReply(const CommandMessage* hkMess
store_address_t storeId;
sid_t sid = HousekeepingMessage::getHkDataReply(hkMessage, &storeId);
auto resultPair = IPCStore->getData(storeId);
auto resultPair = ipcStore->getData(storeId);
if (resultPair.first != returnvalue::OK) {
return resultPair.first;
}
HkPacket hkPacket(sid, resultPair.second.data(), resultPair.second.size());
return sendTmPacket(static_cast<uint8_t>(subserviceId), hkPacket.hkData, hkPacket.hkSize, nullptr,
0);
return sendTmPacket(static_cast<uint8_t>(subserviceId), hkPacket.hkData, hkPacket.hkSize);
}
sid_t Service3Housekeeping::buildSid(object_id_t objectId, const uint8_t** tcData,

View File

@ -5,13 +5,15 @@
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/pus/servicepackets/Service5Packets.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h"
#include "fsfw/tmtcservices/tmHelpers.h"
Service5EventReporting::Service5EventReporting(object_id_t objectId, uint16_t apid,
uint8_t serviceId, size_t maxNumberReportsPerCycle,
Service5EventReporting::Service5EventReporting(PsbParams params, size_t maxNumberReportsPerCycle,
uint32_t messageQueueDepth)
: PusServiceBase(objectId, apid, serviceId),
: PusServiceBase(params),
storeHelper(params.apid),
tmHelper(params.serviceId, storeHelper, sendHelper),
maxNumberReportsPerCycle(maxNumberReportsPerCycle) {
psbParams.name = "PUS 5 Event Reporting";
eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth);
}
@ -45,15 +47,9 @@ ReturnValue_t Service5EventReporting::performService() {
ReturnValue_t Service5EventReporting::generateEventReport(EventMessage message) {
EventReport report(message.getEventId(), message.getReporter(), message.getParameter1(),
message.getParameter2());
#if FSFW_USE_PUS_C_TELEMETRY == 0
TmPacketStoredPusA tmPacket(PusServiceBase::apid, PusServiceBase::serviceId,
message.getSeverity(), packetSubCounter++, &report);
#else
TmPacketStoredPusC tmPacket(PusServiceBase::apid, PusServiceBase::serviceId,
message.getSeverity(), packetSubCounter++, &report);
#endif
ReturnValue_t result =
tmPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId());
storeHelper.preparePacket(psbParams.serviceId, message.getSeverity(), tmHelper.sendCounter);
storeHelper.setSourceDataSerializable(report);
ReturnValue_t result = tmHelper.storeAndSendTmPacket();
if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Service5EventReporting::generateEventReport: "
@ -86,14 +82,19 @@ ReturnValue_t Service5EventReporting::handleRequest(uint8_t subservice) {
// In addition to the default PUSServiceBase initialization, this service needs
// to be registered to the event manager to listen for events.
ReturnValue_t Service5EventReporting::initialize() {
ReturnValue_t result = PusServiceBase::initialize();
if (result != returnvalue::OK) {
return result;
}
auto* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
if (manager == nullptr) {
return returnvalue::FAILED;
}
// register Service 5 as listener for events
ReturnValue_t result = manager->registerListener(eventQueue->getId(), true);
result = manager->registerListener(eventQueue->getId(), true);
if (result != returnvalue::OK) {
return result;
}
return PusServiceBase::initialize();
initializeTmHelpers(sendHelper, storeHelper);
return result;
}

View File

@ -3,6 +3,7 @@
#include "fsfw/events/EventMessage.h"
#include "fsfw/tmtcservices/PusServiceBase.h"
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
/**
* @brief Report on-board events like information or errors
@ -40,9 +41,9 @@
*/
class Service5EventReporting : public PusServiceBase {
public:
Service5EventReporting(object_id_t objectId, uint16_t apid, uint8_t serviceId,
size_t maxNumberReportsPerCycle = 10, uint32_t messageQueueDepth = 10);
virtual ~Service5EventReporting();
Service5EventReporting(PsbParams params, size_t maxNumberReportsPerCycle = 10,
uint32_t messageQueueDepth = 10);
~Service5EventReporting() override;
/***
* Check for events and generate event reports if required.
@ -74,9 +75,11 @@ class Service5EventReporting : public PusServiceBase {
};
private:
uint16_t packetSubCounter = 0;
MessageQueueIF* eventQueue = nullptr;
bool enableEventReport = true;
TmSendHelper sendHelper;
TmStoreHelper storeHelper;
TmStoreAndSendWrapper tmHelper;
const uint8_t maxNumberReportsPerCycle;
ReturnValue_t generateEventReport(EventMessage message);

View File

@ -12,8 +12,8 @@ Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uin
uint8_t serviceId,
uint8_t numParallelCommands,
uint16_t commandTimeoutSeconds)
: CommandingServiceBase(objectId, apid, serviceId, numParallelCommands, commandTimeoutSeconds) {
}
: CommandingServiceBase(objectId, apid, "PUS 8 Functional Commanding", serviceId,
numParallelCommands, commandTimeoutSeconds) {}
Service8FunctionManagement::~Service8FunctionManagement() {}
@ -78,7 +78,7 @@ ReturnValue_t Service8FunctionManagement::prepareDirectCommand(CommandMessage* m
// store additional parameters into the IPC Store
store_address_t parameterAddress;
ReturnValue_t result =
IPCStore->addData(&parameterAddress, command.getParameters(), command.getParametersSize());
ipcStore->addData(&parameterAddress, command.getParameters(), command.getParametersSize());
// setCommand expects a Command Message, an Action ID and a store adress
// pointing to additional parameters
@ -130,7 +130,7 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
store_address_t storeId = ActionMessage::getStoreId(reply);
size_t size = 0;
const uint8_t* buffer = nullptr;
ReturnValue_t result = IPCStore->getData(storeId, &buffer, &size);
ReturnValue_t result = ipcStore->getData(storeId, &buffer, &size);
if (result != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service 8: Could not retrieve data for data reply" << std::endl;
@ -138,9 +138,9 @@ ReturnValue_t Service8FunctionManagement::handleDataReply(const CommandMessage*
return result;
}
DataReply dataReply(objectId, actionId, buffer, size);
result = sendTmPacket(static_cast<uint8_t>(Subservice::REPLY_DIRECT_COMMANDING_DATA), &dataReply);
result = sendTmPacket(static_cast<uint8_t>(Subservice::REPLY_DIRECT_COMMANDING_DATA), dataReply);
auto deletionResult = IPCStore->deleteData(storeId);
auto deletionResult = ipcStore->deleteData(storeId);
if (deletionResult != returnvalue::OK) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Service8FunctionManagement::handleReply: Deletion"

View File

@ -32,7 +32,7 @@ class Service8FunctionManagement : public CommandingServiceBase {
public:
Service8FunctionManagement(object_id_t objectId, uint16_t apid, uint8_t serviceId,
uint8_t numParallelCommands = 4, uint16_t commandTimeoutSeconds = 60);
virtual ~Service8FunctionManagement();
~Service8FunctionManagement() override;
protected:
/* CSB abstract functions implementation . See CSB documentation. */

View File

@ -5,11 +5,11 @@
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/timemanager/CCSDSTime.h"
Service9TimeManagement::Service9TimeManagement(object_id_t objectId, uint16_t apid,
uint8_t serviceId)
: PusServiceBase(objectId, apid, serviceId) {}
Service9TimeManagement::Service9TimeManagement(PsbParams params) : PusServiceBase(params) {
params.name = "PUS 9 Time MGMT";
}
Service9TimeManagement::~Service9TimeManagement() {}
Service9TimeManagement::~Service9TimeManagement() = default;
ReturnValue_t Service9TimeManagement::performService() { return returnvalue::OK; }
@ -25,7 +25,7 @@ ReturnValue_t Service9TimeManagement::handleRequest(uint8_t subservice) {
ReturnValue_t Service9TimeManagement::setTime() {
Clock::TimeOfDay_t timeToSet;
TimePacket timePacket(currentPacket.getApplicationData(), currentPacket.getApplicationDataSize());
TimePacket timePacket(currentPacket.getUserData(), currentPacket.getUserDataLen());
ReturnValue_t result =
CCSDSTime::convertFromCcsds(&timeToSet, timePacket.getTime(), timePacket.getTimeSize());
if (result != returnvalue::OK) {

View File

@ -16,16 +16,16 @@ class Service9TimeManagement : public PusServiceBase {
/**
* @brief This service provides the capability to set the on-board time.
*/
Service9TimeManagement(object_id_t objectId, uint16_t apid, uint8_t serviceId);
explicit Service9TimeManagement(PsbParams params);
virtual ~Service9TimeManagement();
~Service9TimeManagement() override;
virtual ReturnValue_t performService() override;
ReturnValue_t performService() override;
/**
* @brief Sets the onboard-time by retrieving the time to set from TC[9,128].
*/
virtual ReturnValue_t handleRequest(uint8_t subservice) override;
ReturnValue_t handleRequest(uint8_t subservice) override;
virtual ReturnValue_t setTime();

View File

@ -50,7 +50,7 @@ class FailureReport : public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6
if (result != returnvalue::OK) {
return result;
}
if (failureSubtype == tc_verification::PROGRESS_FAILURE) {
if (failureSubtype == tcverif::PROGRESS_FAILURE) {
result = SerializeAdapter::serialize(&stepNumber, buffer, size, maxSize, streamEndianness);
if (result != returnvalue::OK) {
return result;
@ -73,7 +73,7 @@ class FailureReport : public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6
size_t size = 0;
size += SerializeAdapter::getSerializedSize(&packetId);
size += sizeof(packetSequenceControl);
if (failureSubtype == tc_verification::PROGRESS_FAILURE) {
if (failureSubtype == tcverif::PROGRESS_FAILURE) {
size += SerializeAdapter::getSerializedSize(&stepNumber);
}
size += SerializeAdapter::getSerializedSize(&errorCode);
@ -130,7 +130,7 @@ class SuccessReport : public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 1, 3, 5
if (result != returnvalue::OK) {
return result;
}
if (subtype == tc_verification::PROGRESS_SUCCESS) {
if (subtype == tcverif::PROGRESS_SUCCESS) {
result = SerializeAdapter::serialize(&stepNumber, buffer, size, maxSize, streamEndianness);
if (result != returnvalue::OK) {
return result;
@ -143,7 +143,7 @@ class SuccessReport : public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 1, 3, 5
size_t size = 0;
size += SerializeAdapter::getSerializedSize(&packetId);
size += sizeof(packetSequenceControl);
if (subtype == tc_verification::PROGRESS_SUCCESS) {
if (subtype == tcverif::PROGRESS_SUCCESS) {
size += SerializeAdapter::getSerializedSize(&stepNumber);
}
return size;

View File

@ -1,7 +1,7 @@
#ifndef FSFW_PUS_SERVICEPACKETS_SERVICE9PACKETS_H_
#define FSFW_PUS_SERVICEPACKETS_SERVICE9PACKETS_H_
#include "../../serialize/SerialLinkedListAdapter.h"
#include "fsfw/serialize/SerialLinkedListAdapter.h"
/**
* @brief Subservice 128
@ -11,16 +11,16 @@
*/
class TimePacket : SerialLinkedListAdapter<SerializeIF> { //!< [EXPORT] : [SUBSERVICE] 128
public:
TimePacket(const TimePacket& command) = delete;
TimePacket(const uint8_t* timeBuffer_, uint32_t timeSize_) {
timeBuffer = timeBuffer_;
timeSize = timeSize_;
}
const uint8_t* getTime() { return timeBuffer; }
uint32_t getTimeSize() const { return timeSize; }
[[nodiscard]] uint32_t getTimeSize() const { return timeSize; }
private:
TimePacket(const TimePacket& command);
const uint8_t* timeBuffer;
uint32_t timeSize; //!< [EXPORT] : [IGNORE]
};

View File

@ -34,9 +34,10 @@ enum : uint8_t {
FIFO_CLASS, // FF
MESSAGE_PROXY, // MQP
TRIPLE_REDUNDACY_CHECK, // TRC
TC_PACKET_CHECK, // TCC
PACKET_CHECK, // TCC
PACKET_DISTRIBUTION, // TCD
ACCEPTS_TELECOMMANDS_IF, // PUS
ACCEPTS_TELECOMMANDS_IF, // ATC
PUS_IF, // PUS
DEVICE_SERVICE_BASE, // DSB
COMMAND_SERVICE_BASE, // CSB
TM_STORE_BACKEND_IF, // TMB

View File

@ -0,0 +1,8 @@
#ifndef FSFW_RETURNVALUES_HASRETURNVALUES_IF_H_
#define FSFW_RETURNVALUES_HASRETURNVALUES_IF_H_
#warning "This header is deprecated, please include returnvalue.h"
#include "returnvalue.h"
#endif /* FSFW_RETURNVALUES_HASRETURNVALUES_IF_H_ */

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"

6
src/fsfw/retval.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef FSFW_RETVAL_H
#define FSFW_RETVAL_H
#include "fsfw/returnvalues/returnvalue.h"
#endif // FSFW_RETVAL_H

View File

@ -1,10 +1,10 @@
#ifndef FSFW_INC_FSFW_SERIALIZE_H_
#define FSFW_INC_FSFW_SERIALIZE_H_
#ifndef FSFW_SERIALIZE_H_
#define FSFW_SERIALIZE_H_
#include "fsfw/serialize/EndianConverter.h"
#include "fsfw/serialize/SerialArrayListAdapter.h"
#include "fsfw/serialize/SerialBufferAdapter.h"
#include "fsfw/serialize/SerialLinkedListAdapter.h"
#include "fsfw/serialize/SerializeElement.h"
#include "serialize/EndianConverter.h"
#include "serialize/SerialArrayListAdapter.h"
#include "serialize/SerialBufferAdapter.h"
#include "serialize/SerialLinkedListAdapter.h"
#include "serialize/SerializeElement.h"
#endif /* FSFW_INC_FSFW_SERIALIZE_H_ */
#endif /* FSFW_SERIALIZE_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,
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,
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

@ -74,7 +74,7 @@ class SerializeAdapter {
return returnvalue::FAILED;
}
InternalSerializeAdapter<T, std::is_base_of<SerializeIF, T>::value> adapter;
uint8_t **tempPtr = const_cast<uint8_t **>(&buffer);
auto **tempPtr = const_cast<uint8_t **>(&buffer);
size_t tmpSize = 0;
ReturnValue_t result = adapter.serialize(object, tempPtr, &tmpSize, maxSize, streamEndianness);
if (serSize != nullptr) {
@ -232,7 +232,7 @@ class SerializeAdapter {
}
}
uint32_t getSerializedSize(const T *object) { return sizeof(T); }
uint32_t getSerializedSize(const T *) { return sizeof(T); }
};
/**

View File

@ -1,9 +1,8 @@
#include "fsfw/serviceinterface/ServiceInterfaceBuffer.h"
#include "ServiceInterfaceBuffer.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1
#include <inttypes.h>
#include <cinttypes>
#include <cstring>
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h"
@ -16,8 +15,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 +55,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 +74,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 +167,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

@ -1,9 +1,8 @@
#ifndef FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACESTREAM_H_
#define FRAMEWORK_SERVICEINTERFACE_SERVICEINTERFACESTREAM_H_
#include <FSFWConfig.h>
#include "ServiceInterfaceBuffer.h"
#include "fsfw/FSFW.h"
#if FSFW_CPP_OSTREAM_ENABLED == 1

View File

@ -194,8 +194,6 @@ void LocalPool::clearStore() {
for (auto& size : sizeList) {
size = STORAGE_FREE;
}
// std::memset(sizeList[index], 0xff,
// numberOfElements[index] * sizeof(size_type));
}
}
@ -338,3 +336,16 @@ void LocalPool::clearSubPool(max_subpools_t subpoolIndex) {
}
LocalPool::max_subpools_t LocalPool::getNumberOfSubPools() const { return NUMBER_OF_SUBPOOLS; }
bool LocalPool::hasDataAtId(store_address_t storeId) const {
if (storeId.poolIndex >= NUMBER_OF_SUBPOOLS) {
return false;
}
if ((storeId.packetIndex >= numberOfElements[storeId.poolIndex])) {
return false;
}
if (sizeLists[storeId.poolIndex][storeId.packetIndex] != STORAGE_FREE) {
return true;
}
return false;
}

View File

@ -81,7 +81,7 @@ class LocalPool : public SystemObject, public StorageManagerIF {
/**
* @brief In the LocalPool's destructor all allocated memory is freed.
*/
virtual ~LocalPool(void);
~LocalPool() override;
/**
* Documentation: See StorageManagerIF.h
@ -132,6 +132,7 @@ class LocalPool : public SystemObject, public StorageManagerIF {
* @return
*/
max_subpools_t getNumberOfSubPools() const override;
bool hasDataAtId(store_address_t storeId) const override;
protected:
/**

View File

@ -7,7 +7,7 @@ PoolManager::PoolManager(object_id_t setObjectId, const LocalPoolConfig& localPo
mutex = MutexFactory::instance()->createMutex();
}
PoolManager::~PoolManager(void) { MutexFactory::instance()->deleteMutex(mutex); }
PoolManager::~PoolManager() { MutexFactory::instance()->deleteMutex(mutex); }
ReturnValue_t PoolManager::reserveSpace(const size_t size, store_address_t* address,
bool ignoreFault) {
@ -17,7 +17,7 @@ ReturnValue_t PoolManager::reserveSpace(const size_t size, store_address_t* addr
}
ReturnValue_t PoolManager::deleteData(store_address_t storeId) {
#if FSFW_VERBOSE_LEVEL >= 2
#if FSFW_VERBOSE_LEVEL >= 2 && FSFW_OBJ_EVENT_TRANSLATION == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "PoolManager( " << translateObject(getObjectId()) << " )::deleteData from store "
<< storeId.poolIndex << ". id is " << storeId.packetIndex << std::endl;

View File

@ -55,7 +55,7 @@ class StorageManagerIF {
/**
* @brief This is the empty virtual destructor as required for C++ interfaces.
*/
virtual ~StorageManagerIF(){};
~StorageManagerIF() = default;
/**
* @brief With addData, a free storage position is allocated and data
* stored there.
@ -63,9 +63,8 @@ class StorageManagerIF {
* @param storageId A pointer to the storageId to retrieve.
* @param data The data to be stored in the StorageManager.
* @param size The amount of data to be stored.
* @return Returns @li returnvalue::OK if data was added.
* @li returnvalue::FAILED if data could not be added.
* storageId is unchanged then.
* @return Returns @returnvalue::OK if data was added.
* @returnvalue::FAILED if data could not be added, storageId is unchanged then.
*/
virtual ReturnValue_t addData(store_address_t* storageId, const uint8_t* data, size_t size,
bool ignoreFault = false) = 0;
@ -116,8 +115,8 @@ class StorageManagerIF {
* @param packet_ptr The passed pointer address is set to the the memory
* position
* @param size The exact size of the stored data is returned here.
* @return @li returnvalue::OK on success.
* @li returnvalue::FAILED if fetching data did not work
* @return @returnvalue::OK on success.
* @returnvalue::FAILED if fetching data did not work
* (e.g. an illegal packet_id was passed).
*/
virtual ReturnValue_t getData(store_address_t packet_id, const uint8_t** packet_ptr,
@ -157,11 +156,12 @@ class StorageManagerIF {
* @param size The size of the space to be reserved.
* @param p_data A pointer to the element data is returned here.
* @return Returns @li returnvalue::OK if data was added.
* @li returnvalue::FAILED if data could not be added.
* storageId is unchanged then.
* @returnvalue::FAILED if data could not be added, storageId is unchanged then.
*/
virtual ReturnValue_t getFreeElement(store_address_t* storageId, const size_t size,
uint8_t** p_data, bool ignoreFault = false) = 0;
virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** p_data,
bool ignoreFault = false) = 0;
[[nodiscard]] virtual bool hasDataAtId(store_address_t storeId) const = 0;
/**
* Clears the whole store.
@ -192,7 +192,7 @@ class StorageManagerIF {
* Get number of pools.
* @return
*/
virtual max_subpools_t getNumberOfSubPools() const = 0;
[[nodiscard]] virtual max_subpools_t getNumberOfSubPools() const = 0;
};
#endif /* FSFW_STORAGEMANAGER_STORAGEMANAGERIF_H_ */

View File

@ -3,26 +3,26 @@
#include <cstdint>
namespace storeId {
static constexpr uint32_t INVALID_STORE_ADDRESS = 0xffffffff;
}
/**
* This union defines the type that identifies where a data packet is
* stored in the store. It comprises of a raw part to read it as raw value and
* a structured part to use it in pool-like stores.
*/
union store_address_t {
public:
static constexpr uint32_t INVALID_RAW = 0xffffffff;
/**
* Default Constructor, initializing to INVALID_ADDRESS
*/
store_address_t() : raw(storeId::INVALID_STORE_ADDRESS) {}
store_address_t() : raw(INVALID_RAW) {}
/**
* Constructor to create an address object using the raw address
*
* @param rawAddress
*/
store_address_t(uint32_t rawAddress) : raw(rawAddress) {}
explicit store_address_t(uint32_t rawAddress) : raw(rawAddress) {}
static store_address_t invalid() { return {}; };
/**
* Constructor to create an address object using pool
@ -52,6 +52,12 @@ union store_address_t {
uint32_t raw;
bool operator==(const store_address_t& other) const { return raw == other.raw; }
bool operator!=(const store_address_t& other) const { return raw != other.raw; }
store_address_t& operator=(const uint32_t rawAddr) {
raw = rawAddr;
return *this;
}
};
#endif /* FSFW_STORAGEMANAGER_STOREADDRESS_H_ */

View File

@ -2,12 +2,13 @@
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include "fsfw/tmtcpacket/SpacePacketBase.h"
#include "fsfw/tmtcpacket/ccsds/SpacePacketReader.h"
#define CCSDS_DISTRIBUTOR_DEBUGGING 0
CCSDSDistributor::CCSDSDistributor(uint16_t setDefaultApid, object_id_t setObjectId)
: TcDistributor(setObjectId), defaultApid(setDefaultApid) {}
CCSDSDistributor::CCSDSDistributor(uint16_t setDefaultApid, object_id_t setObjectId,
CcsdsPacketCheckIF* packetChecker)
: TcDistributor(setObjectId), defaultApid(setDefaultApid), packetChecker(packetChecker) {}
CCSDSDistributor::~CCSDSDistributor() = default;
@ -25,7 +26,7 @@ TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() {
#endif
const uint8_t* packet = nullptr;
size_t size = 0;
ReturnValue_t result = this->tcStore->getData(currentMessage.getStorageId(), &packet, &size);
ReturnValue_t result = tcStore->getData(currentMessage.getStorageId(), &packet, &size);
if (result != returnvalue::OK) {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -40,23 +41,25 @@ TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() {
#endif
return queueMap.end();
}
SpacePacketBase currentPacket(packet);
SpacePacketReader currentPacket(packet, size);
result = packetChecker->checkPacket(currentPacket, size);
if (result != returnvalue::OK) {
}
#if FSFW_CPP_OSTREAM_ENABLED == 1 && CCSDS_DISTRIBUTOR_DEBUGGING == 1
sif::info << "CCSDSDistributor::selectDestination has packet with APID " << std::hex
<< currentPacket.getAPID() << std::dec << std::endl;
sif::info << "CCSDSDistributor::selectDestination has packet with APID 0x" << std::hex
<< currentPacket.getApid() << std::dec << std::endl;
#endif
auto position = this->queueMap.find(currentPacket.getAPID());
auto position = this->queueMap.find(currentPacket.getApid());
if (position != this->queueMap.end()) {
return position;
} else {
// The APID was not found. Forward packet to main SW-APID anyway to
// create acceptance failure report.
return this->queueMap.find(this->defaultApid);
return queueMap.find(this->defaultApid);
}
}
MessageQueueId_t CCSDSDistributor::getRequestQueue() { return tcQueue->getId(); }
MessageQueueId_t CCSDSDistributor::getRequestQueue() const { return tcQueue->getId(); }
ReturnValue_t CCSDSDistributor::registerApplication(AcceptsTelecommandsIF* application) {
ReturnValue_t returnValue = returnvalue::OK;
@ -77,9 +80,12 @@ ReturnValue_t CCSDSDistributor::registerApplication(uint16_t apid, MessageQueueI
return returnValue;
}
uint16_t CCSDSDistributor::getIdentifier() { return 0; }
uint32_t CCSDSDistributor::getIdentifier() const { return 0; }
ReturnValue_t CCSDSDistributor::initialize() {
if (packetChecker == nullptr) {
packetChecker = new CcsdsPacketChecker(ccsds::PacketType::TC);
}
ReturnValue_t status = this->TcDistributor::initialize();
this->tcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TC_STORE);
if (this->tcStore == nullptr) {

View File

@ -1,11 +1,12 @@
#ifndef FRAMEWORK_TCDISTRIBUTION_CCSDSDISTRIBUTOR_H_
#define FRAMEWORK_TCDISTRIBUTION_CCSDSDISTRIBUTOR_H_
#include "../objectmanager/ObjectManagerIF.h"
#include "../storagemanager/StorageManagerIF.h"
#include "../tcdistribution/CCSDSDistributorIF.h"
#include "../tcdistribution/TcDistributor.h"
#include "../tmtcservices/AcceptsTelecommandsIF.h"
#include "fsfw/objectmanager/ObjectManagerIF.h"
#include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/tcdistribution/CCSDSDistributorIF.h"
#include "fsfw/tcdistribution/CcsdsPacketChecker.h"
#include "fsfw/tcdistribution/TcDistributor.h"
#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h"
/**
* @brief An instantiation of the CCSDSDistributorIF.
@ -24,19 +25,20 @@ class CCSDSDistributor : public TcDistributor,
* TcDistributor ctor with a certain object id.
* @details
* @c tcStore is set in the @c initialize method.
* @param setDefaultApid The default APID, where packets with unknown
* @param unknownApid The default APID, where packets with unknown
* destination are sent to.
*/
CCSDSDistributor(uint16_t setDefaultApid, object_id_t setObjectId);
CCSDSDistributor(uint16_t unknownApid, object_id_t setObjectId,
CcsdsPacketCheckIF* packetChecker = nullptr);
/**
* The destructor is empty.
*/
virtual ~CCSDSDistributor();
~CCSDSDistributor() override;
MessageQueueId_t getRequestQueue() override;
MessageQueueId_t getRequestQueue() const override;
ReturnValue_t registerApplication(uint16_t apid, MessageQueueId_t id) override;
ReturnValue_t registerApplication(AcceptsTelecommandsIF* application) override;
uint16_t getIdentifier() override;
uint32_t getIdentifier() const override;
ReturnValue_t initialize() override;
protected:
@ -63,6 +65,8 @@ class CCSDSDistributor : public TcDistributor,
* pure Space Packets and there exists no SpacePacketStored class.
*/
StorageManagerIF* tcStore = nullptr;
CcsdsPacketCheckIF* packetChecker = nullptr;
};
#endif /* FRAMEWORK_TCDISTRIBUTION_CCSDSDISTRIBUTOR_H_ */

View File

@ -34,7 +34,7 @@ class CCSDSDistributorIF {
/**
* The empty virtual destructor.
*/
virtual ~CCSDSDistributorIF() {}
virtual ~CCSDSDistributorIF() = default;
};
#endif /* FSFW_TCDISTRIBUTION_CCSDSDISTRIBUTORIF_H_ */

Some files were not shown because too many files have changed in this diff Show More