Compare commits
552 Commits
taheran-Se
...
ASTP_0.0.1
Author | SHA1 | Date | |
---|---|---|---|
64b6edab6f | |||
3bd144e6f4 | |||
4764f6ba54 | |||
a2c28198ed | |||
4241c00448 | |||
4406c6eb86 | |||
ce629dfd83 | |||
293d34147e | |||
9bfba41875 | |||
5a20ec583b | |||
d3a7f86ea2 | |||
227ec25e89 | |||
6489246c4b | |||
273ddf9061 | |||
5b5f2f3e1d | |||
51443d7a68 | |||
8aef4b9b99 | |||
752601e85f | |||
0075ae53b3 | |||
520409822e | |||
030f1beb93 | |||
2a4b4f2114 | |||
bb7709fea1 | |||
bc58213482 | |||
136f04a5c6 | |||
37fc22a117 | |||
bc81b5893c | |||
3eefcd3a2d | |||
210d2de11e | |||
83568e11d1 | |||
113397c6c6 | |||
3cd0f8f5f0 | |||
edecb7882b | |||
cc51d9ace9 | |||
3067259a9b | |||
7d83767c2b | |||
59c200254d | |||
2f993cf39a | |||
6bedc9b805 | |||
652dc00cc9 | |||
719aab2a26 | |||
470196a044 | |||
9c9facf4a1 | |||
cf46aebf32 | |||
449a08c92c | |||
a7e06c11fd | |||
0c15a90399 | |||
bcbc61ccba | |||
9221d0ca7c | |||
a7bc69b0ac | |||
77fd2cb871 | |||
093d3562b6 | |||
2761ee8109 | |||
52d3dbfd20 | |||
963c333365 | |||
b441f5242f | |||
508f31a359 | |||
5d0f96c3a1 | |||
82a2f3ec61 | |||
a5cf510ae9 | |||
a0d4c77d94 | |||
0b855c5b55 | |||
38830dfc17 | |||
11a351a202 | |||
51c5b05f03 | |||
de5e62a9c8 | |||
3098f34eb0 | |||
e35aebcd0a | |||
af4c6f1d45 | |||
9b5e940965 | |||
f5b0589f79 | |||
567cbd39ef | |||
78896323b6 | |||
ba036805de | |||
9af5855ece | |||
64c341b5f6 | |||
27e0b9cf38 | |||
4dd79b3495 | |||
64ec4835f3 | |||
4229e256d1 | |||
352296d200 | |||
4557a2eb36 | |||
edb2d3848d | |||
096643971b | |||
56da648026 | |||
38135a3d53 | |||
3c1415a4bd | |||
08496c378e | |||
af18f6c94c | |||
5a8431e82b | |||
97f6dace26 | |||
c8fd698b3a | |||
50151310dc | |||
53e98df37d | |||
cb71a18277 | |||
546db47db4 | |||
ce322ed121 | |||
744d3a2346 | |||
c89a24a248 | |||
6651622a16 | |||
410094ed28 | |||
8b21324815 | |||
f40b432e43 | |||
67dd153511 | |||
342a70d109 | |||
6cce062d62 | |||
29a796ebdb | |||
ede00dfdcc | |||
e4d323683d | |||
4d4300cee6 | |||
1940a2acf0 | |||
279682351a | |||
247c9f2947 | |||
482b77ff05 | |||
72b9adb684 | |||
865ea3386c | |||
c677358343 | |||
7821cc2870 | |||
756df4f37f | |||
0b1b9c11eb | |||
ddacc66b1f | |||
fa67f82462 | |||
407df913d3 | |||
b29376bd71 | |||
3580ec0e09 | |||
12369d8d4b | |||
6b2df54204 | |||
8cea7b05db | |||
17548605ec | |||
829be0f082 | |||
17ea3127a7 | |||
ea8ef8b874 | |||
54af54927b | |||
9bf0026b8a | |||
335e146735 | |||
6776ca86eb | |||
f172c07876 | |||
0a9a8cf867 | |||
f1bc9972f3 | |||
7c7b3de14f | |||
587f87d270 | |||
cd2cb410e4 | |||
b292c5c927 | |||
4f91db2ff8 | |||
c86d654fdf | |||
1f3a10b375 | |||
b8261854cb | |||
89c4370d91 | |||
565859a6f4 | |||
1f994d9933 | |||
5342dc4bc8 | |||
a5a850eb41 | |||
c77bded505 | |||
acc03d3e8b | |||
d647c63da3 | |||
ea13008aa2 | |||
7c3f99ed2d | |||
2344efb3ac | |||
236a833d0b | |||
6c4ec713f3 | |||
b2a7859549 | |||
8178be9dc5 | |||
adf528fce9 | |||
6efdf170f4 | |||
a14558ef1f | |||
77a9a190aa | |||
a0098e8b17 | |||
fcabf93af3 | |||
ab9858b0c7 | |||
823bae1a2a | |||
2f61bd0a0f | |||
aeeef53508 | |||
8d8e918aeb | |||
ecc4bdf11a | |||
5340b9c58e | |||
659671e1df | |||
5fc583117d | |||
86a1ae4a8a | |||
195bf6b89f | |||
f5ded3fa4b | |||
e104cd18e6 | |||
71f2f34aab | |||
6c0bb23ed6 | |||
303fcec9f6 | |||
f73f798a4d | |||
4fce0377a9 | |||
4eef7bfc01 | |||
17d5de15c9 | |||
cdadf48f38 | |||
896302c506 | |||
1bdccedabe | |||
db5890c15a | |||
72f924813d | |||
dffda771ac | |||
06f5b816e4 | |||
3d830a9e20 | |||
13b30f8de6 | |||
e71020d631 | |||
046eec6c18 | |||
47c21cfc6c | |||
00f89bb193 | |||
6879045ef3 | |||
c9005783b2 | |||
4010d8d960 | |||
a3235ced17 | |||
d3ce6d147e | |||
ce983953ff | |||
a71528551a | |||
6a5268f5b0 | |||
392d0299a9 | |||
8ade9e33c1 | |||
37c605c4fb | |||
ea29b272bf | |||
e55f8f583d | |||
d6e82f64e7 | |||
a700f6a96d | |||
6c86cf88f3 | |||
352ce13fb3 | |||
1ed1b7ea06 | |||
a58e47623f | |||
622c7a5a0d | |||
bed4e7affa | |||
1ff85c88b2 | |||
cef84b13d9 | |||
6f965c74ac | |||
b2677ae040 | |||
dae79f30d7 | |||
c01d904552 | |||
7dbb73b7d8 | |||
9f7dad31eb | |||
21cbb19410 | |||
170217e2e8 | |||
bf5e7241b6 | |||
291a62eeb9 | |||
945f49bbe9 | |||
183b6a4193 | |||
75bdf96799 | |||
6d2266f7d0 | |||
9d4c2b90f3 | |||
7b57f372bf | |||
bf5688c8d8 | |||
a0bc6b3c1f | |||
eec022f801 | |||
20279169ed | |||
2edc7fd096 | |||
13b68f10a0 | |||
496251bd68 | |||
22d9b77165 | |||
40558835c7 | |||
842c21684a | |||
d1fb512c1f | |||
59f72d1031 | |||
978d7514a4 | |||
2f73841580 | |||
74a4c98ca7 | |||
0bc3807c18 | |||
d0f912f32b | |||
b681a76f29 | |||
ed80768c66 | |||
de840dcf8d | |||
e0d9a080c5 | |||
59e4b95b62 | |||
ab0f4d8c87 | |||
98333b92ef | |||
87fb17f39a | |||
8652f2f13f | |||
cea748676e | |||
74b9aef36b | |||
7dc3a7ecbd | |||
4248e4000c | |||
b2777faf66 | |||
9faa8d3896 | |||
8f2c8c838e | |||
66383f78c6 | |||
522433e1b5 | |||
156f44c268 | |||
56c6f971e1 | |||
33de6851eb | |||
f575c923d7 | |||
40d83fe603 | |||
bb896faeb4 | |||
3aa9ab2048 | |||
580669d49d | |||
90b3ebd390 | |||
1791b5af57 | |||
108f897102 | |||
9aaa5721af | |||
ade9c32ff3 | |||
da4f6cf447 | |||
4587fbb76d | |||
af53bf6643 | |||
d8c5c4d85d | |||
17583f605d | |||
5e974877fe | |||
447b69bf03 | |||
37cf7566f9 | |||
0d8200e856 | |||
7851a71a8e | |||
721793a058 | |||
8ea0a38658 | |||
6062192bf0 | |||
85f21b0516 | |||
386f347574 | |||
56ff2aef26 | |||
ad8c6f3528 | |||
0f0ddfc375 | |||
96f2b68a22 | |||
53723b0795 | |||
b0a816490e | |||
963015513f | |||
85d6e81881 | |||
b31bee4fda | |||
ae426c50ba | |||
a5c6be9dd9 | |||
21346e40a5 | |||
589b95d28b | |||
d38e13f9d3 | |||
3fcbb988ae | |||
e96ab12312 | |||
f3d42de399 | |||
db697f16de | |||
42bfedd36c | |||
9061d6d67e | |||
c375e838b8 | |||
d77d370c8a | |||
21094c4926 | |||
51cf13428b | |||
b4ca42f1fb | |||
bff08a69fa | |||
4f5b233505 | |||
9334a705f8 | |||
2c6a239d5e | |||
fbd75f947a | |||
4c17ef7be5 | |||
4f48ed9756 | |||
6362de5bc0 | |||
d83573cefc | |||
8048195f63 | |||
853bd75fec | |||
d807ea3afe | |||
036a022e66 | |||
489d8f1903 | |||
be0cf56994 | |||
bbd81c2d6a | |||
e7444912d5 | |||
b8d638cb69 | |||
1635f16bc0 | |||
c63baf70a1 | |||
0da6456bad | |||
db2a31aef4 | |||
de46cf5b08 | |||
a364f36f38 | |||
2d76c744c5 | |||
d1f8040599 | |||
e24e080f31 | |||
dab10d761a | |||
976fd54f5e | |||
d87cf0a612 | |||
b3af2b5fbc | |||
fb36c55419 | |||
5dd08877a5 | |||
0258ce62f0 | |||
b65789824c | |||
278053a342 | |||
2a28114b49 | |||
67b11c0535 | |||
6c42189371 | |||
2439ac455b | |||
a9975f5aef | |||
ba01b4578c | |||
234fbcbf41 | |||
f7223abaa3 | |||
902cd4d210 | |||
a1155686c5 | |||
c6dbce7446 | |||
1a62158f33 | |||
328c1b7195 | |||
ed21ec6c78 | |||
84308c74d9 | |||
d4d96a128e | |||
e83de82481 | |||
62eb327df6 | |||
dbac6e139b | |||
06400fa7bb | |||
3e67701933 | |||
e105be229a | |||
d885dddee8 | |||
a53b9dc3db | |||
a6b2b4dd93 | |||
a3b80288e1 | |||
91d5277a94 | |||
975fb9832b | |||
4bdac1e017 | |||
381914886d | |||
0eb4c3817e | |||
4d7d48e8ca | |||
b8754fbc16 | |||
92c7369276 | |||
04532b8f6b | |||
5eaf6cfd1f | |||
7ad5274803 | |||
ab9f58438f | |||
4da21d2c38 | |||
b3d08cd40b | |||
d5accd16ba | |||
03b2ca679d | |||
75f6cacd10 | |||
b32ea6e316 | |||
5308cb6237 | |||
4f3869de8d | |||
b522b3c29c | |||
02cfa8bcd5 | |||
96c421b72c | |||
f85e4eb22f | |||
66bc60f176 | |||
695a4e7842 | |||
f068df9028 | |||
636e5fb888 | |||
77927363ce | |||
5d87650833 | |||
e949637271 | |||
4a80872c3c | |||
a9e5b54238 | |||
e77c294360 | |||
7059d5f158 | |||
b07b19327c | |||
4abdc436fb | |||
d644a40e14 | |||
a4d9c761a7 | |||
cc5c944c84 | |||
f645fe6607 | |||
c0ed474373 | |||
f12c56c75f | |||
7a5c70e753 | |||
478b88d7a2 | |||
b54d63edcb | |||
aec557a8c0 | |||
6c0defed5e | |||
3ec7162832 | |||
b4978e7df3 | |||
543e2f7d5d | |||
053f75968b | |||
b87a8ba086 | |||
2362b1d165 | |||
ce4d010b5c | |||
eb503ae030 | |||
795b1e5245 | |||
54112acf62 | |||
c4c607776c | |||
8f2d5a5528 | |||
2a74c8d150 | |||
dfe3658a85 | |||
386b153ede | |||
df4fb17a45 | |||
0fedad6da0 | |||
3be253efd6 | |||
73db79a3fe | |||
7723ee13b3 | |||
073f168b95 | |||
aacda3afc2 | |||
64022212f9 | |||
4530b19548 | |||
89d3fe5095 | |||
66cf2d3559 | |||
02be87aa03 | |||
76f145ddcf | |||
281f13e27b | |||
df850116ff | |||
a8f2cf910b | |||
2748a8b93b | |||
561becf6aa | |||
f13e7b4255 | |||
3f9d9b8770 | |||
1ae79ab99d | |||
6903a761ff | |||
af52d1ffda | |||
3001911d69 | |||
9a06cb846c | |||
f863849a75 | |||
84d99a6f04 | |||
b7612bee37 | |||
5210bce64d | |||
5b4e49e966 | |||
549ad97bd3 | |||
111f9dce7d | |||
287a83c54c | |||
3d89bc83e5 | |||
4a2ef6d97f | |||
b484e4d5ad | |||
7dbab61ab7 | |||
e963aca02a | |||
8c722feafb | |||
6b4fa0cc04 | |||
f36da8a79c | |||
2e08037e75 | |||
a0ff1e0019 | |||
0449c63225 | |||
35fe41361b | |||
802004107b | |||
a9c8bea857 | |||
dc4db6e031 | |||
6b03a1c03d | |||
c9bc022941 | |||
36f7cf2caf | |||
646e86ea85 | |||
3a2dc5eeb6 | |||
65d71b1c65 | |||
d795892d57 | |||
5f76b03f3a | |||
e9166ec4c7 | |||
2fccc4fef7 | |||
8f6c3b50af | |||
b699c8b2b3 | |||
991385de65 | |||
ec212d9fcf | |||
f654c4b33e | |||
a589be7c74 | |||
4c59b043e1 | |||
c8b92a8828 | |||
86a6b2fee0 | |||
a6a3180196 | |||
3d175f603c | |||
1d99a99bbd | |||
8e3f99a350 | |||
e20244b0ce | |||
d4f69633f0 | |||
43a7274129 | |||
f871f75e1c | |||
023af149df | |||
a3f379e149 | |||
acf037614f | |||
ab17e28405 | |||
a993223f6e | |||
d83181cb0f | |||
8af5a32f1d | |||
73183b39ef | |||
6c9f157d2c | |||
b4c6a04d4a | |||
adb80a68fc | |||
f829d063ce | |||
d909fcb6a1 | |||
f388bd374c | |||
ca10020f19 | |||
331b36fe18 | |||
730c715120 | |||
7bc29fc2d5 | |||
483a47d353 | |||
7bc7e06277 | |||
4819bad402 | |||
1c967d4739 | |||
eb5832180b | |||
1fb87db82e |
0
.gitmodules
vendored
Normal file
0
.gitmodules
vendored
Normal file
12
FSFWVersion.h
Normal file
12
FSFWVersion.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef FSFW_DEFAULTCFG_VERSION_H_
|
||||
#define FSFW_DEFAULTCFG_VERSION_H_
|
||||
|
||||
const char* const FSFW_VERSION_NAME = "ASTP";
|
||||
|
||||
#define FSFW_VERSION 0
|
||||
#define FSFW_SUBVERSION 0
|
||||
#define FSFW_REVISION 1
|
||||
|
||||
|
||||
|
||||
#endif /* FSFW_DEFAULTCFG_VERSION_H_ */
|
2
NOTICE
2
NOTICE
@ -4,6 +4,8 @@ The initial version of the Flight Software Framework was developed during
|
||||
the Flying Laptop Project by the Universität Stuttgart in coorporation
|
||||
with Airbus Defence and Space GmbH.
|
||||
|
||||
The supreme FSFW Logo was designed by Markus Koller and Luise Trilsbach.
|
||||
|
||||
Copyrights in the Flight Software Framework are retained by their contributors.
|
||||
No copyright assignment is required to contribute to the Flight Software Framework.
|
||||
|
||||
|
159
README.md
Normal file
159
README.md
Normal file
@ -0,0 +1,159 @@
|
||||

|
||||
# Flight Software Framework (FSFW)
|
||||
|
||||
The Flight Software Framework is a C++ Object Oriented Framework for unmanned,
|
||||
automated systems like Satellites.
|
||||
|
||||
The initial version of the Flight Software Framework was developed during
|
||||
the Flying Laptop Project by the University of Stuttgart in cooperation
|
||||
with Airbus Defence and Space GmbH.
|
||||
|
||||
## Intended Use
|
||||
|
||||
The framework is designed for systems, which communicate with external devices, perform control loops, receive telecommands and send telemetry, and need to maintain a high level of availability.
|
||||
Therefore, a mode and health system provides control over the states of the software and the controlled devices.
|
||||
In addition, a simple mechanism of event based fault detection, isolation and recovery is implemented as well.
|
||||
|
||||
The recommended hardware is a microprocessor with more than 2 MB of RAM and 1 MB of non-volatile Memory.
|
||||
For reference, current Applications use a Cobham Gaisler UT699 (LEON3FT), a ISISPACE IOBC or a Zynq-7020 SoC.
|
||||
|
||||
|
||||
## 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.
|
||||
Exceptions are not allowed.
|
||||
|
||||
### Failure Handling
|
||||
|
||||
Functions should return a defined ReturnValue_t to signal to the caller that something is gone wrong.
|
||||
Returnvalues must be unique. For this the function HasReturnvaluesIF::makeReturnCode or the Macro MAKE_RETURN can be used.
|
||||
The CLASS_ID is a unique id for that type of object. See returnvalues/FwClassIds.
|
||||
|
||||
### OSAL
|
||||
The FSFW provides operation system abstraction layers for Linux, FreeRTOS and RTEMS. A independent OSAL called "host" is currently not finished. This aims to be running on windows as well.
|
||||
The OSAL provides periodic tasks, message queues, clocks and Semaphores as well as Mutexes.
|
||||
|
||||
### Core Components
|
||||
|
||||
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):
|
||||
|
||||
* 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.
|
||||
|
||||
``` c++
|
||||
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 must be configured by setting this 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;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
### 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/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 over Message through Queues.
|
||||
Those queues are created by calling the singleton QueueFactory::instance()->create().
|
||||
|
||||
### 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.
|
||||
|
||||
#### 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 must be created.
|
||||
An example can be found in the timemanager folder, this uses CCSDSTime::CDS_short.
|
||||
|
||||
#### DeviceHandling
|
||||
|
||||
DeviceHandlers are a core 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 DH can be tested on different hardware.
|
||||
The DH has mechanisms to monitor the communication with the physical device which allow for FDIR reaction.
|
||||
A standard FDIR component for the DH will be created automatically but can be overwritten by the user.
|
||||
|
||||
#### Modes, 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.
|
||||
|
||||
## Example config
|
||||
|
||||
A example config can be found in defaultcfg/fsfwconfig.
|
||||
|
||||
## Unit Tests
|
||||
|
||||
Unit Tests are provided in the unittest folder. Those use the catch2 framework but do not include catch2 itself.
|
||||
See README.md in the unittest Folder.
|
@ -1,9 +1,12 @@
|
||||
#include "ActionHelper.h"
|
||||
#include "HasActionsIF.h"
|
||||
|
||||
#include "../ipc/MessageQueueSenderIF.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
|
||||
ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) :
|
||||
owner(setOwner), queueToUse(useThisQueue), ipcStore(nullptr) {
|
||||
ActionHelper::ActionHelper(HasActionsIF* setOwner,
|
||||
MessageQueueIF* useThisQueue) :
|
||||
owner(setOwner), queueToUse(useThisQueue) {
|
||||
}
|
||||
|
||||
ActionHelper::~ActionHelper() {
|
||||
@ -32,13 +35,15 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void ActionHelper::step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId, ReturnValue_t result) {
|
||||
void ActionHelper::step(uint8_t step, MessageQueueId_t reportTo,
|
||||
ActionId_t commandId, ReturnValue_t result) {
|
||||
CommandMessage reply;
|
||||
ActionMessage::setStepReply(&reply, commandId, step + STEP_OFFSET, result);
|
||||
queueToUse->sendMessage(reportTo, &reply);
|
||||
}
|
||||
|
||||
void ActionHelper::finish(MessageQueueId_t reportTo, ActionId_t commandId, ReturnValue_t result) {
|
||||
void ActionHelper::finish(MessageQueueId_t reportTo, ActionId_t commandId,
|
||||
ReturnValue_t result) {
|
||||
CommandMessage reply;
|
||||
ActionMessage::setCompletionReply(&reply, commandId, result);
|
||||
queueToUse->sendMessage(reportTo, &reply);
|
||||
@ -48,8 +53,8 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) {
|
||||
queueToUse = queue;
|
||||
}
|
||||
|
||||
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
||||
store_address_t dataAddress) {
|
||||
void ActionHelper::prepareExecution(MessageQueueId_t commandedBy,
|
||||
ActionId_t actionId, store_address_t dataAddress) {
|
||||
const uint8_t* dataPtr = NULL;
|
||||
size_t size = 0;
|
||||
ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size);
|
||||
@ -61,6 +66,11 @@ void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t act
|
||||
}
|
||||
result = owner->executeAction(actionId, commandedBy, dataPtr, size);
|
||||
ipcStore->deleteData(dataAddress);
|
||||
if(result == HasActionsIF::EXECUTION_FINISHED) {
|
||||
CommandMessage reply;
|
||||
ActionMessage::setCompletionReply(&reply, actionId, result);
|
||||
queueToUse->sendMessage(commandedBy, &reply);
|
||||
}
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
CommandMessage reply;
|
||||
ActionMessage::setStepReply(&reply, actionId, 0, result);
|
||||
@ -85,22 +95,28 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
result = data->serialize(&dataPtr, &size, maxSize, SerializeIF::Endianness::BIG);
|
||||
result = data->serialize(&dataPtr, &size, maxSize,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
ipcStore->deleteData(storeAddress);
|
||||
return result;
|
||||
}
|
||||
//We don't need to report the objectId, as we receive REQUESTED data before the completion success message.
|
||||
//True aperiodic replies need to be reported with another dedicated message.
|
||||
// We don't need to report the objectId, as we receive REQUESTED data
|
||||
// before the completion success message.
|
||||
// True aperiodic replies need to be reported with
|
||||
// another dedicated message.
|
||||
ActionMessage::setDataReply(&reply, replyId, storeAddress);
|
||||
|
||||
//TODO Service Implementation sucks at the moment
|
||||
if (hideSender){
|
||||
// If the sender needs to be hidden, for example to handle packet
|
||||
// as unrequested reply, this will be done here.
|
||||
if (hideSender) {
|
||||
result = MessageQueueSenderIF::sendMessage(reportTo, &reply);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
result = queueToUse->sendMessage(reportTo, &reply);
|
||||
}
|
||||
if ( result != HasReturnvaluesIF::RETURN_OK){
|
||||
|
||||
if (result != HasReturnvaluesIF::RETURN_OK){
|
||||
ipcStore->deleteData(storeAddress);
|
||||
}
|
||||
return result;
|
||||
@ -108,3 +124,39 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
|
||||
|
||||
void ActionHelper::resetHelper() {
|
||||
}
|
||||
|
||||
ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
|
||||
ActionId_t replyId, const uint8_t *data, size_t dataSize,
|
||||
bool hideSender) {
|
||||
CommandMessage reply;
|
||||
store_address_t storeAddress;
|
||||
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
ipcStore->deleteData(storeAddress);
|
||||
return result;
|
||||
}
|
||||
|
||||
// We don't need to report the objectId, as we receive REQUESTED data
|
||||
// before the completion success message.
|
||||
// True aperiodic replies need to be reported with
|
||||
// another dedicated message.
|
||||
ActionMessage::setDataReply(&reply, replyId, storeAddress);
|
||||
|
||||
// If the sender needs to be hidden, for example to handle packet
|
||||
// as unrequested reply, this will be done here.
|
||||
if (hideSender) {
|
||||
result = MessageQueueSenderIF::sendMessage(reportTo, &reply);
|
||||
}
|
||||
else {
|
||||
result = queueToUse->sendMessage(reportTo, &reply);
|
||||
}
|
||||
|
||||
if (result != HasReturnvaluesIF::RETURN_OK){
|
||||
ipcStore->deleteData(storeAddress);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1,15 +1,18 @@
|
||||
#ifndef ACTIONHELPER_H_
|
||||
#define ACTIONHELPER_H_
|
||||
#ifndef FSFW_ACTION_ACTIONHELPER_H_
|
||||
#define FSFW_ACTION_ACTIONHELPER_H_
|
||||
|
||||
#include "ActionMessage.h"
|
||||
#include "../serialize/SerializeIF.h"
|
||||
#include "../ipc/MessageQueueIF.h"
|
||||
/**
|
||||
* \brief Action Helper is a helper class which handles action messages
|
||||
* @brief Action Helper is a helper class which handles action messages
|
||||
*
|
||||
* Components which use the HasActionIF this helper can be used to handle the action messages.
|
||||
* It does handle step messages as well as other answers to action calls. It uses the executeAction function
|
||||
* of its owner as callback. The call of the initialize function is mandatory and it needs a valid messageQueueIF pointer!
|
||||
* Components which use the HasActionIF this helper can be used to handle
|
||||
* the action messages.
|
||||
* It does handle step messages as well as other answers to action calls.
|
||||
* It uses the executeAction function of its owner as callback.
|
||||
* The call of the initialize function is mandatory and needs a
|
||||
* valid MessageQueueIF pointer!
|
||||
*/
|
||||
class HasActionsIF;
|
||||
|
||||
@ -18,7 +21,8 @@ public:
|
||||
/**
|
||||
* Constructor of the action helper
|
||||
* @param setOwner Pointer to the owner of the interface
|
||||
* @param useThisQueue messageQueue to be used, can be set during initialize function as well.
|
||||
* @param useThisQueue messageQueue to be used, can be set during
|
||||
* initialize function as well.
|
||||
*/
|
||||
ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue);
|
||||
|
||||
@ -26,28 +30,36 @@ public:
|
||||
/**
|
||||
* Function to be called from the owner with a new command message
|
||||
*
|
||||
* If the message is a valid action message the helper will use the executeAction function from HasActionsIF.
|
||||
* If the message is invalid or the callback fails a message reply will be send to the sender of the message automatically.
|
||||
* If the message is a valid action message the helper will use the
|
||||
* executeAction function from HasActionsIF.
|
||||
* If the message is invalid or the callback fails a message reply will be
|
||||
* send to the sender of the message automatically.
|
||||
*
|
||||
* @param command Pointer to a command message received by the owner
|
||||
* @return HasReturnvaluesIF::RETURN_OK if the message is a action message, CommandMessage::UNKNOW_COMMAND if this message ID is unkown
|
||||
* @return HasReturnvaluesIF::RETURN_OK if the message is a action message,
|
||||
* CommandMessage::UNKNOW_COMMAND if this message ID is unkown
|
||||
*/
|
||||
ReturnValue_t handleActionMessage(CommandMessage* command);
|
||||
/**
|
||||
* Helper initialize function. Must be called before use of any other helper function
|
||||
* @param queueToUse_ Pointer to the messageQueue to be used, optional if queue was set in constructor
|
||||
* Helper initialize function. Must be called before use of any other
|
||||
* helper function
|
||||
* @param queueToUse_ Pointer to the messageQueue to be used, optional
|
||||
* if queue was set in constructor
|
||||
* @return Returns RETURN_OK if successful
|
||||
*/
|
||||
ReturnValue_t initialize(MessageQueueIF* queueToUse_ = nullptr);
|
||||
/**
|
||||
* Function to be called from the owner to send a step message. Success or failure will be determined by the result value.
|
||||
* Function to be called from the owner to send a step message.
|
||||
* Success or failure will be determined by the result value.
|
||||
*
|
||||
* @param step Number of steps already done
|
||||
* @param reportTo The messageQueueId to report the step message to
|
||||
* @param commandId ID of the executed command
|
||||
* @param result Result of the execution
|
||||
*/
|
||||
void step(uint8_t step, MessageQueueId_t reportTo, ActionId_t commandId, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
||||
void step(uint8_t step, MessageQueueId_t reportTo,
|
||||
ActionId_t commandId,
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
||||
/**
|
||||
* Function to be called by the owner to send a action completion message
|
||||
*
|
||||
@ -55,39 +67,59 @@ public:
|
||||
* @param commandId ID of the executed command
|
||||
* @param result Result of the execution
|
||||
*/
|
||||
void finish(MessageQueueId_t reportTo, ActionId_t commandId, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
||||
void finish(MessageQueueId_t reportTo, ActionId_t commandId,
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
||||
/**
|
||||
* Function to be called by the owner if an action does report data
|
||||
*
|
||||
* @param reportTo MessageQueueId_t to report the action completion message to
|
||||
* Function to be called by the owner if an action does report data.
|
||||
* Takes a SerializeIF* pointer and serializes it into the IPC store.
|
||||
* @param reportTo MessageQueueId_t to report the action completion
|
||||
* message to
|
||||
* @param replyId ID of the executed command
|
||||
* @param data Pointer to the data
|
||||
* @return Returns RETURN_OK if successful, otherwise failure code
|
||||
*/
|
||||
ReturnValue_t reportData(MessageQueueId_t reportTo, ActionId_t replyId, SerializeIF* data, bool hideSender = false);
|
||||
ReturnValue_t reportData(MessageQueueId_t reportTo, ActionId_t replyId,
|
||||
SerializeIF* data, bool hideSender = false);
|
||||
/**
|
||||
* Function to be called by the owner if an action does report data.
|
||||
* Takes the raw data and writes it into the IPC store.
|
||||
* @param reportTo MessageQueueId_t to report the action completion
|
||||
* message to
|
||||
* @param replyId ID of the executed command
|
||||
* @param data Pointer to the data
|
||||
* @return Returns RETURN_OK if successful, otherwise failure code
|
||||
*/
|
||||
ReturnValue_t reportData(MessageQueueId_t reportTo, ActionId_t replyId,
|
||||
const uint8_t* data, size_t dataSize, bool hideSender = false);
|
||||
/**
|
||||
* Function to setup the MessageQueueIF* of the helper. Can be used to set the messageQueueIF* if
|
||||
* message queue is unavailable at construction and initialize but must be setup before first call of other functions.
|
||||
* Function to setup the MessageQueueIF* of the helper. Can be used to
|
||||
* set the MessageQueueIF* if message queue is unavailable at construction
|
||||
* and initialize but must be setup before first call of other functions.
|
||||
* @param queue Queue to be used by the helper
|
||||
*/
|
||||
void setQueueToUse(MessageQueueIF *queue);
|
||||
protected:
|
||||
static const uint8_t STEP_OFFSET = 1;//!< Increase of value of this per step
|
||||
//!< Increase of value of this per step
|
||||
static const uint8_t STEP_OFFSET = 1;
|
||||
HasActionsIF* owner;//!< Pointer to the owner
|
||||
MessageQueueIF* queueToUse;//!< Queue to be used as response sender, has to be set with
|
||||
StorageManagerIF* ipcStore;//!< Pointer to an IPC Store, initialized during construction or initialize(MessageQueueIF* queueToUse_) or with setQueueToUse(MessageQueueIF *queue)
|
||||
//! Queue to be used as response sender, has to be set in ctor or with
|
||||
//! setQueueToUse
|
||||
MessageQueueIF* queueToUse;
|
||||
//! Pointer to an IPC Store, initialized during construction or
|
||||
StorageManagerIF* ipcStore = nullptr;
|
||||
|
||||
/**
|
||||
*Internal function called by handleActionMessage(CommandMessage* command)
|
||||
*
|
||||
* Internal function called by handleActionMessage
|
||||
* @param commandedBy MessageQueueID of Commander
|
||||
* @param actionId ID of action to be done
|
||||
* @param dataAddress Address of additional data in IPC Store
|
||||
*/
|
||||
virtual void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, store_address_t dataAddress);
|
||||
virtual void prepareExecution(MessageQueueId_t commandedBy,
|
||||
ActionId_t actionId, store_address_t dataAddress);
|
||||
/**
|
||||
*
|
||||
* @brief Default implementation is empty.
|
||||
*/
|
||||
virtual void resetHelper();
|
||||
};
|
||||
|
||||
#endif /* ACTIONHELPER_H_ */
|
||||
#endif /* FSFW_ACTION_ACTIONHELPER_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef ACTIONMESSAGE_H_
|
||||
#define ACTIONMESSAGE_H_
|
||||
#ifndef FSFW_ACTION_ACTIONMESSAGE_H_
|
||||
#define FSFW_ACTION_ACTIONMESSAGE_H_
|
||||
|
||||
#include "../ipc/CommandMessage.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
@ -18,15 +18,19 @@ public:
|
||||
static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(5);
|
||||
static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(6);
|
||||
virtual ~ActionMessage();
|
||||
static void setCommand(CommandMessage* message, ActionId_t fid, store_address_t parameters);
|
||||
static void setCommand(CommandMessage* message, ActionId_t fid,
|
||||
store_address_t parameters);
|
||||
static ActionId_t getActionId(const CommandMessage* message );
|
||||
static store_address_t getStoreId(const CommandMessage* message );
|
||||
static void setStepReply(CommandMessage* message, ActionId_t fid, uint8_t step, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
||||
static void setStepReply(CommandMessage* message, ActionId_t fid,
|
||||
uint8_t step, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
||||
static uint8_t getStep(const CommandMessage* message );
|
||||
static ReturnValue_t getReturnCode(const CommandMessage* message );
|
||||
static void setDataReply(CommandMessage* message, ActionId_t actionId, store_address_t data);
|
||||
static void setCompletionReply(CommandMessage* message, ActionId_t fid, ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
||||
static void setDataReply(CommandMessage* message, ActionId_t actionId,
|
||||
store_address_t data);
|
||||
static void setCompletionReply(CommandMessage* message, ActionId_t fid,
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK);
|
||||
static void clear(CommandMessage* message);
|
||||
};
|
||||
|
||||
#endif /* ACTIONMESSAGE_H_ */
|
||||
#endif /* FSFW_ACTION_ACTIONMESSAGE_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef COMMANDSACTIONSIF_H_
|
||||
#define COMMANDSACTIONSIF_H_
|
||||
#ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_
|
||||
#define FSFW_ACTION_COMMANDSACTIONSIF_H_
|
||||
|
||||
#include "CommandActionHelper.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
@ -24,11 +24,14 @@ public:
|
||||
virtual MessageQueueIF* getCommandQueuePtr() = 0;
|
||||
protected:
|
||||
virtual void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) = 0;
|
||||
virtual void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) = 0;
|
||||
virtual void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) = 0;
|
||||
virtual void stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||
ReturnValue_t returnCode) = 0;
|
||||
virtual void dataReceived(ActionId_t actionId, const uint8_t* data,
|
||||
uint32_t size) = 0;
|
||||
virtual void completionSuccessfulReceived(ActionId_t actionId) = 0;
|
||||
virtual void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) = 0;
|
||||
virtual void completionFailedReceived(ActionId_t actionId,
|
||||
ReturnValue_t returnCode) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* COMMANDSACTIONSIF_H_ */
|
||||
#endif /* FSFW_ACTION_COMMANDSACTIONSIF_H_ */
|
||||
|
@ -1,11 +1,12 @@
|
||||
#ifndef FRAMEWORK_ACTION_HASACTIONSIF_H_
|
||||
#define FRAMEWORK_ACTION_HASACTIONSIF_H_
|
||||
#ifndef FSFW_ACTION_HASACTIONSIF_H_
|
||||
#define FSFW_ACTION_HASACTIONSIF_H_
|
||||
|
||||
#include "ActionHelper.h"
|
||||
#include "ActionMessage.h"
|
||||
#include "SimpleActionHelper.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../ipc/MessageQueueIF.h"
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Interface for component which uses actions
|
||||
@ -47,14 +48,16 @@ public:
|
||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||
/**
|
||||
* Execute or initialize the execution of a certain function.
|
||||
* Returning #EXECUTION_FINISHED or a failure code, nothing else needs to
|
||||
* be done. When needing more steps, return RETURN_OK and issue steps and
|
||||
* completion manually.
|
||||
* One "step failed" or completion report must be issued!
|
||||
* The ActionHelpers will execute this function and behave differently
|
||||
* depending on the returnvalue.
|
||||
*
|
||||
* @return
|
||||
* -@c EXECUTION_FINISHED Finish reply will be generated
|
||||
* -@c Not RETURN_OK Step failure reply will be generated
|
||||
*/
|
||||
virtual ReturnValue_t executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy, const uint8_t* data, size_t size) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_ACTION_HASACTIONSIF_H_ */
|
||||
#endif /* FSFW_ACTION_HASACTIONSIF_H_ */
|
||||
|
@ -1,16 +1,17 @@
|
||||
#include "HasActionsIF.h"
|
||||
#include "SimpleActionHelper.h"
|
||||
|
||||
SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner,
|
||||
MessageQueueIF* useThisQueue) :
|
||||
ActionHelper(setOwner, useThisQueue), isExecuting(false), lastCommander(
|
||||
0), lastAction(0), stepCount(0) {
|
||||
ActionHelper(setOwner, useThisQueue), isExecuting(false) {
|
||||
}
|
||||
|
||||
SimpleActionHelper::~SimpleActionHelper() {
|
||||
}
|
||||
|
||||
void SimpleActionHelper::step(ReturnValue_t result) {
|
||||
//STEP_OFFESET is subtracted to compensate for adding offset in base method, which is not necessary here.
|
||||
// STEP_OFFESET is subtracted to compensate for adding offset in base
|
||||
// method, which is not necessary here.
|
||||
ActionHelper::step(stepCount - STEP_OFFSET, lastCommander, lastAction,
|
||||
result);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
|
@ -1,8 +1,13 @@
|
||||
#ifndef SIMPLEACTIONHELPER_H_
|
||||
#define SIMPLEACTIONHELPER_H_
|
||||
#ifndef FSFW_ACTION_SIMPLEACTIONHELPER_H_
|
||||
#define FSFW_ACTION_SIMPLEACTIONHELPER_H_
|
||||
|
||||
#include "ActionHelper.h"
|
||||
|
||||
/**
|
||||
* @brief This is an action helper which is only able to service one action
|
||||
* at a time but remembers last commander and last action which
|
||||
* simplifies usage
|
||||
*/
|
||||
class SimpleActionHelper: public ActionHelper {
|
||||
public:
|
||||
SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue);
|
||||
@ -12,13 +17,14 @@ public:
|
||||
ReturnValue_t reportData(SerializeIF* data);
|
||||
|
||||
protected:
|
||||
void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, store_address_t dataAddress);
|
||||
virtual void resetHelper();
|
||||
void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId,
|
||||
store_address_t dataAddress);
|
||||
virtual void resetHelper();
|
||||
private:
|
||||
bool isExecuting;
|
||||
MessageQueueId_t lastCommander;
|
||||
ActionId_t lastAction;
|
||||
uint8_t stepCount;
|
||||
MessageQueueId_t lastCommander = MessageQueueIF::NO_QUEUE;
|
||||
ActionId_t lastAction = 0;
|
||||
uint8_t stepCount = 0;
|
||||
};
|
||||
|
||||
#endif /* SIMPLEACTIONHELPER_H_ */
|
||||
|
@ -1,15 +1,15 @@
|
||||
#ifndef ARRAYLIST_H_
|
||||
#define ARRAYLIST_H_
|
||||
#ifndef FSFW_CONTAINER_ARRAYLIST_H_
|
||||
#define FSFW_CONTAINER_ARRAYLIST_H_
|
||||
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../serialize/SerializeAdapter.h"
|
||||
#include "../serialize/SerializeIF.h"
|
||||
|
||||
/**
|
||||
* A List that stores its values in an array.
|
||||
*
|
||||
* The backend is an array that can be allocated by the class itself or supplied via ctor.
|
||||
*
|
||||
* @brief A List that stores its values in an array.
|
||||
* @details
|
||||
* The underlying storage is an array that can be allocated by the class
|
||||
* itself or supplied via ctor.
|
||||
*
|
||||
* @ingroup container
|
||||
*/
|
||||
@ -20,6 +20,53 @@ public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::ARRAY_LIST;
|
||||
static const ReturnValue_t FULL = MAKE_RETURN_CODE(0x01);
|
||||
|
||||
/**
|
||||
* This is the allocating constructor.
|
||||
* It allocates an array of the specified size.
|
||||
* @param maxSize
|
||||
*/
|
||||
ArrayList(count_t maxSize) :
|
||||
size(0), maxSize_(maxSize), allocated(true) {
|
||||
entries = new T[maxSize];
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the non-allocating constructor
|
||||
*
|
||||
* It expects a pointer to an array of a certain size and initializes
|
||||
* itself to it.
|
||||
*
|
||||
* @param storage the array to use as backend
|
||||
* @param maxSize size of storage
|
||||
* @param size size of data already present in storage
|
||||
*/
|
||||
ArrayList(T *storage, count_t maxSize, count_t size = 0) :
|
||||
size(size), entries(storage), maxSize_(maxSize), allocated(false) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copying is forbiden by declaring copy ctor and copy assignment deleted
|
||||
* It is too ambigous in this case.
|
||||
* (Allocate a new backend? Use the same? What to do in an modifying call?)
|
||||
*/
|
||||
ArrayList(const ArrayList& other) = delete;
|
||||
const ArrayList& operator=(const ArrayList& other) = delete;
|
||||
|
||||
/**
|
||||
* Number of Elements stored in this List
|
||||
*/
|
||||
count_t size;
|
||||
|
||||
|
||||
/**
|
||||
* Destructor, if the allocating constructor was used, it deletes the array.
|
||||
*/
|
||||
virtual ~ArrayList() {
|
||||
if (allocated) {
|
||||
delete[] entries;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An Iterator to go trough an ArrayList
|
||||
*
|
||||
@ -31,10 +78,7 @@ public:
|
||||
/**
|
||||
* Empty ctor, points to NULL
|
||||
*/
|
||||
Iterator() :
|
||||
value(0) {
|
||||
|
||||
}
|
||||
Iterator(): value(0) {}
|
||||
|
||||
/**
|
||||
* Initializes the Iterator to point to an element
|
||||
@ -72,7 +116,11 @@ public:
|
||||
return tmp;
|
||||
}
|
||||
|
||||
T operator*() {
|
||||
T& operator*() {
|
||||
return *value;
|
||||
}
|
||||
|
||||
const T& operator*() const {
|
||||
return *value;
|
||||
}
|
||||
|
||||
@ -80,59 +128,19 @@ public:
|
||||
return value;
|
||||
}
|
||||
|
||||
const T *operator->() const{
|
||||
const T *operator->() const {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
//SHOULDDO this should be implemented as non-member
|
||||
bool operator==(const typename ArrayList<T, count_t>::Iterator& other) const{
|
||||
return (value == other.value);
|
||||
}
|
||||
|
||||
//SHOULDDO this should be implemented as non-member
|
||||
bool operator!=(const typename ArrayList<T, count_t>::Iterator& other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
/**
|
||||
* Number of Elements stored in this List
|
||||
*/
|
||||
count_t size;
|
||||
|
||||
/**
|
||||
* This is the allocating constructor;
|
||||
*
|
||||
* It allocates an array of the specified size.
|
||||
*
|
||||
* @param maxSize
|
||||
*/
|
||||
ArrayList(count_t maxSize) :
|
||||
size(0), maxSize_(maxSize), allocated(true) {
|
||||
entries = new T[maxSize];
|
||||
friend bool operator==(const ArrayList::Iterator& lhs,
|
||||
const ArrayList::Iterator& rhs) {
|
||||
return (lhs.value == rhs.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the non-allocating constructor
|
||||
*
|
||||
* It expects a pointer to an array of a certain size and initializes itself to it.
|
||||
*
|
||||
* @param storage the array to use as backend
|
||||
* @param maxSize size of storage
|
||||
* @param size size of data already present in storage
|
||||
*/
|
||||
ArrayList(T *storage, count_t maxSize, count_t size = 0) :
|
||||
size(size), entries(storage), maxSize_(maxSize), allocated(false) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor, if the allocating constructor was used, it deletes the array.
|
||||
*/
|
||||
virtual ~ArrayList() {
|
||||
if (allocated) {
|
||||
delete[] entries;
|
||||
}
|
||||
friend bool operator!=(const ArrayList::Iterator& lhs,
|
||||
const ArrayList::Iterator& rhs) {
|
||||
return not (lhs.value == rhs.value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,7 +196,7 @@ public:
|
||||
*
|
||||
* @return maximum number of elements
|
||||
*/
|
||||
uint32_t maxSize() const {
|
||||
size_t maxSize() const {
|
||||
return this->maxSize_;
|
||||
}
|
||||
|
||||
@ -223,19 +231,7 @@ public:
|
||||
count_t remaining() {
|
||||
return (maxSize_ - size);
|
||||
}
|
||||
private:
|
||||
/**
|
||||
* This is the copy constructor
|
||||
*
|
||||
* It is private, as copying is too ambigous in this case. (Allocate a new backend? Use the same?
|
||||
* What to do in an modifying call?)
|
||||
*
|
||||
* @param other
|
||||
*/
|
||||
ArrayList(const ArrayList& other) :
|
||||
size(other.size), entries(other.entries), maxSize_(other.maxSize_), allocated(
|
||||
false) {
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* pointer to the array in which the entries are stored
|
||||
@ -244,12 +240,14 @@ protected:
|
||||
/**
|
||||
* remembering the maximum size
|
||||
*/
|
||||
uint32_t maxSize_;
|
||||
size_t maxSize_;
|
||||
|
||||
/**
|
||||
* true if the array was allocated and needs to be deleted in the destructor.
|
||||
*/
|
||||
bool allocated;
|
||||
|
||||
};
|
||||
#endif /* ARRAYLIST_H_ */
|
||||
|
||||
|
||||
|
||||
#endif /* FSFW_CONTAINER_ARRAYLIST_H_ */
|
||||
|
55
container/DynamicFIFO.h
Normal file
55
container/DynamicFIFO.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef FSFW_CONTAINER_DYNAMICFIFO_H_
|
||||
#define FSFW_CONTAINER_DYNAMICFIFO_H_
|
||||
|
||||
#include "FIFOBase.h"
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* @brief Simple First-In-First-Out data structure. The maximum size
|
||||
* can be set in the constructor.
|
||||
* @details
|
||||
* The maximum capacity can be determined at run-time, so this container
|
||||
* performs dynamic memory allocation!
|
||||
* The public interface of FIFOBase exposes the user interface for the FIFO.
|
||||
* @tparam T Entry Type
|
||||
* @tparam capacity Maximum capacity
|
||||
*/
|
||||
template<typename T>
|
||||
class DynamicFIFO: public FIFOBase<T> {
|
||||
public:
|
||||
DynamicFIFO(size_t maxCapacity): FIFOBase<T>(nullptr, maxCapacity),
|
||||
fifoVector(maxCapacity) {
|
||||
// trying to pass the pointer of the uninitialized vector
|
||||
// to the FIFOBase constructor directly lead to a super evil bug.
|
||||
// So we do it like this now.
|
||||
this->setContainer(fifoVector.data());
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Custom copy constructor which prevents setting the
|
||||
* underlying pointer wrong. This function allocates memory!
|
||||
* @details This is a very heavy operation so try to avoid this!
|
||||
*
|
||||
*/
|
||||
DynamicFIFO(const DynamicFIFO& other): FIFOBase<T>(other),
|
||||
fifoVector(other.maxCapacity) {
|
||||
this->fifoVector = other.fifoVector;
|
||||
this->setContainer(fifoVector.data());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Custom assignment operator
|
||||
* @details This is a very heavy operation so try to avoid this!
|
||||
* @param other DyamicFIFO to copy from
|
||||
*/
|
||||
DynamicFIFO& operator=(const DynamicFIFO& other){
|
||||
FIFOBase<T>::operator=(other);
|
||||
this->fifoVector = other.fifoVector;
|
||||
this->setContainer(fifoVector.data());
|
||||
return *this;
|
||||
}
|
||||
private:
|
||||
std::vector<T> fifoVector;
|
||||
};
|
||||
|
||||
#endif /* FSFW_CONTAINER_DYNAMICFIFO_H_ */
|
103
container/FIFO.h
103
container/FIFO.h
@ -1,82 +1,47 @@
|
||||
#ifndef FIFO_H_
|
||||
#define FIFO_H_
|
||||
#ifndef FSFW_CONTAINER_FIFO_H_
|
||||
#define FSFW_CONTAINER_FIFO_H_
|
||||
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "FIFOBase.h"
|
||||
#include <array>
|
||||
|
||||
/**
|
||||
* @brief Simple First-In-First-Out data structure
|
||||
* @brief Simple First-In-First-Out data structure with size fixed at
|
||||
* compile time
|
||||
* @details
|
||||
* Performs no dynamic memory allocation.
|
||||
* The public interface of FIFOBase exposes the user interface for the FIFO.
|
||||
* @tparam T Entry Type
|
||||
* @tparam capacity Maximum capacity
|
||||
*/
|
||||
template<typename T, uint8_t capacity>
|
||||
class FIFO {
|
||||
private:
|
||||
uint8_t readIndex, writeIndex, currentSize;
|
||||
T data[capacity];
|
||||
|
||||
uint8_t next(uint8_t current) {
|
||||
++current;
|
||||
if (current == capacity) {
|
||||
current = 0;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
template<typename T, size_t capacity>
|
||||
class FIFO: public FIFOBase<T> {
|
||||
public:
|
||||
FIFO() :
|
||||
readIndex(0), writeIndex(0), currentSize(0) {
|
||||
FIFO(): FIFOBase<T>(nullptr, capacity) {
|
||||
this->setContainer(fifoArray.data());
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Custom copy constructor to set pointer correctly.
|
||||
* @param other
|
||||
*/
|
||||
FIFO(const FIFO& other): FIFOBase<T>(other) {
|
||||
this->fifoArray = other.fifoArray;
|
||||
this->setContainer(fifoArray.data());
|
||||
}
|
||||
|
||||
bool empty() {
|
||||
return (currentSize == 0);
|
||||
/**
|
||||
* @brief Custom assignment operator
|
||||
* @param other
|
||||
*/
|
||||
FIFO& operator=(const FIFO& other){
|
||||
FIFOBase<T>::operator=(other);
|
||||
this->fifoArray = other.fifoArray;
|
||||
this->setContainer(fifoArray.data());
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool full() {
|
||||
return (currentSize == capacity);
|
||||
}
|
||||
|
||||
uint8_t size(){
|
||||
return currentSize;
|
||||
}
|
||||
|
||||
ReturnValue_t insert(T value) {
|
||||
if (full()) {
|
||||
return FULL;
|
||||
} else {
|
||||
data[writeIndex] = value;
|
||||
writeIndex = next(writeIndex);
|
||||
++currentSize;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t retrieve(T *value) {
|
||||
if (empty()) {
|
||||
return EMPTY;
|
||||
} else {
|
||||
*value = data[readIndex];
|
||||
readIndex = next(readIndex);
|
||||
--currentSize;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t peek(T * value) {
|
||||
if(empty()) {
|
||||
return EMPTY;
|
||||
} else {
|
||||
*value = data[readIndex];
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t pop() {
|
||||
T value;
|
||||
return this->retrieve(&value);
|
||||
}
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::FIFO_CLASS;
|
||||
static const ReturnValue_t FULL = MAKE_RETURN_CODE(1);
|
||||
static const ReturnValue_t EMPTY = MAKE_RETURN_CODE(2);
|
||||
private:
|
||||
std::array<T, capacity> fifoArray;
|
||||
};
|
||||
|
||||
#endif /* FIFO_H_ */
|
||||
#endif /* FSFW_CONTAINER_FIFO_H_ */
|
||||
|
79
container/FIFOBase.h
Normal file
79
container/FIFOBase.h
Normal file
@ -0,0 +1,79 @@
|
||||
#ifndef FSFW_CONTAINER_FIFOBASE_H_
|
||||
#define FSFW_CONTAINER_FIFOBASE_H_
|
||||
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
|
||||
template <typename T>
|
||||
class FIFOBase {
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::FIFO_CLASS;
|
||||
static const ReturnValue_t FULL = MAKE_RETURN_CODE(1);
|
||||
static const ReturnValue_t EMPTY = MAKE_RETURN_CODE(2);
|
||||
|
||||
/** Default ctor, takes pointer to first entry of underlying container
|
||||
* and maximum capacity */
|
||||
FIFOBase(T* values, const size_t maxCapacity);
|
||||
|
||||
/**
|
||||
* Insert value into FIFO
|
||||
* @param value
|
||||
* @return RETURN_OK on success, FULL if full
|
||||
*/
|
||||
ReturnValue_t insert(T value);
|
||||
/**
|
||||
* Retrieve item from FIFO. This removes the item from the FIFO.
|
||||
* @param value Must point to a valid T
|
||||
* @return RETURN_OK on success, EMPTY if empty and FAILED if nullptr check failed
|
||||
*/
|
||||
ReturnValue_t retrieve(T *value);
|
||||
/**
|
||||
* Retrieve item from FIFO without removing it from FIFO.
|
||||
* @param value Must point to a valid T
|
||||
* @return RETURN_OK on success, EMPTY if empty and FAILED if nullptr check failed
|
||||
*/
|
||||
ReturnValue_t peek(T * value);
|
||||
/**
|
||||
* Remove item from FIFO.
|
||||
* @return RETURN_OK on success, EMPTY if empty
|
||||
*/
|
||||
ReturnValue_t pop();
|
||||
|
||||
/***
|
||||
* Check if FIFO is empty
|
||||
* @return True if empty, False if not
|
||||
*/
|
||||
bool empty();
|
||||
/***
|
||||
* Check if FIFO is Full
|
||||
* @return True if full, False if not
|
||||
*/
|
||||
bool full();
|
||||
/***
|
||||
* Current used size (elements) used
|
||||
* @return size_t in elements
|
||||
*/
|
||||
size_t size();
|
||||
/***
|
||||
* Get maximal capacity of fifo
|
||||
* @return size_t with max capacity of this fifo
|
||||
*/
|
||||
size_t getMaxCapacity() const;
|
||||
|
||||
protected:
|
||||
void setContainer(T* data);
|
||||
size_t maxCapacity = 0;
|
||||
|
||||
T* values;
|
||||
|
||||
size_t readIndex = 0;
|
||||
size_t writeIndex = 0;
|
||||
size_t currentSize = 0;
|
||||
|
||||
size_t next(size_t current);
|
||||
};
|
||||
|
||||
#include "FIFOBase.tpp"
|
||||
|
||||
#endif /* FSFW_CONTAINER_FIFOBASE_H_ */
|
93
container/FIFOBase.tpp
Normal file
93
container/FIFOBase.tpp
Normal file
@ -0,0 +1,93 @@
|
||||
#ifndef FSFW_CONTAINER_FIFOBASE_TPP_
|
||||
#define FSFW_CONTAINER_FIFOBASE_TPP_
|
||||
|
||||
#ifndef FSFW_CONTAINER_FIFOBASE_H_
|
||||
#error Include FIFOBase.h before FIFOBase.tpp!
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
inline FIFOBase<T>::FIFOBase(T* values, const size_t maxCapacity):
|
||||
maxCapacity(maxCapacity), values(values){};
|
||||
|
||||
template<typename T>
|
||||
inline ReturnValue_t FIFOBase<T>::insert(T value) {
|
||||
if (full()) {
|
||||
return FULL;
|
||||
} else {
|
||||
values[writeIndex] = value;
|
||||
writeIndex = next(writeIndex);
|
||||
++currentSize;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline ReturnValue_t FIFOBase<T>::retrieve(T* value) {
|
||||
if (empty()) {
|
||||
return EMPTY;
|
||||
} else {
|
||||
if (value == nullptr){
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
*value = values[readIndex];
|
||||
readIndex = next(readIndex);
|
||||
--currentSize;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline ReturnValue_t FIFOBase<T>::peek(T* value) {
|
||||
if(empty()) {
|
||||
return EMPTY;
|
||||
} else {
|
||||
if (value == nullptr){
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
*value = values[readIndex];
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline ReturnValue_t FIFOBase<T>::pop() {
|
||||
T value;
|
||||
return this->retrieve(&value);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline bool FIFOBase<T>::empty() {
|
||||
return (currentSize == 0);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline bool FIFOBase<T>::full() {
|
||||
return (currentSize == maxCapacity);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline size_t FIFOBase<T>::size() {
|
||||
return currentSize;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline size_t FIFOBase<T>::next(size_t current) {
|
||||
++current;
|
||||
if (current == maxCapacity) {
|
||||
current = 0;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline size_t FIFOBase<T>::getMaxCapacity() const {
|
||||
return maxCapacity;
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline void FIFOBase<T>::setContainer(T *data) {
|
||||
this->values = data;
|
||||
}
|
||||
|
||||
#endif
|
@ -2,11 +2,13 @@
|
||||
#define FIXEDARRAYLIST_H_
|
||||
|
||||
#include "ArrayList.h"
|
||||
#include <cmath>
|
||||
/**
|
||||
* \ingroup container
|
||||
*/
|
||||
template<typename T, uint32_t MAX_SIZE, typename count_t = uint8_t>
|
||||
template<typename T, size_t MAX_SIZE, typename count_t = uint8_t>
|
||||
class FixedArrayList: public ArrayList<T, count_t> {
|
||||
static_assert(MAX_SIZE <= (pow(2,sizeof(count_t)*8)-1), "count_t is not large enough to hold MAX_SIZE");
|
||||
private:
|
||||
T data[MAX_SIZE];
|
||||
public:
|
||||
@ -18,11 +20,13 @@ public:
|
||||
ArrayList<T, count_t>(data, MAX_SIZE) {
|
||||
memcpy(this->data, other.data, sizeof(this->data));
|
||||
this->entries = data;
|
||||
this->size = other.size;
|
||||
}
|
||||
|
||||
FixedArrayList& operator=(FixedArrayList other) {
|
||||
memcpy(this->data, other.data, sizeof(this->data));
|
||||
this->entries = data;
|
||||
this->size = other.size;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,27 @@
|
||||
#ifndef FIXEDMAP_H_
|
||||
#define FIXEDMAP_H_
|
||||
#ifndef FSFW_CONTAINER_FIXEDMAP_H_
|
||||
#define FSFW_CONTAINER_FIXEDMAP_H_
|
||||
|
||||
#include "ArrayList.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
||||
/**
|
||||
* \ingroup container
|
||||
* @brief Map implementation for maps with a pre-defined size.
|
||||
* @details
|
||||
* Can be initialized with desired maximum size.
|
||||
* Iterator is used to access <key,value> pair and iterate through map entries.
|
||||
* Complexity O(n).
|
||||
* @warning Iterators return a non-const key_t in the pair.
|
||||
* @warning A User is not allowed to change the key, otherwise the map is corrupted.
|
||||
* @ingroup container
|
||||
*/
|
||||
template<typename key_t, typename T>
|
||||
class FixedMap: public SerializeIF {
|
||||
static_assert (std::is_trivially_copyable<T>::value or
|
||||
std::is_base_of<SerializeIF, T>::value,
|
||||
"Types used in FixedMap must either be trivial copy-able or a "
|
||||
"derived class from SerializeIF to be serialize-able");
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::FIXED_MAP;
|
||||
static const ReturnValue_t KEY_ALREADY_EXISTS = MAKE_RETURN_CODE(0x01);
|
||||
@ -47,17 +59,18 @@ public:
|
||||
Iterator(std::pair<key_t, T> *pair) :
|
||||
ArrayList<std::pair<key_t, T>, uint32_t>::Iterator(pair) {
|
||||
}
|
||||
|
||||
T operator*() {
|
||||
return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
|
||||
}
|
||||
|
||||
T *operator->() {
|
||||
return &ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
friend bool operator==(const typename FixedMap::Iterator& lhs,
|
||||
const typename FixedMap::Iterator& rhs) {
|
||||
return (lhs.value == rhs.value);
|
||||
}
|
||||
|
||||
friend bool operator!=(const typename FixedMap::Iterator& lhs,
|
||||
const typename FixedMap::Iterator& rhs) {
|
||||
return not (lhs.value == rhs.value);
|
||||
}
|
||||
|
||||
Iterator begin() const {
|
||||
return Iterator(&theMap[0]);
|
||||
}
|
||||
@ -70,7 +83,7 @@ public:
|
||||
return _size;
|
||||
}
|
||||
|
||||
ReturnValue_t insert(key_t key, T value, Iterator *storedValue = NULL) {
|
||||
ReturnValue_t insert(key_t key, T value, Iterator *storedValue = nullptr) {
|
||||
if (exists(key) == HasReturnvaluesIF::RETURN_OK) {
|
||||
return KEY_ALREADY_EXISTS;
|
||||
}
|
||||
@ -79,7 +92,7 @@ public:
|
||||
}
|
||||
theMap[_size].first = key;
|
||||
theMap[_size].second = value;
|
||||
if (storedValue != NULL) {
|
||||
if (storedValue != nullptr) {
|
||||
*storedValue = Iterator(&theMap[_size]);
|
||||
}
|
||||
++_size;
|
||||
@ -87,7 +100,7 @@ public:
|
||||
}
|
||||
|
||||
ReturnValue_t insert(std::pair<key_t, T> pair) {
|
||||
return insert(pair.fist, pair.second);
|
||||
return insert(pair.first, pair.second);
|
||||
}
|
||||
|
||||
ReturnValue_t exists(key_t key) const {
|
||||
@ -140,6 +153,24 @@ public:
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
bool empty() {
|
||||
if(_size == 0) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool full() {
|
||||
if(_size >= theMap.maxSize()) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_size = 0;
|
||||
}
|
||||
@ -196,4 +227,4 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#endif /* FIXEDMAP_H_ */
|
||||
#endif /* FSFW_CONTAINER_FIXEDMAP_H_ */
|
||||
|
@ -1,181 +1,206 @@
|
||||
#ifndef FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_H_
|
||||
#define FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_H_
|
||||
#ifndef FSFW_CONTAINER_FIXEDORDEREDMULTIMAP_H_
|
||||
#define FSFW_CONTAINER_FIXEDORDEREDMULTIMAP_H_
|
||||
|
||||
#include "ArrayList.h"
|
||||
#include <cstring>
|
||||
#include <set>
|
||||
|
||||
/**
|
||||
* @brief An associative container which allows multiple entries of the same key.
|
||||
* @details
|
||||
* Same keys are ordered by KEY_COMPARE function which is std::less<key_t> > by default.
|
||||
*
|
||||
* It uses the ArrayList, so technically this is not a real map, it is an array of pairs
|
||||
* of type key_t, T. It is ordered by key_t as FixedMap but allows same keys. Thus it has a linear
|
||||
* complexity O(n). As long as the number of entries remains low, this
|
||||
* should not be an issue.
|
||||
* The number of insertion and deletion operation should be minimized
|
||||
* as those incur extensive memory move operations (the underlying container
|
||||
* is not node based).
|
||||
*
|
||||
* Its of fixed size so no allocations are performed after the construction.
|
||||
*
|
||||
* The maximum size is given as first parameter of the constructor.
|
||||
*
|
||||
* It provides an iterator to do list iterations.
|
||||
*
|
||||
* The type T must have a copy constructor if it is not trivial copy-able.
|
||||
*
|
||||
* @warning Iterators return a non-const key_t in the pair.
|
||||
* @warning A User is not allowed to change the key, otherwise the map is corrupted.
|
||||
*
|
||||
* \ingroup container
|
||||
*/
|
||||
template<typename key_t, typename T, typename KEY_COMPARE = std::less<key_t>>
|
||||
class FixedOrderedMultimap {
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::FIXED_MAP;
|
||||
static const ReturnValue_t KEY_ALREADY_EXISTS = MAKE_RETURN_CODE(0x01);
|
||||
static const ReturnValue_t MAP_FULL = MAKE_RETURN_CODE(0x02);
|
||||
static const ReturnValue_t KEY_DOES_NOT_EXIST = MAKE_RETURN_CODE(0x03);
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::FIXED_MULTIMAP;
|
||||
static const ReturnValue_t MAP_FULL = MAKE_RETURN_CODE(0x01);
|
||||
static const ReturnValue_t KEY_DOES_NOT_EXIST = MAKE_RETURN_CODE(0x02);
|
||||
|
||||
private:
|
||||
typedef KEY_COMPARE compare;
|
||||
compare myComp;
|
||||
ArrayList<std::pair<key_t, T>, uint32_t> theMap;
|
||||
uint32_t _size;
|
||||
/***
|
||||
* Constructor which needs a size_t for the maximum allowed size
|
||||
*
|
||||
* Can not be resized during runtime
|
||||
*
|
||||
* Allocates memory at construction
|
||||
* @param maxSize size_t of Maximum allowed size
|
||||
*/
|
||||
FixedOrderedMultimap(size_t maxSize):theMap(maxSize), _size(0){
|
||||
}
|
||||
|
||||
uint32_t findFirstIndex(key_t key, uint32_t startAt = 0) const {
|
||||
if (startAt >= _size) {
|
||||
return startAt + 1;
|
||||
}
|
||||
uint32_t i = startAt;
|
||||
for (i = startAt; i < _size; ++i) {
|
||||
if (theMap[i].first == key) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
uint32_t findNicePlace(key_t key) const {
|
||||
uint32_t i = 0;
|
||||
for (i = 0; i < _size; ++i) {
|
||||
if (myComp(key, theMap[i].first)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void removeFromPosition(uint32_t position) {
|
||||
if (_size <= position) {
|
||||
return;
|
||||
}
|
||||
memmove(&theMap[position], &theMap[position + 1],
|
||||
(_size - position - 1) * sizeof(std::pair<key_t,T>));
|
||||
--_size;
|
||||
}
|
||||
public:
|
||||
FixedOrderedMultimap(uint32_t maxSize) :
|
||||
theMap(maxSize), _size(0) {
|
||||
}
|
||||
/***
|
||||
* Virtual destructor frees Memory by deleting its member
|
||||
*/
|
||||
virtual ~FixedOrderedMultimap() {
|
||||
}
|
||||
|
||||
class Iterator: public ArrayList<std::pair<key_t, T>, uint32_t>::Iterator {
|
||||
/***
|
||||
* Special iterator for FixedOrderedMultimap
|
||||
*/
|
||||
class Iterator: public ArrayList<std::pair<key_t, T>, size_t>::Iterator {
|
||||
public:
|
||||
Iterator() :
|
||||
ArrayList<std::pair<key_t, T>, uint32_t>::Iterator() {
|
||||
ArrayList<std::pair<key_t, T>, size_t>::Iterator() {
|
||||
}
|
||||
|
||||
Iterator(std::pair<key_t, T> *pair) :
|
||||
ArrayList<std::pair<key_t, T>, uint32_t>::Iterator(pair) {
|
||||
ArrayList<std::pair<key_t, T>, size_t>::Iterator(pair) {
|
||||
}
|
||||
|
||||
T operator*() {
|
||||
return ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
|
||||
}
|
||||
|
||||
T *operator->() {
|
||||
return &ArrayList<std::pair<key_t, T>, uint32_t>::Iterator::value->second;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/***
|
||||
* Returns an iterator pointing to the first element
|
||||
* @return Iterator pointing to first element
|
||||
*/
|
||||
Iterator begin() const {
|
||||
return Iterator(&theMap[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator pointing to one element past the end
|
||||
* @return Iterator pointing to one element past the end
|
||||
*/
|
||||
Iterator end() const {
|
||||
return Iterator(&theMap[_size]);
|
||||
}
|
||||
|
||||
uint32_t size() const {
|
||||
/***
|
||||
* Returns the current size of the map (not maximum size!)
|
||||
* @return Current size
|
||||
*/
|
||||
size_t size() const{
|
||||
return _size;
|
||||
}
|
||||
|
||||
ReturnValue_t insert(key_t key, T value, Iterator *storedValue = NULL) {
|
||||
if (_size == theMap.maxSize()) {
|
||||
return MAP_FULL;
|
||||
}
|
||||
uint32_t position = findNicePlace(key);
|
||||
memmove(&theMap[position + 1], &theMap[position],
|
||||
(_size - position) * sizeof(std::pair<key_t,T>));
|
||||
theMap[position].first = key;
|
||||
theMap[position].second = value;
|
||||
++_size;
|
||||
if (storedValue != NULL) {
|
||||
*storedValue = Iterator(&theMap[position]);
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
/**
|
||||
* Clears the map, does not deallocate any memory
|
||||
*/
|
||||
void clear(){
|
||||
_size = 0;
|
||||
}
|
||||
|
||||
ReturnValue_t insert(std::pair<key_t, T> pair) {
|
||||
return insert(pair.fist, pair.second);
|
||||
/**
|
||||
* Returns the maximum size of the map
|
||||
* @return Maximum size of the map
|
||||
*/
|
||||
size_t maxSize() const{
|
||||
return theMap.maxSize();
|
||||
}
|
||||
|
||||
ReturnValue_t exists(key_t key) const {
|
||||
ReturnValue_t result = KEY_DOES_NOT_EXIST;
|
||||
if (findFirstIndex(key) < _size) {
|
||||
result = HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/***
|
||||
* Used to insert a key and value separately.
|
||||
*
|
||||
* @param[in] key Key of the new element
|
||||
* @param[in] value Value of the new element
|
||||
* @param[in/out] (optional) storedValue On success this points to the new value, otherwise a nullptr
|
||||
* @return RETURN_OK if insert was successful, MAP_FULL if no space is available
|
||||
*/
|
||||
ReturnValue_t insert(key_t key, T value, Iterator *storedValue = nullptr);
|
||||
|
||||
ReturnValue_t erase(Iterator *iter) {
|
||||
uint32_t i;
|
||||
if ((i = findFirstIndex((*iter).value->first)) >= _size) {
|
||||
return KEY_DOES_NOT_EXIST;
|
||||
}
|
||||
removeFromPosition(i);
|
||||
if (*iter != begin()) {
|
||||
(*iter)--;
|
||||
} else {
|
||||
*iter = begin();
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
/***
|
||||
* Used to insert new pair instead of single values
|
||||
*
|
||||
* @param pair Pair to be inserted
|
||||
* @return RETURN_OK if insert was successful, MAP_FULL if no space is available
|
||||
*/
|
||||
ReturnValue_t insert(std::pair<key_t, T> pair);
|
||||
|
||||
ReturnValue_t erase(key_t key) {
|
||||
uint32_t i;
|
||||
if ((i = findFirstIndex(key)) >= _size) {
|
||||
return KEY_DOES_NOT_EXIST;
|
||||
}
|
||||
do {
|
||||
removeFromPosition(i);
|
||||
i = findFirstIndex(key, i);
|
||||
} while (i < _size);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
/***
|
||||
* Can be used to check if a certain key is in the map
|
||||
* @param key Key to be checked
|
||||
* @return RETURN_OK if the key exists KEY_DOES_NOT_EXIST otherwise
|
||||
*/
|
||||
ReturnValue_t exists(key_t key) const;
|
||||
|
||||
//This is potentially unsafe
|
||||
// T *findValue(key_t key) const {
|
||||
// return &theMap[findFirstIndex(key)].second;
|
||||
// }
|
||||
/***
|
||||
* Used to delete the element in the iterator
|
||||
*
|
||||
* The iterator will point to the element before or begin(),
|
||||
* but never to one element in front of the map.
|
||||
*
|
||||
* @warning The iterator needs to be valid and dereferenceable
|
||||
* @param[in/out] iter Pointer to iterator to the element that needs to be ereased
|
||||
* @return RETURN_OK if erased, KEY_DOES_NOT_EXIST if the there is no element like this
|
||||
*/
|
||||
ReturnValue_t erase(Iterator *iter);
|
||||
|
||||
/***
|
||||
* Used to erase by key
|
||||
* @param key Key to be erased
|
||||
* @return RETURN_OK if erased, KEY_DOES_NOT_EXIST if the there is no element like this
|
||||
*/
|
||||
ReturnValue_t erase(key_t key);
|
||||
|
||||
Iterator find(key_t key) const {
|
||||
/***
|
||||
* Find returns the first appearance of the key
|
||||
*
|
||||
* If the key does not exist, it points to end()
|
||||
*
|
||||
* @param key Key to search for
|
||||
* @return Iterator pointing to the first entry of key
|
||||
*/
|
||||
Iterator find(key_t key) const{
|
||||
ReturnValue_t result = exists(key);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return end();
|
||||
}
|
||||
return Iterator(&theMap[findFirstIndex(key)]);
|
||||
};
|
||||
|
||||
/***
|
||||
* Finds first entry of the given key and returns a
|
||||
* pointer to the value
|
||||
*
|
||||
* @param key Key to search for
|
||||
* @param value Found value
|
||||
* @return RETURN_OK if it points to the value,
|
||||
* KEY_DOES_NOT_EXIST if the key is not in the map
|
||||
*/
|
||||
ReturnValue_t find(key_t key, T **value) const;
|
||||
|
||||
friend bool operator==(const typename FixedOrderedMultimap::Iterator& lhs,
|
||||
const typename FixedOrderedMultimap::Iterator& rhs) {
|
||||
return (lhs.value == rhs.value);
|
||||
}
|
||||
|
||||
ReturnValue_t find(key_t key, T **value) const {
|
||||
ReturnValue_t result = exists(key);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
*value = &theMap[findFirstIndex(key)].second;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
friend bool operator!=(const typename FixedOrderedMultimap::Iterator& lhs,
|
||||
const typename FixedOrderedMultimap::Iterator& rhs) {
|
||||
return not (lhs.value == rhs.value);
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_size = 0;
|
||||
}
|
||||
private:
|
||||
typedef KEY_COMPARE compare;
|
||||
compare myComp;
|
||||
ArrayList<std::pair<key_t, T>, size_t> theMap;
|
||||
size_t _size;
|
||||
|
||||
uint32_t maxSize() const {
|
||||
return theMap.maxSize();
|
||||
}
|
||||
size_t findFirstIndex(key_t key, size_t startAt = 0) const;
|
||||
|
||||
size_t findNicePlace(key_t key) const;
|
||||
|
||||
void removeFromPosition(size_t position);
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_H_ */
|
||||
#include "FixedOrderedMultimap.tpp"
|
||||
|
||||
#endif /* FSFW_CONTAINER_FIXEDORDEREDMULTIMAP_H_ */
|
||||
|
109
container/FixedOrderedMultimap.tpp
Normal file
109
container/FixedOrderedMultimap.tpp
Normal file
@ -0,0 +1,109 @@
|
||||
#ifndef FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_TPP_
|
||||
#define FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_TPP_
|
||||
|
||||
|
||||
template<typename key_t, typename T, typename KEY_COMPARE>
|
||||
inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::insert(key_t key, T value, Iterator *storedValue) {
|
||||
if (_size == theMap.maxSize()) {
|
||||
return MAP_FULL;
|
||||
}
|
||||
size_t position = findNicePlace(key);
|
||||
memmove(static_cast<void*>(&theMap[position + 1]),static_cast<void*>(&theMap[position]),
|
||||
(_size - position) * sizeof(std::pair<key_t,T>));
|
||||
theMap[position].first = key;
|
||||
theMap[position].second = value;
|
||||
++_size;
|
||||
if (storedValue != nullptr) {
|
||||
*storedValue = Iterator(&theMap[position]);
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
template<typename key_t, typename T, typename KEY_COMPARE>
|
||||
inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::insert(std::pair<key_t, T> pair) {
|
||||
return insert(pair.first, pair.second);
|
||||
}
|
||||
|
||||
template<typename key_t, typename T, typename KEY_COMPARE>
|
||||
inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::exists(key_t key) const {
|
||||
ReturnValue_t result = KEY_DOES_NOT_EXIST;
|
||||
if (findFirstIndex(key) < _size) {
|
||||
result = HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename key_t, typename T, typename KEY_COMPARE>
|
||||
inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::erase(Iterator *iter) {
|
||||
size_t i;
|
||||
if ((i = findFirstIndex((*iter).value->first)) >= _size) {
|
||||
return KEY_DOES_NOT_EXIST;
|
||||
}
|
||||
removeFromPosition(i);
|
||||
if (*iter != begin()) {
|
||||
(*iter)--;
|
||||
} else {
|
||||
*iter = begin();
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
template<typename key_t, typename T, typename KEY_COMPARE>
|
||||
inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::erase(key_t key) {
|
||||
size_t i;
|
||||
if ((i = findFirstIndex(key)) >= _size) {
|
||||
return KEY_DOES_NOT_EXIST;
|
||||
}
|
||||
do {
|
||||
removeFromPosition(i);
|
||||
i = findFirstIndex(key, i);
|
||||
} while (i < _size);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
template<typename key_t, typename T, typename KEY_COMPARE>
|
||||
inline ReturnValue_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::find(key_t key, T **value) const {
|
||||
ReturnValue_t result = exists(key);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
*value = &theMap[findFirstIndex(key)].second;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
template<typename key_t, typename T, typename KEY_COMPARE>
|
||||
inline size_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::findFirstIndex(key_t key, size_t startAt) const {
|
||||
if (startAt >= _size) {
|
||||
return startAt + 1;
|
||||
}
|
||||
size_t i = startAt;
|
||||
for (i = startAt; i < _size; ++i) {
|
||||
if (theMap[i].first == key) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
template<typename key_t, typename T, typename KEY_COMPARE>
|
||||
inline size_t FixedOrderedMultimap<key_t, T, KEY_COMPARE>::findNicePlace(key_t key) const {
|
||||
size_t i = 0;
|
||||
for (i = 0; i < _size; ++i) {
|
||||
if (myComp(key, theMap[i].first)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
template<typename key_t, typename T, typename KEY_COMPARE>
|
||||
inline void FixedOrderedMultimap<key_t, T, KEY_COMPARE>::removeFromPosition(size_t position) {
|
||||
if (_size <= position) {
|
||||
return;
|
||||
}
|
||||
memmove(static_cast<void*>(&theMap[position]), static_cast<void*>(&theMap[position + 1]),
|
||||
(_size - position - 1) * sizeof(std::pair<key_t,T>));
|
||||
--_size;
|
||||
}
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_CONTAINER_FIXEDORDEREDMULTIMAP_TPP_ */
|
@ -1,41 +0,0 @@
|
||||
#ifndef ISDERIVEDFROM_H_
|
||||
#define ISDERIVEDFROM_H_
|
||||
|
||||
template<typename D, typename B>
|
||||
class IsDerivedFrom {
|
||||
class No {
|
||||
};
|
||||
class Yes {
|
||||
No no[3];
|
||||
};
|
||||
|
||||
static Yes Test(B*); // declared, but not defined
|
||||
static No Test(... ); // declared, but not defined
|
||||
|
||||
public:
|
||||
enum {
|
||||
Is = sizeof(Test(static_cast<D*>(0))) == sizeof(Yes)
|
||||
};
|
||||
};
|
||||
|
||||
template<typename, typename>
|
||||
struct is_same {
|
||||
static bool const value = false;
|
||||
};
|
||||
|
||||
template<typename A>
|
||||
struct is_same<A, A> {
|
||||
static bool const value = true;
|
||||
};
|
||||
|
||||
|
||||
template<bool C, typename T = void>
|
||||
struct enable_if {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct enable_if<false, T> { };
|
||||
|
||||
|
||||
#endif /* ISDERIVEDFROM_H_ */
|
@ -3,26 +3,62 @@
|
||||
|
||||
#include "../storagemanager/StorageManagerIF.h"
|
||||
#include <utility>
|
||||
|
||||
/**
|
||||
* The Placement Factory is used to create objects at runtime in a specific pool.
|
||||
* In general, this should be avoided and it should only be used if you know what you are doing.
|
||||
* You are not allowed to use this container with a type that allocates memory internally like ArrayList.
|
||||
*
|
||||
* Also, you have to check the returned pointer in generate against nullptr!
|
||||
*
|
||||
* A backend of Type StorageManagerIF must be given as a place to store the new objects.
|
||||
* Therefore ThreadSafety is only provided by your StorageManager Implementation.
|
||||
*
|
||||
* Objects must be destroyed by the user with "destroy"! Otherwise the pool will not be cleared.
|
||||
*
|
||||
* The concept is based on the placement new operator.
|
||||
*
|
||||
* @warning Do not use with any Type that allocates memory internally!
|
||||
* @ingroup container
|
||||
*/
|
||||
class PlacementFactory {
|
||||
public:
|
||||
PlacementFactory(StorageManagerIF* backend) :
|
||||
dataBackend(backend) {
|
||||
}
|
||||
|
||||
/***
|
||||
* Generates an object of type T in the backend storage.
|
||||
*
|
||||
* @warning Do not use with any Type that allocates memory internally!
|
||||
*
|
||||
* @tparam T Type of Object
|
||||
* @param args Constructor Arguments to be passed
|
||||
* @return A pointer to the new object or a nullptr in case of failure
|
||||
*/
|
||||
template<typename T, typename ... Args>
|
||||
T* generate(Args&&... args) {
|
||||
store_address_t tempId;
|
||||
uint8_t* pData = NULL;
|
||||
uint8_t* pData = nullptr;
|
||||
ReturnValue_t result = dataBackend->getFreeElement(&tempId, sizeof(T),
|
||||
&pData);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
T* temp = new (pData) T(std::forward<Args>(args)...);
|
||||
return temp;
|
||||
}
|
||||
/***
|
||||
* Function to destroy the object allocated with generate and free space in backend.
|
||||
* This must be called by the user.
|
||||
*
|
||||
* @param thisElement Element to be destroyed
|
||||
* @return RETURN_OK if the element was destroyed, different errors on failure
|
||||
*/
|
||||
template<typename T>
|
||||
ReturnValue_t destroy(T* thisElement) {
|
||||
if (thisElement == nullptr){
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
//Need to call destructor first, in case something was allocated by the object (shouldn't do that, however).
|
||||
thisElement->~T();
|
||||
uint8_t* pointer = (uint8_t*) (thisElement);
|
||||
|
@ -1,96 +1,113 @@
|
||||
#ifndef FRAMEWORK_CONTAINER_RINGBUFFERBASE_H_
|
||||
#define FRAMEWORK_CONTAINER_RINGBUFFERBASE_H_
|
||||
#ifndef FSFW_CONTAINER_RINGBUFFERBASE_H_
|
||||
#define FSFW_CONTAINER_RINGBUFFERBASE_H_
|
||||
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include <cstddef>
|
||||
|
||||
template<uint8_t N_READ_PTRS = 1>
|
||||
class RingBufferBase {
|
||||
public:
|
||||
RingBufferBase(uint32_t startAddress, uint32_t size, bool overwriteOld) :
|
||||
start(startAddress), write(startAddress), size(size), overwriteOld(overwriteOld) {
|
||||
RingBufferBase(size_t startAddress, const size_t size, bool overwriteOld) :
|
||||
start(startAddress), write(startAddress), size(size),
|
||||
overwriteOld(overwriteOld) {
|
||||
for (uint8_t count = 0; count < N_READ_PTRS; count++) {
|
||||
read[count] = startAddress;
|
||||
}
|
||||
}
|
||||
ReturnValue_t readData(uint32_t amount, uint8_t n = 0) {
|
||||
if (availableReadData(n) >= amount) {
|
||||
incrementRead(amount, n);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
ReturnValue_t writeData(uint32_t amount) {
|
||||
if (availableWriteSpace() >= amount || overwriteOld) {
|
||||
incrementWrite(amount);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
uint32_t availableReadData(uint8_t n = 0) const {
|
||||
return ((write + size) - read[n]) % size;
|
||||
}
|
||||
uint32_t availableWriteSpace(uint8_t n = 0) const {
|
||||
//One less to avoid ambiguous full/empty problem.
|
||||
return (((read[n] + size) - write - 1) % size);
|
||||
}
|
||||
|
||||
virtual ~RingBufferBase() {}
|
||||
|
||||
bool isFull(uint8_t n = 0) {
|
||||
return (availableWriteSpace(n) == 0);
|
||||
}
|
||||
bool isEmpty(uint8_t n = 0) {
|
||||
return (availableReadData(n) == 0);
|
||||
return (getAvailableReadData(n) == 0);
|
||||
}
|
||||
virtual ~RingBufferBase() {
|
||||
|
||||
size_t getAvailableReadData(uint8_t n = 0) const {
|
||||
return ((write + size) - read[n]) % size;
|
||||
}
|
||||
uint32_t getRead(uint8_t n = 0) const {
|
||||
return read[n];
|
||||
size_t availableWriteSpace(uint8_t n = 0) const {
|
||||
//One less to avoid ambiguous full/empty problem.
|
||||
return (((read[n] + size) - write - 1) % size);
|
||||
}
|
||||
void setRead(uint32_t read, uint8_t n = 0) {
|
||||
if (read >= start && read < (start+size)) {
|
||||
this->read[n] = read;
|
||||
}
|
||||
|
||||
bool overwritesOld() const {
|
||||
return overwriteOld;
|
||||
}
|
||||
uint32_t getWrite() const {
|
||||
return write;
|
||||
}
|
||||
void setWrite(uint32_t write) {
|
||||
this->write = write;
|
||||
|
||||
size_t getMaxSize() const {
|
||||
return size - 1;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
write = start;
|
||||
for (uint8_t count = 0; count < N_READ_PTRS; count++) {
|
||||
read[count] = start;
|
||||
}
|
||||
}
|
||||
uint32_t writeTillWrap() {
|
||||
|
||||
size_t writeTillWrap() {
|
||||
return (start + size) - write;
|
||||
}
|
||||
uint32_t readTillWrap(uint8_t n = 0) {
|
||||
|
||||
size_t readTillWrap(uint8_t n = 0) {
|
||||
return (start + size) - read[n];
|
||||
}
|
||||
uint32_t getStart() const {
|
||||
|
||||
size_t getStart() const {
|
||||
return start;
|
||||
}
|
||||
bool overwritesOld() const {
|
||||
return overwriteOld;
|
||||
}
|
||||
uint32_t maxSize() const {
|
||||
return size - 1;
|
||||
}
|
||||
|
||||
protected:
|
||||
const uint32_t start;
|
||||
uint32_t write;
|
||||
uint32_t read[N_READ_PTRS];
|
||||
const uint32_t size;
|
||||
const size_t start;
|
||||
size_t write;
|
||||
size_t read[N_READ_PTRS];
|
||||
const size_t size;
|
||||
const bool overwriteOld;
|
||||
|
||||
void incrementWrite(uint32_t amount) {
|
||||
write = ((write + amount - start) % size) + start;
|
||||
}
|
||||
void incrementRead(uint32_t amount, uint8_t n = 0) {
|
||||
read[n] = ((read[n] + amount - start) % size) + start;
|
||||
}
|
||||
|
||||
ReturnValue_t readData(uint32_t amount, uint8_t n = 0) {
|
||||
if (getAvailableReadData(n) >= amount) {
|
||||
incrementRead(amount, n);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t writeData(uint32_t amount) {
|
||||
if (availableWriteSpace() >= amount or overwriteOld) {
|
||||
incrementWrite(amount);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
} else {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
size_t getRead(uint8_t n = 0) const {
|
||||
return read[n];
|
||||
}
|
||||
|
||||
void setRead(uint32_t read, uint8_t n = 0) {
|
||||
if (read >= start && read < (start+size)) {
|
||||
this->read[n] = read;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t getWrite() const {
|
||||
return write;
|
||||
}
|
||||
|
||||
void setWrite(uint32_t write) {
|
||||
this->write = write;
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_CONTAINER_RINGBUFFERBASE_H_ */
|
||||
#endif /* FSFW_CONTAINER_RINGBUFFERBASE_H_ */
|
||||
|
@ -1,79 +0,0 @@
|
||||
|
||||
#include <iostream>
|
||||
#include "SimpleRingBuffer.h"
|
||||
|
||||
|
||||
int main() {
|
||||
using namespace std;
|
||||
SimpleRingBuffer buffer(64, false);
|
||||
uint8_t data[8] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'};
|
||||
ReturnValue_t result = buffer.writeData(data, 8);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
cout << "writeData failed." << endl;
|
||||
}
|
||||
result = buffer.writeData(data, 8);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
cout << "writeData failed." << endl;
|
||||
}
|
||||
uint8_t buffer2[47] = {0};
|
||||
for (uint8_t count = 0; count<sizeof(buffer2); count++) {
|
||||
buffer2[count] = count;
|
||||
}
|
||||
result = buffer.writeData(buffer2, sizeof(buffer2));
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
cout << "writeData failed." << endl;
|
||||
}
|
||||
result = buffer.writeData(buffer2, sizeof(buffer2));
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
cout << "writeData failed." << endl;
|
||||
}
|
||||
uint8_t readBuffer[64] = {0};
|
||||
uint32_t writtenData = 0;
|
||||
result = buffer.readData(readBuffer, 12, true, &writtenData);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
cout << "readData failed." << endl;
|
||||
} else {
|
||||
cout << "Read data: " << writtenData << endl;
|
||||
for (uint32_t count = 0; count < writtenData; count++) {
|
||||
cout << hex << (uint16_t)readBuffer[count] << " ";
|
||||
}
|
||||
cout << dec << endl;
|
||||
}
|
||||
|
||||
result = buffer.readData(readBuffer, 60, true, &writtenData);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
cout << "readData failed." << endl;
|
||||
} else {
|
||||
cout << "Read data: " << writtenData << endl;
|
||||
for (uint32_t count = 0; count < writtenData; count++) {
|
||||
cout << hex << (uint16_t)readBuffer[count] << " ";
|
||||
}
|
||||
cout << dec << endl;
|
||||
}
|
||||
result = buffer.writeData(data, sizeof(data));
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
cout << "writeData failed." << endl;
|
||||
}
|
||||
result = buffer.readData(readBuffer, 60, true, &writtenData);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
cout << "readData failed." << endl;
|
||||
} else {
|
||||
cout << "Read data: " << writtenData << endl;
|
||||
for (uint32_t count = 0; count < writtenData; count++) {
|
||||
cout << hex << (uint16_t)readBuffer[count] << " ";
|
||||
}
|
||||
cout << dec << endl;
|
||||
}
|
||||
result = buffer.writeData(readBuffer, sizeof(readBuffer));
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
cout << "writeData failed." << endl;
|
||||
}
|
||||
result = buffer.writeData(readBuffer, sizeof(readBuffer)-1);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
cout << "writeData failed." << endl;
|
||||
} else {
|
||||
cout << "write done." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
55
container/SharedRingBuffer.cpp
Normal file
55
container/SharedRingBuffer.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "SharedRingBuffer.h"
|
||||
#include "../ipc/MutexFactory.h"
|
||||
#include "../ipc/MutexHelper.h"
|
||||
|
||||
SharedRingBuffer::SharedRingBuffer(object_id_t objectId, const size_t size,
|
||||
bool overwriteOld, size_t maxExcessBytes):
|
||||
SystemObject(objectId), SimpleRingBuffer(size, overwriteOld,
|
||||
maxExcessBytes) {
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
|
||||
|
||||
SharedRingBuffer::SharedRingBuffer(object_id_t objectId, uint8_t *buffer,
|
||||
const size_t size, bool overwriteOld, size_t maxExcessBytes):
|
||||
SystemObject(objectId), SimpleRingBuffer(buffer, size, overwriteOld,
|
||||
maxExcessBytes) {
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
|
||||
|
||||
void SharedRingBuffer::setToUseReceiveSizeFIFO(size_t fifoDepth) {
|
||||
this->fifoDepth = fifoDepth;
|
||||
}
|
||||
|
||||
ReturnValue_t SharedRingBuffer::lockRingBufferMutex(
|
||||
MutexIF::TimeoutType timeoutType, dur_millis_t timeout) {
|
||||
return mutex->lockMutex(timeoutType, timeout);
|
||||
}
|
||||
|
||||
ReturnValue_t SharedRingBuffer::unlockRingBufferMutex() {
|
||||
return mutex->unlockMutex();
|
||||
}
|
||||
|
||||
|
||||
|
||||
MutexIF* SharedRingBuffer::getMutexHandle() const {
|
||||
return mutex;
|
||||
}
|
||||
|
||||
ReturnValue_t SharedRingBuffer::initialize() {
|
||||
if(fifoDepth > 0) {
|
||||
receiveSizesFIFO = new DynamicFIFO<size_t>(fifoDepth);
|
||||
}
|
||||
return SystemObject::initialize();
|
||||
}
|
||||
|
||||
DynamicFIFO<size_t>* SharedRingBuffer::getReceiveSizesFIFO() {
|
||||
if(receiveSizesFIFO == nullptr) {
|
||||
// Configuration error.
|
||||
sif::warning << "SharedRingBuffer::getReceiveSizesFIFO: Ring buffer"
|
||||
<< " was not configured to have sizes FIFO, returning nullptr!"
|
||||
<< std::endl;
|
||||
}
|
||||
return receiveSizesFIFO;
|
||||
}
|
92
container/SharedRingBuffer.h
Normal file
92
container/SharedRingBuffer.h
Normal file
@ -0,0 +1,92 @@
|
||||
#ifndef FSFW_CONTAINER_SHAREDRINGBUFFER_H_
|
||||
#define FSFW_CONTAINER_SHAREDRINGBUFFER_H_
|
||||
|
||||
#include "SimpleRingBuffer.h"
|
||||
#include "DynamicFIFO.h"
|
||||
#include "../ipc/MutexIF.h"
|
||||
#include "../objectmanager/SystemObject.h"
|
||||
#include "../timemanager/Clock.h"
|
||||
|
||||
/**
|
||||
* @brief Ring buffer which can be shared among multiple objects
|
||||
* @details
|
||||
* This class offers a mutex to perform thread-safe operation on the ring
|
||||
* buffer. It is still up to the developer to actually perform the lock
|
||||
* and unlock operations.
|
||||
*/
|
||||
class SharedRingBuffer: public SystemObject,
|
||||
public SimpleRingBuffer {
|
||||
public:
|
||||
/**
|
||||
* This constructor allocates a new internal buffer with the supplied size.
|
||||
* @param size
|
||||
* @param overwriteOld
|
||||
* If the ring buffer is overflowing at a write operartion, the oldest data
|
||||
* will be overwritten.
|
||||
*/
|
||||
SharedRingBuffer(object_id_t objectId, const size_t size,
|
||||
bool overwriteOld, size_t maxExcessBytes);
|
||||
|
||||
/**
|
||||
* @brief This function can be used to add an optional FIFO to the class
|
||||
* @details
|
||||
* This FIFO will be allocated in the initialize function (and will
|
||||
* have a fixed maximum size after that). It can be used to store
|
||||
* values like packet sizes, for example for a shared ring buffer
|
||||
* used by producer/consumer tasks.
|
||||
*/
|
||||
void setToUseReceiveSizeFIFO(size_t fifoDepth);
|
||||
|
||||
/**
|
||||
* This constructor takes an external buffer with the specified size.
|
||||
* @param buffer
|
||||
* @param size
|
||||
* @param overwriteOld
|
||||
* If the ring buffer is overflowing at a write operartion, the oldest data
|
||||
* will be overwritten.
|
||||
*/
|
||||
SharedRingBuffer(object_id_t objectId, uint8_t* buffer, const size_t size,
|
||||
bool overwriteOld, size_t maxExcessBytes);
|
||||
|
||||
/**
|
||||
* Unless a read-only constant value is read, all operations on the
|
||||
* shared ring buffer should be protected by calling this function.
|
||||
* @param timeoutType
|
||||
* @param timeout
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t lockRingBufferMutex(MutexIF::TimeoutType timeoutType,
|
||||
dur_millis_t timeout);
|
||||
/**
|
||||
* Any locked mutex also has to be unlocked, otherwise, access to the
|
||||
* shared ring buffer will be blocked.
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t unlockRingBufferMutex();
|
||||
|
||||
/**
|
||||
* The mutex handle can be accessed directly, for example to perform
|
||||
* the lock with the #MutexHelper for a RAII compliant lock operation.
|
||||
* @return
|
||||
*/
|
||||
MutexIF* getMutexHandle() const;
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
/**
|
||||
* If the shared ring buffer was configured to have a sizes FIFO, a handle
|
||||
* to that FIFO can be retrieved with this function.
|
||||
* Do not forget to protect access with a lock if required!
|
||||
* @return
|
||||
*/
|
||||
DynamicFIFO<size_t>* getReceiveSizesFIFO();
|
||||
private:
|
||||
MutexIF* mutex = nullptr;
|
||||
|
||||
size_t fifoDepth = 0;
|
||||
DynamicFIFO<size_t>* receiveSizesFIFO = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* FSFW_CONTAINER_SHAREDRINGBUFFER_H_ */
|
@ -1,22 +1,69 @@
|
||||
#include "SimpleRingBuffer.h"
|
||||
#include <string.h>
|
||||
#include <cstring>
|
||||
|
||||
SimpleRingBuffer::SimpleRingBuffer(uint32_t size, bool overwriteOld) :
|
||||
RingBufferBase<>(0, size, overwriteOld), buffer(NULL) {
|
||||
buffer = new uint8_t[size];
|
||||
SimpleRingBuffer::SimpleRingBuffer(const size_t size, bool overwriteOld,
|
||||
size_t maxExcessBytes) :
|
||||
RingBufferBase<>(0, size, overwriteOld),
|
||||
maxExcessBytes(maxExcessBytes) {
|
||||
if(maxExcessBytes > size) {
|
||||
this->maxExcessBytes = size;
|
||||
}
|
||||
else {
|
||||
this->maxExcessBytes = maxExcessBytes;
|
||||
}
|
||||
buffer = new uint8_t[size + maxExcessBytes];
|
||||
}
|
||||
|
||||
SimpleRingBuffer::SimpleRingBuffer(uint8_t *buffer, const size_t size,
|
||||
bool overwriteOld, size_t maxExcessBytes):
|
||||
RingBufferBase<>(0, size, overwriteOld), buffer(buffer) {
|
||||
if(maxExcessBytes > size) {
|
||||
this->maxExcessBytes = size;
|
||||
}
|
||||
else {
|
||||
this->maxExcessBytes = maxExcessBytes;
|
||||
}
|
||||
}
|
||||
|
||||
SimpleRingBuffer::~SimpleRingBuffer() {
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
ReturnValue_t SimpleRingBuffer::getFreeElement(uint8_t **writePointer,
|
||||
size_t amount) {
|
||||
if (availableWriteSpace() >= amount or overwriteOld) {
|
||||
size_t amountTillWrap = writeTillWrap();
|
||||
if (amountTillWrap < amount) {
|
||||
if((amount - amountTillWrap + excessBytes) > maxExcessBytes) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
excessBytes = amount - amountTillWrap;
|
||||
}
|
||||
*writePointer = &buffer[write];
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
else {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
void SimpleRingBuffer::confirmBytesWritten(size_t amount) {
|
||||
if(getExcessBytes() > 0) {
|
||||
moveExcessBytesToStart();
|
||||
}
|
||||
incrementWrite(amount);
|
||||
|
||||
}
|
||||
|
||||
ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data,
|
||||
uint32_t amount) {
|
||||
if (availableWriteSpace() >= amount || overwriteOld) {
|
||||
uint32_t amountTillWrap = writeTillWrap();
|
||||
size_t amount) {
|
||||
if (availableWriteSpace() >= amount or overwriteOld) {
|
||||
size_t amountTillWrap = writeTillWrap();
|
||||
if (amountTillWrap >= amount) {
|
||||
// remaining size in buffer is sufficient to fit full amount.
|
||||
memcpy(&buffer[write], data, amount);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
memcpy(&buffer[write], data, amountTillWrap);
|
||||
memcpy(buffer, data + amountTillWrap, amount - amountTillWrap);
|
||||
}
|
||||
@ -27,18 +74,19 @@ ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data,
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t SimpleRingBuffer::readData(uint8_t* data, uint32_t amount,
|
||||
bool readRemaining, uint32_t* trueAmount) {
|
||||
uint32_t availableData = availableReadData(READ_PTR);
|
||||
uint32_t amountTillWrap = readTillWrap(READ_PTR);
|
||||
ReturnValue_t SimpleRingBuffer::readData(uint8_t* data, size_t amount,
|
||||
bool incrementReadPtr, bool readRemaining, size_t* trueAmount) {
|
||||
size_t availableData = getAvailableReadData(READ_PTR);
|
||||
size_t amountTillWrap = readTillWrap(READ_PTR);
|
||||
if (availableData < amount) {
|
||||
if (readRemaining) {
|
||||
// more data available than amount specified.
|
||||
amount = availableData;
|
||||
} else {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
if (trueAmount != NULL) {
|
||||
if (trueAmount != nullptr) {
|
||||
*trueAmount = amount;
|
||||
}
|
||||
if (amountTillWrap >= amount) {
|
||||
@ -47,12 +95,27 @@ ReturnValue_t SimpleRingBuffer::readData(uint8_t* data, uint32_t amount,
|
||||
memcpy(data, &buffer[read[READ_PTR]], amountTillWrap);
|
||||
memcpy(data + amountTillWrap, buffer, amount - amountTillWrap);
|
||||
}
|
||||
|
||||
if(incrementReadPtr) {
|
||||
deleteData(amount, readRemaining);
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t SimpleRingBuffer::deleteData(uint32_t amount,
|
||||
bool deleteRemaining, uint32_t* trueAmount) {
|
||||
uint32_t availableData = availableReadData(READ_PTR);
|
||||
size_t SimpleRingBuffer::getExcessBytes() const {
|
||||
return excessBytes;
|
||||
}
|
||||
|
||||
void SimpleRingBuffer::moveExcessBytesToStart() {
|
||||
if(excessBytes > 0) {
|
||||
std::memcpy(buffer, &buffer[size], excessBytes);
|
||||
excessBytes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t SimpleRingBuffer::deleteData(size_t amount,
|
||||
bool deleteRemaining, size_t* trueAmount) {
|
||||
size_t availableData = getAvailableReadData(READ_PTR);
|
||||
if (availableData < amount) {
|
||||
if (deleteRemaining) {
|
||||
amount = availableData;
|
||||
@ -60,7 +123,7 @@ ReturnValue_t SimpleRingBuffer::deleteData(uint32_t amount,
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
if (trueAmount != NULL) {
|
||||
if (trueAmount != nullptr) {
|
||||
*trueAmount = amount;
|
||||
}
|
||||
incrementRead(amount, READ_PTR);
|
||||
|
@ -1,21 +1,129 @@
|
||||
#ifndef FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_
|
||||
#define FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_
|
||||
#ifndef FSFW_CONTAINER_SIMPLERINGBUFFER_H_
|
||||
#define FSFW_CONTAINER_SIMPLERINGBUFFER_H_
|
||||
|
||||
#include "RingBufferBase.h"
|
||||
#include <stddef.h>
|
||||
#include <cstddef>
|
||||
|
||||
/**
|
||||
* @brief Circular buffer implementation, useful for buffering
|
||||
* into data streams.
|
||||
* @details
|
||||
* Note that the deleteData() has to be called to increment the read pointer.
|
||||
* This class allocated dynamically, so
|
||||
* @ingroup containers
|
||||
*/
|
||||
class SimpleRingBuffer: public RingBufferBase<> {
|
||||
public:
|
||||
SimpleRingBuffer(uint32_t size, bool overwriteOld);
|
||||
/**
|
||||
* This constructor allocates a new internal buffer with the supplied size.
|
||||
*
|
||||
* @param size
|
||||
* @param overwriteOld If the ring buffer is overflowing at a write
|
||||
* operation, the oldest data will be overwritten.
|
||||
* @param maxExcessBytes These additional bytes will be allocated in addtion
|
||||
* to the specified size to accomodate contiguous write operations
|
||||
* with getFreeElement.
|
||||
*
|
||||
*/
|
||||
SimpleRingBuffer(const size_t size, bool overwriteOld,
|
||||
size_t maxExcessBytes = 0);
|
||||
/**
|
||||
* This constructor takes an external buffer with the specified size.
|
||||
* @param buffer
|
||||
* @param size
|
||||
* @param overwriteOld
|
||||
* If the ring buffer is overflowing at a write operartion, the oldest data
|
||||
* will be overwritten.
|
||||
* @param maxExcessBytes
|
||||
* If the buffer can accomodate additional bytes for contigous write
|
||||
* operations with getFreeElement, this is the maximum allowed additional
|
||||
* size
|
||||
*/
|
||||
SimpleRingBuffer(uint8_t* buffer, const size_t size, bool overwriteOld,
|
||||
size_t maxExcessBytes = 0);
|
||||
|
||||
virtual ~SimpleRingBuffer();
|
||||
ReturnValue_t writeData(const uint8_t* data, uint32_t amount);
|
||||
ReturnValue_t readData(uint8_t* data, uint32_t amount, bool readRemaining = false, uint32_t* trueAmount = NULL);
|
||||
ReturnValue_t deleteData(uint32_t amount, bool deleteRemaining = false, uint32_t* trueAmount = NULL);
|
||||
|
||||
/**
|
||||
* Write to circular buffer and increment write pointer by amount.
|
||||
* @param data
|
||||
* @param amount
|
||||
* @return -@c RETURN_OK if write operation was successfull
|
||||
* -@c RETURN_FAILED if
|
||||
*/
|
||||
ReturnValue_t writeData(const uint8_t* data, size_t amount);
|
||||
|
||||
/**
|
||||
* Returns a pointer to a free element. If the remaining buffer is
|
||||
* not large enough, the data will be written past the actual size
|
||||
* and the amount of excess bytes will be cached. This function
|
||||
* does not increment the write pointer!
|
||||
* @param writePointer Pointer to a pointer which can be used to write
|
||||
* contiguous blocks into the ring buffer
|
||||
* @param amount
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t getFreeElement(uint8_t** writePointer, size_t amount);
|
||||
|
||||
/**
|
||||
* This increments the write pointer and also copies the excess bytes
|
||||
* to the beginning. It should be called if the write operation
|
||||
* conducted after calling getFreeElement() was performed.
|
||||
* @return
|
||||
*/
|
||||
void confirmBytesWritten(size_t amount);
|
||||
|
||||
virtual size_t getExcessBytes() const;
|
||||
/**
|
||||
* Helper functions which moves any excess bytes to the start
|
||||
* of the ring buffer.
|
||||
* @return
|
||||
*/
|
||||
virtual void moveExcessBytesToStart();
|
||||
|
||||
/**
|
||||
* Read from circular buffer at read pointer.
|
||||
* @param data
|
||||
* @param amount
|
||||
* @param incrementReadPtr
|
||||
* If this is set to true, the read pointer will be incremented.
|
||||
* If readRemaining is set to true, the read pointer will be incremented
|
||||
* accordingly.
|
||||
* @param readRemaining
|
||||
* If this is set to true, the data will be read even if the amount
|
||||
* specified exceeds the read data available.
|
||||
* @param trueAmount [out]
|
||||
* If readRemaining was set to true, the true amount read will be assigned
|
||||
* to the passed value.
|
||||
* @return
|
||||
* - @c RETURN_OK if data was read successfully
|
||||
* - @c RETURN_FAILED if not enough data was available and readRemaining
|
||||
* was set to false.
|
||||
*/
|
||||
ReturnValue_t readData(uint8_t* data, size_t amount,
|
||||
bool incrementReadPtr = false, bool readRemaining = false,
|
||||
size_t* trueAmount = nullptr);
|
||||
|
||||
/**
|
||||
* Delete data by incrementing read pointer.
|
||||
* @param amount
|
||||
* @param deleteRemaining
|
||||
* If the amount specified is larger than the remaing size to read and this
|
||||
* is set to true, the remaining amount will be deleted as well
|
||||
* @param trueAmount [out]
|
||||
* If deleteRemaining was set to true, the amount deleted will be assigned
|
||||
* to the passed value.
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t deleteData(size_t amount, bool deleteRemaining = false,
|
||||
size_t* trueAmount = nullptr);
|
||||
|
||||
private:
|
||||
// static const uint8_t TEMP_READ_PTR = 1;
|
||||
static const uint8_t READ_PTR = 0;
|
||||
uint8_t* buffer;
|
||||
uint8_t* buffer = nullptr;
|
||||
size_t maxExcessBytes;
|
||||
size_t excessBytes = 0;
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_CONTAINER_SIMPLERINGBUFFER_H_ */
|
||||
#endif /* FSFW_CONTAINER_SIMPLERINGBUFFER_H_ */
|
||||
|
||||
|
@ -1,365 +0,0 @@
|
||||
#include "FixedArrayList.h"
|
||||
#include "SinglyLinkedList.h"
|
||||
#include "HybridIterator.h"
|
||||
|
||||
#include "FixedMap.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
|
||||
class Packet: public SinglyLinkedList {
|
||||
public:
|
||||
SinglyLinkedList::Element<uint32_t> element1;
|
||||
SinglyLinkedList::Element<uint32_t> element2;
|
||||
|
||||
Packet() {
|
||||
this->start = &element1;
|
||||
element1.next = &element2;
|
||||
}
|
||||
};
|
||||
|
||||
class Packet2: public SinglyLinkedList {
|
||||
public:
|
||||
SinglyLinkedList::Element<uint32_t> element1;
|
||||
SinglyLinkedList::Element<FixedArrayList<FixedArrayList<uint8_t, 5>, 2>> element2;
|
||||
SinglyLinkedList::Element<uint32_t> element3;
|
||||
|
||||
Packet2() {
|
||||
this->start = &element1;
|
||||
element1.next = &element2;
|
||||
element2.next = &element3;
|
||||
}
|
||||
};
|
||||
|
||||
class Packet3: public SinglyLinkedList {
|
||||
public:
|
||||
SinglyLinkedList::TypedElement<uint32_t> element1;
|
||||
SinglyLinkedList::TypedElement<uint32_t> element2;
|
||||
|
||||
Packet3() {
|
||||
this->start = &element1;
|
||||
element1.next = &element2;
|
||||
}
|
||||
};
|
||||
|
||||
void arrayList() {
|
||||
puts("** Array List **");
|
||||
FixedArrayList<uint32_t, 10, uint32_t> list;
|
||||
FixedArrayList<uint32_t, 10, uint32_t> list2;
|
||||
|
||||
list.size = 2;
|
||||
|
||||
list[0] = 0xcafecafe;
|
||||
|
||||
list[1] = 0x12345678;
|
||||
|
||||
uint8_t buffer[100];
|
||||
uint8_t *pointer = buffer;
|
||||
uint32_t size = 0;
|
||||
uint32_t maxSize = 100;
|
||||
uint32_t i;
|
||||
int32_t size2;
|
||||
|
||||
printf("printsize: %i\n", list.getPrintSize());
|
||||
|
||||
list.print(&pointer, &size, 100, true);
|
||||
|
||||
printf("buffer(%i):", size);
|
||||
for (i = 0; i < size; ++i) {
|
||||
printf("%02x", buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
pointer = buffer;
|
||||
|
||||
size2 = size;
|
||||
|
||||
printf("list2 read: %x\n", list2.read(&pointer, &size2, true));
|
||||
|
||||
printf("list2(%i):", list2.size);
|
||||
for (ArrayList<uint32_t, uint32_t>::Iterator iter = list2.begin();
|
||||
iter != list2.end(); iter++) {
|
||||
printf("0x%04x ", *iter);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
HybridIterator<uint32_t, uint32_t> hiter(list.begin(),list.end());
|
||||
|
||||
printf("hybrid1: 0x%04x\n", *(hiter++));
|
||||
printf("hybrid2: 0x%04x\n", *hiter);
|
||||
|
||||
}
|
||||
|
||||
void allocatingList() {
|
||||
puts("** Allocating List **");
|
||||
ArrayList<uint8_t> myList(3), myList2(2);
|
||||
myList[0] = 0xab;
|
||||
myList[1] = 0xcd;
|
||||
myList.size = 2;
|
||||
|
||||
uint8_t buffer[100];
|
||||
uint8_t *pointer = buffer;
|
||||
uint32_t size = 0;
|
||||
uint32_t maxSize = 100;
|
||||
uint32_t i;
|
||||
int32_t size2;
|
||||
|
||||
myList.print(&pointer, &size, 100, true);
|
||||
|
||||
pointer = buffer;
|
||||
size2 = size;
|
||||
|
||||
printf("Read %x\n", myList2.read(&pointer, &size2, true));
|
||||
|
||||
printf("%x,%x\n", myList2[0], myList2[1]);
|
||||
|
||||
}
|
||||
|
||||
void linkedList() {
|
||||
puts("** Linked List **");
|
||||
uint8_t buffer[100];
|
||||
uint8_t *pointer = buffer;
|
||||
uint32_t size = 0;
|
||||
uint32_t maxSize = 100;
|
||||
uint32_t i;
|
||||
int32_t size2;
|
||||
|
||||
Packet myPacket;
|
||||
myPacket.element1.entry = 0x12345678;
|
||||
myPacket.element2.entry = 0x9abcdef0;
|
||||
|
||||
pointer = buffer;
|
||||
size = 0;
|
||||
ReturnValue_t result = myPacket.print(&pointer, &size, 100, true);
|
||||
|
||||
printf("result %02x\n", result);
|
||||
|
||||
printf("printsize: %i\n", myPacket.getPrintSize());
|
||||
|
||||
printf("buffer(%i):", size);
|
||||
for (i = 0; i < size; ++i) {
|
||||
printf("%02x", buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
Packet3 myPacket3;
|
||||
|
||||
myPacket3.element1.entry = 0x12345678;
|
||||
myPacket3.element2.entry = 0xabcdeff;
|
||||
|
||||
SinglyLinkedList::TypedIterator<uint32_t> titer(&myPacket3.element1);
|
||||
|
||||
printf("0x%04x\n", *titer);
|
||||
|
||||
HybridIterator<uint32_t, uint32_t> hiter(&myPacket3.element1);
|
||||
|
||||
printf("hybrid1: 0x%04x\n", *hiter);
|
||||
hiter++;
|
||||
printf("hybrid2: 0x%04x\n", *hiter);
|
||||
}
|
||||
|
||||
void complex() {
|
||||
puts("** complex **");
|
||||
uint8_t buffer[100];
|
||||
uint8_t *pointer = buffer;
|
||||
uint32_t size = 0;
|
||||
uint32_t maxSize = 100;
|
||||
uint32_t i;
|
||||
int32_t size2 = size;
|
||||
|
||||
Packet myPacket2;
|
||||
|
||||
size2 = size;
|
||||
pointer = buffer;
|
||||
|
||||
myPacket2.read(&pointer, &size2, true);
|
||||
|
||||
printf("packet: 0x%04x, 0x%04x\n", myPacket2.element1.entry,
|
||||
myPacket2.element2.entry);
|
||||
|
||||
buffer[0] = 0x12;
|
||||
buffer[1] = 0x34;
|
||||
buffer[2] = 0x56;
|
||||
buffer[3] = 0x78;
|
||||
buffer[4] = 0x2;
|
||||
buffer[5] = 0x3;
|
||||
buffer[6] = 0xab;
|
||||
buffer[7] = 0xcd;
|
||||
buffer[8] = 0xef;
|
||||
buffer[9] = 0x2;
|
||||
buffer[10] = 0x11;
|
||||
buffer[11] = 0x22;
|
||||
buffer[12] = 0xca;
|
||||
buffer[13] = 0xfe;
|
||||
buffer[14] = 0x5a;
|
||||
buffer[15] = 0xfe;
|
||||
|
||||
pointer = buffer;
|
||||
size2 = 23;
|
||||
|
||||
Packet2 p2;
|
||||
|
||||
ReturnValue_t result = p2.read(&pointer, &size2, true);
|
||||
printf("result is %02x\n", result);
|
||||
|
||||
printf("%04x; %i: %i: %x %x %x; %i: %x %x;; %04x\n", p2.element1.entry,
|
||||
p2.element2.entry.size, p2.element2.entry[0].size,
|
||||
p2.element2.entry[0][0], p2.element2.entry[0][1],
|
||||
p2.element2.entry[0][2], p2.element2.entry[1].size,
|
||||
p2.element2.entry[1][0], p2.element2.entry[1][1],
|
||||
p2.element3.entry);
|
||||
|
||||
}
|
||||
*/
|
||||
struct Test {
|
||||
uint32_t a;
|
||||
uint32_t b;
|
||||
};
|
||||
|
||||
template<typename key_t, typename T>
|
||||
void printMap(FixedMap<key_t, T> *map) {
|
||||
typename FixedMap<key_t, T>::Iterator iter;
|
||||
printf("Map (%i): ", map->getSize());
|
||||
for (iter = map->begin(); iter != map->end(); ++iter) {
|
||||
printf("%x:%08x,%08x ", iter.value->first, (*iter).a, (*iter).b);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void map() {
|
||||
puts("** Map **");
|
||||
typename FixedMap<T, Test>::Iterator iter;
|
||||
ReturnValue_t result;
|
||||
FixedMap<T, Test> myMap(5);
|
||||
|
||||
printMap<T, Test>(&myMap);
|
||||
|
||||
Test a;
|
||||
a.a = 0x01234567;
|
||||
a.b = 0xabcdef89;
|
||||
|
||||
myMap.insert(1, a);
|
||||
printMap<T, Test>(&myMap);
|
||||
|
||||
a.a = 0;
|
||||
|
||||
myMap.insert(2, a);
|
||||
printMap<T, Test>(&myMap);
|
||||
|
||||
printf("2 exists: %x\n", myMap.exists(0x02));
|
||||
|
||||
printf("ff exists: %x\n", myMap.exists(0xff));
|
||||
|
||||
a.a = 1;
|
||||
printf("insert 0x2: %x\n", myMap.insert(2, a));
|
||||
|
||||
result = myMap.insert(0xff, a);
|
||||
a.a = 0x44;
|
||||
result = myMap.insert(0xab, a);
|
||||
result = myMap.insert(0xa, a);
|
||||
|
||||
printMap<T, Test>(&myMap);
|
||||
|
||||
printf("insert 0x5: %x\n", myMap.insert(5, a));
|
||||
|
||||
printf("erase 0xfe: %x\n", myMap.erase(0xfe));
|
||||
|
||||
printf("erase 0x2: %x\n", myMap.erase(0x2));
|
||||
|
||||
printMap<T, Test>(&myMap);
|
||||
|
||||
printf("erase 0xab: %x\n", myMap.erase(0xab));
|
||||
printMap<T, Test>(&myMap);
|
||||
|
||||
printf("insert 0x5: %x\n", myMap.insert(5, a));
|
||||
printMap<T, Test>(&myMap);
|
||||
|
||||
iter = myMap.begin();
|
||||
++iter;
|
||||
++iter;
|
||||
++iter;
|
||||
|
||||
printf("iter: %i: %x,%x\n",iter.value->first, iter->a, iter->b);
|
||||
|
||||
myMap.erase(&iter);
|
||||
|
||||
printf("iter: %i: %x,%x\n",iter.value->first, iter->a, iter->b);
|
||||
printMap<T, Test>(&myMap);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
void mapPrint() {
|
||||
puts("** Map Print **");
|
||||
FixedMap<uint16_t, Packet2> myMap(5);
|
||||
Packet2 myPacket;
|
||||
myPacket.element1.entry = 0x12345678;
|
||||
|
||||
myPacket.element2.entry[0][0] = 0xab;
|
||||
myPacket.element2.entry[0][1] = 0xcd;
|
||||
myPacket.element2.entry[0].size = 2;
|
||||
myPacket.element2.entry.size = 1;
|
||||
|
||||
myPacket.element3.entry = 0xabcdef90;
|
||||
|
||||
myMap.insert(0x1234, myPacket);
|
||||
|
||||
uint8_t buffer[100];
|
||||
uint32_t size = 0, i;
|
||||
uint8_t *pointer = buffer;
|
||||
|
||||
printf("printsize: %i\n", myMap.getPrintSize());
|
||||
|
||||
SerializeAdapter<FixedMap<uint16_t, Packet2>>::print(&myMap, &pointer,
|
||||
&size, 100, false);
|
||||
|
||||
printf("buffer(%i):", size);
|
||||
for (i = 0; i < size; ++i) {
|
||||
printf("%02x", buffer[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
int32_t size2 = size;
|
||||
pointer = buffer;
|
||||
|
||||
FixedMap<uint16_t, Packet2> myMap2(5);
|
||||
|
||||
ReturnValue_t result = SerializeAdapter<FixedMap<uint16_t, Packet2>>::read(
|
||||
&myMap2, &pointer, &size2, false);
|
||||
|
||||
Packet2 *myPacket2 = myMap2.find(0x1234);
|
||||
|
||||
printf("Map (%i): Packet2: %x, Array (%i): Array (%i): %x, %x; %x\n",
|
||||
myMap2.getSize(), myPacket2->element1.entry,
|
||||
myPacket2->element2.entry.size, myPacket2->element2.entry[0].size,
|
||||
myPacket2->element2.entry[0][0], myPacket2->element2.entry[0][1],
|
||||
myPacket2->element3.entry);
|
||||
|
||||
}
|
||||
|
||||
void empty() {
|
||||
puts("** Empty **");
|
||||
ArrayList<uint32_t> list(0);
|
||||
printf("%p %p\n", list.front(), list.back());
|
||||
}
|
||||
*/
|
||||
|
||||
int main(void) {
|
||||
|
||||
// arrayList();
|
||||
// linkedList();
|
||||
// allocatingList();
|
||||
// complex();
|
||||
|
||||
map<uint32_t>();
|
||||
//
|
||||
// mapPrint();
|
||||
|
||||
// empty();
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,117 +1,117 @@
|
||||
#ifndef _sgp4unit_
|
||||
#define _sgp4unit_
|
||||
/* ----------------------------------------------------------------
|
||||
*
|
||||
* sgp4unit.h
|
||||
*
|
||||
* this file contains the sgp4 procedures for analytical propagation
|
||||
* of a satellite. the code was originally released in the 1980 and 1986
|
||||
* spacetrack papers. a detailed discussion of the theory and history
|
||||
* may be found in the 2006 aiaa paper by vallado, crawford, hujsak,
|
||||
* and kelso.
|
||||
*
|
||||
* companion code for
|
||||
* fundamentals of astrodynamics and applications
|
||||
* 2007
|
||||
* by david vallado
|
||||
*
|
||||
* (w) 719-573-2600, email dvallado@agi.com
|
||||
*
|
||||
* current :
|
||||
* 20 apr 07 david vallado
|
||||
* misc fixes for constants
|
||||
* changes :
|
||||
* 11 aug 06 david vallado
|
||||
* chg lyddane choice back to strn3, constants, misc doc
|
||||
* 15 dec 05 david vallado
|
||||
* misc fixes
|
||||
* 26 jul 05 david vallado
|
||||
* fixes for paper
|
||||
* note that each fix is preceded by a
|
||||
* comment with "sgp4fix" and an explanation of
|
||||
* what was changed
|
||||
* 10 aug 04 david vallado
|
||||
* 2nd printing baseline working
|
||||
* 14 may 01 david vallado
|
||||
* 2nd edition baseline
|
||||
* 80 norad
|
||||
* original baseline
|
||||
* ---------------------------------------------------------------- */
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// -------------------------- structure declarations ----------------------------
|
||||
typedef enum
|
||||
{
|
||||
wgs72old,
|
||||
wgs72,
|
||||
wgs84
|
||||
} gravconsttype;
|
||||
|
||||
typedef struct elsetrec
|
||||
{
|
||||
long int satnum;
|
||||
int epochyr, epochtynumrev;
|
||||
int error;
|
||||
char init, method;
|
||||
|
||||
/* Near Earth */
|
||||
int isimp;
|
||||
double aycof , con41 , cc1 , cc4 , cc5 , d2 , d3 , d4 ,
|
||||
delmo , eta , argpdot, omgcof , sinmao , t , t2cof, t3cof ,
|
||||
t4cof , t5cof , x1mth2 , x7thm1 , mdot , nodedot, xlcof , xmcof ,
|
||||
nodecf;
|
||||
|
||||
/* Deep Space */
|
||||
int irez;
|
||||
double d2201 , d2211 , d3210 , d3222 , d4410 , d4422 , d5220 , d5232 ,
|
||||
d5421 , d5433 , dedt , del1 , del2 , del3 , didt , dmdt ,
|
||||
dnodt , domdt , e3 , ee2 , peo , pgho , pho , pinco ,
|
||||
plo , se2 , se3 , sgh2 , sgh3 , sgh4 , sh2 , sh3 ,
|
||||
si2 , si3 , sl2 , sl3 , sl4 , gsto , xfact , xgh2 ,
|
||||
xgh3 , xgh4 , xh2 , xh3 , xi2 , xi3 , xl2 , xl3 ,
|
||||
xl4 , xlamo , zmol , zmos , atime , xli , xni;
|
||||
|
||||
double a , altp , alta , epochdays, jdsatepoch , nddot , ndot ,
|
||||
bstar , rcse , inclo , nodeo , ecco , argpo , mo ,
|
||||
no;
|
||||
} elsetrec;
|
||||
|
||||
// --------------------------- function declarations ----------------------------
|
||||
int sgp4init
|
||||
(
|
||||
gravconsttype whichconst, const int satn, const double epoch,
|
||||
const double xbstar, const double xecco, const double xargpo,
|
||||
const double xinclo, const double xmo, const double xno,
|
||||
const double xnodeo,
|
||||
elsetrec& satrec
|
||||
);
|
||||
|
||||
int sgp4
|
||||
(
|
||||
gravconsttype whichconst,
|
||||
elsetrec& satrec, double tsince,
|
||||
double r[], double v[]
|
||||
);
|
||||
|
||||
double gstime
|
||||
(
|
||||
double
|
||||
);
|
||||
|
||||
void getgravconst
|
||||
(
|
||||
gravconsttype,
|
||||
double&,
|
||||
double&,
|
||||
double&,
|
||||
double&,
|
||||
double&,
|
||||
double&,
|
||||
double&,
|
||||
double&
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _sgp4unit_
|
||||
#define _sgp4unit_
|
||||
/* ----------------------------------------------------------------
|
||||
*
|
||||
* sgp4unit.h
|
||||
*
|
||||
* this file contains the sgp4 procedures for analytical propagation
|
||||
* of a satellite. the code was originally released in the 1980 and 1986
|
||||
* spacetrack papers. a detailed discussion of the theory and history
|
||||
* may be found in the 2006 aiaa paper by vallado, crawford, hujsak,
|
||||
* and kelso.
|
||||
*
|
||||
* companion code for
|
||||
* fundamentals of astrodynamics and applications
|
||||
* 2007
|
||||
* by david vallado
|
||||
*
|
||||
* (w) 719-573-2600, email dvallado@agi.com
|
||||
*
|
||||
* current :
|
||||
* 20 apr 07 david vallado
|
||||
* misc fixes for constants
|
||||
* changes :
|
||||
* 11 aug 06 david vallado
|
||||
* chg lyddane choice back to strn3, constants, misc doc
|
||||
* 15 dec 05 david vallado
|
||||
* misc fixes
|
||||
* 26 jul 05 david vallado
|
||||
* fixes for paper
|
||||
* note that each fix is preceded by a
|
||||
* comment with "sgp4fix" and an explanation of
|
||||
* what was changed
|
||||
* 10 aug 04 david vallado
|
||||
* 2nd printing baseline working
|
||||
* 14 may 01 david vallado
|
||||
* 2nd edition baseline
|
||||
* 80 norad
|
||||
* original baseline
|
||||
* ---------------------------------------------------------------- */
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// -------------------------- structure declarations ----------------------------
|
||||
typedef enum
|
||||
{
|
||||
wgs72old,
|
||||
wgs72,
|
||||
wgs84
|
||||
} gravconsttype;
|
||||
|
||||
typedef struct elsetrec
|
||||
{
|
||||
long int satnum;
|
||||
int epochyr, epochtynumrev;
|
||||
int error;
|
||||
char init, method;
|
||||
|
||||
/* Near Earth */
|
||||
int isimp;
|
||||
double aycof , con41 , cc1 , cc4 , cc5 , d2 , d3 , d4 ,
|
||||
delmo , eta , argpdot, omgcof , sinmao , t , t2cof, t3cof ,
|
||||
t4cof , t5cof , x1mth2 , x7thm1 , mdot , nodedot, xlcof , xmcof ,
|
||||
nodecf;
|
||||
|
||||
/* Deep Space */
|
||||
int irez;
|
||||
double d2201 , d2211 , d3210 , d3222 , d4410 , d4422 , d5220 , d5232 ,
|
||||
d5421 , d5433 , dedt , del1 , del2 , del3 , didt , dmdt ,
|
||||
dnodt , domdt , e3 , ee2 , peo , pgho , pho , pinco ,
|
||||
plo , se2 , se3 , sgh2 , sgh3 , sgh4 , sh2 , sh3 ,
|
||||
si2 , si3 , sl2 , sl3 , sl4 , gsto , xfact , xgh2 ,
|
||||
xgh3 , xgh4 , xh2 , xh3 , xi2 , xi3 , xl2 , xl3 ,
|
||||
xl4 , xlamo , zmol , zmos , atime , xli , xni;
|
||||
|
||||
double a , altp , alta , epochdays, jdsatepoch , nddot , ndot ,
|
||||
bstar , rcse , inclo , nodeo , ecco , argpo , mo ,
|
||||
no;
|
||||
} elsetrec;
|
||||
|
||||
// --------------------------- function declarations ----------------------------
|
||||
int sgp4init
|
||||
(
|
||||
gravconsttype whichconst, const int satn, const double epoch,
|
||||
const double xbstar, const double xecco, const double xargpo,
|
||||
const double xinclo, const double xmo, const double xno,
|
||||
const double xnodeo,
|
||||
elsetrec& satrec
|
||||
);
|
||||
|
||||
int sgp4
|
||||
(
|
||||
gravconsttype whichconst,
|
||||
elsetrec& satrec, double tsince,
|
||||
double r[], double v[]
|
||||
);
|
||||
|
||||
double gstime
|
||||
(
|
||||
double
|
||||
);
|
||||
|
||||
void getgravconst
|
||||
(
|
||||
gravconsttype,
|
||||
double&,
|
||||
double&,
|
||||
double&,
|
||||
double&,
|
||||
double&,
|
||||
double&,
|
||||
double&,
|
||||
double&
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -18,7 +18,7 @@ MapPacketExtraction::MapPacketExtraction(uint8_t setMapId,
|
||||
object_id_t setPacketDestination) :
|
||||
lastSegmentationFlag(NO_SEGMENTATION), mapId(setMapId), packetLength(0), bufferPosition(
|
||||
packetBuffer), packetDestination(setPacketDestination), packetStore(
|
||||
NULL), tcQueueId(MessageQueueSenderIF::NO_QUEUE) {
|
||||
NULL), tcQueueId(MessageQueueIF::NO_QUEUE) {
|
||||
memset(packetBuffer, 0, sizeof(packetBuffer));
|
||||
}
|
||||
|
||||
|
6
defaultcfg/README.md
Normal file
6
defaultcfg/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
# How to setup configuration folder for FSFW
|
||||
|
||||
It is recommended to copy the content of the defaultcfg folder
|
||||
into a config folder which is in the same directory as the Flight
|
||||
Software Framework submodule. After that, the config.mk folder should be
|
||||
included by the primary Makefile with CURRENTPATH set correctly.
|
55
defaultcfg/fsfwconfig/FSFWConfig.h
Normal file
55
defaultcfg/fsfwconfig/FSFWConfig.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef CONFIG_FSFWCONFIG_H_
|
||||
#define CONFIG_FSFWCONFIG_H_
|
||||
|
||||
#include <FSFWVersion.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
//! Used to determine whether C++ ostreams are used
|
||||
//! Those can lead to code bloat.
|
||||
#define FSFW_CPP_OSTREAM_ENABLED 1
|
||||
|
||||
//! Reduced printout to further decrese code size
|
||||
//! Be careful, this also turns off most diagnostic prinouts!
|
||||
#define FSFW_REDUCED_PRINTOUT 0
|
||||
|
||||
//! Can be used to enable debugging printouts for developing the FSFW
|
||||
#define FSFW_DEBUGGING 0
|
||||
|
||||
//! Defines the FIFO depth of each commanding service base which
|
||||
//! also determines how many commands a CSB service can handle in one cycle
|
||||
//! simulataneously. This will increase the required RAM for
|
||||
//! each CSB service !
|
||||
#define FSFW_CSB_FIFO_DEPTH 6
|
||||
|
||||
//! If FSFW_OBJ_EVENT_TRANSLATION is set to one,
|
||||
//! additional output which requires the translation files translateObjects
|
||||
//! and translateEvents (and their compiled source files)
|
||||
#define FSFW_OBJ_EVENT_TRANSLATION 0
|
||||
|
||||
#if FSFW_OBJ_EVENT_TRANSLATION == 1
|
||||
#define FSFW_DEBUG_OUTPUT 1
|
||||
//! Specify whether info events are printed too.
|
||||
#define FSFW_DEBUG_INFO 1
|
||||
#include <translateObjects.h>
|
||||
#include <translateEvents.h>
|
||||
#else
|
||||
#define FSFW_DEBUG_OUTPUT 0
|
||||
#endif
|
||||
|
||||
//! When using the newlib nano library, C99 support for stdio facilities
|
||||
//! will not be provided. This define should be set to 1 if this is the case.
|
||||
#define FSFW_NO_C99_IO 1
|
||||
|
||||
namespace fsfwconfig {
|
||||
//! Default timestamp size. The default timestamp will be an eight byte CDC
|
||||
//! short timestamp.
|
||||
static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 8;
|
||||
|
||||
//! 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;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FSFWCONFIG_H_ */
|
16
defaultcfg/fsfwconfig/OBSWConfig.h
Normal file
16
defaultcfg/fsfwconfig/OBSWConfig.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef CONFIG_OBSWCONFIG_H_
|
||||
#define CONFIG_OBSWCONFIG_H_
|
||||
|
||||
#include "OBSWVersion.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace config {
|
||||
#endif
|
||||
|
||||
/* Add mission configuration flags here */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_OBSWCONFIG_H_ */
|
9
defaultcfg/fsfwconfig/OBSWVersion.h
Normal file
9
defaultcfg/fsfwconfig/OBSWVersion.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef CONFIG_VERSION_H_
|
||||
#define CONFIG_VERSION_H_
|
||||
|
||||
/* OBSW versioning can be specified in this file */
|
||||
|
||||
#define OBSW_VERSION 0
|
||||
#define OBSW_SUBVERSION 0
|
||||
|
||||
#endif /* CONFIG_VERSION_H_ */
|
5
defaultcfg/fsfwconfig/devices/logicalAddresses.cpp
Normal file
5
defaultcfg/fsfwconfig/devices/logicalAddresses.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "logicalAddresses.h"
|
||||
|
||||
|
||||
|
||||
|
18
defaultcfg/fsfwconfig/devices/logicalAddresses.h
Normal file
18
defaultcfg/fsfwconfig/devices/logicalAddresses.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef CONFIG_DEVICES_LOGICALADDRESSES_H_
|
||||
#define CONFIG_DEVICES_LOGICALADDRESSES_H_
|
||||
|
||||
#include <fsfw/devicehandlers/CookieIF.h>
|
||||
#include "../objects/systemObjectList.h"
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* Can be used for addresses for physical devices like I2C adresses.
|
||||
*/
|
||||
namespace addresses {
|
||||
/* Logical addresses have uint32_t datatype */
|
||||
enum logicalAddresses: address_t {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif /* CONFIG_DEVICES_LOGICALADDRESSES_H_ */
|
4
defaultcfg/fsfwconfig/devices/powerSwitcherList.cpp
Normal file
4
defaultcfg/fsfwconfig/devices/powerSwitcherList.cpp
Normal file
@ -0,0 +1,4 @@
|
||||
#include "powerSwitcherList.h"
|
||||
|
||||
|
||||
|
12
defaultcfg/fsfwconfig/devices/powerSwitcherList.h
Normal file
12
defaultcfg/fsfwconfig/devices/powerSwitcherList.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef CONFIG_DEVICES_POWERSWITCHERLIST_H_
|
||||
#define CONFIG_DEVICES_POWERSWITCHERLIST_H_
|
||||
|
||||
namespace switches {
|
||||
/* Switches are uint8_t datatype and go from 0 to 255 */
|
||||
enum switcherList {
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* CONFIG_DEVICES_POWERSWITCHERLIST_H_ */
|
18
defaultcfg/fsfwconfig/events/subsystemIdRanges.h
Normal file
18
defaultcfg/fsfwconfig/events/subsystemIdRanges.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||
#define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <fsfw/events/fwSubsystemIdRanges.h>
|
||||
|
||||
/**
|
||||
* @brief Custom subsystem IDs can be added here
|
||||
* @details
|
||||
* Subsystem IDs are used to create unique events.
|
||||
*/
|
||||
namespace SUBSYSTEM_ID {
|
||||
enum: uint8_t {
|
||||
SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE,
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ */
|
15
defaultcfg/fsfwconfig/fsfwconfig.mk
Normal file
15
defaultcfg/fsfwconfig/fsfwconfig.mk
Normal file
@ -0,0 +1,15 @@
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/tmtc/*.cpp)
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/devices/*.cpp)
|
||||
|
||||
INCLUDES += $(CURRENTPATH)
|
||||
INCLUDES += $(CURRENTPATH)/objects
|
||||
INCLUDES += $(CURRENTPATH)/returnvalues
|
||||
INCLUDES += $(CURRENTPATH)/tmtc
|
||||
INCLUDES += $(CURRENTPATH)/events
|
||||
INCLUDES += $(CURRENTPATH)/devices
|
||||
INCLUDES += $(CURRENTPATH)/pollingsequence
|
||||
INCLUDES += $(CURRENTPATH)/ipc
|
12
defaultcfg/fsfwconfig/ipc/missionMessageTypes.cpp
Normal file
12
defaultcfg/fsfwconfig/ipc/missionMessageTypes.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "missionMessageTypes.h"
|
||||
|
||||
#include <fsfw/ipc/CommandMessageIF.h>
|
||||
|
||||
void messagetypes::clearMissionMessage(CommandMessage* message) {
|
||||
switch(message->getMessageType()) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
21
defaultcfg/fsfwconfig/ipc/missionMessageTypes.h
Normal file
21
defaultcfg/fsfwconfig/ipc/missionMessageTypes.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef CONFIG_IPC_MISSIONMESSAGETYPES_H_
|
||||
#define CONFIG_IPC_MISSIONMESSAGETYPES_H_
|
||||
|
||||
#include <fsfw/ipc/CommandMessage.h>
|
||||
#include <fsfw/ipc/FwMessageTypes.h>
|
||||
|
||||
/**
|
||||
* Custom command messages are specified here.
|
||||
* Most messages needed to use FSFW are already located in
|
||||
* <fsfw/ipc/FwMessageTypes.h>
|
||||
* @param message Generic Command Message
|
||||
*/
|
||||
namespace messagetypes {
|
||||
enum CustomMessageTypes {
|
||||
MISSION_MESSAGE_TYPE_START = FW_MESSAGES_COUNT
|
||||
};
|
||||
|
||||
void clearMissionMessage(CommandMessage* message);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_IPC_MISSIONMESSAGETYPES_H_ */
|
54
defaultcfg/fsfwconfig/objects/Factory.cpp
Normal file
54
defaultcfg/fsfwconfig/objects/Factory.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
#include "Factory.h"
|
||||
#include "../tmtc/apid.h"
|
||||
#include "../tmtc/pusIds.h"
|
||||
#include "../objects/systemObjectList.h"
|
||||
#include "../devices/logicalAddresses.h"
|
||||
#include "../devices/powerSwitcherList.h"
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <fsfw/events/EventManager.h>
|
||||
#include <fsfw/health/HealthTable.h>
|
||||
#include <fsfw/tmtcpacket/pus/TmPacketStored.h>
|
||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||
#include <internalError/InternalErrorReporter.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* This class should be used to create all system objects required for
|
||||
* the on-board software, using the object ID list from the configuration
|
||||
* folder.
|
||||
*
|
||||
* The objects are registered in the internal object manager automatically.
|
||||
* This is used later to add objects to tasks.
|
||||
*
|
||||
* This file also sets static framework IDs.
|
||||
*
|
||||
* Framework objects are created first.
|
||||
* @ingroup init
|
||||
*/
|
||||
void Factory::produce(void) {
|
||||
setStaticFrameworkObjectIds();
|
||||
new EventManager(objects::EVENT_MANAGER);
|
||||
new HealthTable(objects::HEALTH_TABLE);
|
||||
new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER);
|
||||
}
|
||||
|
||||
void Factory::setStaticFrameworkObjectIds() {
|
||||
PusServiceBase::packetSource = objects::NO_OBJECT;
|
||||
PusServiceBase::packetDestination = 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;
|
||||
|
||||
TmPacketStored::timeStamperId = objects::NO_OBJECT;
|
||||
}
|
||||
|
17
defaultcfg/fsfwconfig/objects/Factory.h
Normal file
17
defaultcfg/fsfwconfig/objects/Factory.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef FACTORY_H_
|
||||
#define FACTORY_H_
|
||||
|
||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace Factory {
|
||||
/**
|
||||
* @brief Creates all SystemObject elements which are persistent
|
||||
* during execution.
|
||||
*/
|
||||
void produce();
|
||||
void setStaticFrameworkObjectIds();
|
||||
}
|
||||
|
||||
|
||||
#endif /* FACTORY_H_ */
|
16
defaultcfg/fsfwconfig/objects/systemObjectList.h
Normal file
16
defaultcfg/fsfwconfig/objects/systemObjectList.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||
#define CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <fsfw/objectmanager/frameworkObjects.h>
|
||||
|
||||
// The objects will be instantiated in the ID order
|
||||
namespace objects {
|
||||
enum sourceObjects: uint32_t {
|
||||
/* All addresses between start and end are reserved for the FSFW */
|
||||
FSFW_CONFIG_RESERVED_START = PUS_SERVICE_1_VERIFICATION,
|
||||
FSFW_CONFIG_RESERVED_END = TM_STORE
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */
|
@ -0,0 +1,23 @@
|
||||
#include "PollingSequenceFactory.h"
|
||||
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||
|
||||
ReturnValue_t pst::pollingSequenceInitDefault(
|
||||
FixedTimeslotTaskIF *thisSequence) {
|
||||
/* Length of a communication cycle */
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
/* Add polling sequence table here */
|
||||
|
||||
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
else {
|
||||
sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
#ifndef POLLINGSEQUENCEFACTORY_H_
|
||||
#define POLLINGSEQUENCEFACTORY_H_
|
||||
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
class FixedTimeslotTaskIF;
|
||||
|
||||
/**
|
||||
* All device handlers are scheduled by adding them into Polling Sequence Tables (PST)
|
||||
* to satisfy stricter timing requirements of device communication,
|
||||
* A device handler has four different communication steps:
|
||||
* 1. DeviceHandlerIF::SEND_WRITE -> Send write via interface
|
||||
* 2. DeviceHandlerIF::GET_WRITE -> Get confirmation for write
|
||||
* 3. DeviceHandlerIF::SEND_READ -> Send read request
|
||||
* 4. DeviceHandlerIF::GET_READ -> Read from interface
|
||||
* The PST specifies precisely when the respective ComIF functions are called
|
||||
* during the communication cycle time.
|
||||
* The task is created using the FixedTimeslotTaskIF,
|
||||
* which utilises the underlying Operating System Abstraction Layer (OSAL)
|
||||
*
|
||||
* @param thisSequence FixedTimeslotTaskIF * object is passed inside the Factory class when creating the PST
|
||||
* @return
|
||||
*/
|
||||
namespace pst {
|
||||
|
||||
/* Default PST */
|
||||
ReturnValue_t pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif /* POLLINGSEQUENCEINIT_H_ */
|
16
defaultcfg/fsfwconfig/returnvalues/classIds.h
Normal file
16
defaultcfg/fsfwconfig/returnvalues/classIds.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||
#define CONFIG_RETURNVALUES_CLASSIDS_H_
|
||||
|
||||
#include <fsfw/returnvalues/FwClassIds.h>
|
||||
|
||||
/**
|
||||
* @brief CLASS_ID defintions which are required for custom returnvalues.
|
||||
*/
|
||||
namespace CLASS_ID {
|
||||
enum {
|
||||
MISSION_CLASS_ID_START = FW_CLASS_ID_COUNT,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif /* CONFIG_RETURNVALUES_CLASSIDS_H_ */
|
18
defaultcfg/fsfwconfig/tmtc/apid.h
Normal file
18
defaultcfg/fsfwconfig/tmtc/apid.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef CONFIG_TMTC_APID_H_
|
||||
#define CONFIG_TMTC_APID_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* Application Process Definition: entity, uniquely identified by an
|
||||
* application process ID (APID), capable of generating telemetry source
|
||||
* packets and receiving telecommand packets.
|
||||
*
|
||||
* Chose APID(s) for mission and define it here.
|
||||
*/
|
||||
namespace apid {
|
||||
static const uint16_t DEFAULT_APID = 0x00;
|
||||
}
|
||||
|
||||
|
||||
#endif /* CONFIG_TMTC_APID_H_ */
|
23
defaultcfg/fsfwconfig/tmtc/pusIds.h
Normal file
23
defaultcfg/fsfwconfig/tmtc/pusIds.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef CONFIG_TMTC_PUSIDS_HPP_
|
||||
#define CONFIG_TMTC_PUSIDS_HPP_
|
||||
|
||||
namespace pus {
|
||||
enum Ids: uint8_t {
|
||||
PUS_SERVICE_1 = 1,
|
||||
PUS_SERVICE_2 = 2,
|
||||
PUS_SERVICE_3 = 3,
|
||||
PUS_SERVICE_5 = 5,
|
||||
PUS_SERVICE_6 = 6,
|
||||
PUS_SERVICE_8 = 8,
|
||||
PUS_SERVICE_9 = 9,
|
||||
PUS_SERVICE_11 = 11,
|
||||
PUS_SERVICE_17 = 17,
|
||||
PUS_SERVICE_19 = 19,
|
||||
PUS_SERVICE_20 = 20,
|
||||
PUS_SERVICE_23 = 23,
|
||||
PUS_SERVICE_200 = 200,
|
||||
PUS_SERVICE_201 = 201,
|
||||
};
|
||||
};
|
||||
|
||||
#endif /* CONFIG_TMTC_PUSIDS_HPP_ */
|
@ -1,17 +1,19 @@
|
||||
#include "../subsystem/SubsystemBase.h"
|
||||
#include "ChildHandlerBase.h"
|
||||
#include "../devicehandlers/ChildHandlerBase.h"
|
||||
#include "../subsystem/SubsystemBase.h"
|
||||
|
||||
ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId,
|
||||
object_id_t deviceCommunication, CookieIF * comCookie,
|
||||
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
|
||||
uint32_t thermalRequestPoolId, uint32_t parent,
|
||||
FailureIsolationBase* customFdir, size_t cmdQueueSize) :
|
||||
DeviceHandlerBase(setObjectId, deviceCommunication, comCookie,
|
||||
setDeviceSwitch, thermalStatePoolId,thermalRequestPoolId,
|
||||
(customFdir == nullptr? &childHandlerFdir : customFdir),
|
||||
cmdQueueSize),
|
||||
object_id_t deviceCommunication, CookieIF * cookie,
|
||||
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId,
|
||||
object_id_t parent, FailureIsolationBase* customFdir,
|
||||
size_t cmdQueueSize) :
|
||||
DeviceHandlerBase(setObjectId, deviceCommunication, cookie,
|
||||
(customFdir == nullptr? &childHandlerFdir : customFdir),
|
||||
cmdQueueSize),
|
||||
parentId(parent), childHandlerFdir(setObjectId) {
|
||||
this->setThermalStateRequestPoolIds(thermalStatePoolId,
|
||||
thermalRequestPoolId);
|
||||
|
||||
}
|
||||
|
||||
ChildHandlerBase::~ChildHandlerBase() {
|
||||
@ -25,7 +27,7 @@ ReturnValue_t ChildHandlerBase::initialize() {
|
||||
|
||||
MessageQueueId_t parentQueue = 0;
|
||||
|
||||
if (parentId != 0) {
|
||||
if (parentId != objects::NO_OBJECT) {
|
||||
SubsystemBase *parent = objectManager->get<SubsystemBase>(parentId);
|
||||
if (parent == NULL) {
|
||||
return RETURN_FAILED;
|
||||
|
@ -1,15 +1,15 @@
|
||||
#ifndef PAYLOADHANDLERBASE_H_
|
||||
#define PAYLOADHANDLERBASE_H_
|
||||
#ifndef FSFW_DEVICES_CHILDHANDLERBASE_H_
|
||||
#define FSFW_DEVICES_CHILDHANDLERBASE_H_
|
||||
|
||||
#include "ChildHandlerFDIR.h"
|
||||
#include "DeviceHandlerBase.h"
|
||||
|
||||
class ChildHandlerBase: public DeviceHandlerBase {
|
||||
public:
|
||||
ChildHandlerBase(object_id_t setObjectId,
|
||||
object_id_t deviceCommunication, CookieIF * comCookie,
|
||||
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
|
||||
uint32_t thermalRequestPoolId, uint32_t parent,
|
||||
ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
|
||||
CookieIF * cookie, uint32_t thermalStatePoolId,
|
||||
uint32_t thermalRequestPoolId,
|
||||
object_id_t parent = objects::NO_OBJECT,
|
||||
FailureIsolationBase* customFdir = nullptr,
|
||||
size_t cmdQueueSize = 20);
|
||||
virtual ~ChildHandlerBase();
|
||||
@ -22,4 +22,5 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
#endif /* PAYLOADHANDLERBASE_H_ */
|
||||
#endif /* FSFW_DEVICES_CHILDHANDLERBASE_H_ */
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "DeviceHandlerBase.h"
|
||||
#include "AcceptsDeviceResponsesIF.h"
|
||||
#include "DeviceTmReportingWrapper.h"
|
||||
|
||||
#include "../objectmanager/ObjectManager.h"
|
||||
#include "../storagemanager/StorageManagerIF.h"
|
||||
#include "../thermal/ThermalComponentIF.h"
|
||||
#include "AcceptsDeviceResponsesIF.h"
|
||||
|
||||
#include "../datapool/DataSet.h"
|
||||
#include "../datapool/PoolVariable.h"
|
||||
#include "DeviceTmReportingWrapper.h"
|
||||
#include "../globalfunctions/CRC.h"
|
||||
#include "../subsystem/SubsystemBase.h"
|
||||
#include "../ipc/QueueFactory.h"
|
||||
@ -14,45 +14,47 @@
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
object_id_t DeviceHandlerBase::powerSwitcherId = 0;
|
||||
object_id_t DeviceHandlerBase::rawDataReceiverId = 0;
|
||||
object_id_t DeviceHandlerBase::defaultFDIRParentId = 0;
|
||||
object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT;
|
||||
object_id_t DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT;
|
||||
object_id_t DeviceHandlerBase::defaultFdirParentId = objects::NO_OBJECT;
|
||||
|
||||
DeviceHandlerBase::DeviceHandlerBase(object_id_t setObjectId,
|
||||
object_id_t deviceCommunication, CookieIF * comCookie,
|
||||
uint8_t setDeviceSwitch, uint32_t thermalStatePoolId,
|
||||
uint32_t thermalRequestPoolId, FailureIsolationBase* fdirInstance,
|
||||
size_t cmdQueueSize) :
|
||||
FailureIsolationBase* fdirInstance, size_t cmdQueueSize) :
|
||||
SystemObject(setObjectId), mode(MODE_OFF), submode(SUBMODE_NONE),
|
||||
wiretappingMode(OFF), storedRawData(StorageManagerIF::INVALID_ADDRESS),
|
||||
deviceCommunicationId(deviceCommunication), comCookie(comCookie),
|
||||
deviceThermalStatePoolId(thermalStatePoolId),
|
||||
deviceThermalRequestPoolId(thermalRequestPoolId),
|
||||
healthHelper(this,setObjectId), modeHelper(this), parameterHelper(this),
|
||||
childTransitionFailure(RETURN_OK), fdirInstance(fdirInstance),
|
||||
hkSwitcher(this), defaultFDIRUsed(fdirInstance == nullptr),
|
||||
switchOffWasReported(false), actionHelper(this, nullptr),
|
||||
childTransitionDelay(5000),
|
||||
transitionSourceMode(_MODE_POWER_DOWN), transitionSourceSubMode(
|
||||
SUBMODE_NONE), deviceSwitch(setDeviceSwitch) {
|
||||
actionHelper(this, nullptr), childTransitionFailure(RETURN_OK),
|
||||
fdirInstance(fdirInstance), hkSwitcher(this),
|
||||
defaultFDIRUsed(fdirInstance == nullptr), switchOffWasReported(false),
|
||||
childTransitionDelay(5000), transitionSourceMode(_MODE_POWER_DOWN),
|
||||
transitionSourceSubMode(SUBMODE_NONE) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(cmdQueueSize,
|
||||
CommandMessage::MAX_MESSAGE_SIZE);
|
||||
MessageQueueMessage::MAX_MESSAGE_SIZE);
|
||||
insertInCommandMap(RAW_COMMAND_ID);
|
||||
cookieInfo.state = COOKIE_UNUSED;
|
||||
cookieInfo.pendingCommand = deviceCommandMap.end();
|
||||
if (comCookie == nullptr) {
|
||||
sif::error << "DeviceHandlerBase: ObjectID 0x" << std::hex <<
|
||||
std::setw(8) << std::setfill('0') << this->getObjectId() <<
|
||||
std::dec << ": Do not pass nullptr as a cookie, consider "
|
||||
<< std::setfill(' ') << "passing a dummy cookie instead!" <<
|
||||
std::endl;
|
||||
sif::error << "DeviceHandlerBase: ObjectID 0x" << std::hex
|
||||
<< std::setw(8) << std::setfill('0') << this->getObjectId()
|
||||
<< std::dec << ": Do not pass nullptr as a cookie, consider "
|
||||
<< std::setfill(' ') << "passing a dummy cookie instead!"
|
||||
<< std::endl;
|
||||
}
|
||||
if (this->fdirInstance == nullptr) {
|
||||
this->fdirInstance = new DeviceHandlerFailureIsolation(setObjectId,
|
||||
defaultFDIRParentId);
|
||||
defaultFdirParentId);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::setThermalStateRequestPoolIds(
|
||||
uint32_t thermalStatePoolId, uint32_t thermalRequestPoolId) {
|
||||
this->deviceThermalRequestPoolId = thermalStatePoolId;
|
||||
this->deviceThermalRequestPoolId = thermalRequestPoolId;
|
||||
}
|
||||
|
||||
|
||||
DeviceHandlerBase::~DeviceHandlerBase() {
|
||||
delete comCookie;
|
||||
if (defaultFDIRUsed) {
|
||||
@ -108,8 +110,12 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
||||
|
||||
communicationInterface = objectManager->get<DeviceCommunicationIF>(
|
||||
deviceCommunicationId);
|
||||
if (communicationInterface == NULL) {
|
||||
return RETURN_FAILED;
|
||||
if (communicationInterface == nullptr) {
|
||||
sif::error << "DeviceHandlerBase::initialize: Communication interface "
|
||||
"invalid." << std::endl;
|
||||
sif::error << "Make sure it is set up properly and implements"
|
||||
" DeviceCommunicationIF" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
result = communicationInterface->initializeInterface(comCookie);
|
||||
@ -118,27 +124,40 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
||||
}
|
||||
|
||||
IPCStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
if (IPCStore == NULL) {
|
||||
return RETURN_FAILED;
|
||||
if (IPCStore == nullptr) {
|
||||
sif::error << "DeviceHandlerBase::initialize: IPC store not set up in "
|
||||
"factory." << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
AcceptsDeviceResponsesIF *rawReceiver = objectManager->get<
|
||||
AcceptsDeviceResponsesIF>(rawDataReceiverId);
|
||||
if(rawDataReceiverId != objects::NO_OBJECT) {
|
||||
AcceptsDeviceResponsesIF *rawReceiver = objectManager->get<
|
||||
AcceptsDeviceResponsesIF>(rawDataReceiverId);
|
||||
|
||||
if (rawReceiver == NULL) {
|
||||
return RETURN_FAILED;
|
||||
if (rawReceiver == nullptr) {
|
||||
sif::error << "DeviceHandlerBase::initialize: Raw receiver object "
|
||||
"ID set but no valid object found." << std::endl;
|
||||
sif::error << "Make sure the raw receiver object is set up properly"
|
||||
" and implements AcceptsDeviceResponsesIF" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
defaultRawReceiver = rawReceiver->getDeviceQueue();
|
||||
}
|
||||
|
||||
defaultRawReceiver = rawReceiver->getDeviceQueue();
|
||||
|
||||
powerSwitcher = objectManager->get<PowerSwitchIF>(powerSwitcherId);
|
||||
if (powerSwitcher == NULL) {
|
||||
return RETURN_FAILED;
|
||||
if(powerSwitcherId != objects::NO_OBJECT) {
|
||||
powerSwitcher = objectManager->get<PowerSwitchIF>(powerSwitcherId);
|
||||
if (powerSwitcher == nullptr) {
|
||||
sif::error << "DeviceHandlerBase::initialize: Power switcher "
|
||||
<< "object ID set but no valid object found." << std::endl;
|
||||
sif::error << "Make sure the raw receiver object is set up properly"
|
||||
<< " and implements PowerSwitchIF" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
result = healthHelper.initialize();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
result = modeHelper.initialize();
|
||||
@ -168,7 +187,7 @@ ReturnValue_t DeviceHandlerBase::initialize() {
|
||||
|
||||
//Set temperature target state to NON_OP.
|
||||
DataSet mySet;
|
||||
PoolVariable<int8_t> thermalRequest(deviceThermalRequestPoolId, &mySet,
|
||||
db_int8_t thermalRequest(deviceThermalRequestPoolId, &mySet,
|
||||
PoolVariableIF::VAR_WRITE);
|
||||
mySet.read();
|
||||
thermalRequest = ThermalComponentIF::STATE_REQUEST_NON_OPERATIONAL;
|
||||
@ -200,38 +219,43 @@ void DeviceHandlerBase::readCommandQueue() {
|
||||
return;
|
||||
}
|
||||
|
||||
CommandMessage message;
|
||||
ReturnValue_t result = commandQueue->receiveMessage(&message);
|
||||
CommandMessage command;
|
||||
ReturnValue_t result = commandQueue->receiveMessage(&command);
|
||||
if (result != RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = healthHelper.handleHealthCommand(&message);
|
||||
result = healthHelper.handleHealthCommand(&command);
|
||||
if (result == RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = modeHelper.handleModeCommand(&command);
|
||||
if (result == RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = modeHelper.handleModeCommand(&message);
|
||||
result = actionHelper.handleActionMessage(&command);
|
||||
if (result == RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = actionHelper.handleActionMessage(&message);
|
||||
result = parameterHelper.handleParameterMessage(&command);
|
||||
if (result == RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = parameterHelper.handleParameterMessage(&message);
|
||||
// result = hkManager.handleHousekeepingMessage(&command);
|
||||
// if (result == RETURN_OK) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
result = handleDeviceHandlerMessage(&command);
|
||||
if (result == RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = handleDeviceHandlerMessage(&message);
|
||||
if (result == RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = letChildHandleMessage(&message);
|
||||
result = letChildHandleMessage(&command);
|
||||
if (result == RETURN_OK) {
|
||||
return;
|
||||
}
|
||||
@ -273,7 +297,8 @@ void DeviceHandlerBase::doStateMachine() {
|
||||
case _MODE_WAIT_ON: {
|
||||
uint32_t currentUptime;
|
||||
Clock::getUptime(¤tUptime);
|
||||
if (currentUptime - timeoutStart >= powerSwitcher->getSwitchDelayMs()) {
|
||||
if (powerSwitcher != nullptr and currentUptime - timeoutStart >=
|
||||
powerSwitcher->getSwitchDelayMs()) {
|
||||
triggerEvent(MODE_TRANSITION_FAILED, PowerSwitchIF::SWITCH_TIMEOUT,
|
||||
0);
|
||||
setMode(_MODE_POWER_DOWN);
|
||||
@ -293,6 +318,12 @@ void DeviceHandlerBase::doStateMachine() {
|
||||
case _MODE_WAIT_OFF: {
|
||||
uint32_t currentUptime;
|
||||
Clock::getUptime(¤tUptime);
|
||||
|
||||
if(powerSwitcher == nullptr) {
|
||||
setMode(MODE_OFF);
|
||||
break;
|
||||
}
|
||||
|
||||
if (currentUptime - timeoutStart >= powerSwitcher->getSwitchDelayMs()) {
|
||||
triggerEvent(MODE_TRANSITION_FAILED, PowerSwitchIF::SWITCH_TIMEOUT,
|
||||
0);
|
||||
@ -343,9 +374,10 @@ ReturnValue_t DeviceHandlerBase::isModeCombinationValid(Mode_t mode,
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::insertInCommandAndReplyMap(DeviceCommandId_t deviceCommand,
|
||||
uint16_t maxDelayCycles, size_t replyLen, bool periodic,
|
||||
bool hasDifferentReplyId, DeviceCommandId_t replyId) {
|
||||
ReturnValue_t DeviceHandlerBase::insertInCommandAndReplyMap(
|
||||
DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles,
|
||||
size_t replyLen, bool periodic, bool hasDifferentReplyId,
|
||||
DeviceCommandId_t replyId) {
|
||||
//No need to check, as we may try to insert multiple times.
|
||||
insertInCommandMap(deviceCommand);
|
||||
if (hasDifferentReplyId) {
|
||||
@ -371,7 +403,8 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId,
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::insertInCommandMap(DeviceCommandId_t deviceCommand) {
|
||||
ReturnValue_t DeviceHandlerBase::insertInCommandMap(
|
||||
DeviceCommandId_t deviceCommand) {
|
||||
DeviceCommandInfo info;
|
||||
info.expectedReplies = 0;
|
||||
info.isExecuting = false;
|
||||
@ -419,7 +452,7 @@ void DeviceHandlerBase::setTransition(Mode_t modeTo, Submode_t submodeTo) {
|
||||
transitionSourceSubMode = submode;
|
||||
childTransitionFailure = CHILD_TIMEOUT;
|
||||
|
||||
//transitionTargetMode is set by setMode
|
||||
// transitionTargetMode is set by setMode
|
||||
setMode((modeTo | TRANSITION_MODE_CHILD_ACTION_MASK), submodeTo);
|
||||
}
|
||||
|
||||
@ -437,7 +470,7 @@ void DeviceHandlerBase::setMode(Mode_t newMode, uint8_t newSubmode) {
|
||||
|
||||
if (mode == MODE_OFF) {
|
||||
DataSet mySet;
|
||||
PoolVariable<int8_t> thermalRequest(deviceThermalRequestPoolId, &mySet,
|
||||
db_int8_t thermalRequest(deviceThermalRequestPoolId, &mySet,
|
||||
PoolVariableIF::VAR_READ_WRITE);
|
||||
mySet.read();
|
||||
if (thermalRequest != ThermalComponentIF::STATE_REQUEST_IGNORE) {
|
||||
@ -578,11 +611,8 @@ void DeviceHandlerBase::doSendRead() {
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::doGetRead() {
|
||||
size_t receivedDataLen;
|
||||
uint8_t *receivedData;
|
||||
DeviceCommandId_t foundId = 0xFFFFFFFF;
|
||||
size_t foundLen = 0;
|
||||
ReturnValue_t result;
|
||||
size_t receivedDataLen = 0;
|
||||
uint8_t *receivedData = nullptr;
|
||||
|
||||
if (cookieInfo.state != COOKIE_READ_SENT) {
|
||||
cookieInfo.state = COOKIE_UNUSED;
|
||||
@ -591,8 +621,8 @@ void DeviceHandlerBase::doGetRead() {
|
||||
|
||||
cookieInfo.state = COOKIE_UNUSED;
|
||||
|
||||
result = communicationInterface->readReceivedMessage(comCookie,
|
||||
&receivedData, &receivedDataLen);
|
||||
ReturnValue_t result = communicationInterface->readReceivedMessage(
|
||||
comCookie, &receivedData, &receivedDataLen);
|
||||
|
||||
if (result != RETURN_OK) {
|
||||
triggerEvent(DEVICE_REQUESTING_REPLY_FAILED, result);
|
||||
@ -608,51 +638,101 @@ void DeviceHandlerBase::doGetRead() {
|
||||
replyRawData(receivedData, receivedDataLen, requestedRawTraffic);
|
||||
}
|
||||
|
||||
if (mode == MODE_RAW) {
|
||||
if (mode == MODE_RAW and defaultRawReceiver != MessageQueueIF::NO_QUEUE) {
|
||||
replyRawReplyIfnotWiretapped(receivedData, receivedDataLen);
|
||||
} else {
|
||||
//The loop may not execute more often than the number of received bytes (worst case).
|
||||
//This approach avoids infinite loops due to buggy scanForReply routines (seen in bug 1077).
|
||||
uint32_t remainingLength = receivedDataLen;
|
||||
for (uint32_t count = 0; count < receivedDataLen; count++) {
|
||||
result = scanForReply(receivedData, remainingLength, &foundId,
|
||||
&foundLen);
|
||||
switch (result) {
|
||||
case RETURN_OK:
|
||||
handleReply(receivedData, foundId, foundLen);
|
||||
break;
|
||||
case APERIODIC_REPLY: {
|
||||
result = interpretDeviceReply(foundId, receivedData);
|
||||
if (result != RETURN_OK) {
|
||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result,
|
||||
foundId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IGNORE_REPLY_DATA:
|
||||
break;
|
||||
case IGNORE_FULL_PACKET:
|
||||
return;
|
||||
default:
|
||||
//We need to wait for timeout.. don't know what command failed and who sent it.
|
||||
}
|
||||
else {
|
||||
parseReply(receivedData, receivedDataLen);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::parseReply(const uint8_t* receivedData,
|
||||
size_t receivedDataLen) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_FAILED;
|
||||
DeviceCommandId_t foundId = 0xFFFFFFFF;
|
||||
size_t foundLen = 0;
|
||||
// The loop may not execute more often than the number of received bytes
|
||||
// (worst case). This approach avoids infinite loops due to buggy
|
||||
// scanForReply routines.
|
||||
uint32_t remainingLength = receivedDataLen;
|
||||
for (uint32_t count = 0; count < receivedDataLen; count++) {
|
||||
result = scanForReply(receivedData, remainingLength, &foundId,
|
||||
&foundLen);
|
||||
switch (result) {
|
||||
case RETURN_OK:
|
||||
handleReply(receivedData, foundId, foundLen);
|
||||
break;
|
||||
case APERIODIC_REPLY: {
|
||||
result = interpretDeviceReply(foundId, receivedData);
|
||||
if (result != RETURN_OK) {
|
||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||
triggerEvent(DEVICE_READING_REPLY_FAILED, result, foundLen);
|
||||
break;
|
||||
}
|
||||
receivedData += foundLen;
|
||||
if (remainingLength > foundLen) {
|
||||
remainingLength -= foundLen;
|
||||
} else {
|
||||
return;
|
||||
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result,
|
||||
foundId);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IGNORE_REPLY_DATA:
|
||||
break;
|
||||
case IGNORE_FULL_PACKET:
|
||||
return;
|
||||
default:
|
||||
//We need to wait for timeout.. don't know what command failed and who sent it.
|
||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||
triggerEvent(DEVICE_READING_REPLY_FAILED, result, foundLen);
|
||||
break;
|
||||
}
|
||||
receivedData += foundLen;
|
||||
if (remainingLength > foundLen) {
|
||||
remainingLength -= foundLen;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::handleReply(const uint8_t* receivedData,
|
||||
DeviceCommandId_t foundId, uint32_t foundLen) {
|
||||
ReturnValue_t result;
|
||||
DeviceReplyMap::iterator iter = deviceReplyMap.find(foundId);
|
||||
|
||||
if (iter == deviceReplyMap.end()) {
|
||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||
triggerEvent(DEVICE_UNKNOWN_REPLY, foundId);
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceReplyInfo *info = &(iter->second);
|
||||
|
||||
if (info->delayCycles != 0) {
|
||||
|
||||
if (info->periodic != false) {
|
||||
info->delayCycles = info->maxDelayCycles;
|
||||
}
|
||||
else {
|
||||
info->delayCycles = 0;
|
||||
}
|
||||
|
||||
result = interpretDeviceReply(foundId, receivedData);
|
||||
|
||||
if (result != RETURN_OK) {
|
||||
// Report failed interpretation to FDIR.
|
||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId);
|
||||
}
|
||||
replyToReply(iter, result);
|
||||
}
|
||||
else {
|
||||
// Other completion failure messages are created by timeout.
|
||||
// Powering down the device might take some time during which periodic
|
||||
// replies may still come in.
|
||||
if (mode != _MODE_WAIT_OFF) {
|
||||
triggerEvent(DEVICE_UNREQUESTED_REPLY, foundId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
|
||||
uint8_t * *data, uint32_t * len) {
|
||||
uint8_t** data, uint32_t * len) {
|
||||
size_t lenTmp;
|
||||
|
||||
if (IPCStore == nullptr) {
|
||||
@ -675,7 +755,7 @@ ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress,
|
||||
|
||||
void DeviceHandlerBase::replyRawData(const uint8_t *data, size_t len,
|
||||
MessageQueueId_t sendTo, bool isCommand) {
|
||||
if (IPCStore == NULL || len == 0) {
|
||||
if (IPCStore == nullptr or len == 0 or sendTo == MessageQueueIF::NO_QUEUE) {
|
||||
return;
|
||||
}
|
||||
store_address_t address;
|
||||
@ -686,18 +766,17 @@ void DeviceHandlerBase::replyRawData(const uint8_t *data, size_t len,
|
||||
return;
|
||||
}
|
||||
|
||||
CommandMessage message;
|
||||
CommandMessage command;
|
||||
|
||||
DeviceHandlerMessage::setDeviceHandlerRawReplyMessage(&message,
|
||||
DeviceHandlerMessage::setDeviceHandlerRawReplyMessage(&command,
|
||||
getObjectId(), address, isCommand);
|
||||
|
||||
// this->DeviceHandlerCommand = CommandMessage::CMD_NONE;
|
||||
|
||||
result = commandQueue->sendMessage(sendTo, &message);
|
||||
result = commandQueue->sendMessage(sendTo, &command);
|
||||
|
||||
if (result != RETURN_OK) {
|
||||
IPCStore->deleteData(address);
|
||||
//Silently discard data, this indicates heavy TM traffic which should not be increased by additional events.
|
||||
// Silently discard data, this indicates heavy TM traffic which
|
||||
// should not be increased by additional events.
|
||||
}
|
||||
}
|
||||
|
||||
@ -726,57 +805,6 @@ MessageQueueId_t DeviceHandlerBase::getCommandQueue() const {
|
||||
return commandQueue->getId();
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::handleReply(const uint8_t* receivedData,
|
||||
DeviceCommandId_t foundId, uint32_t foundLen) {
|
||||
ReturnValue_t result;
|
||||
DeviceReplyMap::iterator iter = deviceReplyMap.find(foundId);
|
||||
|
||||
if (iter == deviceReplyMap.end()) {
|
||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||
triggerEvent(DEVICE_UNKNOWN_REPLY, foundId);
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceReplyInfo *info = &(iter->second);
|
||||
|
||||
if (info->delayCycles != 0) {
|
||||
|
||||
if (info->periodic) {
|
||||
info->delayCycles = info->maxDelayCycles;
|
||||
} else {
|
||||
info->delayCycles = 0;
|
||||
}
|
||||
result = interpretDeviceReply(foundId, receivedData);
|
||||
if (result != RETURN_OK) {
|
||||
//Report failed interpretation to FDIR.
|
||||
replyRawReplyIfnotWiretapped(receivedData, foundLen);
|
||||
triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId);
|
||||
}
|
||||
replyToReply(iter, result);
|
||||
} else {
|
||||
//Other completion failure messages are created by timeout.
|
||||
//Powering down the device might take some time during which periodic replies may still come in.
|
||||
if (mode != _MODE_WAIT_OFF) {
|
||||
triggerEvent(DEVICE_UNREQUESTED_REPLY, foundId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//ReturnValue_t DeviceHandlerBase::switchCookieChannel(object_id_t newChannelId) {
|
||||
// DeviceCommunicationIF *newCommunication = objectManager->get<
|
||||
// DeviceCommunicationIF>(newChannelId);
|
||||
//
|
||||
// if (newCommunication != NULL) {
|
||||
// ReturnValue_t result = newCommunication->reOpen(cookie, ioBoardAddress,
|
||||
// maxDeviceReplyLen);
|
||||
// if (result != RETURN_OK) {
|
||||
// return result;
|
||||
// }
|
||||
// return RETURN_OK;
|
||||
// }
|
||||
// return RETURN_FAILED;
|
||||
//}
|
||||
|
||||
void DeviceHandlerBase::buildRawDeviceCommand(CommandMessage* commandMessage) {
|
||||
storedRawData = DeviceHandlerMessage::getStoreAddress(commandMessage);
|
||||
ReturnValue_t result = getStorageData(storedRawData, &rawPacket,
|
||||
@ -793,6 +821,9 @@ void DeviceHandlerBase::buildRawDeviceCommand(CommandMessage* commandMessage) {
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
|
||||
if(powerSwitcher == nullptr) {
|
||||
return;
|
||||
}
|
||||
const uint8_t *switches;
|
||||
uint8_t numberOfSwitches = 0;
|
||||
ReturnValue_t result = getSwitches(&switches, &numberOfSwitches);
|
||||
@ -807,9 +838,7 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) {
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t **switches,
|
||||
uint8_t *numberOfSwitches) {
|
||||
*switches = &deviceSwitch;
|
||||
*numberOfSwitches = 1;
|
||||
return RETURN_OK;
|
||||
return DeviceHandlerBase::NO_SWITCH;
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::modeChanged(void) {
|
||||
@ -845,6 +874,9 @@ uint32_t DeviceHandlerBase::getTransitionDelayMs(Mode_t modeFrom,
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::getStateOfSwitches(void) {
|
||||
if(powerSwitcher == nullptr) {
|
||||
return NO_SWITCH;
|
||||
}
|
||||
uint8_t numberOfSwitches = 0;
|
||||
const uint8_t *switches;
|
||||
|
||||
@ -895,9 +927,9 @@ ReturnValue_t DeviceHandlerBase::checkModeCommand(Mode_t commandedMode,
|
||||
if ((commandedMode == MODE_ON) && (mode == MODE_OFF)
|
||||
&& (deviceThermalStatePoolId != PoolVariableIF::NO_PARAMETER)) {
|
||||
DataSet mySet;
|
||||
PoolVariable<int8_t> thermalState(deviceThermalStatePoolId, &mySet,
|
||||
db_int8_t thermalState(deviceThermalStatePoolId, &mySet,
|
||||
PoolVariableIF::VAR_READ);
|
||||
PoolVariable<int8_t> thermalRequest(deviceThermalRequestPoolId, &mySet,
|
||||
db_int8_t thermalRequest(deviceThermalRequestPoolId, &mySet,
|
||||
PoolVariableIF::VAR_READ);
|
||||
mySet.read();
|
||||
if (thermalRequest != ThermalComponentIF::STATE_REQUEST_IGNORE) {
|
||||
@ -925,7 +957,7 @@ void DeviceHandlerBase::startTransition(Mode_t commandedMode,
|
||||
MODE_ON);
|
||||
triggerEvent(CHANGING_MODE, commandedMode, commandedSubmode);
|
||||
DataSet mySet;
|
||||
PoolVariable<int8_t> thermalRequest(deviceThermalRequestPoolId,
|
||||
db_int8_t thermalRequest(deviceThermalRequestPoolId,
|
||||
&mySet, PoolVariableIF::VAR_READ_WRITE);
|
||||
mySet.read();
|
||||
if (thermalRequest != ThermalComponentIF::STATE_REQUEST_IGNORE) {
|
||||
@ -997,8 +1029,8 @@ HasHealthIF::HealthState DeviceHandlerBase::getHealth() {
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::setHealth(HealthState health) {
|
||||
healthHelper.setHealth(health);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
healthHelper.setHealth(health);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::checkSwitchState() {
|
||||
@ -1111,35 +1143,47 @@ void DeviceHandlerBase::handleDeviceTM(SerializeIF* data,
|
||||
return;
|
||||
}
|
||||
DeviceTmReportingWrapper wrapper(getObjectId(), replyId, data);
|
||||
if (iter->second.command != deviceCommandMap.end()) {//replies to a command
|
||||
//replies to a command
|
||||
if (iter->second.command != deviceCommandMap.end())
|
||||
{
|
||||
MessageQueueId_t queueId = iter->second.command->second.sendReplyTo;
|
||||
|
||||
if (queueId != NO_COMMANDER) {
|
||||
//This may fail, but we'll ignore the fault.
|
||||
actionHelper.reportData(queueId, replyId, data);
|
||||
}
|
||||
|
||||
//This check should make sure we get any TM but don't get anything doubled.
|
||||
if (wiretappingMode == TM && (requestedRawTraffic != queueId)) {
|
||||
actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
|
||||
} else if (forceDirectTm && (defaultRawReceiver != queueId)) {
|
||||
|
||||
// hiding of sender needed so the service will handle it as unexpected Data, no matter what state
|
||||
//(progress or completed) it is in
|
||||
actionHelper.reportData(defaultRawReceiver, replyId, &wrapper,
|
||||
true);
|
||||
|
||||
}
|
||||
} else { //unrequested/aperiodic replies
|
||||
if (wiretappingMode == TM) {
|
||||
actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
|
||||
} else if (forceDirectTm) {
|
||||
// hiding of sender needed so the service will handle it as unexpected Data, no matter what state
|
||||
//(progress or completed) it is in
|
||||
else if (forceDirectTm and (defaultRawReceiver != queueId) and
|
||||
(defaultRawReceiver != MessageQueueIF::NO_QUEUE))
|
||||
{
|
||||
// hiding of sender needed so the service will handle it as
|
||||
// unexpected Data, no matter what state (progress or completed)
|
||||
// it is in
|
||||
actionHelper.reportData(defaultRawReceiver, replyId, &wrapper,
|
||||
true);
|
||||
true);
|
||||
}
|
||||
}
|
||||
//Try to cast to DataSet and commit data.
|
||||
//unrequested/aperiodic replies
|
||||
else
|
||||
{
|
||||
if (wiretappingMode == TM) {
|
||||
actionHelper.reportData(requestedRawTraffic, replyId, &wrapper);
|
||||
}
|
||||
else if (forceDirectTm and defaultRawReceiver !=
|
||||
MessageQueueIF::NO_QUEUE)
|
||||
{
|
||||
// hiding of sender needed so the service will handle it as
|
||||
// unexpected Data, no matter what state (progress or completed)
|
||||
// it is in
|
||||
actionHelper.reportData(defaultRawReceiver, replyId, &wrapper,
|
||||
true);
|
||||
}
|
||||
}
|
||||
//Try to cast to GlobDataSet and commit data.
|
||||
if (!neverInDataPool) {
|
||||
DataSet* dataSet = dynamic_cast<DataSet*>(data);
|
||||
if (dataSet != NULL) {
|
||||
@ -1178,18 +1222,23 @@ void DeviceHandlerBase::buildInternalCommand(void) {
|
||||
if (mode == MODE_NORMAL) {
|
||||
result = buildNormalDeviceCommand(&deviceCommandId);
|
||||
if (result == BUSY) {
|
||||
//so we can track misconfigurations
|
||||
sif::debug << std::hex << getObjectId()
|
||||
<< ": DHB::buildInternalCommand busy" << std::endl; //so we can track misconfigurations
|
||||
<< ": DHB::buildInternalCommand: Busy" << std::dec << std::endl;
|
||||
result = NOTHING_TO_SEND; //no need to report this
|
||||
}
|
||||
} else if (mode == MODE_RAW) {
|
||||
}
|
||||
else if (mode == MODE_RAW) {
|
||||
result = buildChildRawCommand();
|
||||
deviceCommandId = RAW_COMMAND_ID;
|
||||
} else if (mode & TRANSITION_MODE_CHILD_ACTION_MASK) {
|
||||
}
|
||||
else if (mode & TRANSITION_MODE_CHILD_ACTION_MASK) {
|
||||
result = buildTransitionDeviceCommand(&deviceCommandId);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
if (result == NOTHING_TO_SEND) {
|
||||
return;
|
||||
}
|
||||
@ -1281,11 +1330,22 @@ void DeviceHandlerBase::changeHK(Mode_t mode, Submode_t submode, bool enable) {
|
||||
}
|
||||
|
||||
void DeviceHandlerBase::setTaskIF(PeriodicTaskIF* task_){
|
||||
executingTask = task_;
|
||||
executingTask = task_;
|
||||
}
|
||||
|
||||
// Default implementations empty.
|
||||
void DeviceHandlerBase::debugInterface(uint8_t positionTracker,
|
||||
object_id_t objectId, uint32_t parameter) {}
|
||||
|
||||
void DeviceHandlerBase::performOperationHook() {}
|
||||
void DeviceHandlerBase::performOperationHook() {
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() {
|
||||
// In this function, the task handle should be valid if the task
|
||||
// was implemented correctly. We still check to be 1000 % sure :-)
|
||||
if(executingTask != nullptr) {
|
||||
pstIntervalMs = executingTask->getPeriodMs();
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,23 @@
|
||||
#ifndef DEVICEHANDLERBASE_H_
|
||||
#define DEVICEHANDLERBASE_H_
|
||||
#ifndef FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERBASE_H_
|
||||
#define FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERBASE_H_
|
||||
|
||||
#include "DeviceHandlerIF.h"
|
||||
#include "DeviceCommunicationIF.h"
|
||||
#include "DeviceHandlerFailureIsolation.h"
|
||||
|
||||
#include "../objectmanager/SystemObject.h"
|
||||
#include "../tasks/PeriodicTaskIF.h"
|
||||
#include "../tasks/ExecutableObjectIF.h"
|
||||
#include "DeviceHandlerIF.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../action/HasActionsIF.h"
|
||||
#include "../datapool/PoolVariableIF.h"
|
||||
#include "DeviceCommunicationIF.h"
|
||||
#include "../modes/HasModesIF.h"
|
||||
#include "../power/PowerSwitchIF.h"
|
||||
#include "../ipc/MessageQueueIF.h"
|
||||
|
||||
#include "../action/ActionHelper.h"
|
||||
#include "../health/HealthHelper.h"
|
||||
#include "../parameters/ParameterHelper.h"
|
||||
#include "../datapool/HkSwitchHelper.h"
|
||||
#include "DeviceHandlerFailureIsolation.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
@ -46,14 +47,16 @@ class StorageManagerIF;
|
||||
* If data has been received (GET_READ), the data will be interpreted.
|
||||
* The action for each step can be defined by the child class but as most
|
||||
* device handlers share a 4-call (sendRead-getRead-sendWrite-getWrite) structure,
|
||||
* a default implementation is provided. NOTE: RMAP is a standard which is used for FLP.
|
||||
* a default implementation is provided.
|
||||
* NOTE: RMAP is a standard which is used for FLP.
|
||||
* RMAP communication is not mandatory for projects implementing the FSFW.
|
||||
* However, the communication principles are similar to RMAP as there are
|
||||
* two write and two send calls involved.
|
||||
*
|
||||
* Device handler instances should extend this class and implement the abstract functions.
|
||||
* Components and drivers can send so called cookies which are used for communication
|
||||
* and contain information about the communcation (e.g. slave address for I2C or RMAP structs).
|
||||
* Device handler instances should extend this class and implement the abstract
|
||||
* functions. Components and drivers can send so called cookies which are used
|
||||
* for communication and contain information about the communcation (e.g. slave
|
||||
* address for I2C or RMAP structs).
|
||||
* The following abstract methods must be implemented by a device handler:
|
||||
* 1. doStartUp()
|
||||
* 2. doShutDown()
|
||||
@ -100,12 +103,12 @@ public:
|
||||
* @param cmdQueueSize
|
||||
*/
|
||||
DeviceHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication,
|
||||
CookieIF * comCookie, uint8_t setDeviceSwitch,
|
||||
uint32_t thermalStatePoolId = PoolVariableIF::NO_PARAMETER,
|
||||
uint32_t thermalRequestPoolId = PoolVariableIF::NO_PARAMETER,
|
||||
FailureIsolationBase* fdirInstance = nullptr,
|
||||
CookieIF * comCookie, FailureIsolationBase* fdirInstance = nullptr,
|
||||
size_t cmdQueueSize = 20);
|
||||
|
||||
void setThermalStateRequestPoolIds(uint32_t thermalStatePoolId,
|
||||
uint32_t thermalRequestPoolId);
|
||||
|
||||
/**
|
||||
* @brief This function is the device handler base core component and is
|
||||
* called periodically.
|
||||
@ -150,11 +153,9 @@ public:
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t initialize();
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
*/
|
||||
/** Destructor. */
|
||||
virtual ~DeviceHandlerBase();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief This is used to let the child class handle the transition from
|
||||
@ -232,8 +233,9 @@ protected:
|
||||
* Build the device command to send for a transitional mode.
|
||||
*
|
||||
* This is only called in @c _MODE_TO_NORMAL, @c _MODE_TO_ON, @c _MODE_TO_RAW,
|
||||
* @c _MODE_START_UP and @c _MODE_TO_POWER_DOWN. So it is used by doStartUp()
|
||||
* and doShutDown() as well as doTransition()
|
||||
* @c _MODE_START_UP and @c _MODE_SHUT_DOWN. So it is used by doStartUp()
|
||||
* and doShutDown() as well as doTransition(), by setting those
|
||||
* modes in the respective functions.
|
||||
*
|
||||
* A good idea is to implement a flag indicating a command has to be built
|
||||
* and a variable containing the command number to be built
|
||||
@ -321,12 +323,11 @@ protected:
|
||||
* - @c RETURN_FAILED when the reply could not be interpreted,
|
||||
* e.g. logical errors or range violations occurred
|
||||
*/
|
||||
|
||||
virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) = 0;
|
||||
|
||||
/**
|
||||
* @brief fill the #deviceCommandMap
|
||||
* @brief fill the #DeviceCommandMap and #DeviceReplyMap
|
||||
* called by the initialize() of the base class
|
||||
* @details
|
||||
* This is used to let the base class know which replies are expected.
|
||||
@ -470,6 +471,18 @@ protected:
|
||||
virtual ReturnValue_t getSwitches(const uint8_t **switches,
|
||||
uint8_t *numberOfSwitches);
|
||||
|
||||
/**
|
||||
* This function is used to initialize the local housekeeping pool
|
||||
* entries. The default implementation leaves the pool empty.
|
||||
* @param localDataPoolMap
|
||||
* @return
|
||||
*/
|
||||
//virtual ReturnValue_t initializePoolEntries(
|
||||
// LocalDataPool& localDataPoolMap) override;
|
||||
|
||||
/** Get the HK manager object handle */
|
||||
//virtual LocalDataPoolManager* getHkManagerHandle() override;
|
||||
|
||||
/**
|
||||
* @brief Hook function for child handlers which is called once per
|
||||
* performOperation(). Default implementation is empty.
|
||||
@ -493,7 +506,7 @@ public:
|
||||
ReturnValue_t setHealth(HealthState health);
|
||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
||||
ParameterWrapper *parameterWrapper,
|
||||
const ParameterWrapper *newValues, uint16_t startAtIndex);
|
||||
const ParameterWrapper *newValues, uint16_t startAtIndex) override;
|
||||
/**
|
||||
* Implementation of ExecutableObjectIF function
|
||||
*
|
||||
@ -505,7 +518,7 @@ public:
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The Returnvalues ID of this class, required by HasReturnvaluesIF
|
||||
* The Returnvalues id of this class, required by HasReturnvaluesIF
|
||||
*/
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::DEVICE_HANDLER_BASE;
|
||||
|
||||
@ -527,114 +540,138 @@ protected:
|
||||
static const DeviceCommandId_t NO_COMMAND_ID = -2;
|
||||
static const MessageQueueId_t NO_COMMANDER = 0;
|
||||
|
||||
/**
|
||||
* Pointer to the raw packet that will be sent.
|
||||
*/
|
||||
/** Pointer to the raw packet that will be sent.*/
|
||||
uint8_t *rawPacket = nullptr;
|
||||
/**
|
||||
* Size of the #rawPacket.
|
||||
*/
|
||||
/** Size of the #rawPacket. */
|
||||
uint32_t rawPacketLen = 0;
|
||||
|
||||
/**
|
||||
* The mode the device handler is currently in.
|
||||
*
|
||||
* This should never be changed directly but only with setMode()
|
||||
*/
|
||||
Mode_t mode;
|
||||
|
||||
/**
|
||||
* The submode the device handler is currently in.
|
||||
*
|
||||
* This should never be changed directly but only with setMode()
|
||||
*/
|
||||
Submode_t submode;
|
||||
|
||||
/**
|
||||
* This is the counter value from performOperation().
|
||||
*/
|
||||
/** This is the counter value from performOperation(). */
|
||||
uint8_t pstStep = 0;
|
||||
uint32_t pstIntervalMs = 0;
|
||||
|
||||
/**
|
||||
* wiretapping flag:
|
||||
* Wiretapping flag:
|
||||
*
|
||||
* indicates either that all raw messages to and from the device should be sent to #theOneWhoWantsToReadRawTraffic
|
||||
* or that all device TM should be downlinked to #theOneWhoWantsToReadRawTraffic
|
||||
* indicates either that all raw messages to and from the device should be
|
||||
* sent to #defaultRawReceiver
|
||||
* or that all device TM should be downlinked to #defaultRawReceiver.
|
||||
*/
|
||||
enum WiretappingMode {
|
||||
OFF = 0, RAW = 1, TM = 2
|
||||
} wiretappingMode;
|
||||
|
||||
/**
|
||||
* A message queue that accepts raw replies
|
||||
* @brief A message queue that accepts raw replies
|
||||
*
|
||||
* Statically initialized in initialize() to a configurable object. Used when there is no method
|
||||
* of finding a recipient, ie raw mode and reporting erreonous replies
|
||||
* Statically initialized in initialize() to a configurable object.
|
||||
* Used when there is no method of finding a recipient, ie raw mode and
|
||||
* reporting erroneous replies
|
||||
*/
|
||||
MessageQueueId_t defaultRawReceiver = 0;
|
||||
|
||||
MessageQueueId_t defaultRawReceiver = MessageQueueIF::NO_QUEUE;
|
||||
store_address_t storedRawData;
|
||||
|
||||
/**
|
||||
* the message queue which wants to read all raw traffic
|
||||
*
|
||||
* if #isWiretappingActive all raw communication from and to the device will be sent to this queue
|
||||
* @brief The message queue which wants to read all raw traffic
|
||||
* If #isWiretappingActive all raw communication from and to the device
|
||||
* will be sent to this queue
|
||||
*/
|
||||
MessageQueueId_t requestedRawTraffic = 0;
|
||||
|
||||
/**
|
||||
* the object used to set power switches
|
||||
*/
|
||||
PowerSwitchIF *powerSwitcher = nullptr;
|
||||
|
||||
/**
|
||||
* Pointer to the IPCStore.
|
||||
*
|
||||
* This caches the pointer received from the objectManager in the constructor.
|
||||
*/
|
||||
StorageManagerIF *IPCStore = nullptr;
|
||||
|
||||
/**
|
||||
* cached for init
|
||||
*/
|
||||
/** The comIF object ID is cached for the intialize() function */
|
||||
object_id_t deviceCommunicationId;
|
||||
|
||||
/**
|
||||
* Communication object used for device communication
|
||||
*/
|
||||
/** Communication object used for device communication */
|
||||
DeviceCommunicationIF * communicationInterface = nullptr;
|
||||
|
||||
/**
|
||||
* Cookie used for communication
|
||||
*/
|
||||
/** Cookie used for communication */
|
||||
CookieIF * comCookie;
|
||||
|
||||
/** Health helper for HasHealthIF */
|
||||
HealthHelper healthHelper;
|
||||
/** Mode helper for HasModesIF */
|
||||
ModeHelper modeHelper;
|
||||
/** Parameter helper for ReceivesParameterMessagesIF */
|
||||
ParameterHelper parameterHelper;
|
||||
/** Action helper for HasActionsIF */
|
||||
ActionHelper actionHelper;
|
||||
/** Housekeeping Manager */
|
||||
//LocalDataPoolManager hkManager;
|
||||
|
||||
/**
|
||||
* @brief Information about commands
|
||||
*/
|
||||
struct DeviceCommandInfo {
|
||||
bool isExecuting; //!< Indicates if the command is already executing.
|
||||
uint8_t expectedReplies; //!< Dynamic value to indicate how many replies are expected. Inititated with 0.
|
||||
MessageQueueId_t sendReplyTo; //!< if this is != NO_COMMANDER, DHB was commanded externally and shall report everything to commander.
|
||||
//! Indicates if the command is already executing.
|
||||
bool isExecuting;
|
||||
//! Dynamic value to indicate how many replies are expected.
|
||||
//! Inititated with 0.
|
||||
uint8_t expectedReplies;
|
||||
//! if this is != NO_COMMANDER, DHB was commanded externally and shall
|
||||
//! report everything to commander.
|
||||
MessageQueueId_t sendReplyTo;
|
||||
};
|
||||
using DeviceCommandMap = std::map<DeviceCommandId_t, DeviceCommandInfo> ;
|
||||
/**
|
||||
* Information about commands
|
||||
*/
|
||||
DeviceCommandMap deviceCommandMap;
|
||||
|
||||
/**
|
||||
* @brief Information about expected replies
|
||||
*
|
||||
* This is used to keep track of pending replies
|
||||
* This is used to keep track of pending replies.
|
||||
*/
|
||||
struct DeviceReplyInfo {
|
||||
uint16_t maxDelayCycles; //!< The maximum number of cycles the handler should wait for a reply to this command.
|
||||
uint16_t delayCycles; //!< The currently remaining cycles the handler should wait for a reply, 0 means there is no reply expected
|
||||
//! The maximum number of cycles the handler should wait for a reply
|
||||
//! to this command.
|
||||
uint16_t maxDelayCycles;
|
||||
//! The currently remaining cycles the handler should wait for a reply,
|
||||
//! 0 means there is no reply expected
|
||||
uint16_t delayCycles;
|
||||
size_t replyLen = 0; //!< Expected size of the reply.
|
||||
bool periodic; //!< if this is !=0, the delayCycles will not be reset to 0 but to maxDelayCycles
|
||||
DeviceCommandMap::iterator command; //!< The command that expects this reply.
|
||||
//! if this is !=0, the delayCycles will not be reset to 0 but to
|
||||
//! maxDelayCycles
|
||||
bool periodic = false;
|
||||
//! The dataset used to access housekeeping data related to the
|
||||
//! respective device reply. Will point to a dataset held by
|
||||
//! the child handler (if one is specified)
|
||||
// DataSetIF* dataSet = nullptr;
|
||||
//! The command that expects this reply.
|
||||
DeviceCommandMap::iterator command;
|
||||
};
|
||||
|
||||
using DeviceReplyMap = std::map<DeviceCommandId_t, DeviceReplyInfo> ;
|
||||
using DeviceReplyIter = DeviceReplyMap::iterator;
|
||||
|
||||
/**
|
||||
* The MessageQueue used to receive device handler commands and to send replies.
|
||||
* This map is used to check and track correct reception of all replies.
|
||||
*
|
||||
* It has multiple use:
|
||||
* - It stores the information on pending replies. If a command is sent,
|
||||
* the DeviceCommandInfo.count is incremented.
|
||||
* - It is used to time-out missing replies. If a command is sent, the
|
||||
* DeviceCommandInfo.DelayCycles is set to MaxDelayCycles.
|
||||
* - It is queried to check if a reply from the device can be interpreted.
|
||||
* scanForReply() returns the id of the command a reply was found for.
|
||||
* The reply is ignored in the following cases:
|
||||
* - No entry for the returned id was found
|
||||
* - The deviceReplyInfo.delayCycles is == 0
|
||||
*/
|
||||
DeviceReplyMap deviceReplyMap;
|
||||
|
||||
//! The MessageQueue used to receive device handler commands
|
||||
//! and to send replies.
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
|
||||
/**
|
||||
@ -642,23 +679,14 @@ protected:
|
||||
*
|
||||
* can be set to PoolVariableIF::NO_PARAMETER to deactivate thermal checking
|
||||
*/
|
||||
uint32_t deviceThermalStatePoolId;
|
||||
uint32_t deviceThermalStatePoolId = PoolVariableIF::NO_PARAMETER;
|
||||
|
||||
/**
|
||||
* this is the datapool variable with the thermal request of the device
|
||||
*
|
||||
* can be set to PoolVariableIF::NO_PARAMETER to deactivate thermal checking
|
||||
*/
|
||||
uint32_t deviceThermalRequestPoolId;
|
||||
|
||||
/**
|
||||
* Taking care of the health
|
||||
*/
|
||||
HealthHelper healthHelper;
|
||||
|
||||
ModeHelper modeHelper;
|
||||
|
||||
ParameterHelper parameterHelper;
|
||||
uint32_t deviceThermalRequestPoolId = PoolVariableIF::NO_PARAMETER;
|
||||
|
||||
/**
|
||||
* Optional Error code
|
||||
@ -676,13 +704,15 @@ protected:
|
||||
|
||||
bool switchOffWasReported; //!< Indicates if SWITCH_WENT_OFF was already thrown.
|
||||
|
||||
PeriodicTaskIF* executingTask = nullptr;//!< Pointer to the task which executes this component, is invalid before setTaskIF was called.
|
||||
//! Pointer to the task which executes this component, is invalid
|
||||
//! before setTaskIF was called.
|
||||
PeriodicTaskIF* executingTask = nullptr;
|
||||
|
||||
static object_id_t powerSwitcherId; //!< Object which switches power on and off.
|
||||
|
||||
static object_id_t rawDataReceiverId; //!< Object which receives RAW data by default.
|
||||
|
||||
static object_id_t defaultFDIRParentId; //!< Object which may be the root cause of an identified fault.
|
||||
static object_id_t defaultFdirParentId; //!< Object which may be the root cause of an identified fault.
|
||||
/**
|
||||
* Helper function to report a missed reply
|
||||
*
|
||||
@ -730,28 +760,40 @@ protected:
|
||||
/**
|
||||
* 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
|
||||
* 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]
|
||||
*
|
||||
* The intended target submode is already set. The origin submode can be read in subModeFrom.
|
||||
* The intended target submode is already set.
|
||||
* The origin submode can be read in subModeFrom.
|
||||
*
|
||||
* If the transition can not be completed, the child class can try to reach an working mode by setting the mode either directly
|
||||
* or setting the mode to an transitional mode (TO_ON, TO_NORMAL, TO_RAW) if the device needs to be reconfigured.
|
||||
* If the transition can not be completed, the child class can try to reach
|
||||
* an working mode by setting the mode either directly
|
||||
* or setting the mode to an transitional mode (TO_ON, TO_NORMAL, TO_RAW)
|
||||
* if the device needs to be reconfigured.
|
||||
*
|
||||
* If nothing works, the child class can wait for the timeout and the base class will reset the mode to the mode where the transition
|
||||
* If nothing works, the child class can wait for the timeout and the base
|
||||
* class will reset the mode to the mode where the transition
|
||||
* originated from (the child should report the reason for the failed transition).
|
||||
*
|
||||
* The intended way to send commands is to set a flag (enum) indicating which command is to be sent here
|
||||
* and then to check in buildTransitionCommand() for the flag. This flag can also be used by doStartUp() and
|
||||
* doShutDown() to get a nice and clean implementation of buildTransitionCommand() without switching through modes.
|
||||
* The intended way to send commands is to set a flag (enum) indicating
|
||||
* which command is to be sent here and then to check in
|
||||
* buildTransitionCommand() for the flag. This flag can also be used by
|
||||
* doStartUp() and doShutDown() to get a nice and clean implementation of
|
||||
* buildTransitionCommand() without switching through modes.
|
||||
*
|
||||
* When the the condition for the completion of the transition is met, the mode can be set, for example in the parseReply() function.
|
||||
* When the the condition for the completion of the transition is met, the
|
||||
* mode can be set, for example in the scanForReply() function.
|
||||
*
|
||||
* The default implementation goes into the target mode;
|
||||
* The default implementation goes into the target mode directly.
|
||||
*
|
||||
* #transitionFailure can be set to a failure code indicating the reason for a failed transition
|
||||
* #transitionFailure can be set to a failure code indicating the reason
|
||||
* for a failed transition
|
||||
*
|
||||
* @param modeFrom the mode the transition originated from: [MODE_ON, MODE_NORMAL, MODE_RAW and _MODE_POWER_DOWN (if the mode changed from _MODE_START_UP to _MODE_TO_ON)]
|
||||
* @param modeFrom
|
||||
* The mode the transition originated from:
|
||||
* [MODE_ON, MODE_NORMAL, MODE_RAW and _MODE_POWER_DOWN (if the mode changed
|
||||
* from _MODE_START_UP to _MODE_TO_ON)]
|
||||
* @param subModeFrom the subMode of modeFrom
|
||||
*/
|
||||
virtual void doTransition(Mode_t modeFrom, Submode_t subModeFrom);
|
||||
@ -953,24 +995,11 @@ protected:
|
||||
bool commandIsExecuting(DeviceCommandId_t commandId);
|
||||
|
||||
/**
|
||||
* This map is used to check and track correct reception of all replies.
|
||||
* set all switches returned by getSwitches()
|
||||
*
|
||||
* It has multiple use:
|
||||
* - it stores the information on pending replies. If a command is sent, the DeviceCommandInfo.count is incremented.
|
||||
* - it is used to time-out missing replies. If a command is sent, the DeviceCommandInfo.DelayCycles is set to MaxDelayCycles.
|
||||
* - it is queried to check if a reply from the device can be interpreted. scanForReply() returns the id of the command a reply was found for.
|
||||
* The reply is ignored in the following cases:
|
||||
* - No entry for the returned id was found
|
||||
* - The deviceReplyInfo.delayCycles is == 0
|
||||
* @param onOff on == @c SWITCH_ON; off != @c SWITCH_ON
|
||||
*/
|
||||
DeviceReplyMap deviceReplyMap;
|
||||
|
||||
/**
|
||||
* Information about commands
|
||||
*/
|
||||
DeviceCommandMap deviceCommandMap;
|
||||
|
||||
ActionHelper actionHelper;
|
||||
void commandSwitch(ReturnValue_t onOff);
|
||||
private:
|
||||
|
||||
/**
|
||||
@ -997,15 +1026,16 @@ private:
|
||||
};
|
||||
|
||||
/**
|
||||
* Info about the #cookie
|
||||
*
|
||||
* @brief Info about the #cookie
|
||||
* Used to track the state of the communication
|
||||
*/
|
||||
CookieInfo cookieInfo;
|
||||
|
||||
/** the object used to set power switches */
|
||||
PowerSwitchIF *powerSwitcher = nullptr;
|
||||
|
||||
/**
|
||||
* Used for timing out mode transitions.
|
||||
*
|
||||
* @brief Used for timing out mode transitions.
|
||||
* Set when setMode() is called.
|
||||
*/
|
||||
uint32_t timeoutStart = 0;
|
||||
@ -1016,11 +1046,12 @@ private:
|
||||
uint32_t childTransitionDelay;
|
||||
|
||||
/**
|
||||
* The mode the current transition originated from
|
||||
* @brief The mode the current transition originated from
|
||||
*
|
||||
* This is private so the child can not change it and fuck up the timeouts
|
||||
*
|
||||
* IMPORTANT: This is not valid during _MODE_SHUT_DOWN and _MODE_START_UP!! (it is _MODE_POWER_DOWN during this modes)
|
||||
* IMPORTANT: This is not valid during _MODE_SHUT_DOWN and _MODE_START_UP!!
|
||||
* (it is _MODE_POWER_DOWN during this modes)
|
||||
*
|
||||
* is element of [MODE_ON, MODE_NORMAL, MODE_RAW]
|
||||
*/
|
||||
@ -1031,13 +1062,6 @@ private:
|
||||
*/
|
||||
Submode_t transitionSourceSubMode;
|
||||
|
||||
/**
|
||||
* the switch of the device
|
||||
*
|
||||
* for devices using two switches override getSwitches()
|
||||
*/
|
||||
const uint8_t deviceSwitch;
|
||||
|
||||
/**
|
||||
* read the command queue
|
||||
*/
|
||||
@ -1135,12 +1159,6 @@ private:
|
||||
ReturnValue_t getStorageData(store_address_t storageAddress, uint8_t **data,
|
||||
uint32_t *len);
|
||||
|
||||
/**
|
||||
* set all switches returned by getSwitches()
|
||||
*
|
||||
* @param onOff on == @c SWITCH_ON; off != @c SWITCH_ON
|
||||
*/
|
||||
void commandSwitch(ReturnValue_t onOff);
|
||||
|
||||
/**
|
||||
* @param modeTo either @c MODE_ON, MODE_NORMAL or MODE_RAW NOTHING ELSE!!!
|
||||
@ -1165,7 +1183,12 @@ private:
|
||||
ReturnValue_t switchCookieChannel(object_id_t newChannelId);
|
||||
|
||||
ReturnValue_t handleDeviceHandlerMessage(CommandMessage *message);
|
||||
|
||||
virtual ReturnValue_t initializeAfterTaskCreation() override;
|
||||
|
||||
void parseReply(const uint8_t* receivedData,
|
||||
size_t receivedDataLen);
|
||||
};
|
||||
|
||||
#endif /* DEVICEHANDLERBASE_H_ */
|
||||
#endif /* FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERBASE_H_ */
|
||||
|
||||
|
@ -1,19 +1,27 @@
|
||||
#include "DeviceHandlerBase.h"
|
||||
#include "DeviceHandlerFailureIsolation.h"
|
||||
|
||||
#include "../devicehandlers/DeviceHandlerIF.h"
|
||||
#include "../modes/HasModesIF.h"
|
||||
#include "../health/HealthTableIF.h"
|
||||
#include "../power/Fuse.h"
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../thermal/ThermalComponentIF.h"
|
||||
|
||||
object_id_t DeviceHandlerFailureIsolation::powerConfirmationId = 0;
|
||||
object_id_t DeviceHandlerFailureIsolation::powerConfirmationId =
|
||||
objects::NO_OBJECT;
|
||||
|
||||
DeviceHandlerFailureIsolation::DeviceHandlerFailureIsolation(object_id_t owner, object_id_t parent) :
|
||||
FailureIsolationBase(owner, parent), strangeReplyCount(MAX_STRANGE_REPLIES,
|
||||
STRANGE_REPLIES_TIME_MS, parameterDomainBase++), missedReplyCount(
|
||||
MAX_MISSED_REPLY_COUNT, MISSED_REPLY_TIME_MS,
|
||||
parameterDomainBase++), recoveryCounter(MAX_REBOOT,
|
||||
REBOOT_TIME_MS, parameterDomainBase++), fdirState(NONE), powerConfirmation(
|
||||
0) {
|
||||
DeviceHandlerFailureIsolation::DeviceHandlerFailureIsolation(object_id_t owner,
|
||||
object_id_t parent) :
|
||||
FailureIsolationBase(owner, parent),
|
||||
strangeReplyCount(DEFAULT_MAX_STRANGE_REPLIES,
|
||||
DEFAULT_STRANGE_REPLIES_TIME_MS,
|
||||
parameterDomainBase++),
|
||||
missedReplyCount( DEFAULT_MAX_MISSED_REPLY_COUNT,
|
||||
DEFAULT_MISSED_REPLY_TIME_MS,
|
||||
parameterDomainBase++),
|
||||
recoveryCounter(DEFAULT_MAX_REBOOT, DEFAULT_REBOOT_TIME_MS,
|
||||
parameterDomainBase++),
|
||||
fdirState(NONE) {
|
||||
}
|
||||
|
||||
DeviceHandlerFailureIsolation::~DeviceHandlerFailureIsolation() {
|
||||
@ -68,9 +76,11 @@ ReturnValue_t DeviceHandlerFailureIsolation::eventReceived(EventMessage* event)
|
||||
break;
|
||||
//****Power*****
|
||||
case PowerSwitchIF::SWITCH_WENT_OFF:
|
||||
result = sendConfirmationRequest(event, powerConfirmation);
|
||||
if (result == RETURN_OK) {
|
||||
setFdirState(DEVICE_MIGHT_BE_OFF);
|
||||
if(powerConfirmation != MessageQueueIF::NO_QUEUE) {
|
||||
result = sendConfirmationRequest(event, powerConfirmation);
|
||||
if (result == RETURN_OK) {
|
||||
setFdirState(DEVICE_MIGHT_BE_OFF);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Fuse::FUSE_WENT_OFF:
|
||||
@ -133,7 +143,7 @@ void DeviceHandlerFailureIsolation::decrementFaultCounters() {
|
||||
|
||||
void DeviceHandlerFailureIsolation::handleRecovery(Event reason) {
|
||||
clearFaultCounters();
|
||||
if (!recoveryCounter.incrementAndCheck()) {
|
||||
if (not recoveryCounter.incrementAndCheck()) {
|
||||
startRecovery(reason);
|
||||
} else {
|
||||
setFaulty(reason);
|
||||
@ -142,7 +152,8 @@ void DeviceHandlerFailureIsolation::handleRecovery(Event reason) {
|
||||
|
||||
void DeviceHandlerFailureIsolation::wasParentsFault(EventMessage* event) {
|
||||
//We'll better ignore the SWITCH_WENT_OFF event and await a system-wide reset.
|
||||
//This means, no fault message will come through until a MODE_ or HEALTH_INFO message comes through -> Is that ok?
|
||||
//This means, no fault message will come through until a MODE_ or
|
||||
//HEALTH_INFO message comes through -> Is that ok?
|
||||
//Same issue in TxFailureIsolation!
|
||||
// if ((event->getEvent() == PowerSwitchIF::SWITCH_WENT_OFF)
|
||||
// && (fdirState != RECOVERY_ONGOING)) {
|
||||
@ -158,14 +169,16 @@ void DeviceHandlerFailureIsolation::clearFaultCounters() {
|
||||
ReturnValue_t DeviceHandlerFailureIsolation::initialize() {
|
||||
ReturnValue_t result = FailureIsolationBase::initialize();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "DeviceHandlerFailureIsolation::initialize: Could not"
|
||||
" initialize FailureIsolationBase." << std::endl;
|
||||
return result;
|
||||
}
|
||||
ConfirmsFailuresIF* power = objectManager->get<ConfirmsFailuresIF>(
|
||||
powerConfirmationId);
|
||||
if (power == NULL) {
|
||||
return RETURN_FAILED;
|
||||
if (power != nullptr) {
|
||||
powerConfirmation = power->getEventReceptionQueue();
|
||||
}
|
||||
powerConfirmation = power->getEventReceptionQueue();
|
||||
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
#ifndef FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
|
||||
#define FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
|
||||
#ifndef FSFW_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
|
||||
#define FSFW_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_
|
||||
|
||||
#include "../fdir/FaultCounter.h"
|
||||
#include "../fdir/FailureIsolationBase.h"
|
||||
|
||||
namespace Factory{
|
||||
void setStaticFrameworkObjectIds();
|
||||
}
|
||||
|
||||
|
||||
class DeviceHandlerFailureIsolation: public FailureIsolationBase {
|
||||
friend void (Factory::setStaticFrameworkObjectIds)();
|
||||
friend class Heater;
|
||||
@ -20,22 +20,27 @@ public:
|
||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
||||
ParameterWrapper *parameterWrapper,
|
||||
const ParameterWrapper *newValues, uint16_t startAtIndex);
|
||||
|
||||
protected:
|
||||
FaultCounter strangeReplyCount;
|
||||
FaultCounter missedReplyCount;
|
||||
FaultCounter recoveryCounter;
|
||||
|
||||
enum FDIRState {
|
||||
NONE, RECOVERY_ONGOING, DEVICE_MIGHT_BE_OFF, AWAIT_SHUTDOWN
|
||||
};
|
||||
FDIRState fdirState;
|
||||
MessageQueueId_t powerConfirmation;
|
||||
|
||||
MessageQueueId_t powerConfirmation = MessageQueueIF::NO_QUEUE;
|
||||
static object_id_t powerConfirmationId;
|
||||
static const uint32_t MAX_REBOOT = 1;
|
||||
static const uint32_t REBOOT_TIME_MS = 180000;
|
||||
static const uint32_t MAX_STRANGE_REPLIES = 10;
|
||||
static const uint32_t STRANGE_REPLIES_TIME_MS = 10000;
|
||||
static const uint32_t MAX_MISSED_REPLY_COUNT = 5;
|
||||
static const uint32_t MISSED_REPLY_TIME_MS = 10000;
|
||||
|
||||
static const uint32_t DEFAULT_MAX_REBOOT = 1;
|
||||
static const uint32_t DEFAULT_REBOOT_TIME_MS = 180000;
|
||||
static const uint32_t DEFAULT_MAX_STRANGE_REPLIES = 10;
|
||||
static const uint32_t DEFAULT_STRANGE_REPLIES_TIME_MS = 10000;
|
||||
static const uint32_t DEFAULT_MAX_MISSED_REPLY_COUNT = 5;
|
||||
static const uint32_t DEFAULT_MISSED_REPLY_TIME_MS = 10000;
|
||||
|
||||
virtual ReturnValue_t eventReceived(EventMessage* event);
|
||||
virtual void eventConfirmed(EventMessage* event);
|
||||
void wasParentsFault(EventMessage* event);
|
||||
@ -49,4 +54,4 @@ protected:
|
||||
bool isFdirInActionOrAreWeFaulty(EventMessage* event);
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_ */
|
||||
#endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERFAILUREISOLATION_H_ */
|
||||
|
@ -1,20 +0,0 @@
|
||||
/**
|
||||
* @file PollingSlot.cpp
|
||||
* @brief This file defines the PollingSlot class.
|
||||
* @date 19.12.2012
|
||||
* @author baetz
|
||||
*/
|
||||
|
||||
#include "FixedSequenceSlot.h"
|
||||
#include "../objectmanager/SystemObjectIF.h"
|
||||
#include <cstddef>
|
||||
|
||||
FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime,
|
||||
int8_t setSequenceId, PeriodicTaskIF* executingTask) :
|
||||
handler(NULL), pollingTimeMs(setTime), opcode(setSequenceId) {
|
||||
handler = objectManager->get<ExecutableObjectIF>(handlerId);
|
||||
handler->setTaskIF(executingTask);
|
||||
}
|
||||
|
||||
FixedSequenceSlot::~FixedSequenceSlot() {}
|
||||
|
@ -5,7 +5,7 @@ HealthDevice::HealthDevice(object_id_t setObjectId,
|
||||
MessageQueueId_t parentQueue) :
|
||||
SystemObject(setObjectId), lastHealth(HEALTHY), parentQueue(
|
||||
parentQueue), commandQueue(), healthHelper(this, setObjectId) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(3, CommandMessage::COMMAND_MESSAGE_SIZE);
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(3);
|
||||
}
|
||||
|
||||
HealthDevice::~HealthDevice() {
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <stdint.h>
|
||||
#include "fwSubsystemIdRanges.h"
|
||||
//could be move to more suitable location
|
||||
#include <config/tmtc/subsystemIdRanges.h>
|
||||
#include <events/subsystemIdRanges.h>
|
||||
|
||||
typedef uint16_t EventId_t;
|
||||
typedef uint8_t EventSeverity_t;
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "EventManager.h"
|
||||
#include "EventMessage.h"
|
||||
#include <FSFWConfig.h>
|
||||
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
#include "../ipc/QueueFactory.h"
|
||||
#include "../ipc/MutexFactory.h"
|
||||
@ -8,13 +10,18 @@
|
||||
const uint16_t EventManager::POOL_SIZES[N_POOLS] = {
|
||||
sizeof(EventMatchTree::Node), sizeof(EventIdRangeMatcher),
|
||||
sizeof(ReporterRangeMatcher) };
|
||||
//If one checks registerListener calls, there are around 40 (to max 50) objects registering for certain events.
|
||||
//Each listener requires 1 or 2 EventIdMatcher and 1 or 2 ReportRangeMatcher. So a good guess is 75 to a max of 100 pools required for each, which fits well.
|
||||
const uint16_t EventManager::N_ELEMENTS[N_POOLS] = { 240, 120, 120 };
|
||||
// If one checks registerListener calls, there are around 40 (to max 50)
|
||||
// objects registering for certain events.
|
||||
// Each listener requires 1 or 2 EventIdMatcher and 1 or 2 ReportRangeMatcher.
|
||||
// So a good guess is 75 to a max of 100 pools required for each, which fits well.
|
||||
const uint16_t EventManager::N_ELEMENTS[N_POOLS] = {
|
||||
fsfwconfig::FSFW_EVENTMGMR_MATCHTREE_NODES ,
|
||||
fsfwconfig::FSFW_EVENTMGMT_EVENTIDMATCHERS,
|
||||
fsfwconfig::FSFW_EVENTMGMR_RANGEMATCHERS };
|
||||
|
||||
EventManager::EventManager(object_id_t setObjectId) :
|
||||
SystemObject(setObjectId), eventReportQueue(NULL), mutex(NULL), factoryBackend(
|
||||
0, POOL_SIZES, N_ELEMENTS, false, true) {
|
||||
SystemObject(setObjectId),
|
||||
factoryBackend(0, POOL_SIZES, N_ELEMENTS, false, true) {
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
eventReportQueue = QueueFactory::instance()->createMessageQueue(
|
||||
MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE);
|
||||
@ -108,41 +115,45 @@ ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener,
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
//forward declaration, should be implemented by mission
|
||||
const char* translateObject(object_id_t object);
|
||||
const char * translateEvents(Event event);
|
||||
|
||||
void EventManager::printEvent(EventMessage* message) {
|
||||
const char *string = 0;
|
||||
switch (message->getSeverity()) {
|
||||
case SEVERITY::INFO:
|
||||
// string = translateObject(message->getReporter());
|
||||
// sif::info << "EVENT: ";
|
||||
// if (string != 0) {
|
||||
// sif::info << string;
|
||||
// } else {
|
||||
// sif::info << "0x" << std::hex << message->getReporter() << std::dec;
|
||||
// }
|
||||
// sif::info << " reported " << translateEvents(message->getEvent()) << " ("
|
||||
// << std::dec << message->getEventId() << std::hex << ") P1: 0x"
|
||||
// << message->getParameter1() << " P2: 0x"
|
||||
// << message->getParameter2() << std::dec << std::endl;
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG_INFO_EVENT
|
||||
string = translateObject(message->getReporter());
|
||||
sif::error << "EVENT: ";
|
||||
sif::info << "EVENT: ";
|
||||
if (string != 0) {
|
||||
sif::error << string;
|
||||
sif::info << string;
|
||||
} else {
|
||||
sif::error << "0x" << std::hex << message->getReporter() << std::dec;
|
||||
sif::info << "0x" << std::hex << message->getReporter() << std::dec;
|
||||
}
|
||||
sif::error << " reported " << translateEvents(message->getEvent()) << " ("
|
||||
sif::info << " reported " << translateEvents(message->getEvent()) << " ("
|
||||
<< std::dec << message->getEventId() << std::hex << ") P1: 0x"
|
||||
<< message->getParameter1() << " P2: 0x"
|
||||
<< message->getParameter2() << std::dec << std::endl;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
string = translateObject(message->getReporter());
|
||||
sif::debug << "EventManager: ";
|
||||
if (string != 0) {
|
||||
sif::debug << string;
|
||||
}
|
||||
else {
|
||||
sif::debug << "0x" << std::hex << message->getReporter() << std::dec;
|
||||
}
|
||||
sif::debug << " reported " << translateEvents(message->getEvent())
|
||||
<< " (" << std::dec << message->getEventId() << ") "
|
||||
<< std::endl;
|
||||
|
||||
sif::debug << std::hex << "P1 Hex: 0x" << message->getParameter1()
|
||||
<< ", P1 Dec: " << std::dec << message->getParameter1()
|
||||
<< std::endl;
|
||||
sif::debug << std::hex << "P2 Hex: 0x" << message->getParameter2()
|
||||
<< ", P2 Dec: " << std::dec << message->getParameter2()
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -10,6 +10,12 @@
|
||||
#include "../ipc/MutexIF.h"
|
||||
#include <map>
|
||||
|
||||
#ifdef DEBUG
|
||||
// forward declaration, should be implemented by mission
|
||||
extern const char* translateObject(object_id_t object);
|
||||
extern const char* translateEvents(Event event);
|
||||
#endif
|
||||
|
||||
class EventManager: public EventManagerIF,
|
||||
public ExecutableObjectIF,
|
||||
public SystemObject {
|
||||
@ -36,11 +42,11 @@ public:
|
||||
ReturnValue_t performOperation(uint8_t opCode);
|
||||
protected:
|
||||
|
||||
MessageQueueIF* eventReportQueue;
|
||||
MessageQueueIF* eventReportQueue = nullptr;
|
||||
|
||||
std::map<MessageQueueId_t, EventMatchTree> listenerList;
|
||||
|
||||
MutexIF* mutex;
|
||||
MutexIF* mutex = nullptr;
|
||||
|
||||
static const uint8_t N_POOLS = 3;
|
||||
LocalPool<N_POOLS> factoryBackend;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef FRAMEWORK_EVENTS_FWSUBSYSTEMIDRANGES_H_
|
||||
#define FRAMEWORK_EVENTS_FWSUBSYSTEMIDRANGES_H_
|
||||
#ifndef FSFW_EVENTS_FWSUBSYSTEMIDRANGES_H_
|
||||
#define FSFW_EVENTS_FWSUBSYSTEMIDRANGES_H_
|
||||
|
||||
namespace SUBSYSTEM_ID {
|
||||
enum {
|
||||
@ -19,10 +19,12 @@ enum {
|
||||
SYSTEM_MANAGER_1 = 75,
|
||||
SYSTEM_1 = 79,
|
||||
PUS_SERVICE_1 = 80,
|
||||
PUS_SERVICE_9 = 89,
|
||||
PUS_SERVICE_17 = 97,
|
||||
FW_SUBSYSTEM_ID_RANGE
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_EVENTS_FWSUBSYSTEMIDRANGES_H_ */
|
||||
#endif /* FSFW_EVENTS_FWSUBSYSTEMIDRANGES_H_ */
|
||||
|
@ -5,10 +5,12 @@
|
||||
#include "../ipc/QueueFactory.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
|
||||
FailureIsolationBase::FailureIsolationBase(object_id_t owner, object_id_t parent, uint8_t messageDepth, uint8_t parameterDomainBase) :
|
||||
eventQueue(NULL), ownerId(
|
||||
owner), owner(NULL), faultTreeParent(parent), parameterDomainBase(parameterDomainBase) {
|
||||
eventQueue = QueueFactory::instance()->createMessageQueue(messageDepth, EventMessage::EVENT_MESSAGE_SIZE);
|
||||
FailureIsolationBase::FailureIsolationBase(object_id_t owner,
|
||||
object_id_t parent, uint8_t messageDepth, uint8_t parameterDomainBase) :
|
||||
ownerId(owner), faultTreeParent(parent),
|
||||
parameterDomainBase(parameterDomainBase) {
|
||||
eventQueue = QueueFactory::instance()->createMessageQueue(messageDepth,
|
||||
EventMessage::EVENT_MESSAGE_SIZE);
|
||||
}
|
||||
|
||||
FailureIsolationBase::~FailureIsolationBase() {
|
||||
@ -18,27 +20,36 @@ FailureIsolationBase::~FailureIsolationBase() {
|
||||
ReturnValue_t FailureIsolationBase::initialize() {
|
||||
EventManagerIF* manager = objectManager->get<EventManagerIF>(
|
||||
objects::EVENT_MANAGER);
|
||||
if (manager == NULL) {
|
||||
if (manager == nullptr) {
|
||||
sif::error << "FailureIsolationBase::initialize: Event Manager has not"
|
||||
" been initialized!" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
ReturnValue_t result = manager->registerListener(eventQueue->getId());
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
if (ownerId != 0) {
|
||||
if (ownerId != objects::NO_OBJECT) {
|
||||
result = manager->subscribeToAllEventsFrom(eventQueue->getId(), ownerId);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
owner = objectManager->get<HasHealthIF>(ownerId);
|
||||
if (owner == NULL) {
|
||||
return RETURN_FAILED;
|
||||
if (owner == nullptr) {
|
||||
sif::error << "FailureIsolationBase::intialize: Owner object "
|
||||
"invalid. Make sure it implements HasHealthIF" << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
}
|
||||
if (faultTreeParent != 0) {
|
||||
if (faultTreeParent != objects::NO_OBJECT) {
|
||||
ConfirmsFailuresIF* parentIF = objectManager->get<ConfirmsFailuresIF>(
|
||||
faultTreeParent);
|
||||
if (parentIF == NULL) {
|
||||
if (parentIF == nullptr) {
|
||||
sif::error << "FailureIsolationBase::intialize: Parent object"
|
||||
<< "invalid." << std::endl;
|
||||
sif::error << "Make sure it implements ConfirmsFailuresIF."
|
||||
<< std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
eventQueue->setDefaultDestination(parentIF->getEventReceptionQueue());
|
||||
@ -93,9 +104,9 @@ MessageQueueId_t FailureIsolationBase::getEventReceptionQueue() {
|
||||
ReturnValue_t FailureIsolationBase::sendConfirmationRequest(EventMessage* event,
|
||||
MessageQueueId_t destination) {
|
||||
event->setMessageId(EventMessage::CONFIRMATION_REQUEST);
|
||||
if (destination != 0) {
|
||||
if (destination != MessageQueueIF::NO_QUEUE) {
|
||||
return eventQueue->sendMessage(destination, event);
|
||||
} else if (faultTreeParent != 0) {
|
||||
} else if (faultTreeParent != objects::NO_OBJECT) {
|
||||
return eventQueue->sendToDefault(event);
|
||||
}
|
||||
return RETURN_FAILED;
|
||||
|
@ -17,18 +17,25 @@ public:
|
||||
static const Event FDIR_CHANGED_STATE = MAKE_EVENT(1, SEVERITY::INFO); //!< FDIR has an internal state, which changed from par2 (oldState) to par1 (newState).
|
||||
static const Event FDIR_STARTS_RECOVERY = MAKE_EVENT(2, SEVERITY::MEDIUM); //!< FDIR tries to restart device. Par1: event that caused recovery.
|
||||
static const Event FDIR_TURNS_OFF_DEVICE = MAKE_EVENT(3, SEVERITY::MEDIUM); //!< FDIR turns off device. Par1: event that caused recovery.
|
||||
FailureIsolationBase(object_id_t owner, object_id_t parent = 0,
|
||||
|
||||
FailureIsolationBase(object_id_t owner,
|
||||
object_id_t parent = objects::NO_OBJECT,
|
||||
uint8_t messageDepth = 10, uint8_t parameterDomainBase = 0xF0);
|
||||
|
||||
virtual ~FailureIsolationBase();
|
||||
virtual ReturnValue_t initialize();
|
||||
|
||||
/**
|
||||
* This is called by the DHB in performOperation()
|
||||
*/
|
||||
void checkForFailures();
|
||||
MessageQueueId_t getEventReceptionQueue();
|
||||
MessageQueueId_t getEventReceptionQueue() override;
|
||||
virtual void triggerEvent(Event event, uint32_t parameter1 = 0,
|
||||
uint32_t parameter2 = 0);
|
||||
protected:
|
||||
MessageQueueIF* eventQueue;
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
object_id_t ownerId;
|
||||
HasHealthIF* owner;
|
||||
HasHealthIF* owner = nullptr;
|
||||
object_id_t faultTreeParent;
|
||||
uint8_t parameterDomainBase;
|
||||
void setOwnerHealth(HasHealthIF::HealthState health);
|
||||
@ -38,7 +45,7 @@ protected:
|
||||
virtual ReturnValue_t confirmFault(EventMessage* event);
|
||||
virtual void decrementFaultCounters() = 0;
|
||||
ReturnValue_t sendConfirmationRequest(EventMessage* event,
|
||||
MessageQueueId_t destination = 0);
|
||||
MessageQueueId_t destination = MessageQueueIF::NO_QUEUE);
|
||||
void throwFdirEvent(Event event, uint32_t parameter1 = 0,
|
||||
uint32_t parameter2 = 0);
|
||||
private:
|
||||
|
13
fsfw.mk
13
fsfw.mk
@ -28,12 +28,25 @@ CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/*.cpp)
|
||||
# select the OS
|
||||
ifeq ($(OS_FSFW),rtems)
|
||||
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/rtems/*.cpp)
|
||||
|
||||
else ifeq ($(OS_FSFW),linux)
|
||||
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/linux/*.cpp)
|
||||
|
||||
else ifeq ($(OS_FSFW),freeRTOS)
|
||||
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/FreeRTOS/*.cpp)
|
||||
|
||||
else ifeq ($(OS_FSFW),host)
|
||||
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/host/*.cpp)
|
||||
ifeq ($(OS),Windows_NT)
|
||||
CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/windows/*.cpp)
|
||||
else
|
||||
# For now, the linux UDP bridge sources needs to be included manually by upper makefile
|
||||
# for host OS because we can't be sure the OS is linux.
|
||||
# Following lines can be used to do this:
|
||||
# CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TcUnixUdpPollingTask.cpp
|
||||
# CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TmTcUnixUdpBridge.cpp
|
||||
endif
|
||||
|
||||
else
|
||||
$(error invalid OS_FSFW specified, valid OS_FSFW are rtems, linux, freeRTOS, host)
|
||||
endif
|
||||
|
@ -1,95 +1,124 @@
|
||||
#include "DleEncoder.h"
|
||||
#include "../globalfunctions/DleEncoder.h"
|
||||
|
||||
DleEncoder::DleEncoder() {
|
||||
}
|
||||
DleEncoder::DleEncoder() {}
|
||||
|
||||
DleEncoder::~DleEncoder() {
|
||||
DleEncoder::~DleEncoder() {}
|
||||
|
||||
ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream,
|
||||
size_t sourceLen, uint8_t* destStream, size_t maxDestLen,
|
||||
size_t* encodedLen, bool addStxEtx) {
|
||||
if (maxDestLen < 2) {
|
||||
return STREAM_TOO_SHORT;
|
||||
}
|
||||
size_t encodedIndex = 0, sourceIndex = 0;
|
||||
uint8_t nextByte;
|
||||
if (addStxEtx) {
|
||||
destStream[0] = STX_CHAR;
|
||||
++encodedIndex;
|
||||
}
|
||||
|
||||
while (encodedIndex < maxDestLen and sourceIndex < sourceLen)
|
||||
{
|
||||
nextByte = sourceStream[sourceIndex];
|
||||
// STX, ETX and CR characters in the stream need to be escaped with DLE
|
||||
if (nextByte == STX_CHAR or nextByte == ETX_CHAR or nextByte == CARRIAGE_RETURN) {
|
||||
if (encodedIndex + 1 >= maxDestLen) {
|
||||
return STREAM_TOO_SHORT;
|
||||
}
|
||||
else {
|
||||
destStream[encodedIndex] = DLE_CHAR;
|
||||
++encodedIndex;
|
||||
/* Escaped byte will be actual byte + 0x40. This prevents
|
||||
* STX, ETX, and carriage return characters from appearing
|
||||
* in the encoded data stream at all, so when polling an
|
||||
* encoded stream, the transmission can be stopped at ETX.
|
||||
* 0x40 was chosen at random with special requirements:
|
||||
* - Prevent going from one control char to another
|
||||
* - Prevent overflow for common characters */
|
||||
destStream[encodedIndex] = nextByte + 0x40;
|
||||
}
|
||||
}
|
||||
// DLE characters are simply escaped with DLE.
|
||||
else if (nextByte == DLE_CHAR) {
|
||||
if (encodedIndex + 1 >= maxDestLen) {
|
||||
return STREAM_TOO_SHORT;
|
||||
}
|
||||
else {
|
||||
destStream[encodedIndex] = DLE_CHAR;
|
||||
++encodedIndex;
|
||||
destStream[encodedIndex] = DLE_CHAR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
destStream[encodedIndex] = nextByte;
|
||||
}
|
||||
++encodedIndex;
|
||||
++sourceIndex;
|
||||
}
|
||||
|
||||
if (sourceIndex == sourceLen and encodedIndex < maxDestLen) {
|
||||
if (addStxEtx) {
|
||||
destStream[encodedIndex] = ETX_CHAR;
|
||||
++encodedIndex;
|
||||
}
|
||||
*encodedLen = encodedIndex;
|
||||
return RETURN_OK;
|
||||
}
|
||||
else {
|
||||
return STREAM_TOO_SHORT;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t DleEncoder::decode(const uint8_t *sourceStream,
|
||||
uint32_t sourceStreamLen, uint32_t *readLen, uint8_t *destStream,
|
||||
uint32_t maxDestStreamlen, uint32_t *decodedLen) {
|
||||
uint32_t encodedIndex = 0, decodedIndex = 0;
|
||||
size_t sourceStreamLen, size_t *readLen, uint8_t *destStream,
|
||||
size_t maxDestStreamlen, size_t *decodedLen) {
|
||||
size_t encodedIndex = 0, decodedIndex = 0;
|
||||
uint8_t nextByte;
|
||||
if (*sourceStream != STX) {
|
||||
return RETURN_FAILED;
|
||||
if (*sourceStream != STX_CHAR) {
|
||||
return DECODING_ERROR;
|
||||
}
|
||||
++encodedIndex;
|
||||
|
||||
while ((encodedIndex < sourceStreamLen) && (decodedIndex < maxDestStreamlen)
|
||||
&& (sourceStream[encodedIndex] != ETX)
|
||||
&& (sourceStream[encodedIndex] != STX)) {
|
||||
if (sourceStream[encodedIndex] == DLE) {
|
||||
&& (sourceStream[encodedIndex] != ETX_CHAR)
|
||||
&& (sourceStream[encodedIndex] != STX_CHAR)) {
|
||||
if (sourceStream[encodedIndex] == DLE_CHAR) {
|
||||
nextByte = sourceStream[encodedIndex + 1];
|
||||
if (nextByte == 0x10) {
|
||||
// The next byte is a DLE character that was escaped by another
|
||||
// DLE character, so we can write it to the destination stream.
|
||||
if (nextByte == DLE_CHAR) {
|
||||
destStream[decodedIndex] = nextByte;
|
||||
} else {
|
||||
if ((nextByte == 0x42) || (nextByte == 0x43)
|
||||
|| (nextByte == 0x4D)) {
|
||||
}
|
||||
else {
|
||||
/* The next byte is a STX, DTX or 0x0D character which
|
||||
* was escaped by a DLE character. The actual byte was
|
||||
* also encoded by adding + 0x40 to prevent having control chars,
|
||||
* in the stream at all, so we convert it back. */
|
||||
if (nextByte == 0x42 or nextByte == 0x43 or nextByte == 0x4D) {
|
||||
destStream[decodedIndex] = nextByte - 0x40;
|
||||
} else {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
else {
|
||||
return DECODING_ERROR;
|
||||
}
|
||||
}
|
||||
++encodedIndex;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
destStream[decodedIndex] = sourceStream[encodedIndex];
|
||||
}
|
||||
|
||||
++encodedIndex;
|
||||
++decodedIndex;
|
||||
}
|
||||
if (sourceStream[encodedIndex] != ETX) {
|
||||
return RETURN_FAILED;
|
||||
} else {
|
||||
|
||||
if (sourceStream[encodedIndex] != ETX_CHAR) {
|
||||
*readLen = ++encodedIndex;
|
||||
return DECODING_ERROR;
|
||||
}
|
||||
else {
|
||||
*readLen = ++encodedIndex;
|
||||
*decodedLen = decodedIndex;
|
||||
return RETURN_OK;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream,
|
||||
uint32_t sourceLen, uint8_t* destStream, uint32_t maxDestLen,
|
||||
uint32_t* encodedLen, bool addStxEtx) {
|
||||
if (maxDestLen < 2) {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
uint32_t encodedIndex = 0, sourceIndex = 0;
|
||||
uint8_t nextByte;
|
||||
if (addStxEtx) {
|
||||
destStream[0] = STX;
|
||||
++encodedIndex;
|
||||
}
|
||||
while ((encodedIndex < maxDestLen) && (sourceIndex < sourceLen)) {
|
||||
nextByte = sourceStream[sourceIndex];
|
||||
if ((nextByte == STX) || (nextByte == ETX) || (nextByte == 0x0D)) {
|
||||
if (encodedIndex + 1 >= maxDestLen) {
|
||||
return RETURN_FAILED;
|
||||
} else {
|
||||
destStream[encodedIndex] = DLE;
|
||||
++encodedIndex;
|
||||
destStream[encodedIndex] = nextByte + 0x40;
|
||||
}
|
||||
} else if (nextByte == DLE) {
|
||||
if (encodedIndex + 1 >= maxDestLen) {
|
||||
return RETURN_FAILED;
|
||||
} else {
|
||||
destStream[encodedIndex] = DLE;
|
||||
++encodedIndex;
|
||||
destStream[encodedIndex] = DLE;
|
||||
}
|
||||
} else {
|
||||
destStream[encodedIndex] = nextByte;
|
||||
}
|
||||
++encodedIndex;
|
||||
++sourceIndex;
|
||||
}
|
||||
if ((sourceIndex == sourceLen) && (encodedIndex < maxDestLen)) {
|
||||
if (addStxEtx) {
|
||||
destStream[encodedIndex] = ETX;
|
||||
++encodedIndex;
|
||||
}
|
||||
*encodedLen = encodedIndex;
|
||||
return RETURN_OK;
|
||||
} else {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,79 @@
|
||||
#ifndef DLEENCODER_H_
|
||||
#define DLEENCODER_H_
|
||||
#ifndef FRAMEWORK_GLOBALFUNCTIONS_DLEENCODER_H_
|
||||
#define FRAMEWORK_GLOBALFUNCTIONS_DLEENCODER_H_
|
||||
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include <cstddef>
|
||||
|
||||
/**
|
||||
* @brief This DLE Encoder (Data Link Encoder) can be used to encode and
|
||||
* decode arbitrary data with ASCII control characters
|
||||
* @details
|
||||
* List of control codes:
|
||||
* https://en.wikipedia.org/wiki/C0_and_C1_control_codes
|
||||
*
|
||||
* This encoder can be used to achieve a basic transport layer when using
|
||||
* char based transmission systems.
|
||||
* The passed source strean is converted into a encoded stream by adding
|
||||
* a STX marker at the start of the stream and an ETX marker at the end of
|
||||
* the stream. Any STX, ETX, DLE and CR occurrences in the source stream are
|
||||
* escaped by a DLE character. The encoder also replaces escaped control chars
|
||||
* by another char, so STX, ETX and CR should not appear anywhere in the actual
|
||||
* encoded data stream.
|
||||
*
|
||||
* When using a strictly char based reception of packets encoded with DLE,
|
||||
* STX can be used to notify a reader that actual data will start to arrive
|
||||
* while ETX can be used to notify the reader that the data has ended.
|
||||
*/
|
||||
class DleEncoder: public HasReturnvaluesIF {
|
||||
private:
|
||||
DleEncoder();
|
||||
virtual ~DleEncoder();
|
||||
|
||||
public:
|
||||
static const uint8_t STX = 0x02;
|
||||
static const uint8_t ETX = 0x03;
|
||||
static const uint8_t DLE = 0x10;
|
||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::DLE_ENCODER;
|
||||
static constexpr ReturnValue_t STREAM_TOO_SHORT = MAKE_RETURN_CODE(0x01);
|
||||
static constexpr ReturnValue_t DECODING_ERROR = MAKE_RETURN_CODE(0x02);
|
||||
|
||||
//! Start Of Text character. First character is encoded stream
|
||||
static constexpr uint8_t STX_CHAR = 0x02;
|
||||
//! End Of Text character. Last character in encoded stream
|
||||
static constexpr uint8_t ETX_CHAR = 0x03;
|
||||
//! Data Link Escape character. Used to escape STX, ETX and DLE occurrences
|
||||
//! in the source stream.
|
||||
static constexpr uint8_t DLE_CHAR = 0x10;
|
||||
static constexpr uint8_t CARRIAGE_RETURN = 0x0D;
|
||||
|
||||
/**
|
||||
* Encodes the give data stream by preceding it with the STX marker
|
||||
* and ending it with an ETX marker. STX, ETX and DLE characters inside
|
||||
* the stream are escaped by DLE characters and also replaced by adding
|
||||
* 0x40 (which is reverted in the decoding process).
|
||||
* @param sourceStream
|
||||
* @param sourceLen
|
||||
* @param destStream
|
||||
* @param maxDestLen
|
||||
* @param encodedLen
|
||||
* @param addStxEtx
|
||||
* Adding STX and ETX can be omitted, if they are added manually.
|
||||
* @return
|
||||
*/
|
||||
static ReturnValue_t encode(const uint8_t *sourceStream, size_t sourceLen,
|
||||
uint8_t *destStream, size_t maxDestLen, size_t *encodedLen,
|
||||
bool addStxEtx = true);
|
||||
|
||||
/**
|
||||
* Converts an encoded stream back.
|
||||
* @param sourceStream
|
||||
* @param sourceStreamLen
|
||||
* @param readLen
|
||||
* @param destStream
|
||||
* @param maxDestStreamlen
|
||||
* @param decodedLen
|
||||
* @return
|
||||
*/
|
||||
static ReturnValue_t decode(const uint8_t *sourceStream,
|
||||
uint32_t sourceStreamLen, uint32_t *readLen, uint8_t *destStream,
|
||||
uint32_t maxDestStreamlen, uint32_t *decodedLen);
|
||||
|
||||
static ReturnValue_t encode(const uint8_t *sourceStream, uint32_t sourceLen,
|
||||
uint8_t *destStream, uint32_t maxDestLen, uint32_t *encodedLen,
|
||||
bool addStxEtx = true);
|
||||
size_t sourceStreamLen, size_t *readLen, uint8_t *destStream,
|
||||
size_t maxDestStreamlen, size_t *decodedLen);
|
||||
};
|
||||
|
||||
#endif /* DLEENCODER_H_ */
|
||||
#endif /* FRAMEWORK_GLOBALFUNCTIONS_DLEENCODER_H_ */
|
||||
|
34
globalfunctions/PeriodicOperationDivider.cpp
Normal file
34
globalfunctions/PeriodicOperationDivider.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
#include "PeriodicOperationDivider.h"
|
||||
|
||||
|
||||
PeriodicOperationDivider::PeriodicOperationDivider(uint32_t divider,
|
||||
bool resetAutomatically): resetAutomatically(resetAutomatically),
|
||||
counter(divider), divider(divider) {
|
||||
}
|
||||
|
||||
bool PeriodicOperationDivider::checkAndIncrement() {
|
||||
if(counter >= divider) {
|
||||
if(resetAutomatically) {
|
||||
counter = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
counter ++;
|
||||
return false;
|
||||
}
|
||||
|
||||
void PeriodicOperationDivider::resetCounter() {
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
void PeriodicOperationDivider::setDivider(uint32_t newDivider) {
|
||||
divider = newDivider;
|
||||
}
|
||||
|
||||
uint32_t PeriodicOperationDivider::getCounter() const {
|
||||
return counter;
|
||||
}
|
||||
|
||||
uint32_t PeriodicOperationDivider::getDivider() const {
|
||||
return divider;
|
||||
}
|
55
globalfunctions/PeriodicOperationDivider.h
Normal file
55
globalfunctions/PeriodicOperationDivider.h
Normal file
@ -0,0 +1,55 @@
|
||||
#ifndef FSFW_GLOBALFUNCTIONS_PERIODICOPERATIONDIVIDER_H_
|
||||
#define FSFW_GLOBALFUNCTIONS_PERIODICOPERATIONDIVIDER_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* @brief Lightweight helper class to facilitate periodic operation with
|
||||
* decreased frequencies.
|
||||
* @details
|
||||
* This class is useful to perform operations which have to be performed
|
||||
* with a reduced frequency, like debugging printouts in high periodic tasks
|
||||
* or low priority operations.
|
||||
*/
|
||||
class PeriodicOperationDivider {
|
||||
public:
|
||||
/**
|
||||
* Initialize with the desired divider and specify whether the internal
|
||||
* counter will be reset automatically.
|
||||
* @param divider
|
||||
* @param resetAutomatically
|
||||
*/
|
||||
PeriodicOperationDivider(uint32_t divider, bool resetAutomatically = true);
|
||||
|
||||
/**
|
||||
* Check whether operation is necessary.
|
||||
* If an operation is necessary and the class has been
|
||||
* configured to be reset automatically, the counter will be reset.
|
||||
* If not, the counter will be incremented.
|
||||
* @return
|
||||
* -@c true if the counter is larger or equal to the divider
|
||||
* -@c false otherwise
|
||||
*/
|
||||
bool checkAndIncrement();
|
||||
|
||||
/**
|
||||
* Can be used to reset the counter to 0 manually.
|
||||
*/
|
||||
void resetCounter();
|
||||
uint32_t getCounter() const;
|
||||
|
||||
/**
|
||||
* Can be used to set a new divider value.
|
||||
* @param newDivider
|
||||
*/
|
||||
void setDivider(uint32_t newDivider);
|
||||
uint32_t getDivider() const;
|
||||
private:
|
||||
bool resetAutomatically = true;
|
||||
uint32_t counter = 0;
|
||||
uint32_t divider = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* FSFW_GLOBALFUNCTIONS_PERIODICOPERATIONDIVIDER_H_ */
|
@ -90,3 +90,10 @@ double timevalOperations::toDouble(const timeval timeval) {
|
||||
double result = timeval.tv_sec * 1000000. + timeval.tv_usec;
|
||||
return result / 1000000.;
|
||||
}
|
||||
|
||||
timeval timevalOperations::toTimeval(const double seconds) {
|
||||
timeval tval;
|
||||
tval.tv_sec = seconds;
|
||||
tval.tv_usec = seconds *(double) 1e6 - (tval.tv_sec *1e6);
|
||||
return tval;
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ namespace timevalOperations {
|
||||
* @return seconds
|
||||
*/
|
||||
double toDouble(const timeval timeval);
|
||||
timeval toTimeval(const double seconds);
|
||||
}
|
||||
|
||||
#endif /* TIMEVALOPERATIONS_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef HASHEALTHIF_H_
|
||||
#define HASHEALTHIF_H_
|
||||
#ifndef FSFW_HEALTH_HASHEALTHIF_H_
|
||||
#define FSFW_HEALTH_HASHEALTHIF_H_
|
||||
|
||||
#include "../events/Event.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
@ -8,9 +8,13 @@
|
||||
class HasHealthIF {
|
||||
public:
|
||||
|
||||
typedef enum {
|
||||
HEALTHY = 1, FAULTY = 0, EXTERNAL_CONTROL = 2, NEEDS_RECOVERY = 3, PERMANENT_FAULTY = 4
|
||||
} HealthState;
|
||||
enum HealthState: uint8_t {
|
||||
HEALTHY = 1,
|
||||
FAULTY = 0,
|
||||
EXTERNAL_CONTROL = 2,
|
||||
NEEDS_RECOVERY = 3,
|
||||
PERMANENT_FAULTY = 4
|
||||
};
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::HAS_HEALTH_IF;
|
||||
static const ReturnValue_t OBJECT_NOT_HEALTHY = MAKE_RETURN_CODE(1);
|
||||
@ -31,20 +35,17 @@ public:
|
||||
virtual MessageQueueId_t getCommandQueue() const = 0;
|
||||
|
||||
/**
|
||||
* set the Health State
|
||||
*
|
||||
* @brief Set the Health State
|
||||
* The parent will be informed, if the Health changes
|
||||
*
|
||||
* @param health
|
||||
*/
|
||||
virtual ReturnValue_t setHealth(HealthState health) = 0;
|
||||
|
||||
/**
|
||||
* get Health State
|
||||
*
|
||||
* @return Health State of the object
|
||||
* @brief Get Health State
|
||||
* @return Health State of the object
|
||||
*/
|
||||
virtual HasHealthIF::HealthState getHealth() = 0;
|
||||
};
|
||||
|
||||
#endif /* HASHEALTHIF_H_ */
|
||||
#endif /* FSFW_HEALTH_HASHEALTHIF_H_ */
|
||||
|
@ -1,9 +1,8 @@
|
||||
#include "HealthHelper.h"
|
||||
#include "../ipc/MessageQueueSenderIF.h"
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId) :
|
||||
healthTable(NULL), eventSender(NULL), objectId(objectId), parentQueue(
|
||||
0), owner(owner) {
|
||||
objectId(objectId), owner(owner) {
|
||||
}
|
||||
|
||||
HealthHelper::~HealthHelper() {
|
||||
@ -40,9 +39,19 @@ void HealthHelper::setParentQueue(MessageQueueId_t parentQueue) {
|
||||
ReturnValue_t HealthHelper::initialize() {
|
||||
healthTable = objectManager->get<HealthTableIF>(objects::HEALTH_TABLE);
|
||||
eventSender = objectManager->get<EventReportingProxyIF>(objectId);
|
||||
if ((healthTable == NULL) || eventSender == NULL) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
|
||||
if (healthTable == nullptr) {
|
||||
sif::error << "HealthHelper::initialize: Health table object needs"
|
||||
"to be created in factory." << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
if(eventSender == nullptr) {
|
||||
sif::error << "HealthHelper::initialize: Owner has to implement "
|
||||
"ReportingProxyIF." << std::endl;
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
ReturnValue_t result = healthTable->registerObject(objectId,
|
||||
HasHealthIF::HEALTHY);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -62,22 +71,22 @@ void HealthHelper::setHealth(HasHealthIF::HealthState health) {
|
||||
|
||||
void HealthHelper::informParent(HasHealthIF::HealthState health,
|
||||
HasHealthIF::HealthState oldHealth) {
|
||||
if (parentQueue == 0) {
|
||||
if (parentQueue == MessageQueueIF::NO_QUEUE) {
|
||||
return;
|
||||
}
|
||||
CommandMessage message;
|
||||
HealthMessage::setHealthMessage(&message, HealthMessage::HEALTH_INFO,
|
||||
CommandMessage information;
|
||||
HealthMessage::setHealthMessage(&information, HealthMessage::HEALTH_INFO,
|
||||
health, oldHealth);
|
||||
if (MessageQueueSenderIF::sendMessage(parentQueue, &message,
|
||||
owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (MessageQueueSenderIF::sendMessage(parentQueue, &information,
|
||||
owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::debug << "HealthHelper::informParent: sending health reply failed."
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void HealthHelper::handleSetHealthCommand(CommandMessage* message) {
|
||||
ReturnValue_t result = owner->setHealth(HealthMessage::getHealth(message));
|
||||
if (message->getSender() == 0) {
|
||||
void HealthHelper::handleSetHealthCommand(CommandMessage* command) {
|
||||
ReturnValue_t result = owner->setHealth(HealthMessage::getHealth(command));
|
||||
if (command->getSender() == MessageQueueIF::NO_QUEUE) {
|
||||
return;
|
||||
}
|
||||
CommandMessage reply;
|
||||
@ -85,12 +94,12 @@ void HealthHelper::handleSetHealthCommand(CommandMessage* message) {
|
||||
HealthMessage::setHealthMessage(&reply,
|
||||
HealthMessage::REPLY_HEALTH_SET);
|
||||
} else {
|
||||
reply.setReplyRejected(result, message->getCommand());
|
||||
reply.setReplyRejected(result, command->getCommand());
|
||||
}
|
||||
if (MessageQueueSenderIF::sendMessage(message->getSender(), &reply,
|
||||
owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::debug
|
||||
<< "HealthHelper::handleHealthCommand: sending health reply failed."
|
||||
<< std::endl;
|
||||
if (MessageQueueSenderIF::sendMessage(command->getSender(), &reply,
|
||||
owner->getCommandQueue()) != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::debug << "HealthHelper::handleHealthCommand: sending health "
|
||||
"reply failed." << std::endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,26 @@
|
||||
#ifndef HEALTHHELPER_H_
|
||||
#define HEALTHHELPER_H_
|
||||
#ifndef FSFW_HEALTH_HEALTHHELPER_H_
|
||||
#define FSFW_HEALTH_HEALTHHELPER_H_
|
||||
|
||||
#include "../events/EventManagerIF.h"
|
||||
#include "../events/EventReportingProxyIF.h"
|
||||
#include "HasHealthIF.h"
|
||||
#include "HealthMessage.h"
|
||||
#include "HealthTableIF.h"
|
||||
|
||||
#include "../events/EventManagerIF.h"
|
||||
#include "../events/EventReportingProxyIF.h"
|
||||
#include "../ipc/MessageQueueIF.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
/**
|
||||
* Helper class for Objects that implement HasHealthIF
|
||||
* @brief Helper class for Objects that implement HasHealthIF
|
||||
* @details
|
||||
* It takes care of registering with the Health Table as well as handling
|
||||
* health commands (including replying to the sender) and updating
|
||||
* the Health Table.
|
||||
*
|
||||
* It takes care of registering with the Health Table as well as handling health commands
|
||||
* (including replying to the sender) and updating the Health Table.
|
||||
*
|
||||
* If a parent is set in the ctor, the parent will be informed with a @c HEALTH_INFO message
|
||||
* about changes in the health state. Note that a @c HEALTH_INFO is only generated if the Health
|
||||
* If a parent is set in the ctor, the parent will be informed with a
|
||||
* @c HEALTH_INFO message about changes in the health state.
|
||||
* Note that a @c HEALTH_INFO is only generated if the Health
|
||||
* changes, not for all @c HEALTH_SET commands received.
|
||||
*
|
||||
* It does NOT handle @c HEALTH_INFO messages
|
||||
@ -25,10 +29,9 @@ class HealthHelper {
|
||||
public:
|
||||
|
||||
/**
|
||||
* ctor
|
||||
*
|
||||
* @param objectId the object Id to use when communication with the HealthTable
|
||||
* @param useAsFrom id to use as from id when sending replies, can be set to 0
|
||||
* @param owner
|
||||
* @param objectId The object Id to use when communication with
|
||||
* the HealthTable
|
||||
*/
|
||||
HealthHelper(HasHealthIF* owner, object_id_t objectId);
|
||||
|
||||
@ -39,12 +42,12 @@ public:
|
||||
*
|
||||
* only valid after initialize() has been called
|
||||
*/
|
||||
HealthTableIF *healthTable;
|
||||
HealthTableIF *healthTable = nullptr;
|
||||
|
||||
/**
|
||||
* Proxy to forward events.
|
||||
*/
|
||||
EventReportingProxyIF* eventSender;
|
||||
EventReportingProxyIF* eventSender = nullptr;
|
||||
|
||||
/**
|
||||
* Try to handle the message.
|
||||
@ -54,8 +57,9 @@ public:
|
||||
*
|
||||
* @param message
|
||||
* @return
|
||||
* -@c RETURN_OK if the message was handled
|
||||
* -@c RETURN_FAILED if the message could not be handled (ie it was not a @c HEALTH_SET or @c HEALTH_READ message)
|
||||
* -@c RETURN_OK if the message was handled
|
||||
* -@c RETURN_FAILED if the message could not be handled
|
||||
* (ie it was not a @c HEALTH_SET or @c HEALTH_READ message)
|
||||
*/
|
||||
ReturnValue_t handleHealthCommand(CommandMessage *message);
|
||||
|
||||
@ -76,16 +80,19 @@ public:
|
||||
HasHealthIF::HealthState getHealth();
|
||||
|
||||
/**
|
||||
* @param parentQueue the Queue id of the parent object. Set to 0 if no parent present
|
||||
* @param parentQueue The queue ID of the parent object.
|
||||
* Set to 0 if no parent present
|
||||
*/
|
||||
void setParentQueue(MessageQueueId_t parentQueue);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parentQueue the Queue id of the parent object. Set to 0 if no parent present
|
||||
* @param parentQueue The queue ID of the parent object.
|
||||
* Set to 0 if no parent present
|
||||
* @return
|
||||
* -@c RETURN_OK if the Health Table was found and the object could be registered
|
||||
* -@c RETURN_FAILED else
|
||||
* -@c RETURN_OK if the Health Table was found and the object
|
||||
* could be registered
|
||||
* -@c RETURN_FAILED else
|
||||
*/
|
||||
ReturnValue_t initialize(MessageQueueId_t parentQueue );
|
||||
|
||||
@ -100,7 +107,7 @@ private:
|
||||
/**
|
||||
* The Queue of the parent
|
||||
*/
|
||||
MessageQueueId_t parentQueue;
|
||||
MessageQueueId_t parentQueue = MessageQueueIF::NO_QUEUE;
|
||||
|
||||
/**
|
||||
* The one using the healthHelper.
|
||||
@ -108,13 +115,17 @@ private:
|
||||
HasHealthIF* owner;
|
||||
|
||||
/**
|
||||
* if the #parentQueue is not NULL, a @c HEALTH_INFO message will be sent to this queue
|
||||
* @param health the health is passed as parameter so that the number of calls to the health table can be minimized
|
||||
* if the #parentQueue is not NULL, a @c HEALTH_INFO message
|
||||
* will be sent to this queue
|
||||
* @param health
|
||||
* The health is passed as parameter so that the number of
|
||||
* calls to the health table can be minimized
|
||||
* @param oldHealth information of the previous health state.
|
||||
*/
|
||||
void informParent(HasHealthIF::HealthState health, HasHealthIF::HealthState oldHealth);
|
||||
void informParent(HasHealthIF::HealthState health,
|
||||
HasHealthIF::HealthState oldHealth);
|
||||
|
||||
void handleSetHealthCommand(CommandMessage *message);
|
||||
};
|
||||
|
||||
#endif /* HEALTHHELPER_H_ */
|
||||
#endif /* FSFW_HEALTH_HEALTHHELPER_H_ */
|
||||
|
@ -7,11 +7,13 @@ void HealthMessage::setHealthMessage(CommandMessage* message, Command_t command,
|
||||
message->setParameter2(oldHealth);
|
||||
}
|
||||
|
||||
void HealthMessage::setHealthMessage(CommandMessage* message, Command_t command) {
|
||||
void HealthMessage::setHealthMessage(CommandMessage* message,
|
||||
Command_t command) {
|
||||
message->setCommand(command);
|
||||
}
|
||||
|
||||
HasHealthIF::HealthState HealthMessage::getHealth(const CommandMessage* message) {
|
||||
HasHealthIF::HealthState HealthMessage::getHealth(
|
||||
const CommandMessage* message) {
|
||||
return (HasHealthIF::HealthState) message->getParameter();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef HEALTHMESSAGE_H_
|
||||
#define HEALTHMESSAGE_H_
|
||||
#ifndef FSFW_HEALTH_HEALTHMESSAGE_H_
|
||||
#define FSFW_HEALTH_HEALTHMESSAGE_H_
|
||||
|
||||
#include "HasHealthIF.h"
|
||||
#include "../ipc/CommandMessage.h"
|
||||
@ -7,14 +7,20 @@
|
||||
class HealthMessage {
|
||||
public:
|
||||
static const uint8_t MESSAGE_ID = messagetypes::HEALTH_COMMAND;
|
||||
static const Command_t HEALTH_SET = MAKE_COMMAND_ID(1);//REPLY_COMMAND_OK/REPLY_REJECTED
|
||||
static const Command_t HEALTH_ANNOUNCE = MAKE_COMMAND_ID(3); //NO REPLY!
|
||||
|
||||
static const Command_t HEALTH_SET = MAKE_COMMAND_ID(1);
|
||||
// No reply expected, health will be announced as event!
|
||||
static const Command_t HEALTH_ANNOUNCE = MAKE_COMMAND_ID(2);
|
||||
// Same as before, but all objects in health table will
|
||||
// announce their health as events.
|
||||
static const Command_t HEALTH_ANNOUNCE_ALL = MAKE_COMMAND_ID(3);
|
||||
|
||||
static const Command_t HEALTH_INFO = MAKE_COMMAND_ID(5);
|
||||
static const Command_t REPLY_HEALTH_SET = MAKE_COMMAND_ID(6);
|
||||
|
||||
static void setHealthMessage(CommandMessage *message, Command_t command,
|
||||
HasHealthIF::HealthState health, HasHealthIF::HealthState oldHealth = HasHealthIF::FAULTY);
|
||||
|
||||
HasHealthIF::HealthState health,
|
||||
HasHealthIF::HealthState oldHealth = HasHealthIF::FAULTY);
|
||||
static void setHealthMessage(CommandMessage *message, Command_t command);
|
||||
|
||||
static HasHealthIF::HealthState getHealth(const CommandMessage *message);
|
||||
@ -27,4 +33,4 @@ private:
|
||||
HealthMessage();
|
||||
};
|
||||
|
||||
#endif /* HEALTHMESSAGE_H_ */
|
||||
#endif /* FSFW_HEALTH_HEALTHMESSAGE_H_ */
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "HealthTable.h"
|
||||
#include "../serialize/SerializeAdapter.h"
|
||||
#include "../ipc/MutexHelper.h"
|
||||
#include "../ipc/MutexFactory.h"
|
||||
#include "../serialize/SerializeAdapter.h"
|
||||
|
||||
HealthTable::HealthTable(object_id_t objectid) :
|
||||
SystemObject(objectid) {
|
||||
@ -9,6 +10,12 @@ HealthTable::HealthTable(object_id_t objectid) :
|
||||
mapIterator = healthMap.begin();
|
||||
}
|
||||
|
||||
void HealthTable::setMutexTimeout(MutexIF::TimeoutType timeoutType,
|
||||
uint32_t timeoutMs) {
|
||||
this->timeoutType = timeoutType;
|
||||
this->mutexTimeoutMs = timeoutMs;
|
||||
}
|
||||
|
||||
HealthTable::~HealthTable() {
|
||||
MutexFactory::instance()->deleteMutex(mutex);
|
||||
}
|
||||
@ -18,74 +25,63 @@ ReturnValue_t HealthTable::registerObject(object_id_t object,
|
||||
if (healthMap.count(object) != 0) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
healthMap.insert(
|
||||
std::pair<object_id_t, HasHealthIF::HealthState>(object,
|
||||
initilialState));
|
||||
healthMap.emplace(object, initilialState);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void HealthTable::setHealth(object_id_t object,
|
||||
HasHealthIF::HealthState newState) {
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
MutexHelper(mutex, timeoutType, mutexTimeoutMs);
|
||||
HealthMap::iterator iter = healthMap.find(object);
|
||||
if (iter != healthMap.end()) {
|
||||
iter->second = newState;
|
||||
}
|
||||
mutex->unlockMutex();
|
||||
}
|
||||
|
||||
HasHealthIF::HealthState HealthTable::getHealth(object_id_t object) {
|
||||
HasHealthIF::HealthState state = HasHealthIF::HEALTHY;
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
MutexHelper(mutex, timeoutType, mutexTimeoutMs);
|
||||
HealthMap::iterator iter = healthMap.find(object);
|
||||
if (iter != healthMap.end()) {
|
||||
state = iter->second;
|
||||
}
|
||||
mutex->unlockMutex();
|
||||
return state;
|
||||
}
|
||||
|
||||
uint32_t HealthTable::getPrintSize() {
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
uint32_t size = healthMap.size() * 5 + 2;
|
||||
mutex->unlockMutex();
|
||||
return size;
|
||||
}
|
||||
|
||||
bool HealthTable::hasHealth(object_id_t object) {
|
||||
bool exits = false;
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
MutexHelper(mutex, timeoutType, mutexTimeoutMs);
|
||||
HealthMap::iterator iter = healthMap.find(object);
|
||||
if (iter != healthMap.end()) {
|
||||
exits = true;
|
||||
return true;
|
||||
}
|
||||
mutex->unlockMutex();
|
||||
return exits;
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t HealthTable::getPrintSize() {
|
||||
MutexHelper(mutex, timeoutType, mutexTimeoutMs);
|
||||
uint32_t size = healthMap.size() * sizeof(object_id_t) +
|
||||
sizeof(HasHealthIF::HealthState) + sizeof(uint16_t);
|
||||
return size;
|
||||
}
|
||||
|
||||
void HealthTable::printAll(uint8_t* pointer, size_t maxSize) {
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
MutexHelper(mutex, timeoutType, mutexTimeoutMs);
|
||||
size_t size = 0;
|
||||
uint16_t count = healthMap.size();
|
||||
ReturnValue_t result = SerializeAdapter::serialize(&count,
|
||||
SerializeAdapter::serialize(&count,
|
||||
&pointer, &size, maxSize, SerializeIF::Endianness::BIG);
|
||||
HealthMap::iterator iter;
|
||||
for (iter = healthMap.begin();
|
||||
iter != healthMap.end() && result == HasReturnvaluesIF::RETURN_OK;
|
||||
++iter) {
|
||||
result = SerializeAdapter::serialize(&iter->first,
|
||||
for (const auto& health: healthMap) {
|
||||
SerializeAdapter::serialize(&health.first,
|
||||
&pointer, &size, maxSize, SerializeIF::Endianness::BIG);
|
||||
uint8_t health = iter->second;
|
||||
result = SerializeAdapter::serialize(&health, &pointer, &size,
|
||||
uint8_t healthValue = health.second;
|
||||
SerializeAdapter::serialize(&healthValue, &pointer, &size,
|
||||
maxSize, SerializeIF::Endianness::BIG);
|
||||
}
|
||||
mutex->unlockMutex();
|
||||
}
|
||||
|
||||
ReturnValue_t HealthTable::iterate(
|
||||
std::pair<object_id_t, HasHealthIF::HealthState> *value, bool reset) {
|
||||
ReturnValue_t HealthTable::iterate(HealthEntry *value, bool reset) {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
mutex->lockMutex(MutexIF::BLOCKING);
|
||||
MutexHelper(mutex, timeoutType, mutexTimeoutMs);
|
||||
if (reset) {
|
||||
mapIterator = healthMap.begin();
|
||||
}
|
||||
@ -94,7 +90,5 @@ ReturnValue_t HealthTable::iterate(
|
||||
}
|
||||
*value = *mapIterator;
|
||||
mapIterator++;
|
||||
mutex->unlockMutex();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1,35 +1,47 @@
|
||||
#ifndef HEALTHTABLE_H_
|
||||
#define HEALTHTABLE_H_
|
||||
#ifndef FSFW_HEALTH_HEALTHTABLE_H_
|
||||
#define FSFW_HEALTH_HEALTHTABLE_H_
|
||||
|
||||
#include "HealthTableIF.h"
|
||||
#include "../objectmanager/SystemObject.h"
|
||||
#include "../ipc/MutexIF.h"
|
||||
#include <map>
|
||||
|
||||
typedef std::map<object_id_t, HasHealthIF::HealthState> HealthMap;
|
||||
|
||||
class HealthTable: public HealthTableIF, public SystemObject {
|
||||
public:
|
||||
HealthTable(object_id_t objectid);
|
||||
virtual ~HealthTable();
|
||||
|
||||
virtual ReturnValue_t registerObject(object_id_t object,
|
||||
HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY);
|
||||
void setMutexTimeout(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs);
|
||||
|
||||
virtual bool hasHealth(object_id_t object);
|
||||
virtual void setHealth(object_id_t object, HasHealthIF::HealthState newState);
|
||||
virtual HasHealthIF::HealthState getHealth(object_id_t);
|
||||
/** HealthTableIF overrides */
|
||||
virtual ReturnValue_t registerObject(object_id_t object,
|
||||
HasHealthIF::HealthState initilialState =
|
||||
HasHealthIF::HEALTHY) override;
|
||||
virtual size_t getPrintSize() override;
|
||||
virtual void printAll(uint8_t *pointer, size_t maxSize) override;
|
||||
|
||||
virtual uint32_t getPrintSize();
|
||||
virtual void printAll(uint8_t *pointer, size_t maxSize);
|
||||
/** ManagesHealthIF overrides */
|
||||
virtual bool hasHealth(object_id_t object) override;
|
||||
virtual void setHealth(object_id_t object,
|
||||
HasHealthIF::HealthState newState) override;
|
||||
virtual HasHealthIF::HealthState getHealth(object_id_t) override;
|
||||
|
||||
protected:
|
||||
using HealthMap = std::map<object_id_t, HasHealthIF::HealthState>;
|
||||
using HealthEntry = std::pair<object_id_t, HasHealthIF::HealthState>;
|
||||
|
||||
MutexIF* mutex;
|
||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||
uint32_t mutexTimeoutMs = 20;
|
||||
|
||||
HealthMap healthMap;
|
||||
|
||||
HealthMap::iterator mapIterator;
|
||||
|
||||
virtual ReturnValue_t iterate(std::pair<object_id_t,HasHealthIF::HealthState> *value, bool reset = false);
|
||||
virtual ReturnValue_t iterate(
|
||||
HealthEntry* value,
|
||||
bool reset = false) override;
|
||||
};
|
||||
|
||||
#endif /* HEALTHTABLE_H_ */
|
||||
#endif /* FSFW_HEALTH_HEALTHTABLE_H_ */
|
||||
|
@ -1,26 +1,24 @@
|
||||
#ifndef HEALTHTABLEIF_H_
|
||||
#define HEALTHTABLEIF_H_
|
||||
#ifndef FSFW_HEALTH_HEALTHTABLEIF_H_
|
||||
#define FSFW_HEALTH_HEALTHTABLEIF_H_
|
||||
|
||||
#include "ManagesHealthIF.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include <map>
|
||||
|
||||
|
||||
class HealthTableIF: public ManagesHealthIF {
|
||||
friend class HealthCommandingService;
|
||||
public:
|
||||
virtual ~HealthTableIF() {
|
||||
}
|
||||
virtual ~HealthTableIF() {}
|
||||
|
||||
virtual ReturnValue_t registerObject(object_id_t object,
|
||||
HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY) = 0;
|
||||
|
||||
virtual uint32_t getPrintSize() = 0;
|
||||
virtual size_t getPrintSize() = 0;
|
||||
virtual void printAll(uint8_t *pointer, size_t maxSize) = 0;
|
||||
|
||||
protected:
|
||||
virtual ReturnValue_t iterate(std::pair<object_id_t,HasHealthIF::HealthState> *value, bool reset = false) = 0;
|
||||
virtual ReturnValue_t iterate(
|
||||
std::pair<object_id_t,HasHealthIF::HealthState> *value,
|
||||
bool reset = false) = 0;
|
||||
};
|
||||
|
||||
#endif /* HEALTHTABLEIF_H_ */
|
||||
#endif /* FRAMEWORK_HEALTH_HEALTHTABLEIF_H_ */
|
||||
|
@ -1,8 +1,9 @@
|
||||
#ifndef FRAMEWORK_HEALTH_MANAGESHEALTHIF_H_
|
||||
#define FRAMEWORK_HEALTH_MANAGESHEALTHIF_H_
|
||||
#ifndef FSFW_HEALTH_MANAGESHEALTHIF_H_
|
||||
#define FSFW_HEALTH_MANAGESHEALTHIF_H_
|
||||
|
||||
#include "HasHealthIF.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
|
||||
class ManagesHealthIF {
|
||||
public:
|
||||
virtual ~ManagesHealthIF() {
|
||||
@ -49,4 +50,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_HEALTH_MANAGESHEALTHIF_H_ */
|
||||
#endif /* FSFW_HEALTH_MANAGESHEALTHIF_H_ */
|
||||
|
@ -1,124 +1,96 @@
|
||||
/**
|
||||
* @file CommandMessage.cpp
|
||||
* @brief This file defines the CommandMessage class.
|
||||
* @date 20.06.2013
|
||||
* @author baetz
|
||||
*/
|
||||
|
||||
#include "../devicehandlers/DeviceHandlerMessage.h"
|
||||
#include "../health/HealthMessage.h"
|
||||
#include "CommandMessage.h"
|
||||
#include "../memory/MemoryMessage.h"
|
||||
#include "../modes/ModeMessage.h"
|
||||
#include "../monitoring/MonitoringMessage.h"
|
||||
#include "../subsystem/modes/ModeSequenceMessage.h"
|
||||
#include "../tmstorage/TmStoreMessage.h"
|
||||
#include "../parameters/ParameterMessage.h"
|
||||
|
||||
namespace messagetypes {
|
||||
void clearMissionMessage(CommandMessage* message);
|
||||
}
|
||||
|
||||
#include "CommandMessageCleaner.h"
|
||||
#include <cstring>
|
||||
|
||||
CommandMessage::CommandMessage() {
|
||||
this->messageSize = COMMAND_MESSAGE_SIZE;
|
||||
setCommand(CMD_NONE);
|
||||
MessageQueueMessage::setMessageSize(DEFAULT_COMMAND_MESSAGE_SIZE);
|
||||
setCommand(CMD_NONE);
|
||||
}
|
||||
|
||||
CommandMessage::CommandMessage(Command_t command, uint32_t parameter1,
|
||||
uint32_t parameter2) {
|
||||
this->messageSize = COMMAND_MESSAGE_SIZE;
|
||||
setCommand(command);
|
||||
setParameter(parameter1);
|
||||
setParameter2(parameter2);
|
||||
uint32_t parameter2) {
|
||||
MessageQueueMessage::setMessageSize(DEFAULT_COMMAND_MESSAGE_SIZE);
|
||||
setCommand(command);
|
||||
setParameter(parameter1);
|
||||
setParameter2(parameter2);
|
||||
}
|
||||
|
||||
Command_t CommandMessage::getCommand() const {
|
||||
Command_t command;
|
||||
memcpy(&command, getData(), sizeof(Command_t));
|
||||
return command;
|
||||
Command_t command;
|
||||
std::memcpy(&command, MessageQueueMessage::getData(), sizeof(Command_t));
|
||||
return command;
|
||||
}
|
||||
|
||||
void CommandMessage::setCommand(Command_t command) {
|
||||
memcpy(getData(), &command, sizeof(command));
|
||||
std::memcpy(MessageQueueMessage::getData(), &command, sizeof(Command_t));
|
||||
}
|
||||
|
||||
uint8_t CommandMessage::getMessageType() const {
|
||||
// first byte of command ID.
|
||||
return getCommand() >> 8 & 0xff;
|
||||
}
|
||||
|
||||
uint32_t CommandMessage::getParameter() const {
|
||||
uint32_t parameter1;
|
||||
memcpy(¶meter1, getData() + sizeof(Command_t), sizeof(parameter1));
|
||||
return parameter1;
|
||||
uint32_t parameter1;
|
||||
std::memcpy(¶meter1, this->getData(), sizeof(parameter1));
|
||||
return parameter1;
|
||||
}
|
||||
|
||||
void CommandMessage::setParameter(uint32_t parameter1) {
|
||||
memcpy(getData() + sizeof(Command_t), ¶meter1, sizeof(parameter1));
|
||||
std::memcpy(this->getData(), ¶meter1, sizeof(parameter1));
|
||||
}
|
||||
|
||||
uint32_t CommandMessage::getParameter2() const {
|
||||
uint32_t parameter2;
|
||||
memcpy(¶meter2, getData() + sizeof(Command_t) + sizeof(uint32_t),
|
||||
sizeof(parameter2));
|
||||
return parameter2;
|
||||
uint32_t parameter2;
|
||||
std::memcpy(¶meter2, this->getData() + sizeof(uint32_t),
|
||||
sizeof(parameter2));
|
||||
return parameter2;
|
||||
}
|
||||
|
||||
void CommandMessage::setParameter2(uint32_t parameter2) {
|
||||
memcpy(getData() + sizeof(Command_t) + sizeof(uint32_t), ¶meter2,
|
||||
sizeof(parameter2));
|
||||
std::memcpy(this->getData() + sizeof(uint32_t), ¶meter2,
|
||||
sizeof(parameter2));
|
||||
}
|
||||
|
||||
void CommandMessage::clearCommandMessage() {
|
||||
switch((getCommand()>>8) & 0xff){
|
||||
case messagetypes::MODE_COMMAND:
|
||||
ModeMessage::clear(this);
|
||||
break;
|
||||
case messagetypes::HEALTH_COMMAND:
|
||||
HealthMessage::clear(this);
|
||||
break;
|
||||
case messagetypes::MODE_SEQUENCE:
|
||||
ModeSequenceMessage::clear(this);
|
||||
break;
|
||||
case messagetypes::ACTION:
|
||||
ActionMessage::clear(this);
|
||||
break;
|
||||
case messagetypes::DEVICE_HANDLER_COMMAND:
|
||||
DeviceHandlerMessage::clear(this);
|
||||
break;
|
||||
case messagetypes::MEMORY:
|
||||
MemoryMessage::clear(this);
|
||||
break;
|
||||
case messagetypes::MONITORING:
|
||||
MonitoringMessage::clear(this);
|
||||
break;
|
||||
case messagetypes::TM_STORE:
|
||||
TmStoreMessage::clear(this);
|
||||
break;
|
||||
case messagetypes::PARAMETER:
|
||||
ParameterMessage::clear(this);
|
||||
break;
|
||||
default:
|
||||
messagetypes::clearMissionMessage(this);
|
||||
break;
|
||||
}
|
||||
uint32_t CommandMessage::getParameter3() const {
|
||||
uint32_t parameter3;
|
||||
std::memcpy(¶meter3, this->getData() + 2 * sizeof(uint32_t),
|
||||
sizeof(parameter3));
|
||||
return parameter3;
|
||||
}
|
||||
|
||||
bool CommandMessage::isClearedCommandMessage() {
|
||||
return getCommand() == CMD_NONE;
|
||||
void CommandMessage::setParameter3(uint32_t parameter3) {
|
||||
std::memcpy(this->getData() + 2 * sizeof(uint32_t), ¶meter3,
|
||||
sizeof(parameter3));
|
||||
}
|
||||
|
||||
size_t CommandMessage::getMinimumMessageSize() const {
|
||||
return COMMAND_MESSAGE_SIZE;
|
||||
return MINIMUM_COMMAND_MESSAGE_SIZE;
|
||||
}
|
||||
|
||||
void CommandMessage::clearCommandMessage() {
|
||||
clear();
|
||||
}
|
||||
|
||||
void CommandMessage::clear() {
|
||||
CommandMessageCleaner::clearCommandMessage(this);
|
||||
}
|
||||
|
||||
bool CommandMessage::isClearedCommandMessage() {
|
||||
return getCommand() == CMD_NONE;
|
||||
}
|
||||
|
||||
void CommandMessage::setToUnknownCommand() {
|
||||
Command_t initialCommand = getCommand();
|
||||
clearCommandMessage();
|
||||
setReplyRejected(UNKNOWN_COMMAND, initialCommand);
|
||||
Command_t initialCommand = getCommand();
|
||||
this->clear();
|
||||
setReplyRejected(UNKNOWN_COMMAND, initialCommand);
|
||||
}
|
||||
|
||||
void CommandMessage::setReplyRejected(ReturnValue_t reason,
|
||||
Command_t initialCommand) {
|
||||
Command_t initialCommand) {
|
||||
setCommand(REPLY_REJECTED);
|
||||
setParameter(reason);
|
||||
setParameter2(initialCommand);
|
||||
setParameter(reason);
|
||||
setParameter2(initialCommand);
|
||||
}
|
||||
|
||||
ReturnValue_t CommandMessage::getReplyRejectedReason(
|
||||
@ -129,3 +101,11 @@ ReturnValue_t CommandMessage::getReplyRejectedReason(
|
||||
}
|
||||
return reason;
|
||||
}
|
||||
|
||||
uint8_t* CommandMessage::getData() {
|
||||
return MessageQueueMessage::getData() + sizeof(Command_t);
|
||||
}
|
||||
|
||||
const uint8_t* CommandMessage::getData() const {
|
||||
return MessageQueueMessage::getData() + sizeof(Command_t);
|
||||
}
|
||||
|
@ -1,114 +1,88 @@
|
||||
/**
|
||||
* @file CommandMessage.h
|
||||
* @brief This file defines the CommandMessage class.
|
||||
* @date 20.06.2013
|
||||
* @author baetz
|
||||
*/
|
||||
#ifndef FSFW_IPC_COMMANDMESSAGE_H_
|
||||
#define FSFW_IPC_COMMANDMESSAGE_H_
|
||||
|
||||
#ifndef COMMANDMESSAGE_H_
|
||||
#define COMMANDMESSAGE_H_
|
||||
|
||||
|
||||
#include "FwMessageTypes.h"
|
||||
#include <config/ipc/MissionMessageTypes.h>
|
||||
#include "CommandMessageIF.h"
|
||||
|
||||
#include "MessageQueueMessage.h"
|
||||
#include "FwMessageTypes.h"
|
||||
|
||||
#define MAKE_COMMAND_ID( number ) ((MESSAGE_ID << 8) + (number))
|
||||
typedef ReturnValue_t Command_t;
|
||||
|
||||
class CommandMessage : public MessageQueueMessage {
|
||||
/**
|
||||
* @brief Default command message used to pass command messages between tasks.
|
||||
* Primary message type for IPC. Contains sender, 2-byte command ID
|
||||
* field, and 3 4-byte parameter
|
||||
* @details
|
||||
* It operates on an external memory which is contained inside a
|
||||
* class implementing MessageQueueMessageIF by taking its address.
|
||||
* This allows for a more flexible designs of message implementations.
|
||||
* The pointer can be passed to different message implementations without
|
||||
* the need of unnecessary copying.
|
||||
*
|
||||
* The command message is based of the generic MessageQueueMessage which
|
||||
* currently has an internal message size of 28 bytes.
|
||||
* @author Bastian Baetz
|
||||
*/
|
||||
class CommandMessage: public MessageQueueMessage, public CommandMessageIF {
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::COMMAND_MESSAGE;
|
||||
static const ReturnValue_t UNKNOWN_COMMAND = MAKE_RETURN_CODE(0x01);
|
||||
|
||||
|
||||
static const uint8_t MESSAGE_ID = messagetypes::COMMAND;
|
||||
static const Command_t CMD_NONE = MAKE_COMMAND_ID( 0 );//!< Used internally, will be ignored
|
||||
static const Command_t REPLY_COMMAND_OK = MAKE_COMMAND_ID( 3 );
|
||||
static const Command_t REPLY_REJECTED = MAKE_COMMAND_ID( 0xD1 );//!< Reply indicating that the current command was rejected, par1 should contain the error code
|
||||
/**
|
||||
* Default size can accomodate 3 4-byte parameters.
|
||||
*/
|
||||
static constexpr size_t DEFAULT_COMMAND_MESSAGE_SIZE =
|
||||
CommandMessageIF::MINIMUM_COMMAND_MESSAGE_SIZE +
|
||||
3 * sizeof(uint32_t);
|
||||
|
||||
/**
|
||||
* This is the size of a message as it is seen by the MessageQueue
|
||||
*/
|
||||
static const size_t COMMAND_MESSAGE_SIZE = HEADER_SIZE
|
||||
+ sizeof(Command_t) + 2 * sizeof(uint32_t);
|
||||
|
||||
/**
|
||||
* Default Constructor, does not initialize anything.
|
||||
*
|
||||
* This constructor should be used when receiving a Message, as the content is filled by the MessageQueue.
|
||||
* @brief Default Constructor, does not initialize anything.
|
||||
* @details
|
||||
* This constructor should be used when receiving a Message, as the
|
||||
* content is filled by the MessageQueue.
|
||||
*/
|
||||
CommandMessage();
|
||||
/**
|
||||
* This constructor creates a new message with all message content initialized
|
||||
* This constructor creates a new message with all message content
|
||||
* initialized
|
||||
*
|
||||
* @param command The DeviceHandlerCommand_t that will be sent
|
||||
* @param parameter1 The first parameter
|
||||
* @param parameter2 The second parameter
|
||||
*/
|
||||
CommandMessage(Command_t command,
|
||||
uint32_t parameter1, uint32_t parameter2);
|
||||
CommandMessage(Command_t command, uint32_t parameter1, uint32_t parameter2);
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
* @brief Default Destructor
|
||||
*/
|
||||
virtual ~CommandMessage() {
|
||||
}
|
||||
virtual ~CommandMessage() {}
|
||||
|
||||
/**
|
||||
* Read the DeviceHandlerCommand_t that is stored in the message, usually used after receiving
|
||||
*
|
||||
* @return the Command stored in the Message
|
||||
*/
|
||||
Command_t getCommand() const;
|
||||
/**
|
||||
* Read the DeviceHandlerCommand_t that is stored in the message,
|
||||
* usually used after receiving.
|
||||
*
|
||||
* @return the Command stored in the Message
|
||||
*/
|
||||
virtual Command_t getCommand() const override;
|
||||
/**
|
||||
* Set the command type of the message. Default implementation also
|
||||
* sets the message type, which will be the first byte of the command ID.
|
||||
* @param the Command to be sent
|
||||
*/
|
||||
virtual void setCommand(Command_t command);
|
||||
|
||||
/**
|
||||
* Set the DeviceHandlerCOmmand_t of the message
|
||||
*
|
||||
* @param the Command to be sent
|
||||
*/
|
||||
void setCommand(Command_t command);
|
||||
virtual uint8_t* getData() override;
|
||||
virtual const uint8_t* getData() const override;
|
||||
|
||||
/**
|
||||
* Get the first parameter of the message
|
||||
*
|
||||
* @return the first Parameter of the message
|
||||
*/
|
||||
uint32_t getParameter() const;
|
||||
|
||||
/**
|
||||
* Set the first parameter of the message
|
||||
*
|
||||
* @param the first parameter of the message
|
||||
*/
|
||||
void setParameter(uint32_t parameter1);
|
||||
|
||||
/**
|
||||
* Get the second parameter of the message
|
||||
*
|
||||
* @return the second Parameter of the message
|
||||
*/
|
||||
uint32_t getParameter2() const;
|
||||
|
||||
/**
|
||||
* Set the second parameter of the message
|
||||
*
|
||||
* @param the second parameter of the message
|
||||
*/
|
||||
void setParameter2(uint32_t parameter2);
|
||||
|
||||
/**
|
||||
* Set the command to CMD_NONE and try to find
|
||||
* the correct class to handle a more detailed
|
||||
* clear.
|
||||
* Also, calls a mission-specific clearMissionMessage
|
||||
* function to separate between framework and mission
|
||||
* messages. Not optimal, may be replaced by totally
|
||||
* different auto-delete solution (e.g. smart pointers).
|
||||
*
|
||||
*/
|
||||
void clearCommandMessage();
|
||||
uint32_t getParameter3() const;
|
||||
void setParameter3(uint32_t parameter3);
|
||||
|
||||
/**
|
||||
* check if a message was cleared
|
||||
@ -117,18 +91,41 @@ public:
|
||||
*/
|
||||
bool isClearedCommandMessage();
|
||||
|
||||
|
||||
/**
|
||||
* Sets the command to REPLY_REJECTED with parameter UNKNOWN_COMMAND.
|
||||
* Is needed quite often, so we better code it once only.
|
||||
*/
|
||||
void setToUnknownCommand();
|
||||
void setReplyRejected(ReturnValue_t reason, Command_t initialCommand = CMD_NONE);
|
||||
ReturnValue_t getReplyRejectedReason(
|
||||
Command_t *initialCommand = nullptr) const;
|
||||
void setToUnknownCommand() override;
|
||||
|
||||
size_t getMinimumMessageSize() const;
|
||||
/**
|
||||
* A command message can be rejected and needs to offer a function
|
||||
* to set a rejected reply
|
||||
* @param reason
|
||||
* @param initialCommand
|
||||
*/
|
||||
void setReplyRejected(ReturnValue_t reason,
|
||||
Command_t initialCommand) override;
|
||||
/**
|
||||
* Corrensonding getter function.
|
||||
* @param initialCommand
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t getReplyRejectedReason(
|
||||
Command_t* initialCommand = nullptr) const override;
|
||||
|
||||
|
||||
virtual void clear() override;
|
||||
void clearCommandMessage();
|
||||
|
||||
/**
|
||||
* Extract message ID, which is the first byte of the command ID for the
|
||||
* default implementation.
|
||||
* @return
|
||||
*/
|
||||
virtual uint8_t getMessageType() const override;
|
||||
|
||||
/** MessageQueueMessageIF functions used for minimum size check. */
|
||||
size_t getMinimumMessageSize() const override;
|
||||
};
|
||||
|
||||
|
||||
#endif /* COMMANDMESSAGE_H_ */
|
||||
#endif /* FSFW_IPC_COMMANDMESSAGE_H_ */
|
||||
|
45
ipc/CommandMessageCleaner.cpp
Normal file
45
ipc/CommandMessageCleaner.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include "../ipc/CommandMessageCleaner.h"
|
||||
|
||||
#include "../devicehandlers/DeviceHandlerMessage.h"
|
||||
#include "../health/HealthMessage.h"
|
||||
#include "../memory/MemoryMessage.h"
|
||||
#include "../modes/ModeMessage.h"
|
||||
#include "../monitoring/MonitoringMessage.h"
|
||||
#include "../subsystem/modes/ModeSequenceMessage.h"
|
||||
#include "../tmstorage/TmStoreMessage.h"
|
||||
#include "../parameters/ParameterMessage.h"
|
||||
|
||||
void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) {
|
||||
switch(message->getMessageType()){
|
||||
case messagetypes::MODE_COMMAND:
|
||||
ModeMessage::clear(message);
|
||||
break;
|
||||
case messagetypes::HEALTH_COMMAND:
|
||||
HealthMessage::clear(message);
|
||||
break;
|
||||
case messagetypes::MODE_SEQUENCE:
|
||||
ModeSequenceMessage::clear(message);
|
||||
break;
|
||||
case messagetypes::ACTION:
|
||||
ActionMessage::clear(message);
|
||||
break;
|
||||
case messagetypes::DEVICE_HANDLER_COMMAND:
|
||||
DeviceHandlerMessage::clear(message);
|
||||
break;
|
||||
case messagetypes::MEMORY:
|
||||
MemoryMessage::clear(message);
|
||||
break;
|
||||
case messagetypes::MONITORING:
|
||||
MonitoringMessage::clear(message);
|
||||
break;
|
||||
case messagetypes::TM_STORE:
|
||||
TmStoreMessage::clear(message);
|
||||
break;
|
||||
case messagetypes::PARAMETER:
|
||||
ParameterMessage::clear(message);
|
||||
break;
|
||||
default:
|
||||
messagetypes::clearMissionMessage(message);
|
||||
break;
|
||||
}
|
||||
}
|
16
ipc/CommandMessageCleaner.h
Normal file
16
ipc/CommandMessageCleaner.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef FRAMEWORK_IPC_COMMANDMESSAGECLEANER_H_
|
||||
#define FRAMEWORK_IPC_COMMANDMESSAGECLEANER_H_
|
||||
#include "../ipc/CommandMessage.h"
|
||||
|
||||
namespace messagetypes {
|
||||
// Implemented in config.
|
||||
void clearMissionMessage(CommandMessage* message);
|
||||
}
|
||||
|
||||
class CommandMessageCleaner {
|
||||
public:
|
||||
static void clearCommandMessage(CommandMessage* message);
|
||||
};
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_IPC_COMMANDMESSAGECLEANER_H_ */
|
73
ipc/CommandMessageIF.h
Normal file
73
ipc/CommandMessageIF.h
Normal file
@ -0,0 +1,73 @@
|
||||
#ifndef FSFW_IPC_COMMANDMESSAGEIF_H_
|
||||
#define FSFW_IPC_COMMANDMESSAGEIF_H_
|
||||
|
||||
#include "MessageQueueMessageIF.h"
|
||||
#include "FwMessageTypes.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
#define MAKE_COMMAND_ID( number ) ((MESSAGE_ID << 8) + (number))
|
||||
typedef uint16_t Command_t;
|
||||
|
||||
class CommandMessageIF {
|
||||
public:
|
||||
/**
|
||||
* Header consists of sender ID and command ID.
|
||||
*/
|
||||
static constexpr size_t HEADER_SIZE = MessageQueueMessageIF::HEADER_SIZE +
|
||||
sizeof(Command_t);
|
||||
/**
|
||||
* This minimum size is derived from the interface requirement to be able
|
||||
* to set a rejected reply, which contains a returnvalue and the initial
|
||||
* command.
|
||||
*/
|
||||
static constexpr size_t MINIMUM_COMMAND_MESSAGE_SIZE =
|
||||
CommandMessageIF::HEADER_SIZE + sizeof(ReturnValue_t) +
|
||||
sizeof(Command_t);
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::COMMAND_MESSAGE;
|
||||
static const ReturnValue_t UNKNOWN_COMMAND = MAKE_RETURN_CODE(0x01);
|
||||
|
||||
static const uint8_t MESSAGE_ID = messagetypes::COMMAND;
|
||||
//! Used internally, shall be ignored
|
||||
static const Command_t CMD_NONE = MAKE_COMMAND_ID( 0 );
|
||||
static const Command_t REPLY_COMMAND_OK = MAKE_COMMAND_ID( 1 );
|
||||
//! Reply indicating that the current command was rejected,
|
||||
//! par1 should contain the error code
|
||||
static const Command_t REPLY_REJECTED = MAKE_COMMAND_ID( 2 );
|
||||
|
||||
virtual ~CommandMessageIF() {};
|
||||
|
||||
/**
|
||||
* A command message shall have a uint16_t command ID field.
|
||||
* @return
|
||||
*/
|
||||
virtual Command_t getCommand() const = 0;
|
||||
/**
|
||||
* A command message shall have a uint8_t message type ID field.
|
||||
* @return
|
||||
*/
|
||||
virtual uint8_t getMessageType() const = 0;
|
||||
|
||||
/**
|
||||
* A command message can be rejected and needs to offer a function
|
||||
* to set a rejected reply
|
||||
* @param reason
|
||||
* @param initialCommand
|
||||
*/
|
||||
virtual void setReplyRejected(ReturnValue_t reason,
|
||||
Command_t initialCommand) = 0;
|
||||
/**
|
||||
* Corrensonding getter function.
|
||||
* @param initialCommand
|
||||
* @return
|
||||
*/
|
||||
virtual ReturnValue_t getReplyRejectedReason(
|
||||
Command_t* initialCommand = nullptr) const = 0;
|
||||
|
||||
virtual void setToUnknownCommand() = 0;
|
||||
|
||||
virtual void clear() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* FSFW_IPC_COMMANDMESSAGEIF_H_ */
|
@ -1,61 +1,77 @@
|
||||
#ifndef FRAMEWORK_IPC_MESSAGEQUEUEIF_H_
|
||||
#define FRAMEWORK_IPC_MESSAGEQUEUEIF_H_
|
||||
#ifndef FSFW_IPC_MESSAGEQUEUEIF_H_
|
||||
#define FSFW_IPC_MESSAGEQUEUEIF_H_
|
||||
|
||||
#include "messageQueueDefinitions.h"
|
||||
#include "MessageQueueMessageIF.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
// COULDDO: We could support blocking calls
|
||||
// semaphores are being implemented, which makes this idea even more iteresting.
|
||||
|
||||
#include "MessageQueueMessage.h"
|
||||
#include "MessageQueueSenderIF.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
/**
|
||||
* @defgroup message_queue Message Queue
|
||||
* @brief Message Queue related software components
|
||||
*/
|
||||
class MessageQueueIF {
|
||||
public:
|
||||
|
||||
static const MessageQueueId_t NO_QUEUE = MessageQueueSenderIF::NO_QUEUE; //!< Ugly hack.
|
||||
static const MessageQueueId_t NO_QUEUE = 0;
|
||||
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::MESSAGE_QUEUE_IF;
|
||||
/**
|
||||
* No new messages on the queue
|
||||
*/
|
||||
//! No new messages on the queue
|
||||
static const ReturnValue_t EMPTY = MAKE_RETURN_CODE(1);
|
||||
/**
|
||||
* No space left for more messages
|
||||
*/
|
||||
//! No space left for more messages
|
||||
static const ReturnValue_t FULL = MAKE_RETURN_CODE(2);
|
||||
/**
|
||||
* Returned if a reply method was called without partner
|
||||
*/
|
||||
//! Returned if a reply method was called without partner
|
||||
static const ReturnValue_t NO_REPLY_PARTNER = MAKE_RETURN_CODE(3);
|
||||
//! Returned if the target destination is invalid.
|
||||
static constexpr ReturnValue_t DESTINVATION_INVALID = MAKE_RETURN_CODE(4);
|
||||
|
||||
virtual ~MessageQueueIF() {}
|
||||
/**
|
||||
* @brief This operation sends a message to the last communication partner.
|
||||
* @details This operation simplifies answering an incoming message by using the stored
|
||||
* lastParnter information as destination. If there was no message received yet
|
||||
* (i.e. lastPartner is zero), an error code is returned.
|
||||
* @param message A pointer to a previously created message, which is sent.
|
||||
* \return RETURN_OK if ok
|
||||
* \return NO_REPLY_PARTNER Should return NO_REPLY_PARTNER if partner was found
|
||||
* @details
|
||||
* This operation simplifies answering an incoming message by using the
|
||||
* stored lastParnter information as destination. If there was no message
|
||||
* received yet (i.e. lastPartner is zero), an error code is returned.
|
||||
* @param message
|
||||
* A pointer to a previously created message, which is sent.
|
||||
* @return
|
||||
* -@c RETURN_OK if ok
|
||||
* -@c NO_REPLY_PARTNER Should return NO_REPLY_PARTNER if partner was found.
|
||||
*/
|
||||
virtual ReturnValue_t reply( MessageQueueMessage* message ) = 0;
|
||||
virtual ReturnValue_t reply(MessageQueueMessageIF* message) = 0;
|
||||
|
||||
/**
|
||||
* @brief This function reads available messages from the message queue and returns the sender.
|
||||
* @details It works identically to the other receiveMessage call, but in addition returns the
|
||||
* sender's queue id.
|
||||
* @param message A pointer to a message in which the received data is stored.
|
||||
* @param receivedFrom A pointer to a queue id in which the sender's id is stored.
|
||||
* @brief This function reads available messages from the message queue
|
||||
* and returns the sender.
|
||||
* @details
|
||||
* It works identically to the other receiveMessage call, but in addition
|
||||
* returns the sender's queue id.
|
||||
* @param message
|
||||
* A pointer to a message in which the received data is stored.
|
||||
* @param receivedFrom
|
||||
* A pointer to a queue id in which the sender's id is stored.
|
||||
*/
|
||||
virtual ReturnValue_t receiveMessage(MessageQueueMessage* message,
|
||||
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message,
|
||||
MessageQueueId_t *receivedFrom) = 0;
|
||||
|
||||
/**
|
||||
* @brief This function reads available messages from the message queue.
|
||||
* @details If data is available it is stored in the passed message pointer. The message's
|
||||
* original content is overwritten and the sendFrom information is stored in the
|
||||
* lastPartner attribute. Else, the lastPartner information remains untouched, the
|
||||
* message's content is cleared and the function returns immediately.
|
||||
* @param message A pointer to a message in which the received data is stored.
|
||||
* @details
|
||||
* If data is available it is stored in the passed message pointer.
|
||||
* The message's original content is overwritten and the sendFrom
|
||||
* information is stored in theblastPartner attribute. Else, the lastPartner
|
||||
* information remains untouched, the message's content is cleared and the
|
||||
* function returns immediately.
|
||||
* @param message
|
||||
* A pointer to a message in which the received data is stored.
|
||||
* @return -@c RETURN_OK on success
|
||||
* -@c MessageQueueIF::EMPTY if queue is empty
|
||||
*/
|
||||
virtual ReturnValue_t receiveMessage(MessageQueueMessage* message) = 0;
|
||||
virtual ReturnValue_t receiveMessage(MessageQueueMessageIF* message) = 0;
|
||||
/**
|
||||
* Deletes all pending messages in the queue.
|
||||
* @param count The number of flushed messages.
|
||||
@ -63,57 +79,89 @@ public:
|
||||
*/
|
||||
virtual ReturnValue_t flush(uint32_t* count) = 0;
|
||||
/**
|
||||
* @brief This method returns the message queue id of the last communication partner.
|
||||
* @brief This method returns the message queue
|
||||
* id of the last communication partner.
|
||||
*/
|
||||
virtual MessageQueueId_t getLastPartner() const = 0;
|
||||
/**
|
||||
* @brief This method returns the message queue id of this class's message queue.
|
||||
* @brief This method returns the message queue
|
||||
* id of this class's message queue.
|
||||
*/
|
||||
virtual MessageQueueId_t getId() const = 0;
|
||||
|
||||
/**
|
||||
* \brief With the sendMessage call, a queue message is sent to a receiving queue.
|
||||
* \details This method takes the message provided, adds the sentFrom information and passes
|
||||
* it on to the destination provided with an operating system call. The OS's return
|
||||
* value is returned.
|
||||
* \param sendTo This parameter specifies the message queue id to send the message to.
|
||||
* \param message This is a pointer to a previously created message, which is sent.
|
||||
* \param sentFrom The sentFrom information can be set to inject the sender's queue id into the message.
|
||||
* This variable is set to zero by default.
|
||||
* \param ignoreFault If set to true, the internal software fault counter is not incremented if queue is full (if implemented).
|
||||
* @brief With the sendMessage call, a queue message
|
||||
* is sent to a receiving queue.
|
||||
* @details
|
||||
* This method takes the message provided, adds the sentFrom information
|
||||
* and passes it on to the destination provided with an operating system
|
||||
* call. The OS's returnvalue is returned.
|
||||
* @param sendTo
|
||||
* This parameter specifies the message queue id to send the message to.
|
||||
* @param message
|
||||
* This is a pointer to a previously created message, which is sent.
|
||||
* @param sentFrom
|
||||
* The sentFrom information can be set to inject the sender's queue id
|
||||
* into the message. This variable is set to zero by default.
|
||||
* @param ignoreFault
|
||||
* If set to true, the internal software fault counter is not incremented
|
||||
* if queue is full (if implemented).
|
||||
* @return -@c RETURN_OK on success
|
||||
* -@c MessageQueueIF::FULL if queue is full
|
||||
*/
|
||||
virtual ReturnValue_t sendMessageFrom( MessageQueueId_t sendTo, MessageQueueMessage* message, MessageQueueId_t sentFrom, bool ignoreFault = false ) = 0;
|
||||
/**
|
||||
* @brief This operation sends a message to the given destination.
|
||||
* @details It directly uses the sendMessage call of the MessageQueueSender parent, but passes its
|
||||
* queue id as "sentFrom" parameter.
|
||||
* @param sendTo This parameter specifies the message queue id of the destination message queue.
|
||||
* @param message A pointer to a previously created message, which is sent.
|
||||
* @param ignoreFault If set to true, the internal software fault counter is not incremented if queue is full.
|
||||
*/
|
||||
virtual ReturnValue_t sendMessage( MessageQueueId_t sendTo, MessageQueueMessage* message, bool ignoreFault = false ) = 0;
|
||||
virtual ReturnValue_t sendMessageFrom( MessageQueueId_t sendTo,
|
||||
MessageQueueMessageIF* message, MessageQueueId_t sentFrom,
|
||||
bool ignoreFault = false ) = 0;
|
||||
|
||||
/**
|
||||
* \brief The sendToDefaultFrom method sends a queue message to the default destination.
|
||||
* \details In all other aspects, it works identical to the sendMessage method.
|
||||
* \param message This is a pointer to a previously created message, which is sent.
|
||||
* \param sentFrom The sentFrom information can be set to inject the sender's queue id into the message.
|
||||
* This variable is set to zero by default.
|
||||
* @brief This operation sends a message to the given destination.
|
||||
* @details
|
||||
* It directly uses the sendMessage call of the MessageQueueSender parent,
|
||||
* but passes its queue id as "sentFrom" parameter.
|
||||
* @param sendTo
|
||||
* This parameter specifies the message queue id of the destination
|
||||
* message queue.
|
||||
* @param message
|
||||
* A pointer to a previously created message, which is sent.
|
||||
* @param ignoreFault
|
||||
* If set to true, the internal software fault counter is not incremented
|
||||
* if queue is full.
|
||||
*/
|
||||
virtual ReturnValue_t sendToDefaultFrom( MessageQueueMessage* message, MessageQueueId_t sentFrom, bool ignoreFault = false ) = 0;
|
||||
virtual ReturnValue_t sendMessage( MessageQueueId_t sendTo,
|
||||
MessageQueueMessageIF* message, bool ignoreFault = false ) = 0;
|
||||
|
||||
/**
|
||||
* @brief The sendToDefaultFrom method sends a queue message
|
||||
* to the default destination.
|
||||
* @details
|
||||
* In all other aspects, it works identical to the sendMessage method.
|
||||
* @param message
|
||||
* This is a pointer to a previously created message, which is sent.
|
||||
* @param sentFrom
|
||||
* The sentFrom information can be set to inject the sender's queue id
|
||||
* into the message. This variable is set to zero by default.
|
||||
* @return -@c RETURN_OK on success
|
||||
* -@c MessageQueueIF::FULL if queue is full
|
||||
*/
|
||||
virtual ReturnValue_t sendToDefaultFrom( MessageQueueMessageIF* message,
|
||||
MessageQueueId_t sentFrom, bool ignoreFault = false ) = 0;
|
||||
/**
|
||||
* @brief This operation sends a message to the default destination.
|
||||
* @details As in the sendMessage method, this function uses the sendToDefault call of the
|
||||
* Implementation class and adds its queue id as "sentFrom" information.
|
||||
* @details
|
||||
* As in the sendMessage method, this function uses the sendToDefault
|
||||
* call of the Implementation class and adds its queue id as
|
||||
* "sentFrom" information.
|
||||
* @param message A pointer to a previously created message, which is sent.
|
||||
* @return -@c RETURN_OK on success
|
||||
* -@c MessageQueueIF::FULL if queue is full
|
||||
*/
|
||||
virtual ReturnValue_t sendToDefault( MessageQueueMessage* message ) = 0;
|
||||
virtual ReturnValue_t sendToDefault( MessageQueueMessageIF* message ) = 0;
|
||||
/**
|
||||
* \brief This method is a simple setter for the default destination.
|
||||
* @brief This method is a simple setter for the default destination.
|
||||
*/
|
||||
virtual void setDefaultDestination(MessageQueueId_t defaultDestination) = 0;
|
||||
/**
|
||||
* \brief This method is a simple getter for the default destination.
|
||||
* @brief This method is a simple getter for the default destination.
|
||||
*/
|
||||
virtual MessageQueueId_t getDefaultDestination() const = 0;
|
||||
|
||||
@ -122,4 +170,4 @@ public:
|
||||
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_IPC_MESSAGEQUEUEIF_H_ */
|
||||
#endif /* FSFW_IPC_MESSAGEQUEUEIF_H_ */
|
||||
|
@ -1,13 +1,27 @@
|
||||
#include "MessageQueueMessage.h"
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
#include <string.h>
|
||||
#include "../globalfunctions/arrayprinter.h"
|
||||
#include <cstring>
|
||||
|
||||
MessageQueueMessage::MessageQueueMessage() :
|
||||
messageSize(this->HEADER_SIZE) {
|
||||
messageSize(getMinimumMessageSize()) {
|
||||
memset(this->internalBuffer, 0, sizeof(this->internalBuffer));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
else {
|
||||
sif::warning << "MessageQueueMessage: Passed size larger than maximum"
|
||||
"allowed size! Setting content to 0" << std::endl;
|
||||
memset(this->internalBuffer, 0, sizeof(this->internalBuffer));
|
||||
this->messageSize = this->HEADER_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
MessageQueueMessage::~MessageQueueMessage() {
|
||||
}
|
||||
|
||||
@ -37,29 +51,34 @@ void MessageQueueMessage::setSender(MessageQueueId_t setId) {
|
||||
memcpy(this->internalBuffer, &setId, sizeof(MessageQueueId_t));
|
||||
}
|
||||
|
||||
MessageQueueMessage::MessageQueueMessage(uint8_t* data, uint32_t size) :
|
||||
messageSize(this->HEADER_SIZE + size) {
|
||||
if (size <= this->MAX_DATA_SIZE) {
|
||||
memcpy(this->getData(), data, size);
|
||||
} else {
|
||||
memset(this->internalBuffer, 0, sizeof(this->internalBuffer));
|
||||
this->messageSize = this->HEADER_SIZE;
|
||||
void MessageQueueMessage::print(bool printWholeMessage) {
|
||||
sif::debug << "MessageQueueMessage content: " << std::endl;
|
||||
if(printWholeMessage) {
|
||||
arrayprinter::print(getData(), getMaximumMessageSize());
|
||||
}
|
||||
}
|
||||
|
||||
size_t MessageQueueMessage::getMinimumMessageSize() {
|
||||
return this->HEADER_SIZE;
|
||||
}
|
||||
|
||||
void MessageQueueMessage::print() {
|
||||
sif::debug << "MessageQueueMessage has size: " << this->messageSize << std::hex
|
||||
<< std::endl;
|
||||
for (uint8_t count = 0; count < this->messageSize; count++) {
|
||||
sif::debug << (uint32_t) this->internalBuffer[count] << ":";
|
||||
else {
|
||||
arrayprinter::print(getData(), getMessageSize());
|
||||
}
|
||||
sif::debug << std::dec << std::endl;
|
||||
|
||||
}
|
||||
|
||||
void MessageQueueMessage::clear() {
|
||||
memset(this->getBuffer(), 0, this->MAX_MESSAGE_SIZE);
|
||||
}
|
||||
|
||||
size_t MessageQueueMessage::getMessageSize() const {
|
||||
return this->messageSize;
|
||||
}
|
||||
|
||||
void MessageQueueMessage::setMessageSize(size_t messageSize) {
|
||||
this->messageSize = messageSize;
|
||||
}
|
||||
|
||||
size_t MessageQueueMessage::getMinimumMessageSize() const {
|
||||
return this->MIN_MESSAGE_SIZE;
|
||||
}
|
||||
|
||||
size_t MessageQueueMessage::getMaximumMessageSize() const {
|
||||
return this->MAX_MESSAGE_SIZE;
|
||||
}
|
||||
|
||||
|
@ -1,118 +1,149 @@
|
||||
#ifndef MESSAGEQUEUEMESSAGE_H_
|
||||
#define MESSAGEQUEUEMESSAGE_H_
|
||||
#ifndef FSFW_IPC_MESSAGEQUEUEMESSAGE_H_
|
||||
#define FSFW_IPC_MESSAGEQUEUEMESSAGE_H_
|
||||
|
||||
#include "MessageQueueSenderIF.h"
|
||||
#include <stddef.h>
|
||||
#include "../ipc/MessageQueueMessageIF.h"
|
||||
#include <cstddef>
|
||||
|
||||
/**
|
||||
* \brief This class is the representation and data organizer for interprocess messages.
|
||||
* @brief This class is the representation and data organizer
|
||||
* for interprocess messages.
|
||||
* @details
|
||||
* To facilitate and standardize interprocess communication, this class was
|
||||
* created to handle a lightweight "interprocess message protocol".
|
||||
*
|
||||
* \details To facilitate and standardize interprocess communication, this class was created
|
||||
* to handle a lightweight "interprocess message protocol". It adds a header with the
|
||||
* sender's queue id to every sent message and defines the maximum total message size.
|
||||
* Specialized messages, such as device commanding messages, can be created by inheriting
|
||||
* from this class and filling the buffer provided by getData with additional content.
|
||||
* If larger amounts of data must be sent between processes, the data shall be stored in
|
||||
* the IPC Store object and only the storage id is passed in a queue message.
|
||||
* The class is used both to generate and send messages and to receive messages from
|
||||
* other tasks.
|
||||
* \ingroup message_queue
|
||||
* It adds a header with the sender's queue id to every sent message and
|
||||
* defines the maximum total message size. Specialized messages, such as
|
||||
* device commanding messages, can be created by inheriting from this class
|
||||
* and filling the buffer provided by getData with additional content.
|
||||
*
|
||||
* If larger amounts of data must be sent between processes, the data shall
|
||||
* be stored in the IPC Store object and only the storage id is passed in a
|
||||
* queue message.The class is used both to generate and send messages and to
|
||||
* receive messages from other tasks.
|
||||
* @ingroup message_queue
|
||||
*/
|
||||
class MessageQueueMessage {
|
||||
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.
|
||||
* @brief The class is initialized empty with this constructor.
|
||||
* @details
|
||||
* The messageSize attribute is set to the header's size and the whole
|
||||
* content is set to zero.
|
||||
*/
|
||||
MessageQueueMessage();
|
||||
/**
|
||||
* @brief With this constructor the class is initialized with
|
||||
* the given content.
|
||||
* @details
|
||||
* If the passed message size fits into the buffer, the passed data is
|
||||
* copied to the internal buffer and the messageSize information is set.
|
||||
* Otherwise, messageSize is set to the header's size and the whole
|
||||
* content is set to zero.
|
||||
* @param data The data to be put in the message.
|
||||
* @param size Size of the data to be copied. Must be smaller than
|
||||
* MAX_MESSAGE_SIZE and larger than MIN_MESSAGE_SIZE.
|
||||
*/
|
||||
MessageQueueMessage(uint8_t* data, size_t size);
|
||||
|
||||
/**
|
||||
* @brief As no memory is allocated in this class,
|
||||
* the destructor is empty.
|
||||
*/
|
||||
virtual ~MessageQueueMessage();
|
||||
|
||||
/**
|
||||
* @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 constants defines the size of the header, which is added to every message.
|
||||
* @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 const size_t HEADER_SIZE = sizeof(MessageQueueId_t);
|
||||
static constexpr size_t MAX_MESSAGE_SIZE = MAX_DATA_SIZE + HEADER_SIZE;
|
||||
/**
|
||||
* \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.
|
||||
* @brief Defines the minimum size of a message where only the
|
||||
* header is included
|
||||
*/
|
||||
static const size_t MAX_MESSAGE_SIZE = MAX_DATA_SIZE + HEADER_SIZE;
|
||||
static constexpr size_t MIN_MESSAGE_SIZE = HEADER_SIZE;
|
||||
private:
|
||||
/**
|
||||
* \brief This is the internal buffer that contains the actual message data.
|
||||
* @brief This is the internal buffer that contains the
|
||||
* actual message data.
|
||||
*/
|
||||
uint8_t internalBuffer[MAX_MESSAGE_SIZE];
|
||||
public:
|
||||
/**
|
||||
* \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 variable's 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.
|
||||
* @brief This method is used to get the complete data of the message.
|
||||
*/
|
||||
size_t messageSize;
|
||||
const uint8_t* getBuffer() const override;
|
||||
/**
|
||||
* \brief The class is initialized empty with this constructor.
|
||||
* \details The messageSize attribute is set to the header's size and the whole content is set to
|
||||
* zero.
|
||||
* @brief This method is used to get the complete data of the message.
|
||||
*/
|
||||
MessageQueueMessage();
|
||||
uint8_t* getBuffer() override;
|
||||
/**
|
||||
* \brief With this constructor the class is initialized with the given content.
|
||||
* \details If the passed message size fits into the buffer, the passed data is copied to the
|
||||
* internal buffer and the messageSize information is set. Otherwise, messageSize
|
||||
* is set to the header's size and the whole content is set to zero.
|
||||
* \param data The data to be put in the message.
|
||||
* \param size Size of the data to be copied. Must be smaller than MAX_MESSAGE_SIZE.
|
||||
* @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.
|
||||
*/
|
||||
MessageQueueMessage(uint8_t* data, uint32_t size);
|
||||
const uint8_t* getData() const override;
|
||||
/**
|
||||
* \brief As no memory is allocated in this class, the destructor is empty.
|
||||
* @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 ~MessageQueueMessage();
|
||||
uint8_t* getData() override;
|
||||
/**
|
||||
* \brief This method is used to get the complete data of the message.
|
||||
* @brief This method is used to extract the sender's message
|
||||
* queue id information from a received message.
|
||||
*/
|
||||
const uint8_t* getBuffer() const;
|
||||
MessageQueueId_t getSender() const override;
|
||||
/**
|
||||
* \brief This method is used to get the complete data of the message.
|
||||
* @brief With this method, the whole content
|
||||
* and the message size is set to zero.
|
||||
*/
|
||||
uint8_t* getBuffer();
|
||||
void clear() override;
|
||||
|
||||
/**
|
||||
* \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.
|
||||
* @brief This method is used to set the sender's message queue id
|
||||
* information prior to ing the message.
|
||||
* @param setId
|
||||
* The message queue id that identifies the sending message queue.
|
||||
*/
|
||||
const uint8_t* getData() const;
|
||||
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;
|
||||
|
||||
/**
|
||||
* \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.
|
||||
* @brief This is a debug method that prints the content.
|
||||
*/
|
||||
uint8_t* getData();
|
||||
/**
|
||||
* \brief This method is used to extract the sender's message queue id information from a
|
||||
* received message.
|
||||
*/
|
||||
MessageQueueId_t getSender() const;
|
||||
/**
|
||||
* \brief With this method, the whole content and the message size is set to zero.
|
||||
*/
|
||||
void clear();
|
||||
/**
|
||||
* \brief This is a debug method that prints the content (till messageSize) to the debug output.
|
||||
*/
|
||||
void print();
|
||||
/**
|
||||
* \brief This method is used to set the sender's message queue id information prior to
|
||||
* sending the message.
|
||||
* \param setId The message queue id that identifies the sending message queue.
|
||||
*/
|
||||
void setSender(MessageQueueId_t setId);
|
||||
/**
|
||||
* \brief This helper function is used by the MessageQueue class to check the size of an
|
||||
* incoming message.
|
||||
* \details The method must be overwritten by child classes if size checks shall be more strict.
|
||||
* @return The default implementation returns HEADER_SIZE.
|
||||
*/
|
||||
virtual size_t getMinimumMessageSize();
|
||||
void print(bool printWholeMessage);
|
||||
};
|
||||
|
||||
#endif /* MESSAGEQUEUEMESSAGE_H_ */
|
||||
#endif /* FSFW_IPC_MESSAGEQUEUEMESSAGE_H_ */
|
||||
|
80
ipc/MessageQueueMessageIF.h
Normal file
80
ipc/MessageQueueMessageIF.h
Normal file
@ -0,0 +1,80 @@
|
||||
#ifndef FRAMEWORK_IPC_MESSAGEQUEUEMESSAGEIF_H_
|
||||
#define FRAMEWORK_IPC_MESSAGEQUEUEMESSAGEIF_H_
|
||||
|
||||
#include <fsfw/ipc/messageQueueDefinitions.h>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
class MessageQueueMessageIF {
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief This constants defines the size of the header,
|
||||
* which is added to every message.
|
||||
*/
|
||||
static const size_t HEADER_SIZE = sizeof(MessageQueueId_t);
|
||||
|
||||
virtual ~MessageQueueMessageIF() {};
|
||||
|
||||
/**
|
||||
* @brief With this method, the whole content and the message
|
||||
* size is set to zero.
|
||||
* @details
|
||||
* Implementations should also take care to clear data which is stored
|
||||
* indirectly (e.g. storage data).
|
||||
*/
|
||||
virtual void clear() = 0;
|
||||
|
||||
/**
|
||||
* @brief Get read-only pointer to the complete data of the message.
|
||||
* @return
|
||||
*/
|
||||
virtual const uint8_t* getBuffer() const = 0;
|
||||
|
||||
/**
|
||||
* @brief This method is used to get the complete data of the message.
|
||||
*/
|
||||
virtual uint8_t* getBuffer() = 0;
|
||||
|
||||
/**
|
||||
* @brief This method is used to set the sender's message queue id
|
||||
* information prior to sending the message.
|
||||
* @param setId
|
||||
* The message queue id that identifies the sending message queue.
|
||||
*/
|
||||
virtual void setSender(MessageQueueId_t setId) = 0;
|
||||
|
||||
/**
|
||||
* @brief This method is used to extract the sender's message queue id
|
||||
* information from a received message.
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* @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 uint8_t* getData() = 0;
|
||||
|
||||
/**
|
||||
* Get constant message size of current message implementation.
|
||||
* @return
|
||||
*/
|
||||
virtual size_t getMessageSize() const = 0;
|
||||
|
||||
virtual void setMessageSize(size_t messageSize) = 0;
|
||||
virtual size_t getMinimumMessageSize() const = 0;
|
||||
virtual size_t getMaximumMessageSize() const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_IPC_MESSAGEQUEUEMESSAGEIF_H_ */
|
@ -1,37 +1,26 @@
|
||||
#ifndef FRAMEWORK_IPC_MESSAGEQUEUESENDERIF_H_
|
||||
#define FRAMEWORK_IPC_MESSAGEQUEUESENDERIF_H_
|
||||
#ifndef FSFW_IPC_MESSAGEQUEUESENDERIF_H_
|
||||
#define FSFW_IPC_MESSAGEQUEUESENDERIF_H_
|
||||
|
||||
#include "MessageQueueIF.h"
|
||||
#include "MessageQueueMessageIF.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
class MessageQueueMessage;
|
||||
|
||||
|
||||
//TODO: Actually, the definition of this ID to be a uint32_t is not ideal and breaks layering.
|
||||
//However, it is difficult to keep layering, as the ID is stored in many places and sent around in
|
||||
//MessageQueueMessage.
|
||||
//Ideally, one would use the (current) object_id_t only, however, doing a lookup of queueIDs for every
|
||||
//call does not sound ideal.
|
||||
//In a first step, I'll circumvent the issue by not touching it, maybe in a second step.
|
||||
//This also influences Interface design (getCommandQueue) and some other issues..
|
||||
typedef uint32_t MessageQueueId_t;
|
||||
|
||||
class MessageQueueSenderIF {
|
||||
public:
|
||||
static const MessageQueueId_t NO_QUEUE = 0;
|
||||
|
||||
virtual ~MessageQueueSenderIF() {}
|
||||
|
||||
/**
|
||||
* Allows sending messages without actually "owing" a message queue.
|
||||
* Allows sending messages without actually "owning" a message queue.
|
||||
* Not sure whether this is actually a good idea.
|
||||
* Must be implemented by a subclass.
|
||||
*/
|
||||
static ReturnValue_t sendMessage(MessageQueueId_t sendTo,
|
||||
MessageQueueMessage* message, MessageQueueId_t sentFrom =
|
||||
MessageQueueSenderIF::NO_QUEUE, bool ignoreFault=false);
|
||||
MessageQueueMessageIF* message,
|
||||
MessageQueueId_t sentFrom = MessageQueueIF::NO_QUEUE,
|
||||
bool ignoreFault = false);
|
||||
private:
|
||||
MessageQueueSenderIF() {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* FRAMEWORK_IPC_MESSAGEQUEUESENDERIF_H_ */
|
||||
#endif /* FSFW_IPC_MESSAGEQUEUESENDERIF_H_ */
|
||||
|
@ -1,8 +1,10 @@
|
||||
#ifndef FRAMEWORK_IPC_QUEUEFACTORY_H_
|
||||
#define FRAMEWORK_IPC_QUEUEFACTORY_H_
|
||||
#ifndef FSFW_IPC_QUEUEFACTORY_H_
|
||||
#define FSFW_IPC_QUEUEFACTORY_H_
|
||||
|
||||
#include "MessageQueueIF.h"
|
||||
#include <stdint.h>
|
||||
#include "MessageQueueMessage.h"
|
||||
#include <cstdint>
|
||||
|
||||
/**
|
||||
* Creates message queues.
|
||||
* This class is a "singleton" interface, i.e. it provides an
|
||||
@ -30,4 +32,4 @@ private:
|
||||
static QueueFactory* factoryInstance;
|
||||
};
|
||||
|
||||
#endif /* FRAMEWORK_IPC_QUEUEFACTORY_H_ */
|
||||
#endif /* FSFW_IPC_QUEUEFACTORY_H_ */
|
||||
|
18
ipc/messageQueueDefinitions.h
Normal file
18
ipc/messageQueueDefinitions.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef FSFW_IPC_MESSAGEQUEUEDEFINITIONS_H_
|
||||
#define FSFW_IPC_MESSAGEQUEUEDEFINITIONS_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
/*
|
||||
* TODO: Actually, the definition of this ID to be a uint32_t is not ideal and
|
||||
* breaks layering. However, it is difficult to keep layering, as the ID is
|
||||
* stored in many places and sent around in MessageQueueMessage.
|
||||
* Ideally, one would use the (current) object_id_t only, however, doing a
|
||||
* lookup of queueIDs for every call does not sound ideal.
|
||||
* In a first step, I'll circumvent the issue by not touching it,
|
||||
* maybe in a second step. This also influences Interface design
|
||||
* (getCommandQueue) and some other issues..
|
||||
*/
|
||||
using MessageQueueId_t = uint32_t;
|
||||
|
||||
#endif /* FSFW_IPC_MESSAGEQUEUEDEFINITIONS_H_ */
|
BIN
logo/FSFW_Logo_V3.png
Normal file
BIN
logo/FSFW_Logo_V3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
711
logo/FSFW_Logo_V3.svg
Normal file
711
logo/FSFW_Logo_V3.svg
Normal file
@ -0,0 +1,711 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="59.111mm"
|
||||
height="67.383003mm"
|
||||
viewBox="0 0 59.111 67.383003"
|
||||
version="1.1"
|
||||
id="svg22814"
|
||||
inkscape:version="0.92.0 r15299"
|
||||
sodipodi:docname="FSFW_Logo_V3.svg"
|
||||
style="enable-background:new">
|
||||
<defs
|
||||
id="defs22808">
|
||||
<inkscape:path-effect
|
||||
effect="bspline"
|
||||
id="path-effect23502"
|
||||
is_visible="true"
|
||||
weight="33.333333"
|
||||
steps="2"
|
||||
helper_size="0"
|
||||
apply_no_weight="true"
|
||||
apply_with_weight="true"
|
||||
only_selected="false" />
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
style="color-interpolation-filters:sRGB"
|
||||
id="filter23683">
|
||||
<feBlend
|
||||
inkscape:collect="always"
|
||||
mode="darken"
|
||||
in2="BackgroundImage"
|
||||
id="feBlend23685" />
|
||||
</filter>
|
||||
<meshgradient
|
||||
inkscape:collect="always"
|
||||
id="meshgradient23819"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x="-9.447978"
|
||||
y="-28.967659"
|
||||
gradientTransform="matrix(1.6672918,0,0,1.5637161,15.752536,45.300004)">
|
||||
<meshrow
|
||||
id="meshrow23821">
|
||||
<meshpatch
|
||||
id="meshpatch23823">
|
||||
<stop
|
||||
path="c 11.8178,0 23.6355,0 35.4533,0"
|
||||
style="stop-color:#0087ce;stop-opacity:1"
|
||||
id="stop23825" />
|
||||
<stop
|
||||
path="c 0,3.49232 0,6.98464 0,10.477"
|
||||
style="stop-color:#00beff;stop-opacity:1"
|
||||
id="stop23827" />
|
||||
<stop
|
||||
path="c -11.8178,0 -23.6355,0 -35.4533,0"
|
||||
style="stop-color:#0087ce;stop-opacity:1"
|
||||
id="stop23829" />
|
||||
<stop
|
||||
path="c 0,-3.49232 0,-6.98464 0,-10.477"
|
||||
style="stop-color:#00519e;stop-opacity:1"
|
||||
id="stop23831" />
|
||||
</meshpatch>
|
||||
</meshrow>
|
||||
</meshgradient>
|
||||
<clipPath
|
||||
clipPathUnits="userSpaceOnUse"
|
||||
id="clipPath24955">
|
||||
<g
|
||||
style="display:inline;fill:url(#meshgradient24977);fill-opacity:1;enable-background:new"
|
||||
id="g24975"
|
||||
transform="translate(-42.742183,-140.61702)"
|
||||
clip-path="none">
|
||||
<path
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.98999999;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.98699999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 48.300305,143.44076 c -0.811661,0 -1.109125,0.75874 -1.480469,1.48047 l -4.00014,7.77454 c -0.371344,0.72173 0.668807,1.48047 1.480468,1.48047 h 9.625183 c 0.811661,0 1.109108,-0.75875 1.480469,-1.48047 l 4.00036,-7.77454 c 0.371361,-0.72172 -0.668808,-1.48047 -1.480469,-1.48047 z m 0,0.98828 h 9.625402 c 0.281935,0 0.621179,0.2415 0.492187,0.49219 l -4.00036,7.77454 c -0.128993,0.25069 -0.210251,0.49218 -0.492187,0.49218 h -9.625181 c -0.281935,0 -0.621175,-0.24149 -0.492189,-0.49218 l 4.000141,-7.77454 c 0.128986,-0.25069 0.210253,-0.49219 0.492187,-0.49219 z"
|
||||
id="path24957"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ssssssssssssssssss" />
|
||||
<path
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
sodipodi:nodetypes="ssssssssssssssssss"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path24959"
|
||||
d="m 90.668816,143.44076 c -0.811661,0 -1.109125,0.75874 -1.480469,1.48047 l -4.00014,7.77454 c -0.371344,0.72173 0.668808,1.48047 1.480469,1.48047 h 9.625909 c 0.81166,0 1.109109,-0.75875 1.48047,-1.48047 l 4.000355,-7.77454 c 0.37136,-0.72172 -0.66881,-1.48047 -1.48046,-1.48047 z m 0,0.98828 h 9.626134 c 0.28193,0 0.62117,0.24151 0.49218,0.49219 l -4.000365,7.77454 c -0.128993,0.25069 -0.21025,0.49218 -0.49218,0.49218 h -9.625909 c -0.281935,0 -0.621174,-0.24149 -0.492188,-0.49218 l 4.00014,-7.77454 c 0.128986,-0.25069 0.210254,-0.49219 0.492188,-0.49219 z"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.98999999;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.98699999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||
<text
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;opacity:0.98999999;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
x="69.980721"
|
||||
y="150.38542"
|
||||
id="text24965"><tspan
|
||||
dy="-2"
|
||||
dx="0"
|
||||
sodipodi:role="line"
|
||||
id="tspan24961"
|
||||
x="69.980721"
|
||||
y="150.38542"
|
||||
style="text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill-opacity:1;stroke-width:0.26458332">fs</tspan><tspan
|
||||
dx="0 0 -0.27000001"
|
||||
id="tspan24963"
|
||||
sodipodi:role="line"
|
||||
x="69.980721"
|
||||
y="157"
|
||||
style="text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill-opacity:1;stroke-width:0.26458332"> fw</tspan></text>
|
||||
<g
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
transform="translate(-1.937002)"
|
||||
id="g24969"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.36171436px;line-height:5.85107136px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;opacity:0.98999999;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.23404284"
|
||||
aria-label="{">
|
||||
<path
|
||||
sodipodi:nodetypes="ccssccsssccccssccccssscc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path24967"
|
||||
style="font-size:18.72342873px;fill:#000000;fill-opacity:1;stroke-width:0.23404284"
|
||||
d="m 67.678074,141.482 c -0.798867,0.0624 -1.915603,0.38946 -2.290072,0.80139 -0.361986,0.41191 -0.543,1.06141 -0.543,1.94766 v 1.29191 c 0,1.04851 -0.199567,1.82824 -0.599,2.34001 -0.386951,0.51177 -1.010722,0.82383 -1.872,0.93617 0.848795,0.11234 1.472567,0.41816 1.872,0.91745 0.399433,0.49929 0.599,1.22951 0.599,2.19064 v 1.38554 c 0,0.88624 0.193496,1.5478 0.543,1.98468 0.349504,0.44936 1.453759,0.79514 2.290072,0.85755 v 0.86501 c -1.260711,-0.0749 -2.215606,-0.38696 -2.864685,-0.93618 -0.636597,-0.53673 -0.954895,-1.55404 -0.954895,-3.05192 v -1.23574 c 0,-0.84879 -0.205958,-1.44794 -0.617873,-1.79745 -0.399433,-0.36199 -1.017306,-0.59291 -1.853619,-0.69277 v -0.95489 c 0.761419,-0.0624 1.360569,-0.28084 1.797449,-0.65532 0.449362,-0.38695 0.674043,-0.91745 0.674043,-1.59149 v -1.66639 c 0,-1.26071 0.293334,-2.19064 0.880001,-2.78979 0.586667,-0.59915 1.566527,-0.93617 2.939579,-1.01107 z" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
aria-label="{"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.36171436px;line-height:5.85107136px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;opacity:0.98999999;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.23404284"
|
||||
id="g24973"
|
||||
transform="rotate(180,73.264036,148.80851)">
|
||||
<path
|
||||
d="m 67.678074,141.482 c -0.798867,0.0624 -1.915603,0.38946 -2.290072,0.80139 -0.361986,0.41191 -0.543,1.06141 -0.543,1.94766 v 1.29191 c 0,1.04851 -0.199567,1.82824 -0.599,2.34001 -0.386951,0.51177 -1.010722,0.82383 -1.872,0.93617 0.848795,0.11234 1.472567,0.41816 1.872,0.91745 0.399433,0.49929 0.599,1.22951 0.599,2.19064 v 1.38554 c 0,0.88624 0.193496,1.5478 0.543,1.98468 0.349504,0.44936 1.453759,0.79514 2.290072,0.85755 v 0.86501 c -1.260711,-0.0749 -2.215606,-0.38696 -2.864685,-0.93618 -0.636597,-0.53673 -0.954895,-1.55404 -0.954895,-3.05192 v -1.23574 c 0,-0.84879 -0.205958,-1.44794 -0.617873,-1.79745 -0.399433,-0.36199 -1.017306,-0.59291 -1.853619,-0.69277 v -0.95489 c 0.761419,-0.0624 1.360569,-0.28084 1.797449,-0.65532 0.449362,-0.38695 0.674043,-0.91745 0.674043,-1.59149 v -1.66639 c 0,-1.26071 0.293334,-2.19064 0.880001,-2.78979 0.586667,-0.59915 1.566527,-0.93617 2.939579,-1.01107 z"
|
||||
style="font-size:18.72342873px;fill:#000000;fill-opacity:1;stroke-width:0.23404284"
|
||||
id="path24971"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccssccsssccccssccccssscc" />
|
||||
</g>
|
||||
</g>
|
||||
</clipPath>
|
||||
<meshgradient
|
||||
inkscape:collect="always"
|
||||
id="meshgradient24977"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.6672918,0,0,1.5637161,15.752536,45.300004)"
|
||||
x="42.742184"
|
||||
y="140.617">
|
||||
<meshrow
|
||||
id="meshrow24989">
|
||||
<meshpatch
|
||||
id="meshpatch24987">
|
||||
<stop
|
||||
path="c 19.7036,0 39.4071,0 59.1107,0"
|
||||
style="stop-color:#00519e;stop-opacity:1"
|
||||
id="stop24979" />
|
||||
<stop
|
||||
path="c 0,5.46099 0,10.922 0,16.383"
|
||||
style="stop-color:#00beff;stop-opacity:1"
|
||||
id="stop24981" />
|
||||
<stop
|
||||
path="c -19.7036,0 -39.4071,0 -59.1107,0"
|
||||
style="stop-color:#00beff;stop-opacity:1"
|
||||
id="stop24983" />
|
||||
<stop
|
||||
path="c 0,-5.46099 0,-10.922 0,-16.383"
|
||||
style="stop-color:#00519e;stop-opacity:1"
|
||||
id="stop24985" />
|
||||
</meshpatch>
|
||||
</meshrow>
|
||||
</meshgradient>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2"
|
||||
inkscape:cx="110.06798"
|
||||
inkscape:cy="138.03068"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer16"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1536"
|
||||
inkscape:window-height="801"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:pagecheckerboard="true" />
|
||||
<metadata
|
||||
id="metadata22811">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer13"
|
||||
inkscape:label="Corporate_Uni_Stuttgart"
|
||||
transform="translate(0,16.383002)"
|
||||
style="display:none;filter:url(#filter23683)">
|
||||
<rect
|
||||
style="opacity:1;fill:#3e444c;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23621"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-8.499999"
|
||||
y="42.5" />
|
||||
<rect
|
||||
y="34"
|
||||
x="-8.499999"
|
||||
height="8.499999"
|
||||
width="8.499999"
|
||||
id="rect23623"
|
||||
style="opacity:1;fill:#00519e;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
|
||||
<rect
|
||||
style="opacity:1;fill:#00beff;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23625"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-8.499999"
|
||||
y="25.5" />
|
||||
<rect
|
||||
style="opacity:1;fill:#009e51;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23629"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-50.999996"
|
||||
y="34" />
|
||||
<rect
|
||||
y="25.5"
|
||||
x="-50.999996"
|
||||
height="8.499999"
|
||||
width="8.499999"
|
||||
id="rect23631"
|
||||
style="opacity:1;fill:#00ffbe;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
|
||||
<rect
|
||||
y="34"
|
||||
x="-16.999998"
|
||||
height="8.499999"
|
||||
width="8.499999"
|
||||
id="rect23635"
|
||||
style="opacity:1;fill:#51009e;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
|
||||
<rect
|
||||
style="opacity:1;fill:#be00ff;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23637"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-16.999998"
|
||||
y="25.5" />
|
||||
<rect
|
||||
y="42.5"
|
||||
x="-50.999996"
|
||||
height="8.499999"
|
||||
width="8.499999"
|
||||
id="rect23639"
|
||||
style="opacity:1;fill:#3e4c44;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
|
||||
<rect
|
||||
style="opacity:1;fill:#443e4c;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23641"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-16.999998"
|
||||
y="42.5" />
|
||||
<rect
|
||||
y="42.5"
|
||||
x="-33.999996"
|
||||
height="8.499999"
|
||||
width="8.499999"
|
||||
id="rect23655"
|
||||
style="opacity:1;fill:#4c443e;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
|
||||
<rect
|
||||
style="opacity:1;fill:#9e5100;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23657"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-33.999996"
|
||||
y="34" />
|
||||
<rect
|
||||
y="25.5"
|
||||
x="-33.999996"
|
||||
height="8.499999"
|
||||
width="8.499999"
|
||||
id="rect23659"
|
||||
style="opacity:1;fill:#ffbe00;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
|
||||
<rect
|
||||
style="opacity:1;fill:#4c3e44;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23661"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-25.499998"
|
||||
y="42.5" />
|
||||
<rect
|
||||
y="34"
|
||||
x="-25.499998"
|
||||
height="8.499999"
|
||||
width="8.499999"
|
||||
id="rect23663"
|
||||
style="opacity:1;fill:#9e0051;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
|
||||
<rect
|
||||
style="opacity:1;fill:#ff00be;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23665"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-25.499998"
|
||||
y="25.5" />
|
||||
<rect
|
||||
y="42.5"
|
||||
x="-42.499996"
|
||||
height="8.499999"
|
||||
width="8.499999"
|
||||
id="rect23667"
|
||||
style="opacity:1;fill:#444c3e;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
|
||||
<rect
|
||||
style="opacity:1;fill:#519e00;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23669"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-42.499996"
|
||||
y="34" />
|
||||
<rect
|
||||
y="25.5"
|
||||
x="-42.499996"
|
||||
height="8.499999"
|
||||
width="8.499999"
|
||||
id="rect23671"
|
||||
style="opacity:1;fill:#beff00;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
|
||||
<rect
|
||||
style="opacity:1;fill:#006cb6;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23673"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-8.499999"
|
||||
y="17" />
|
||||
<rect
|
||||
y="8.500001"
|
||||
x="-8.499999"
|
||||
height="8.499999"
|
||||
width="8.499999"
|
||||
id="rect23713"
|
||||
style="opacity:1;fill:#0087ce;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke" />
|
||||
<rect
|
||||
style="opacity:1;fill:#00a3e7;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke"
|
||||
id="rect23715"
|
||||
width="8.499999"
|
||||
height="8.499999"
|
||||
x="-8.499999"
|
||||
y="1.9073486e-006" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer10"
|
||||
inkscape:label="Logo_mono_black"
|
||||
transform="translate(0,-229.617)"
|
||||
style="display:inline">
|
||||
<g
|
||||
style="display:inline"
|
||||
id="g23526"
|
||||
transform="translate(-42.742184,139.99998)">
|
||||
<path
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.98999999;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.98699999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 48.300305,143.44076 c -0.811661,0 -1.109125,0.75874 -1.480469,1.48047 l -4.00014,7.77454 c -0.371344,0.72173 0.668807,1.48047 1.480468,1.48047 h 9.625183 c 0.811661,0 1.109108,-0.75875 1.480469,-1.48047 l 4.00036,-7.77454 c 0.371361,-0.72172 -0.668808,-1.48047 -1.480469,-1.48047 z m 0,0.98828 h 9.625402 c 0.281935,0 0.621179,0.2415 0.492187,0.49219 l -4.00036,7.77454 c -0.128993,0.25069 -0.210251,0.49218 -0.492187,0.49218 h -9.625181 c -0.281935,0 -0.621175,-0.24149 -0.492189,-0.49218 l 4.000141,-7.77454 c 0.128986,-0.25069 0.210253,-0.49219 0.492187,-0.49219 z"
|
||||
id="path23506"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ssssssssssssssssss" />
|
||||
<path
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
sodipodi:nodetypes="ssssssssssssssssss"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23508"
|
||||
d="m 90.668816,143.44076 c -0.811661,0 -1.109125,0.75874 -1.480469,1.48047 l -4.00014,7.77454 c -0.371344,0.72173 0.668808,1.48047 1.480469,1.48047 h 9.625909 c 0.81166,0 1.109109,-0.75875 1.48047,-1.48047 l 4.000355,-7.77454 c 0.37136,-0.72172 -0.66881,-1.48047 -1.48046,-1.48047 z m 0,0.98828 h 9.626134 c 0.28193,0 0.62117,0.24151 0.49218,0.49219 l -4.000365,7.77454 c -0.128993,0.25069 -0.21025,0.49218 -0.49218,0.49218 h -9.625909 c -0.281935,0 -0.621174,-0.24149 -0.492188,-0.49218 l 4.00014,-7.77454 c 0.128986,-0.25069 0.210254,-0.49219 0.492188,-0.49219 z"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.98999999;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.98699999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||
<text
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;opacity:0.98999999;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
x="69.980721"
|
||||
y="150.38542"
|
||||
id="text23365-1"><tspan
|
||||
dy="-2"
|
||||
dx="0"
|
||||
sodipodi:role="line"
|
||||
id="tspan23363-7"
|
||||
x="69.980721"
|
||||
y="150.38542"
|
||||
style="text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;stroke-width:0.26458332">fs</tspan><tspan
|
||||
dx="0 0 -0.27000001"
|
||||
id="tspan23367-0"
|
||||
sodipodi:role="line"
|
||||
x="69.980721"
|
||||
y="157"
|
||||
style="text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;stroke-width:0.26458332"> fw</tspan></text>
|
||||
<g
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
transform="translate(-1.937002)"
|
||||
id="text23461"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.36171436px;line-height:5.85107136px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;opacity:0.98999999;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.23404284"
|
||||
aria-label="{">
|
||||
<path
|
||||
sodipodi:nodetypes="ccssccsssccccssccccssscc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23467"
|
||||
style="font-size:18.72342873px;fill:#000000;fill-opacity:1;stroke-width:0.23404284"
|
||||
d="m 67.678074,141.482 c -0.798867,0.0624 -1.915603,0.38946 -2.290072,0.80139 -0.361986,0.41191 -0.543,1.06141 -0.543,1.94766 v 1.29191 c 0,1.04851 -0.199567,1.82824 -0.599,2.34001 -0.386951,0.51177 -1.010722,0.82383 -1.872,0.93617 0.848795,0.11234 1.472567,0.41816 1.872,0.91745 0.399433,0.49929 0.599,1.22951 0.599,2.19064 v 1.38554 c 0,0.88624 0.193496,1.5478 0.543,1.98468 0.349504,0.44936 1.453759,0.79514 2.290072,0.85755 v 0.86501 c -1.260711,-0.0749 -2.215606,-0.38696 -2.864685,-0.93618 -0.636597,-0.53673 -0.954895,-1.55404 -0.954895,-3.05192 v -1.23574 c 0,-0.84879 -0.205958,-1.44794 -0.617873,-1.79745 -0.399433,-0.36199 -1.017306,-0.59291 -1.853619,-0.69277 v -0.95489 c 0.761419,-0.0624 1.360569,-0.28084 1.797449,-0.65532 0.449362,-0.38695 0.674043,-0.91745 0.674043,-1.59149 v -1.66639 c 0,-1.26071 0.293334,-2.19064 0.880001,-2.78979 0.586667,-0.59915 1.566527,-0.93617 2.939579,-1.01107 z" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
aria-label="{"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.36171436px;line-height:5.85107136px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;opacity:0.98999999;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.23404284"
|
||||
id="g23472"
|
||||
transform="rotate(180,73.264036,148.80851)">
|
||||
<path
|
||||
d="m 67.678074,141.482 c -0.798867,0.0624 -1.915603,0.38946 -2.290072,0.80139 -0.361986,0.41191 -0.543,1.06141 -0.543,1.94766 v 1.29191 c 0,1.04851 -0.199567,1.82824 -0.599,2.34001 -0.386951,0.51177 -1.010722,0.82383 -1.872,0.93617 0.848795,0.11234 1.472567,0.41816 1.872,0.91745 0.399433,0.49929 0.599,1.22951 0.599,2.19064 v 1.38554 c 0,0.88624 0.193496,1.5478 0.543,1.98468 0.349504,0.44936 1.453759,0.79514 2.290072,0.85755 v 0.86501 c -1.260711,-0.0749 -2.215606,-0.38696 -2.864685,-0.93618 -0.636597,-0.53673 -0.954895,-1.55404 -0.954895,-3.05192 v -1.23574 c 0,-0.84879 -0.205958,-1.44794 -0.617873,-1.79745 -0.399433,-0.36199 -1.017306,-0.59291 -1.853619,-0.69277 v -0.95489 c 0.761419,-0.0624 1.360569,-0.28084 1.797449,-0.65532 0.449362,-0.38695 0.674043,-0.91745 0.674043,-1.59149 v -1.66639 c 0,-1.26071 0.293334,-2.19064 0.880001,-2.78979 0.586667,-0.59915 1.566527,-0.93617 2.939579,-1.01107 z"
|
||||
style="font-size:18.72342873px;fill:#000000;fill-opacity:1;stroke-width:0.23404284"
|
||||
id="path23470"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccssccsssccccssccccssscc" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer12"
|
||||
inkscape:label="Logo_mono_white"
|
||||
style="display:inline"
|
||||
transform="translate(0,16.383002)">
|
||||
<g
|
||||
id="g23618">
|
||||
<path
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.98999999;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.98699999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 5.558122,20.44074 c -0.811661,0 -1.109125,0.75874 -1.480469,1.48047 l -4.00014,7.77454 c -0.371344,0.72173 0.668807,1.48047 1.480468,1.48047 h 9.625183 c 0.811661,0 1.109108,-0.75875 1.480469,-1.48047 l 4.00036,-7.77454 c 0.371361,-0.72172 -0.668808,-1.48047 -1.480469,-1.48047 z m 0,0.98828 h 9.625402 c 0.281935,0 0.621179,0.2415 0.492187,0.49219 l -4.00036,7.77454 c -0.128993,0.25069 -0.210251,0.49218 -0.492187,0.49218 H 1.557983 c -0.281935,0 -0.621175,-0.24149 -0.492189,-0.49218 l 4.000141,-7.77454 c 0.128986,-0.25069 0.210253,-0.49219 0.492187,-0.49219 z"
|
||||
id="path23560"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ssssssssssssssssss" />
|
||||
<path
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
sodipodi:nodetypes="ssssssssssssssssss"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23562"
|
||||
d="m 47.926633,20.44074 c -0.811661,0 -1.109125,0.75874 -1.480469,1.48047 l -4.00014,7.77454 c -0.371344,0.72173 0.668808,1.48047 1.480469,1.48047 h 9.625909 c 0.81166,0 1.109109,-0.75875 1.48047,-1.48047 l 4.000355,-7.77454 c 0.37136,-0.72172 -0.66881,-1.48047 -1.48046,-1.48047 z m 0,0.98828 h 9.626134 c 0.28193,0 0.62117,0.24151 0.49218,0.49219 l -4.000365,7.77454 c -0.128993,0.25069 -0.21025,0.49218 -0.49218,0.49218 h -9.625909 c -0.281935,0 -0.621174,-0.24149 -0.492188,-0.49218 l 4.00014,-7.77454 c 0.128986,-0.25069 0.210254,-0.49219 0.492188,-0.49219 z"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.98999999;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.98699999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||
<text
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;opacity:0.98999999;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
x="27.238537"
|
||||
y="27.385403"
|
||||
id="text23568"><tspan
|
||||
dy="-2"
|
||||
dx="0"
|
||||
sodipodi:role="line"
|
||||
id="tspan23564"
|
||||
x="27.238537"
|
||||
y="27.385403"
|
||||
style="text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;stroke-width:0.26458332">fs</tspan><tspan
|
||||
dx="0 0 -0.27000001"
|
||||
id="tspan23566"
|
||||
sodipodi:role="line"
|
||||
x="27.238537"
|
||||
y="33.999985"
|
||||
style="text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffffff;stroke-width:0.26458332"> fw</tspan></text>
|
||||
<g
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
transform="translate(-44.679185,-123.00002)"
|
||||
id="g23572"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.36171436px;line-height:5.85107136px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;opacity:0.98999999;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.23404284"
|
||||
aria-label="{">
|
||||
<path
|
||||
sodipodi:nodetypes="ccssccsssccccssccccssscc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23570"
|
||||
style="font-size:18.72342873px;fill:#ffffff;fill-opacity:1;stroke-width:0.23404284"
|
||||
d="m 67.678074,141.482 c -0.798867,0.0624 -1.915603,0.38946 -2.290072,0.80139 -0.361986,0.41191 -0.543,1.06141 -0.543,1.94766 v 1.29191 c 0,1.04851 -0.199567,1.82824 -0.599,2.34001 -0.386951,0.51177 -1.010722,0.82383 -1.872,0.93617 0.848795,0.11234 1.472567,0.41816 1.872,0.91745 0.399433,0.49929 0.599,1.22951 0.599,2.19064 v 1.38554 c 0,0.88624 0.193496,1.5478 0.543,1.98468 0.349504,0.44936 1.453759,0.79514 2.290072,0.85755 v 0.86501 c -1.260711,-0.0749 -2.215606,-0.38696 -2.864685,-0.93618 -0.636597,-0.53673 -0.954895,-1.55404 -0.954895,-3.05192 v -1.23574 c 0,-0.84879 -0.205958,-1.44794 -0.617873,-1.79745 -0.399433,-0.36199 -1.017306,-0.59291 -1.853619,-0.69277 v -0.95489 c 0.761419,-0.0624 1.360569,-0.28084 1.797449,-0.65532 0.449362,-0.38695 0.674043,-0.91745 0.674043,-1.59149 v -1.66639 c 0,-1.26071 0.293334,-2.19064 0.880001,-2.78979 0.586667,-0.59915 1.566527,-0.93617 2.939579,-1.01107 z" />
|
||||
</g>
|
||||
<g
|
||||
inkscape:export-ydpi="499.60001"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
aria-label="{"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.36171436px;line-height:5.85107136px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;opacity:0.98999999;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.23404284"
|
||||
id="g23576"
|
||||
transform="rotate(180,51.892944,87.3085)">
|
||||
<path
|
||||
d="m 67.678074,141.482 c -0.798867,0.0624 -1.915603,0.38946 -2.290072,0.80139 -0.361986,0.41191 -0.543,1.06141 -0.543,1.94766 v 1.29191 c 0,1.04851 -0.199567,1.82824 -0.599,2.34001 -0.386951,0.51177 -1.010722,0.82383 -1.872,0.93617 0.848795,0.11234 1.472567,0.41816 1.872,0.91745 0.399433,0.49929 0.599,1.22951 0.599,2.19064 v 1.38554 c 0,0.88624 0.193496,1.5478 0.543,1.98468 0.349504,0.44936 1.453759,0.79514 2.290072,0.85755 v 0.86501 c -1.260711,-0.0749 -2.215606,-0.38696 -2.864685,-0.93618 -0.636597,-0.53673 -0.954895,-1.55404 -0.954895,-3.05192 v -1.23574 c 0,-0.84879 -0.205958,-1.44794 -0.617873,-1.79745 -0.399433,-0.36199 -1.017306,-0.59291 -1.853619,-0.69277 v -0.95489 c 0.761419,-0.0624 1.360569,-0.28084 1.797449,-0.65532 0.449362,-0.38695 0.674043,-0.91745 0.674043,-1.59149 v -1.66639 c 0,-1.26071 0.293334,-2.19064 0.880001,-2.78979 0.586667,-0.59915 1.566527,-0.93617 2.939579,-1.01107 z"
|
||||
style="font-size:18.72342873px;fill:#ffffff;fill-opacity:1;stroke-width:0.23404284"
|
||||
id="path23574"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccssccsssccccssccccssscc" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer14"
|
||||
inkscape:label="Logo_colored"
|
||||
style="display:inline"
|
||||
transform="translate(0,17.000002)">
|
||||
<g
|
||||
id="g24826">
|
||||
<path
|
||||
sodipodi:nodetypes="ssssssssssssssssss"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23538"
|
||||
d="m 5.558122,19.823743 c -0.811661,0 -1.109125,0.75874 -1.480469,1.48047 l -4.00014,7.77454 c -0.371344,0.72173 0.668807,1.48047 1.480468,1.48047 h 9.625183 c 0.811661,0 1.109108,-0.75875 1.480469,-1.48047 l 4.00036,-7.77454 c 0.371361,-0.72172 -0.668808,-1.48047 -1.480469,-1.48047 z m 0,0.98828 h 9.625402 c 0.281935,0 0.621179,0.2415 0.492187,0.49219 l -4.00036,7.77454 c -0.128993,0.25069 -0.210251,0.49218 -0.492187,0.49218 H 1.557983 c -0.281935,0 -0.621175,-0.24149 -0.492189,-0.49218 l 4.000141,-7.77454 c 0.128986,-0.25069 0.210253,-0.49219 0.492187,-0.49219 z"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#00beff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.98699999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
inkscape:export-ydpi="499.60001"
|
||||
transform="translate(0,-17.000002)" />
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.98999999;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#00beff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.98699999;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 47.926633,19.823743 c -0.811661,0 -1.109125,0.75874 -1.480469,1.48047 l -4.00014,7.77454 c -0.371344,0.72173 0.668808,1.48047 1.480469,1.48047 h 9.625909 c 0.81166,0 1.109109,-0.75875 1.48047,-1.48047 l 4.000355,-7.77454 c 0.37136,-0.72172 -0.66881,-1.48047 -1.48046,-1.48047 z m 0,0.98828 h 9.626134 c 0.28193,0 0.62117,0.24151 0.49218,0.49219 l -4.000365,7.77454 c -0.128993,0.25069 -0.21025,0.49218 -0.49218,0.49218 h -9.625909 c -0.281935,0 -0.621174,-0.24149 -0.492188,-0.49218 l 4.00014,-7.77454 c 0.128986,-0.25069 0.210254,-0.49219 0.492188,-0.49219 z"
|
||||
id="path23540"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ssssssssssssssssss"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
inkscape:export-ydpi="499.60001"
|
||||
transform="translate(0,-17.000002)" />
|
||||
<g
|
||||
aria-label="{"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.36171436px;line-height:5.85107136px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;display:inline;opacity:0.98999999;fill:#00519e;fill-opacity:1;stroke:none;stroke-width:0.23404284;enable-background:new"
|
||||
id="g23550"
|
||||
transform="translate(-44.679185,-140.61702)"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
inkscape:export-ydpi="499.60001">
|
||||
<path
|
||||
d="m 67.678074,141.482 c -0.798867,0.0624 -1.915603,0.38946 -2.290072,0.80139 -0.361986,0.41191 -0.543,1.06141 -0.543,1.94766 v 1.29191 c 0,1.04851 -0.199567,1.82824 -0.599,2.34001 -0.386951,0.51177 -1.010722,0.82383 -1.872,0.93617 0.848795,0.11234 1.472567,0.41816 1.872,0.91745 0.399433,0.49929 0.599,1.22951 0.599,2.19064 v 1.38554 c 0,0.88624 0.193496,1.5478 0.543,1.98468 0.349504,0.44936 1.453759,0.79514 2.290072,0.85755 v 0.86501 c -1.260711,-0.0749 -2.215606,-0.38696 -2.864685,-0.93618 -0.636597,-0.53673 -0.954895,-1.55404 -0.954895,-3.05192 v -1.23574 c 0,-0.84879 -0.205958,-1.44794 -0.617873,-1.79745 -0.399433,-0.36199 -1.017306,-0.59291 -1.853619,-0.69277 v -0.95489 c 0.761419,-0.0624 1.360569,-0.28084 1.797449,-0.65532 0.449362,-0.38695 0.674043,-0.91745 0.674043,-1.59149 v -1.66639 c 0,-1.26071 0.293334,-2.19064 0.880001,-2.78979 0.586667,-0.59915 1.566527,-0.93617 2.939579,-1.01107 z"
|
||||
style="font-size:18.72342873px;fill:#00519e;fill-opacity:1;stroke-width:0.23404284"
|
||||
id="path23548"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccssccsssccccssccccssscc" />
|
||||
</g>
|
||||
<g
|
||||
transform="rotate(180,51.892943,78.500001)"
|
||||
id="g23554"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:9.36171436px;line-height:5.85107136px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';letter-spacing:0px;word-spacing:0px;display:inline;opacity:0.98999999;fill:#00519e;fill-opacity:1;stroke:none;stroke-width:0.23404284;enable-background:new"
|
||||
aria-label="{"
|
||||
inkscape:export-xdpi="499.60001"
|
||||
inkscape:export-ydpi="499.60001">
|
||||
<path
|
||||
sodipodi:nodetypes="ccssccsssccccssccccssscc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23552"
|
||||
style="font-size:18.72342873px;fill:#00519e;fill-opacity:1;stroke-width:0.23404284"
|
||||
d="m 67.678074,141.482 c -0.798867,0.0624 -1.915603,0.38946 -2.290072,0.80139 -0.361986,0.41191 -0.543,1.06141 -0.543,1.94766 v 1.29191 c 0,1.04851 -0.199567,1.82824 -0.599,2.34001 -0.386951,0.51177 -1.010722,0.82383 -1.872,0.93617 0.848795,0.11234 1.472567,0.41816 1.872,0.91745 0.399433,0.49929 0.599,1.22951 0.599,2.19064 v 1.38554 c 0,0.88624 0.193496,1.5478 0.543,1.98468 0.349504,0.44936 1.453759,0.79514 2.290072,0.85755 v 0.86501 c -1.260711,-0.0749 -2.215606,-0.38696 -2.864685,-0.93618 -0.636597,-0.53673 -0.954895,-1.55404 -0.954895,-3.05192 v -1.23574 c 0,-0.84879 -0.205958,-1.44794 -0.617873,-1.79745 -0.399433,-0.36199 -1.017306,-0.59291 -1.853619,-0.69277 v -0.95489 c 0.761419,-0.0624 1.360569,-0.28084 1.797449,-0.65532 0.449362,-0.38695 0.674043,-0.91745 0.674043,-1.59149 v -1.66639 c 0,-1.26071 0.293334,-2.19064 0.880001,-2.78979 0.586667,-0.59915 1.566527,-0.93617 2.939579,-1.01107 z" />
|
||||
</g>
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23705"
|
||||
d="m 24.042453,7.7684013 h 0.98425 V 6.1909995 h -0.98425 z"
|
||||
style="display:inline;fill:#00519e;fill-opacity:1;stroke:none;stroke-width:0.15297562px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23707"
|
||||
d="m 26.264953,3.0725683 -2.2225,3e-7 v 0.7196666 l 2.2225,-3e-7 z"
|
||||
style="display:inline;fill:#0087ce;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
transform="translate(0,-0.617)" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23709"
|
||||
d="m 22.994703,3.0725686 v 0.7196666 h 1.04775 V 3.0725686 Z"
|
||||
style="display:inline;fill:none;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
transform="translate(0,-0.617)" />
|
||||
<path
|
||||
id="path23719"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#00beff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
d="m 26.41312,1.4850686 c -0.1905,-0.014111 -0.373945,-0.021167 -0.550334,-0.021167 -0.282222,0 -0.493889,0.045861 -0.635,0.1375834 -0.772583,-0.62441639 0,0 -0.772583,-0.62441639 0.282222,-0.23988888 0.663222,-0.35983332 1.143,-0.35983332 0.141111,0 0.278695,0.007056 0.41275,0.0211667 0.141111,0.0141111 0.275167,0.03175 0.402167,0.0529167 z"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="csccsccc"
|
||||
transform="translate(0,-0.617)" />
|
||||
<path
|
||||
sodipodi:nodetypes="csccscc"
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 25.227786,1.601485 c -0.134055,0.091722 -0.201083,0.2751666 -0.201083,0.5503333 v 0.92075 l -0.98425,3e-7 v -0.85725 c 0,-0.5926667 0.137583,-1.0054167 0.41275,-1.23824999 0.772583,0.62441639 0,0 0.772583,0.62441639 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#00a3e7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
id="path23717"
|
||||
transform="translate(0,-0.617)" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23727"
|
||||
d="m 22.994703,2.4555686 v 0.7196666 h 1.04775 V 2.4555686 h -1.04775"
|
||||
style="fill:#00beff;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23729"
|
||||
d="m 24.042453,6.1909994 h 0.98425 V 3.1752349 l -0.98425,3e-7 v 3.0157642"
|
||||
style="fill:#006cb6;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23731"
|
||||
d="m 24.02759,11.070149 v 0.719667 h 2.032 v -0.719667 z"
|
||||
style="fill:#00beff;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23733"
|
||||
d="m 27.29784,11.070149 v 0.719667 h -1.23825 v -0.719667"
|
||||
style="fill:#00a3e7;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23735"
|
||||
d="m 25.07534,13.366982 h 0.98425 v 3.016 h -0.98425 z"
|
||||
style="fill:#00beff;fill-opacity:1;stroke:none;stroke-width:0.21439861px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23737"
|
||||
d="m 25.07534,11.789816 h 0.98425 v 1.577166 h -0.98425 v -1.577166"
|
||||
style="fill:#00a3e7;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cscsccscsccc"
|
||||
d="m 27.446007,10.099652 c -0.1905,-0.01411 -0.373945,-0.02117 -0.550334,-0.02117 -0.282222,0 -0.493889,0.04586 -0.635,0.137584 -0.134055,0.09172 -0.201083,0.275166 -0.201083,0.550333 v 0.92075 h -0.98425 v -0.85725 c 0,-0.592667 0.137583,-1.0054166 0.41275,-1.2382499 0.282222,-0.2398889 0.663222,-0.3598333 1.143,-0.3598333 0.141111,0 0.278695,0.00706 0.41275,0.021167 0.141111,0.014111 0.275167,0.03175 0.402167,0.052917 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#006cb6;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
id="path23739"
|
||||
inkscape:connector-curvature="0"
|
||||
transform="translate(0,-0.617)" />
|
||||
<path
|
||||
d="m 28.921204,8.5335684 c -0.677333,0 -1.199444,-0.1481667 -1.566333,-0.4445 -0.359833,-0.3033889 -0.53975,-0.7307356 -0.53975,-1.2810689 l 1.04775,4.856e-4 c 0,0.3033889 0.09878,0.53975 0.296333,0.7090833 0.204611,0.1693333 0.497417,0.254 0.878417,0.254 0,0 0,0 -0.116417,0.762 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#00beff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
id="path23748"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccccccc"
|
||||
transform="translate(0,-0.617)" />
|
||||
<path
|
||||
d="m 29.799621,5.3903185 c 0.465667,0.1128889 0.811389,0.28575 1.037166,0.5185833 0.232833,0.2257778 0.34925,0.5326945 0.34925,0.92075 0,0.5221111 -0.197555,0.9383888 -0.592666,1.2488333 -0.395111,0.3033889 -0.9525,0.4550833 -1.672167,0.4550833 0.116417,-0.762 0,0 0.116417,-0.762 0.359833,0 0.631472,-0.077611 0.814917,-0.2328333 0.183444,-0.1552222 0.275166,-0.3563055 0.275166,-0.60325 0,-0.3175 -0.165805,-0.5221111 -0.497416,-0.6138333 0.169333,-0.9313333 0,0 0.169333,-0.9313333 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#0087ce;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
id="path23752"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccsccccscc"
|
||||
transform="translate(0,-0.617)" />
|
||||
<path
|
||||
d="m 27.926371,4.4378185 c 0,0.3245555 0.215194,0.53975 0.645583,0.6455833 l 1.227667,0.3069167 c -0.169333,0.9313333 0,0 -0.169333,0.9313333 C 29.298677,6.222874 28.910621,6.1240962 28.466121,6.0253185 28.014566,5.9265407 27.644149,5.7677907 27.354871,5.5490685 27.065593,5.3303463 26.920954,4.9987352 26.920954,4.5542352 c 1.005417,-0.1164167 0,0 1.005417,-0.1164167 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#00a3e7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
id="path23755"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccscc"
|
||||
transform="translate(0,-0.617)" />
|
||||
<path
|
||||
d="m 31.048454,4.5436518 h -1.016 v -0.0635 c 0,-0.5362222 -0.342194,-0.8043333 -1.026583,-0.8043333 -0.338667,0 -0.60325,0.067028 -0.79375,0.2010834 -0.1905,0.127 -0.28575,0.3139722 -0.28575,0.5609166 -1.005417,0.1164167 0,0 -1.005417,0.1164167 0,-0.4797778 0.1905,-0.8678334 0.5715,-1.1641667 0.388056,-0.2963333 0.889001,-0.4444999 1.502834,-0.4444999 0.578555,0 1.065388,0.1199444 1.460499,0.3598333 0.395111,0.2328333 0.592667,0.5961944 0.592667,1.0900833 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#006cb6;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
id="path23758"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="ccssccccscsc"
|
||||
transform="translate(0,-0.617)" />
|
||||
<path
|
||||
sodipodi:nodetypes="cccccc"
|
||||
transform="translate(0,-0.617)"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23764"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#00beff;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
d="m 33.742924,15.878152 1.3335,-4.191 h 1.026583 l -1.87325,5.312833 h -1.142999 c 0.656166,-1.121833 0,0 0.656166,-1.121833 z" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
d="m 32.536424,11.070152 1.2065,4.191 c -0.656166,1.121833 0,0 -0.656166,1.121833 l -1.248834,-4.370916 c 0.6985,-0.941917 0,0 0.6985,-0.941917 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#00a3e7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
id="path23766"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccccc"
|
||||
transform="translate(0,-0.617)"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path23768"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#0087ce;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
d="m 29.890591,15.920485 1.344083,-4.233333 h 1.30175 c -0.6985,0.941917 0,0 -0.6985,0.941917 l -1.386416,4.370916 h -1.17475 c 0.613833,-1.0795 0,0 0.613833,-1.0795 z" />
|
||||
<path
|
||||
sodipodi:nodetypes="ccccc"
|
||||
d="m 28.610008,11.687152 1.280583,4.233333 c -0.613833,1.0795 0,0 -0.613833,1.0795 l -1.756834,-5.312833 z"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:'Univers for UniS 55 Roman';-inkscape-font-specification:'Univers for UniS 55 Roman, ';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;display:inline;opacity:0.98999999;fill:#00519e;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
id="path23770"
|
||||
inkscape:connector-curvature="0"
|
||||
transform="translate(0,-0.617)" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer16"
|
||||
inkscape:label="Logo_gradient"
|
||||
style="display:inline">
|
||||
<rect
|
||||
style="display:inline;opacity:1;fill:url(#meshgradient23819);fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:fill markers stroke;enable-background:new"
|
||||
id="rect23817"
|
||||
width="59.111"
|
||||
height="16.382999"
|
||||
x="-1.110223e-016"
|
||||
y="3.8147118e-006"
|
||||
clip-path="url(#clipPath24955)" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 58 KiB |
BIN
logo/FSFW_Logo_V3_bw.png
Normal file
BIN
logo/FSFW_Logo_V3_bw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@ -1,12 +1,5 @@
|
||||
/**
|
||||
* @file AcceptsMemoryMessagesIF.h
|
||||
* @brief This file defines the AcceptsMemoryMessagesIF class.
|
||||
* @date 11.07.2013
|
||||
* @author baetz
|
||||
*/
|
||||
|
||||
#ifndef ACCEPTSMEMORYMESSAGESIF_H_
|
||||
#define ACCEPTSMEMORYMESSAGESIF_H_
|
||||
#ifndef FSFW_MEMORY_ACCEPTSMEMORYMESSAGESIF_H_
|
||||
#define FSFW_MEMORY_ACCEPTSMEMORYMESSAGESIF_H_
|
||||
|
||||
#include "HasMemoryIF.h"
|
||||
#include "MemoryMessage.h"
|
||||
@ -18,4 +11,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif /* ACCEPTSMEMORYMESSAGESIF_H_ */
|
||||
#endif /* FSFW_MEMORY_ACCEPTSMEMORYMESSAGESIF_H_ */
|
||||
|
@ -1,14 +1,15 @@
|
||||
#include "../globalfunctions/CRC.h"
|
||||
#include "MemoryHelper.h"
|
||||
#include "MemoryMessage.h"
|
||||
|
||||
#include "../globalfunctions/CRC.h"
|
||||
#include "../objectmanager/ObjectManagerIF.h"
|
||||
#include "../serialize/EndianConverter.h"
|
||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||
|
||||
MemoryHelper::MemoryHelper(HasMemoryIF* workOnThis, MessageQueueIF* useThisQueue) :
|
||||
workOnThis(workOnThis), queueToUse(useThisQueue), ipcStore(NULL), ipcAddress(), lastCommand(
|
||||
CommandMessage::CMD_NONE), lastSender(0), reservedSpaceInIPC(
|
||||
NULL), busy(false) {
|
||||
MemoryHelper::MemoryHelper(HasMemoryIF* workOnThis,
|
||||
MessageQueueIF* useThisQueue):
|
||||
workOnThis(workOnThis), queueToUse(useThisQueue), ipcAddress(),
|
||||
lastCommand(CommandMessage::CMD_NONE), busy(false) {
|
||||
}
|
||||
|
||||
ReturnValue_t MemoryHelper::handleMemoryCommand(CommandMessage* message) {
|
||||
@ -33,17 +34,8 @@ ReturnValue_t MemoryHelper::handleMemoryCommand(CommandMessage* message) {
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t MemoryHelper::initialize() {
|
||||
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
if (ipcStore != NULL) {
|
||||
return RETURN_OK;
|
||||
} else {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryHelper::completeLoad(ReturnValue_t errorCode,
|
||||
const uint8_t* dataToCopy, const uint32_t size, uint8_t* copyHere) {
|
||||
const uint8_t* dataToCopy, const size_t size, uint8_t* copyHere) {
|
||||
busy = false;
|
||||
switch (errorCode) {
|
||||
case HasMemoryIF::DO_IT_MYSELF:
|
||||
@ -67,13 +59,13 @@ void MemoryHelper::completeLoad(ReturnValue_t errorCode,
|
||||
return;
|
||||
}
|
||||
//Only reached on success
|
||||
CommandMessage reply(CommandMessage::REPLY_COMMAND_OK, 0, 0);
|
||||
CommandMessage reply( CommandMessage::REPLY_COMMAND_OK, 0, 0);
|
||||
queueToUse->sendMessage(lastSender, &reply);
|
||||
ipcStore->deleteData(ipcAddress);
|
||||
}
|
||||
|
||||
void MemoryHelper::completeDump(ReturnValue_t errorCode,
|
||||
const uint8_t* dataToCopy, const uint32_t size) {
|
||||
const uint8_t* dataToCopy, const size_t size) {
|
||||
busy = false;
|
||||
CommandMessage reply;
|
||||
MemoryMessage::setMemoryReplyFailed(&reply, errorCode, lastCommand);
|
||||
@ -125,12 +117,12 @@ void MemoryHelper::completeDump(ReturnValue_t errorCode,
|
||||
break;
|
||||
}
|
||||
if (queueToUse->sendMessage(lastSender, &reply) != RETURN_OK) {
|
||||
reply.clearCommandMessage();
|
||||
reply.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryHelper::swapMatrixCopy(uint8_t* out, const uint8_t *in,
|
||||
uint32_t totalSize, uint8_t datatypeSize) {
|
||||
size_t totalSize, uint8_t datatypeSize) {
|
||||
if (totalSize % datatypeSize != 0){
|
||||
return;
|
||||
}
|
||||
@ -185,11 +177,18 @@ void MemoryHelper::handleMemoryCheckOrDump(CommandMessage* message) {
|
||||
}
|
||||
|
||||
ReturnValue_t MemoryHelper::initialize(MessageQueueIF* queueToUse_) {
|
||||
if(queueToUse_!=NULL){
|
||||
this->queueToUse = queueToUse_;
|
||||
}else{
|
||||
return MessageQueueIF::NO_QUEUE;
|
||||
if(queueToUse_ == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
this->queueToUse = queueToUse_;
|
||||
return initialize();
|
||||
}
|
||||
|
||||
ReturnValue_t MemoryHelper::initialize() {
|
||||
ipcStore = objectManager->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
if (ipcStore != nullptr) {
|
||||
return RETURN_OK;
|
||||
} else {
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,16 @@
|
||||
#ifndef MEMORYHELPER_H_
|
||||
#define MEMORYHELPER_H_
|
||||
#include "../ipc/CommandMessage.h"
|
||||
#ifndef FSFW_MEMORY_MEMORYHELPER_H_
|
||||
#define FSFW_MEMORY_MEMORYHELPER_H_
|
||||
|
||||
#include "AcceptsMemoryMessagesIF.h"
|
||||
|
||||
#include "../ipc/CommandMessage.h"
|
||||
#include "../returnvalues/HasReturnvaluesIF.h"
|
||||
#include "../storagemanager/StorageManagerIF.h"
|
||||
#include "../ipc/MessageQueueIF.h"
|
||||
|
||||
/**
|
||||
* @brief TODO: documentation.
|
||||
*/
|
||||
class MemoryHelper : public HasReturnvaluesIF {
|
||||
public:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::MEMORY_HELPER;
|
||||
@ -13,25 +18,32 @@ public:
|
||||
static const ReturnValue_t INVALID_ADDRESS = MAKE_RETURN_CODE(0xE1);
|
||||
static const ReturnValue_t INVALID_SIZE = MAKE_RETURN_CODE(0xE2);
|
||||
static const ReturnValue_t STATE_MISMATCH = MAKE_RETURN_CODE(0xE3);
|
||||
|
||||
MemoryHelper(HasMemoryIF* workOnThis, MessageQueueIF* useThisQueue);
|
||||
~MemoryHelper();
|
||||
|
||||
ReturnValue_t handleMemoryCommand(CommandMessage* message);
|
||||
void completeLoad(ReturnValue_t errorCode,
|
||||
const uint8_t* dataToCopy = nullptr, const size_t size = 0,
|
||||
uint8_t* copyHere = nullptr);
|
||||
void completeDump(ReturnValue_t errorCode,
|
||||
const uint8_t* dataToCopy = nullptr, const size_t size = 0);
|
||||
void swapMatrixCopy(uint8_t *out, const uint8_t *in, size_t totalSize,
|
||||
uint8_t datatypeSize);
|
||||
ReturnValue_t initialize(MessageQueueIF* queueToUse_);
|
||||
|
||||
private:
|
||||
HasMemoryIF* workOnThis;
|
||||
MessageQueueIF* queueToUse;
|
||||
StorageManagerIF* ipcStore;
|
||||
StorageManagerIF* ipcStore = nullptr;
|
||||
store_address_t ipcAddress;
|
||||
Command_t lastCommand;
|
||||
MessageQueueId_t lastSender;
|
||||
uint8_t* reservedSpaceInIPC;
|
||||
MessageQueueId_t lastSender = MessageQueueIF::NO_QUEUE;
|
||||
uint8_t* reservedSpaceInIPC = nullptr;
|
||||
bool busy;
|
||||
void handleMemoryLoad(CommandMessage* message);
|
||||
void handleMemoryCheckOrDump(CommandMessage* message);
|
||||
ReturnValue_t initialize();
|
||||
public:
|
||||
ReturnValue_t handleMemoryCommand(CommandMessage* message);
|
||||
void completeLoad( ReturnValue_t errorCode, const uint8_t* dataToCopy = NULL, const uint32_t size = 0, uint8_t* copyHere = NULL );
|
||||
void completeDump( ReturnValue_t errorCode, const uint8_t* dataToCopy = NULL, const uint32_t size = 0);
|
||||
void swapMatrixCopy( uint8_t *out, const uint8_t *in, uint32_t totalSize, uint8_t datatypeSize);
|
||||
ReturnValue_t initialize(MessageQueueIF* queueToUse_);
|
||||
MemoryHelper( HasMemoryIF* workOnThis, MessageQueueIF* useThisQueue );
|
||||
~MemoryHelper();
|
||||
|
||||
};
|
||||
#endif /* MEMORYHELPER_H_ */
|
||||
#endif /* FSFW_MEMORY_MEMORYHELPER_H_ */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user