TSPD-ADQ EPICS device support  1.2.0
ADQAIChannel.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018 Cosylab d.d.
3 // This software is distributed under the terms found
4 // in file LICENSE.txt that is included with this distribution.
5 //
6 
7 #ifndef ADQAICHANNEL_H
8 #define ADQAICHANNEL_H
9 
10 #include <nds3/nds.h>
11 
20 {
21 public:
30  ADQAIChannel(const std::string& name, nds::Node& parentNode, int32_t channelNum, ADQInterface*& adqInterface, nds::PVDelegateIn<std::string> logMsgPV);
31 
35  int32_t m_channelNum;
36 
40  void setInputRange(const timespec& pTimestamp, const double& pValue);
41 
45  void getInputRange(timespec* pTimestamp, double* pValue);
46 
50  void setDcBias(const timespec& pTimestamp, const int32_t& pValue);
51 
55  void getDcBias(timespec* pTimestamp, int32_t* pValue);
56 
60  void setChanDec(const timespec& pTimestamp, const int32_t& pValue);
61 
65  void getChanDec(timespec* pTimestamp, int32_t* pValue);
66 
70  void setState(nds::state_t newState);
71 
75  void readData(short* rawData, int32_t sampleCnt);
76 
80  void getDataPV(timespec* pTimestamp, std::vector<int32_t>* pValue);
81 
87  void commitChanges(bool calledFromDaqThread = false);
88 
89 private:
90  nds::Node m_node;
91  nds::StateMachine m_stateMachine;
92 
93  ADQInterface* m_adqInterface;
94 
95  double m_inputRange;
96  bool m_inputRangeChanged;
97 
98  int32_t m_dcBias;
99  bool m_dcBiasChanged;
100 
101  int32_t m_chanDec;
102  bool m_chanDecChanged;
103 
104  std::vector<int32_t> m_data;
105 
106  bool m_firstReadout;
107 
108  void switchOn();
109  void switchOff();
110  void start();
111  void stop();
112  void recover();
113  bool allowChange(const nds::state_t, const nds::state_t, const nds::state_t);
114 
115  nds::PVDelegateIn<std::string> m_logMsgPV;
116  nds::PVDelegateIn<double> m_inputRangePV;
117  nds::PVDelegateIn<int32_t> m_dcBiasPV;
118  nds::PVDelegateIn<int32_t> m_chanDecPV;
119  nds::PVDelegateIn<std::vector<int32_t>> m_dataPV;
120 };
121 
122 #endif /* ADQAICHANNEL_H; */
ADQAIChannel::m_channelNum
int32_t m_channelNum
Number of channel.
Definition: ADQAIChannel.h:35
ADQAIChannel::setInputRange
void setInputRange(const timespec &pTimestamp, const double &pValue)
Sets the channel's input range.
Definition: ADQAIChannel.cpp:80
ADQAIChannel
This class handles channel specific parameters and pushes acquired data to appropriate data PVs.
Definition: ADQAIChannel.h:19
ADQAIChannel::getInputRange
void getInputRange(timespec *pTimestamp, double *pValue)
Gets the channel's input range.
Definition: ADQAIChannel.cpp:88
ADQAIChannel::getDcBias
void getDcBias(timespec *pTimestamp, int32_t *pValue)
Gets the channel's DC bias.
Definition: ADQAIChannel.cpp:102
ADQAIChannel::ADQAIChannel
ADQAIChannel(const std::string &name, nds::Node &parentNode, int32_t channelNum, ADQInterface *&adqInterface, nds::PVDelegateIn< std::string > logMsgPV)
ADQAIChannel class constructor.
Definition: ADQAIChannel.cpp:21
ADQAIChannel::readData
void readData(short *rawData, int32_t sampleCnt)
This method passes the acquired data to appropriate data PV.
Definition: ADQAIChannel.cpp:302
ADQAIChannel::setDcBias
void setDcBias(const timespec &pTimestamp, const int32_t &pValue)
Sets the channel's DC bias.
Definition: ADQAIChannel.cpp:94
ADQAIChannel::setState
void setState(nds::state_t newState)
Sets a new state to the ADQAIChannel class' state machine.
Definition: ADQAIChannel.cpp:259
ADQAIChannel::getDataPV
void getDataPV(timespec *pTimestamp, std::vector< int32_t > *pValue)
This is a dummy method held by the data PV for appropriate work in NDS3.
Definition: ADQAIChannel.cpp:293
ADQAIChannel::getChanDec
void getChanDec(timespec *pTimestamp, int32_t *pValue)
Gets the channel's sample decimation.
Definition: ADQAIChannel.cpp:116
ADQAIChannel::setChanDec
void setChanDec(const timespec &pTimestamp, const int32_t &pValue)
Sets the channel's sample decimation.
Definition: ADQAIChannel.cpp:108
ADQAIChannel::commitChanges
void commitChanges(bool calledFromDaqThread=false)
This method processes changes are applied to channel specific parameters.
Definition: ADQAIChannel.cpp:125