mesytec-mnode/src/mana_plugin_c_test.c
Florian Lüke 6f7102549e mana: add a root-histogram plugin and improve ManaCountingSink
Currently only histograms the hit counts per input array element, not
the actual data.

The counting plugin now also tracks and prints 'eventArrayIndexHits'.
2024-12-26 01:46:58 +01:00

57 lines
1.3 KiB
C

#include "internal/mana_api.h"
#include "internal/rxi/log.h"
#include <string.h>
#include <stdlib.h>
struct Context
{
};
MANA_DEFINE_PLUGIN_INIT(init)
{
log_set_level(LOG_DEBUG);
struct Context *ctx = calloc(1, sizeof(*ctx));
log_debug("init: ctx=%p", ctx);
return ctx;
}
MANA_DEFINE_PLUGIN_SHUTDOWN(shutdown)
{
(void)context;
log_debug("shutdown");
}
MANA_DEFINE_PLUGIN_BEGIN_RUN(begin_run)
{
log_debug("begin_run: ctx=%p, descriptor_json=%s", context, descriptor_json);
/* pretty useless as the json needs to be parsed back into some c structure describing the input
*/
}
MANA_DEFINE_PLUGIN_END_RUN(end_run)
{
log_debug("end: ctx=%p, descriptor_json=%s", context, descriptor_json);
}
MANA_DEFINE_PLUGIN_EVENT_DATA(process_event)
{
log_trace("event: ctx=%p, eventIndex=%d, arrayCount=%zu, totalBytes=%zu", context, eventIndex,
arrayCount, totalBytes);
}
MANA_DEFINE_PLUGIN_SYSTEM_EVENT(process_system_event)
{
log_debug("system_event: ctx=%p, size=%zu", context, size);
}
MANA_DEFINE_GET_PLUGIN(mana_get_plugin)
{
mana_plugin_t plugin;
plugin.init = init;
plugin.shutdown = shutdown;
plugin.begin_run = begin_run;
plugin.end_run = end_run;
plugin.process_event = process_event;
plugin.process_system_event = process_system_event;
return plugin;
}