mesytec-mnode/src/mana_plugin_cpp_test.cc
2024-12-30 10:42:11 +01:00

47 lines
1.2 KiB
C++

#include "internal/mana_api.hpp"
#include "internal/rxi/log.hpp"
using namespace mesytec::mnode;
using namespace mesytec::mnode::mana;
class Sink: public IManaSink
{
public:
Sink()
{
log_set_level(LOG_INFO);
log_info("init: this=%p", this);
}
void begin_run(const char *descriptor_json) override
{
(void)descriptor_json;
log_info("begin_run: this=%p", this);
}
void end_run(const char *descriptor_json) override
{
(void)descriptor_json;
log_info("end_run: this=%p", this);
}
void process_event(uint16_t eventIndex, mana_offset_array_t *arrays, size_t arrayCount,
size_t totalBytes) override
{
log_trace("event: this=%p, eventIndex=%d, arrayCount=%zu, totalBytes=%zu", this, eventIndex,
arrayCount, totalBytes);
}
void process_system_event(const uint32_t *data, size_t size) override
{
log_debug("system_event: this=%p, size=%zu", this, size);
}
};
class Plugin: public IManaPlugin
{
public:
std::unique_ptr<IManaSink> makeSink() override { return std::make_unique<Sink>(); }
};
MANA_CPP_PLUGIN() { return new Plugin; }