58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
/*************************************************************************\
|
|
* Copyright (c) 2024 PSI
|
|
* ecmc is distributed subject to a Software License Agreement found
|
|
* in file LICENSE that is included with this distribution.
|
|
*
|
|
* ecmcDAQDataArray.h
|
|
*
|
|
* Created on: Mar 01, 2024
|
|
* Author: anders sandstrom
|
|
*
|
|
\*************************************************************************/
|
|
#ifndef ECMC_DAQ_DATA_ARRAY_H_
|
|
#define ECMC_DAQ_DATA_ARRAY_H_
|
|
|
|
#include <stdexcept>
|
|
#include <vector>
|
|
#include <string>
|
|
#include "ecmcDAQDataChannel.h"
|
|
#include "ecmcAsynPortDriver.h"
|
|
#include "ecmcEc.h"
|
|
|
|
/* Class to format an array of ecmcDAQDataChannels with headers and push over asyn to epics */
|
|
class ecmcDAQDataArray : public asynPortDriver {
|
|
|
|
public:
|
|
ecmcDAQDataArray(const char* name, const char* portName);
|
|
~ecmcDAQDataArray();
|
|
void connectToDataSources();
|
|
void execute();
|
|
void addChannel(int type);
|
|
void addDataItemToChannel(const char* name, int format, int oldData); // Always add to last added channel
|
|
void setEnable(int enable);
|
|
size_t getArraySize();
|
|
int validate();
|
|
std::string getName();
|
|
|
|
private:
|
|
void buildArrayHeader();
|
|
void initAsyn();
|
|
void updateAsyn();
|
|
|
|
std::string name_;
|
|
double *buffer_;
|
|
std::vector<ecmcDAQDataChannel*> dataChannels_;
|
|
size_t channelCounter_;
|
|
size_t dataElementCount_;
|
|
size_t totalElementCount_;
|
|
size_t firstDataElementIndex_;
|
|
bool dataSourcesLinked_;
|
|
// Asyn
|
|
int asynEnableId_; // Enable/disable
|
|
int asynRawDataId_; // Raw data buffer
|
|
int enablePlugin_; // Enable
|
|
ecmcEc *master_;
|
|
};
|
|
|
|
#endif /* ECMC_DAQ_DATA_ARRAY_H_ */
|