very inefficient, but can receive udp monitor events and count them and send them as kafka events

This commit is contained in:
2025-10-30 15:07:21 +01:00
parent 09ba30025a
commit 4c1741bd4b
2 changed files with 158 additions and 54 deletions

View File

@@ -2,6 +2,13 @@
#define asynStreamGeneratorDriver_H
#include "asynPortDriver.h"
#include <epicsRingPointer.h>
#include <librdkafka/rdkafka.h>
struct __attribute__((__packed__)) NormalisedMonitorEvent {
uint64_t TimeStamp;
uint32_t DataID : 4;
};
/* These are the drvInfo strings that are used to identify the parameters. */
#define P_CountsString "COUNTS%d" /* asynInt32, r/w */
@@ -16,6 +23,7 @@ class asynStreamGeneratorDriver : public asynPortDriver {
virtual asynStatus readInt32(asynUser *pasynUser, epicsInt32 *value);
void receiveUDP();
void produceMonitor();
protected:
int *P_Counts;
@@ -23,6 +31,9 @@ class asynStreamGeneratorDriver : public asynPortDriver {
private:
asynUser *pasynUDPUser;
int num_channels;
epicsRingPointer<NormalisedMonitorEvent> monitorQueue;
rd_kafka_t *monitorProducer;
};
#endif