PicoScenes API Docs
 
Loading...
Searching...
No Matches
FrameDumper.hxx
Go to the documentation of this file.
1//
2// Created by Zhiping Jiang on 17-9-18.
3//
4
5#ifndef FRAMEDUMPER_HXX
6#define FRAMEDUMPER_HXX
7
8#include "PicoScenesCommons.hxx"
9#include "ModularPicoScenesFrame.hxx"
10#include "TimeTools.hxx"
11
23public:
31 static std::shared_ptr<FrameDumper> getInstance(const std::string &dumperName, bool withoutTime = false);
32
39 static std::shared_ptr<FrameDumper> getInstanceWithoutTime(const std::string &dumperName);
40
49 int dumpData(const uint8_t *buffer, const size_t msg_len);
50
56 void dumpData(const std::vector<uint8_t> &buffer);
57
63 void dumpRxFrame(const ModularPicoScenesRxFrame &rxFrame);
64
71
77 static void finishAllSessions();
78
85
86private:
87 std::string prefix{};
88 std::string dumpFilePath{};
89 void *dumpPtr{};
90 bool sessionFinished{};
91
93 static std::map<std::string, std::shared_ptr<FrameDumper>> instanceMap;
94
96 static std::map<std::string, std::shared_ptr<std::mutex>> mutexMap;
97
104 FrameDumper(const std::string &prefix, bool withoutTime = false);
105};
106
107
108#endif //FRAMEDUMPER_HXX
Class for dumping PicoScenes frames to files.
int dumpData(const uint8_t *buffer, const size_t msg_len)
Dump raw data buffer to file.
void dumpRxFrame(const ModularPicoScenesRxFrame &rxFrame)
Dump a PicoScenes RX frame to file.
static std::shared_ptr< FrameDumper > getInstance(const std::string &dumperName, bool withoutTime=false)
Get or create a dumper instance with the specified name.
static std::shared_ptr< FrameDumper > getInstanceWithoutTime(const std::string &dumperName)
Get or create a dumper instance without timestamp in filename.
void finishCurrentSession()
Finish current dump session.
void dumpData(const std::vector< uint8_t > &buffer)
Dump vector data to file.
static void finishAllSessions()
Finish all active dump sessions.
~FrameDumper()
Destructor.