Scope
ZoomResonance.cpp
1 #include "stdafx.h"
2 #include "ZoomResonance.h"
3 #include "helpers/ScopeException.h"
4 
5 namespace scope {
6 
8  : state(0)
9  , factor1(0)
10  , factor2(1)
11  , factor3(2)
12  , factor4(3) {
13 }
14 
16  task.WriteDigitalLines(&factor1, 1, true); // Do not check for exception here
17  state = factor1;
18 }
19 
20 void ZoomResonance::Initialize(const std::wstring& _outputline) {
21  try {
22  task.CreateTask();
23  task.CreateDOChannel(_outputline);
24  } catch (...) { ScopeExceptionHandler(__FUNCTION__); }
25  Set(factor1);
26 }
27 
28 void ZoomResonance::Set(const uint8_t& _factor) {
29  try {
30  task.WriteDigitalLines(&_factor, 1, true);
31  state = &_factor;
32  } catch (...) { ScopeExceptionHandler(__FUNCTION__); }
33 }
34 
35 }
int32_t WriteDigitalLines(const uInt8 *_data, int32 _sampsperchan, bool _autostart=false, float64 _timeout=2, bool32 _layout=DAQmx_Val_GroupByChannel)
Writes to up to 8 digital lines (in one port, I suppose), depending on which lines are configured int...
Definition: DAQmxTask.cpp:296
void Set(const uint8_t &_factor)
Sets the amplitude reduction factor.
const uint8_t factor1
00
Definition: ZoomResonance.h:19
void CreateDOChannel(const std::wstring &_devicelines, const std::wstring &_channelname=L"")
Creates a digital output channel.
Definition: DAQmxTask.cpp:270
uint8_t state
current zoom state
Definition: ZoomResonance.h:16
This is the include file for standard system include files, or project specific include files that ar...
void Initialize(const std::wstring &_outputline)
Initialization.
void ScopeExceptionHandler(const std::string &_origin, const bool &_log, const bool &_showmessagebox, const bool &_trace, const bool &_rethrow)
Handles all exceptions and does nice logging.
void CreateTask(const std::wstring &_name=L"")
Definition: DAQmxTask.cpp:91
DAQmx::CDAQmxDigitalOutTask task
the DAQmx task
Definition: ZoomResonance.h:13
ZoomResonance()
Constructor, reset to amplitude 1.
~ZoomResonance()
Destructor, reset to amplitude 1.