fsfw/src/fsfw/tmtc/TmManager.h

67 lines
1.9 KiB
C++

#pragma once
#include <fsfw/objectmanager/SystemObject.h>
#include <fsfw/storagemanager/StorageManagerIF.h>
#include <map>
#include "AcceptsTelemetryIF.h"
#include "FsfwProtocolHeader.h"
#include "FsfwProtocols.h"
// TODO handle VCs and backpressure
// TODO trailing space?
class TmManager : public SystemObject {
public:
struct ProtocolInformation {
neither_type protocol;
size_t offset;
MessageQueueId_t reportingQueue;
};
TmManager(object_id_t setObjectId);
virtual ~TmManager() = default;
ReturnValue_t initialize() override;
/**
* 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);
/**
* 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
*
*/
ReturnValue_t getProtocolInformation(store_address_t tc, ProtocolInformation *information) const;
/**
* If tm is unrequested, get Default path
*/
ReturnValue_t getDefaultProtocolInformation(ProtocolInformation *information) const;
/**
* Offset is where application data should start in a preallocated zero-copy packet. If no fixed
* value, report 0 and allocate and copy yourself
*/
ReturnValue_t registerNetworkProtocolInterface(AcceptsTelemetryIF2 *object, neither_type protocol,
size_t offset);
protected:
struct StoredProtocolInformation {
MessageQueueId_t queue;
size_t offset;
};
StorageManagerIF *IPCStore;
std::map<neither_type, StoredProtocolInformation> protocolMap;
};