#ifndef GMD_BSA_H #define GMD_BSA_H #include #include "BsaApi.h" #include "gmdDebugStream.h" typedef struct bsaData_t { epicsFloat64 photonEn; epicsFloat64 x_pos; epicsFloat64 y_pos; epicsTimeStamp time; epicsUInt16 statusFromFirmware; BsaStat stat; BsaSevr sevr; } bsaData_t; class GmdBSA: public epicsThreadRunable { public: // Singleton method to retrieve pointer to the only object that can be // instantiated from this class. static GmdBSA* getInstance(); void initialize(const char* portName, const char* photonEnChannelName, const char* posXChannelName, const char* posYChannelName); ~GmdBSA(); epicsThread gmdBSAThread; void run(); void updateData(gmd_stream_with_header_t rawData, epicsTimeStamp time); private: // Singleton design pattern: here is the pointer for the only instance of // this class. static GmdBSA* instance; // Private constructor for Singleton design pattern GmdBSA(); // Private copy constructor and copy assignment operator, to avoid someone // to clone the object (we want only one instance) GmdBSA(const GmdBSA&); GmdBSA& operator=(const GmdBSA&); void addChannels(const char* photonEnChannelName, const char* posXChannelName, const char* posYChannelName); bool stopRunning; BsaChannel photonEnBsaChannel; BsaChannel posXBsaChannel; BsaChannel posYBsaChannel; bsaData_t bsaData; std::string streamPortName; bool initialized; }; void bsaCallbackFunction(void *pBuf, unsigned size, epicsTimeStamp time, int timeslot, void *usr); #endif /*GMD_BSA_H*/