fsfw/src/fsfw/tmtc/TmManager.h

67 lines
1.9 KiB
C
Raw Normal View History

2023-07-05 13:49:03 +02:00
#pragma once
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/storagemanager/StorageManagerIF.h>
#include <map>
#include "AcceptsTelemetryIF.h"
2023-07-12 14:19:58 +02:00
#include "FsfwProtocolHeader.h"
2023-07-05 13:49:03 +02:00
#include "FsfwProtocols.h"
// TODO handle VCs and backpressure
2023-07-12 14:19:58 +02:00
// TODO trailing space?
2023-07-05 13:49:03 +02:00
class TmManager : public SystemObject {
public:
2023-07-12 14:19:58 +02:00
struct ProtocolInformation {
neither_type protocol;
size_t offset;
MessageQueueId_t reportingQueue;
};
2023-07-05 13:49:03 +02:00
TmManager(object_id_t setObjectId);
virtual ~TmManager() = default;
ReturnValue_t initialize() override;
2023-07-12 14:19:58 +02:00
/**
* send a tm packet
*
*
*/
ReturnValue_t sendTmPacket(object_id_t objectId, FsfwProtocolHeader::InterfaceType_t interface,
FsfwProtocolHeader::FunctionType_t function,
SerializeIF *applicationData,
store_address_t tc = store_address_t(), size_t tcOffset = 0);
2023-07-05 13:49:03 +02:00
/**
* returns the offset which the application data should start at, using the same network layer as
* the tc, as well as the protocol type which should be the first byte of the tm
*
*/
2023-07-12 14:19:58 +02:00
ReturnValue_t getProtocolInformation(store_address_t tc, ProtocolInformation *information) const;
2023-07-05 13:49:03 +02:00
/**
* If tm is unrequested, get Default path
*/
2023-07-12 14:19:58 +02:00
ReturnValue_t getDefaultProtocolInformation(ProtocolInformation *information) const;
2023-07-05 13:49:03 +02:00
/**
2023-07-12 14:19:58 +02:00
* Offset is where application data should start in a preallocated zero-copy packet. If no fixed
* value, report 0 and allocate and copy yourself
2023-07-05 13:49:03 +02:00
*/
2023-07-05 23:47:07 +02:00
ReturnValue_t registerNetworkProtocolInterface(AcceptsTelemetryIF2 *object, neither_type protocol,
2023-07-05 13:49:03 +02:00
size_t offset);
protected:
2023-07-12 14:19:58 +02:00
struct StoredProtocolInformation {
2023-07-05 13:49:03 +02:00
MessageQueueId_t queue;
size_t offset;
};
StorageManagerIF *IPCStore;
2023-07-12 14:19:58 +02:00
std::map<neither_type, StoredProtocolInformation> protocolMap;
2023-07-05 13:49:03 +02:00
};