Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
5603d01412 |
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -9,7 +9,7 @@
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "Build",
|
||||
"program": "${workspaceFolder}/bin/Debug/net8.0/linux-x64/File-Watcher.dll",
|
||||
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/File-Watcher.dll",
|
||||
"args": [
|
||||
"s"
|
||||
],
|
||||
|
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
@ -64,7 +64,7 @@
|
||||
"args": [
|
||||
"publish",
|
||||
"-r",
|
||||
"linux-x64",
|
||||
"win-x64",
|
||||
"-c",
|
||||
"Release",
|
||||
"-p:PublishAot=true"
|
||||
@ -74,7 +74,7 @@
|
||||
{
|
||||
"label": "File-Folder-Helper AOT s X Day-Helper-2025-03-20",
|
||||
"type": "shell",
|
||||
"command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/linux-x64/publish/File-Folder-Helper.exe",
|
||||
"command": "L:/DevOps/Mesa_FI/File-Folder-Helper/bin/Release/net8.0/win-x64/publish/File-Folder-Helper.exe",
|
||||
"args": [
|
||||
"s",
|
||||
"X",
|
||||
|
@ -3,9 +3,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
|
||||
<UserSecretsIdBeforeOracle>b6f34b8e-5026-41d4-9c28-6516d19d6569</UserSecretsIdBeforeOracle>
|
||||
<UserSecretsId>6062c774-99a9-4f4a-b42d-a9cb7fcbd8be</UserSecretsId>
|
||||
@ -21,7 +20,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.1" />
|
||||
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="23.7.0" />
|
||||
<PackageReference Include="ShellProgressBar" Version="5.2.0" />
|
||||
<PackageReference Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="8.0.16" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="8.0.16" />
|
||||
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
|
||||
|
@ -7,7 +7,7 @@ public static class DAQmx
|
||||
public static string GetErrorString(int errorCode)
|
||||
{
|
||||
StringBuilder errorString = new(256);
|
||||
_ = Interop.DAQmxBaseGetErrorString(errorCode, errorString, (uint)(errorString.Capacity + 1));
|
||||
_ = Interop.DAQmxGetErrorString(errorCode, errorString, (uint)(errorString.Capacity + 1));
|
||||
return errorString.ToString();
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@ public class DAQmxTask
|
||||
{
|
||||
DAQmxTask result;
|
||||
IntPtr taskHandle;
|
||||
int task = Interop.DAQmxBaseCreateTask(taskName, out taskHandle);
|
||||
int task = Interop.DAQmxCreateTask(taskName, out taskHandle);
|
||||
if (task < 0)
|
||||
throw new DAQmxException(task, "Could not create Task");
|
||||
result = new() { taskHandle = taskHandle, Channels = 0 };
|
||||
@ -35,14 +35,14 @@ public class DAQmxTask
|
||||
|
||||
public void ConfigureLoggingTechnicalDataManagementStreaming(string filePath, DAQmxLoggingMode loggingMode, string groupName, DAQmxLoggingTDMSOperation operation)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseConfigureLogging(taskHandle, filePath, (int)loggingMode, groupName, (int)operation);
|
||||
int errorCode = Interop.DAQmxConfigureLogging(taskHandle, filePath, (int)loggingMode, groupName, (int)operation);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "Could not configure technical data management streaming logging");
|
||||
}
|
||||
|
||||
public void CreateAnalogInputVoltageChannel(string physicalChannel, string nameToAssignToChannel, DAQmxInputTerminalConfiguration terminalConfig, double minVal, double maxVal, DAQmxUnits units, string customScaleName)
|
||||
{
|
||||
int analogInputVoltageChan = Interop.DAQmxBaseCreateAIVoltageChan(taskHandle, physicalChannel, nameToAssignToChannel, (int)terminalConfig, minVal, maxVal, (int)units, customScaleName);
|
||||
int analogInputVoltageChan = Interop.DAQmxCreateAIVoltageChan(taskHandle, physicalChannel, nameToAssignToChannel, (int)terminalConfig, minVal, maxVal, (int)units, customScaleName);
|
||||
if (analogInputVoltageChan < 0)
|
||||
throw new DAQmxException(analogInputVoltageChan, "Could not create analog input voltage channel");
|
||||
++Channels;
|
||||
@ -50,7 +50,7 @@ public class DAQmxTask
|
||||
|
||||
public void CreateAnalogOutputVoltageChan(string physicalChannel, string nameToAssignToChannel, double minVal, double maxVal, DAQmxUnits units, string customScaleName)
|
||||
{
|
||||
int analogOutputVoltageChan = Interop.DAQmxBaseCreateAOVoltageChan(taskHandle, physicalChannel, nameToAssignToChannel, minVal, maxVal, (int)units, customScaleName);
|
||||
int analogOutputVoltageChan = Interop.DAQmxCreateAOVoltageChan(taskHandle, physicalChannel, nameToAssignToChannel, minVal, maxVal, (int)units, customScaleName);
|
||||
if (analogOutputVoltageChan < 0)
|
||||
throw new DAQmxException(analogOutputVoltageChan, "Could not create analog output voltage channel");
|
||||
++Channels;
|
||||
@ -58,13 +58,13 @@ public class DAQmxTask
|
||||
|
||||
public void CreateDigitalOutputChanel(string lines, string nameToAssignToLines, DAQmxLineGrouping lineGrouping)
|
||||
{
|
||||
int doChan = Interop.DAQmxBaseCreateDOChan(taskHandle, lines, nameToAssignToLines, (int)lineGrouping);
|
||||
int doChan = Interop.DAQmxCreateDOChan(taskHandle, lines, nameToAssignToLines, (int)lineGrouping);
|
||||
if (doChan < 0)
|
||||
throw new DAQmxException(doChan, "Could not create digital output channel");
|
||||
++Channels;
|
||||
}
|
||||
|
||||
#if !unsafe
|
||||
#if unsafe
|
||||
public unsafe void ReadAnalogF64(int numSamplesPerChan, double timeout, DAQmxFillMode fillMode, Span<double> data)
|
||||
{
|
||||
int arraySizeInSamples = numSamplesPerChan * Channels;
|
||||
@ -73,7 +73,7 @@ public class DAQmxTask
|
||||
fixed (double* readArray = &data.GetPinnableReference())
|
||||
{
|
||||
IntPtr samplesPerChanRead;
|
||||
int errorCode = Interop.DAQmxBaseReadAnalogF64(taskHandle, numSamplesPerChan, timeout, (int)fillMode, readArray, (uint)arraySizeInSamples, out samplesPerChanRead, IntPtr.Zero);
|
||||
int errorCode = Interop.DAQmxReadAnalogF64(taskHandle, numSamplesPerChan, timeout, (int)fillMode, readArray, (uint)arraySizeInSamples, out samplesPerChanRead, IntPtr.Zero);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "Could not read samples");
|
||||
int int32 = samplesPerChanRead.ToInt32();
|
||||
@ -88,22 +88,23 @@ public class DAQmxTask
|
||||
public double ReadAnalogScalarF64(double timeout)
|
||||
{
|
||||
double result;
|
||||
int errorCode = Interop.DAQmxBaseReadAnalogScalarF64(taskHandle, timeout, out result, IntPtr.Zero);
|
||||
int errorCode = Interop.DAQmxReadAnalogScalarF64(taskHandle, timeout, out result, IntPtr.Zero);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "Could not read samples");
|
||||
++TotalSamplesRead;
|
||||
return result;
|
||||
}
|
||||
|
||||
#if !unsafe
|
||||
#if unsafe
|
||||
public double ReadAnalogF64(double timeout)
|
||||
{
|
||||
double result = DAQmxReadAnalogF64(timeout);
|
||||
++TotalSamplesRead;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !unsafe
|
||||
#if unsafe
|
||||
private unsafe double DAQmxReadAnalogF64(double timeout)
|
||||
{
|
||||
double results;
|
||||
@ -112,7 +113,7 @@ public class DAQmxTask
|
||||
IntPtr samplesPerChanRead = IntPtr.Zero;
|
||||
double* readArray = stackalloc double[1];
|
||||
int fillMode = (int)DAQmxFillMode.GroupByChannel;
|
||||
int errorCode = Interop.DAQmxBaseReadAnalogF64(taskHandle,
|
||||
int errorCode = Interop.DAQmxReadAnalogF64(taskHandle,
|
||||
numSamplesPerChan,
|
||||
timeout,
|
||||
fillMode,
|
||||
@ -129,7 +130,7 @@ public class DAQmxTask
|
||||
|
||||
public void Start()
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseStartTask(taskHandle);
|
||||
int errorCode = Interop.DAQmxStartTask(taskHandle);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "Could not start Task");
|
||||
TaskStartedUtc = DateTime.UtcNow;
|
||||
@ -137,21 +138,21 @@ public class DAQmxTask
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseStopTask(taskHandle);
|
||||
int errorCode = Interop.DAQmxStopTask(taskHandle);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "Could not stop Task");
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseClearTask(taskHandle);
|
||||
int errorCode = Interop.DAQmxClearTask(taskHandle);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "Could not clear Task");
|
||||
}
|
||||
|
||||
public void CfgSampleClkTiming(string source, double rate, DAQmxActiveEdge activeEdge, DAQmxSampleMode sampleMode, ulong samplesPerChan)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgSampClkTiming(taskHandle, source, rate, (int)activeEdge, (int)sampleMode, samplesPerChan);
|
||||
int errorCode = Interop.DAQmxCfgSampClkTiming(taskHandle, source, rate, (int)activeEdge, (int)sampleMode, samplesPerChan);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "CfgSampleClkTiming failed.");
|
||||
DT = 1.0 / SampleClockRate;
|
||||
@ -159,42 +160,42 @@ public class DAQmxTask
|
||||
|
||||
public void DAQmxCfgHandshakingTiming(DAQmxSampleMode sampleMode, ulong samplesPerChan)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgHandshakingTiming(taskHandle, (int)sampleMode, samplesPerChan);
|
||||
int errorCode = Interop.DAQmxCfgHandshakingTiming(taskHandle, (int)sampleMode, samplesPerChan);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "DAQmxCfgHandshakingTiming failed.");
|
||||
}
|
||||
|
||||
public void DAQmxCfgBurstHandshakingTimingImportClock(DAQmxSampleMode sampleMode, ulong samplesPerChan, double sampleClkRate, string sampleClkSrc, DAQmxPolarity sampleClkActiveEdge, DAQmxLevel pauseWhen, DAQmxPolarity readyEventActiveLevel)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgBurstHandshakingTimingImportClock(taskHandle, (int)sampleMode, samplesPerChan, sampleClkRate, sampleClkSrc, (int)sampleClkActiveEdge, (int)pauseWhen, (int)readyEventActiveLevel);
|
||||
int errorCode = Interop.DAQmxCfgBurstHandshakingTimingImportClock(taskHandle, (int)sampleMode, samplesPerChan, sampleClkRate, sampleClkSrc, (int)sampleClkActiveEdge, (int)pauseWhen, (int)readyEventActiveLevel);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "DAQmxCfgBurstHandshakingTimingImportClock failed.");
|
||||
}
|
||||
|
||||
public void DAQmxCfgBurstHandshakingTimingExportClock(DAQmxSampleMode sampleMode, ulong samplesPerChan, double sampleClkRate, string sampleClkOutputTerm, DAQmxPolarity sampleClkPulsePolarity, DAQmxLevel pauseWhen, DAQmxPolarity readyEventActiveLevel)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgBurstHandshakingTimingExportClock(taskHandle, (int)sampleMode, samplesPerChan, sampleClkRate, sampleClkOutputTerm, (int)sampleClkPulsePolarity, (int)pauseWhen, (int)readyEventActiveLevel);
|
||||
int errorCode = Interop.DAQmxCfgBurstHandshakingTimingExportClock(taskHandle, (int)sampleMode, samplesPerChan, sampleClkRate, sampleClkOutputTerm, (int)sampleClkPulsePolarity, (int)pauseWhen, (int)readyEventActiveLevel);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "DAQmxCfgBurstHandshakingTimingExportClock failed.");
|
||||
}
|
||||
|
||||
public void DAQmxCfgChangeDetectionTiming(string risingEdgeChan, string fallingEdgeChan, DAQmxSampleMode sampleMode, ulong samplesPerChan)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgChangeDetectionTiming(taskHandle, risingEdgeChan, fallingEdgeChan, (int)sampleMode, samplesPerChan);
|
||||
int errorCode = Interop.DAQmxCfgChangeDetectionTiming(taskHandle, risingEdgeChan, fallingEdgeChan, (int)sampleMode, samplesPerChan);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "DAQmxCfgChangeDetectionTiming failed.");
|
||||
}
|
||||
|
||||
public void DAQmxCfgImplicitTiming(DAQmxSampleMode sampleMode, ulong samplesPerChan)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgImplicitTiming(taskHandle, (int)sampleMode, samplesPerChan);
|
||||
int errorCode = Interop.DAQmxCfgImplicitTiming(taskHandle, (int)sampleMode, samplesPerChan);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "DAQmxCfgImplicitTiming failed.");
|
||||
}
|
||||
|
||||
public void DAQmxCfgPipelinedSampleClkTiming(string source, double rate, DAQmxActiveEdge activeEdge, DAQmxSampleMode sampleMode, ulong samplesPerChan)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgPipelinedSampClkTiming(taskHandle, source, rate, (int)activeEdge, (int)sampleMode, samplesPerChan);
|
||||
int errorCode = Interop.DAQmxCfgPipelinedSampClkTiming(taskHandle, source, rate, (int)activeEdge, (int)sampleMode, samplesPerChan);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "DAQmxCfgPipelinedSampleClkTiming failed.");
|
||||
}
|
||||
@ -204,14 +205,14 @@ public class DAQmxTask
|
||||
get
|
||||
{
|
||||
double result = 0.0;
|
||||
int sampleClkRate = Interop.DAQmxBaseGetSampClkRate(taskHandle, ref result);
|
||||
int sampleClkRate = Interop.DAQmxGetSampClkRate(taskHandle, ref result);
|
||||
if (sampleClkRate < 0)
|
||||
throw new DAQmxException(sampleClkRate, "Could not get SampleClockRate");
|
||||
return result;
|
||||
}
|
||||
set
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseSetSampClkRate(taskHandle, value);
|
||||
int errorCode = Interop.DAQmxSetSampClkRate(taskHandle, value);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "Could not set SampleClockRate");
|
||||
}
|
||||
@ -222,7 +223,7 @@ public class DAQmxTask
|
||||
get
|
||||
{
|
||||
double result = 0.0;
|
||||
int sampleClkMaxRate = Interop.DAQmxBaseGetSampClkMaxRate(taskHandle, ref result);
|
||||
int sampleClkMaxRate = Interop.DAQmxGetSampClkMaxRate(taskHandle, ref result);
|
||||
if (sampleClkMaxRate < 0)
|
||||
throw new DAQmxException(sampleClkMaxRate, "Could not get SampleClockMaxRate");
|
||||
return result;
|
||||
@ -231,21 +232,21 @@ public class DAQmxTask
|
||||
|
||||
public void DisableStartTrig()
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseDisableStartTrig(taskHandle);
|
||||
int errorCode = Interop.DAQmxDisableStartTrig(taskHandle);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "DisableStartTrig failed.");
|
||||
}
|
||||
|
||||
public void CfgDigEdgeStartTrig(string triggerSource, DAQmxEdge triggerEdge)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgDigEdgeStartTrig(taskHandle, triggerSource, (int)triggerEdge);
|
||||
int errorCode = Interop.DAQmxCfgDigEdgeStartTrig(taskHandle, triggerSource, (int)triggerEdge);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "CfgDigEdgeStartTrig failed.");
|
||||
}
|
||||
|
||||
public void CfgAnalogEdgeStartTrig(string triggerSource, DAQmxEdge triggerSlope, double triggerLevel)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgAnlgEdgeStartTrig(taskHandle, triggerSource, (int)triggerSlope, triggerLevel);
|
||||
int errorCode = Interop.DAQmxCfgAnlgEdgeStartTrig(taskHandle, triggerSource, (int)triggerSlope, triggerLevel);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "CfgAnalogEdgeStartTrig failed.");
|
||||
}
|
||||
@ -255,42 +256,42 @@ public class DAQmxTask
|
||||
|
||||
public void CfgAnalogWindowStartTrig(string triggerSource, DAQmxWindowTriggerWhen triggerWhen, double windowTop, double windowBottom)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgAnlgWindowStartTrig(taskHandle, triggerSource, (int)triggerWhen, windowTop, windowBottom);
|
||||
int errorCode = Interop.DAQmxCfgAnlgWindowStartTrig(taskHandle, triggerSource, (int)triggerWhen, windowTop, windowBottom);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "CfgAnalogWindowStartTrig failed.");
|
||||
}
|
||||
|
||||
public void CfgTimeStartTrig(CVIAbsoluteTime when, DAQmxTimescale timescale)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgTimeStartTrig(taskHandle, when, (int)timescale);
|
||||
int errorCode = Interop.DAQmxCfgTimeStartTrig(taskHandle, when, (int)timescale);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "CfgTimeStartTrig failed.");
|
||||
}
|
||||
|
||||
public void CfgDigPatternStartTrig(string triggerSource, string triggerPattern, DAQmxDigitalPatternTriggerWhen triggerWhen)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgDigPatternStartTrig(taskHandle, triggerSource, triggerPattern, (int)triggerWhen);
|
||||
int errorCode = Interop.DAQmxCfgDigPatternStartTrig(taskHandle, triggerSource, triggerPattern, (int)triggerWhen);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "CfgDigPatternStartTrig failed.");
|
||||
}
|
||||
|
||||
public void DisableRefTrig()
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseDisableRefTrig(taskHandle);
|
||||
int errorCode = Interop.DAQmxDisableRefTrig(taskHandle);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "DisableRefTrig failed.");
|
||||
}
|
||||
|
||||
public void CfgDigEdgeRefTrig(string triggerSource, DAQmxEdge triggerEdge, uint pretriggerSamples)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgDigEdgeRefTrig(taskHandle, triggerSource, (int)triggerEdge, pretriggerSamples);
|
||||
int errorCode = Interop.DAQmxCfgDigEdgeRefTrig(taskHandle, triggerSource, (int)triggerEdge, pretriggerSamples);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "CfgDigEdgeRefTrig failed.");
|
||||
}
|
||||
|
||||
public void CfgAnalogEdgeRefTrig(string triggerSource, DAQmxEdge triggerSlope, double triggerLevel, uint pretriggerSamples)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgAnlgEdgeRefTrig(taskHandle, triggerSource, (int)triggerSlope, triggerLevel, pretriggerSamples);
|
||||
int errorCode = Interop.DAQmxCfgAnlgEdgeRefTrig(taskHandle, triggerSource, (int)triggerSlope, triggerLevel, pretriggerSamples);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "CfgAnalogEdgeRefTrig failed.");
|
||||
}
|
||||
@ -300,14 +301,14 @@ public class DAQmxTask
|
||||
|
||||
public void CfgAnalogWindowRefTrig(string triggerSource, DAQmxWindowTriggerWhen triggerWhen, double windowTop, double windowBottom, uint pretriggerSamples)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgAnlgWindowRefTrig(taskHandle, triggerSource, (int)triggerWhen, windowTop, windowBottom, pretriggerSamples);
|
||||
int errorCode = Interop.DAQmxCfgAnlgWindowRefTrig(taskHandle, triggerSource, (int)triggerWhen, windowTop, windowBottom, pretriggerSamples);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "CfgAnalogWindowRefTrig failed.");
|
||||
}
|
||||
|
||||
public void CfgDigPatternRefTrig(string triggerSource, string triggerPattern, DAQmxDigitalPatternTriggerWhen triggerWhen, uint pretriggerSamples)
|
||||
{
|
||||
int errorCode = Interop.DAQmxBaseCfgDigPatternRefTrig(taskHandle, triggerSource, triggerPattern, (int)triggerWhen, pretriggerSamples);
|
||||
int errorCode = Interop.DAQmxCfgDigPatternRefTrig(taskHandle, triggerSource, triggerPattern, (int)triggerWhen, pretriggerSamples);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "CfgDigPatternRefTrig failed.");
|
||||
}
|
||||
@ -318,7 +319,7 @@ public class DAQmxTask
|
||||
if (data.Length < num)
|
||||
throw new DAQmxMemoryException("Span length too short. (Span length: " + data.Length.ToString() + ", required length: " + num.ToString() + ")");
|
||||
IntPtr samplesPerChanWritten;
|
||||
int errorCode = Interop.DAQmxBaseWriteAnalogF64(taskHandle, numSamplesPerChan, autoStart, timeout, dataLayout > DAQmxDataLayout.GroupByChannel, data.ToArray(), out samplesPerChanWritten, IntPtr.Zero);
|
||||
int errorCode = Interop.DAQmxWriteAnalogF64(taskHandle, numSamplesPerChan, autoStart, timeout, dataLayout > DAQmxDataLayout.GroupByChannel, data.ToArray(), out samplesPerChanWritten, IntPtr.Zero);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "Could not write samples");
|
||||
int int32 = samplesPerChanWritten.ToInt32();
|
||||
@ -334,7 +335,7 @@ public class DAQmxTask
|
||||
if (data.Length < num)
|
||||
throw new DAQmxMemoryException("Span length too short. (Span length: " + data.Length.ToString() + ", required length: " + num.ToString() + ")");
|
||||
IntPtr samplesPerChanWritten;
|
||||
int errorCode = Interop.DAQmxBaseWriteDigitalLines(taskHandle, numSamplesPerChan, autoStart, timeout, dataLayout > DAQmxDataLayout.GroupByChannel, data.ToArray(), out samplesPerChanWritten, IntPtr.Zero);
|
||||
int errorCode = Interop.DAQmxWriteDigitalLines(taskHandle, numSamplesPerChan, autoStart, timeout, dataLayout > DAQmxDataLayout.GroupByChannel, data.ToArray(), out samplesPerChanWritten, IntPtr.Zero);
|
||||
if (errorCode < 0)
|
||||
throw new DAQmxException(errorCode, "Could not write samples");
|
||||
int int32 = samplesPerChanWritten.ToInt32();
|
||||
|
@ -10,7 +10,7 @@ namespace Helpers.DAQmx;
|
||||
internal class Interop
|
||||
{ // cSpell:disable
|
||||
|
||||
private const string lib = "DAQmxBase";
|
||||
private const string lib = "DAQmx";
|
||||
private static IntPtr libHandle = IntPtr.Zero;
|
||||
|
||||
static Interop() =>
|
||||
@ -18,7 +18,7 @@ internal class Interop
|
||||
|
||||
private static IntPtr ImportResolver(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
|
||||
{
|
||||
if (libraryName == "DAQmxBase" && !(libHandle != IntPtr.Zero))
|
||||
if (libraryName == "DAQmx" && !(libHandle != IntPtr.Zero))
|
||||
{
|
||||
bool loaded;
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
@ -41,20 +41,20 @@ internal class Interop
|
||||
return libHandle;
|
||||
}
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseGetSampClkRate(IntPtr taskHandle, ref double data);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxGetSampClkRate(IntPtr taskHandle, ref double data);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseSetSampClkRate(IntPtr taskHandle, double data);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxSetSampClkRate(IntPtr taskHandle, double data);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseGetSampClkMaxRate(IntPtr taskHandle, ref double data);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxGetSampClkMaxRate(IntPtr taskHandle, ref double data);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseSetWriteRegenMode(IntPtr taskHandle, int data);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxSetWriteRegenMode(IntPtr taskHandle, int data);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCreateAIVoltageChan(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCreateAIVoltageChan(
|
||||
IntPtr taskHandle,
|
||||
string physicalChannel,
|
||||
string nameToAssignToChannel,
|
||||
@ -64,8 +64,8 @@ internal class Interop
|
||||
int units,
|
||||
string customScaleName);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCreateAOVoltageChan(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCreateAOVoltageChan(
|
||||
IntPtr taskHandle,
|
||||
string physicalChannel,
|
||||
string nameToAssignToChannel,
|
||||
@ -74,22 +74,22 @@ internal class Interop
|
||||
int units,
|
||||
string customScaleName);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCreateDOChan(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCreateDOChan(
|
||||
IntPtr taskHandle,
|
||||
string lines,
|
||||
string nameToAssignToLines,
|
||||
int lineGrouping);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseGetErrorString(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxGetErrorString(
|
||||
int errorCode,
|
||||
StringBuilder errorString,
|
||||
uint buffersize);
|
||||
|
||||
#if !unsafe
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern unsafe int DAQmxBaseReadAnalogF64(
|
||||
#if unsafe
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern unsafe int DAQmxReadAnalogF64(
|
||||
IntPtr taskHandle,
|
||||
int numSampsPerChan,
|
||||
double timeout,
|
||||
@ -100,16 +100,16 @@ internal class Interop
|
||||
IntPtr reserved);
|
||||
#endif
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseReadAnalogScalarF64(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxReadAnalogScalarF64(
|
||||
IntPtr taskHandle,
|
||||
double timeout,
|
||||
out double value,
|
||||
IntPtr reserved);
|
||||
|
||||
#if unsafe
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern unsafe int DAQmxBaseReadBinaryI16(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern unsafe int DAQmxReadBinaryI16(
|
||||
IntPtr taskHandle,
|
||||
int numSampsPerChan,
|
||||
double timeout,
|
||||
@ -121,8 +121,8 @@ internal class Interop
|
||||
#endif
|
||||
|
||||
#if unsafe
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern unsafe int DAQmxBaseReadBinaryU16(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern unsafe int DAQmxReadBinaryU16(
|
||||
IntPtr taskHandle,
|
||||
int numSampsPerChan,
|
||||
double timeout,
|
||||
@ -134,8 +134,8 @@ internal class Interop
|
||||
#endif
|
||||
|
||||
#if unsafe
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern unsafe int DAQmxBaseReadBinaryI32(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern unsafe int DAQmxReadBinaryI32(
|
||||
IntPtr taskHandle,
|
||||
int numSampsPerChan,
|
||||
double timeout,
|
||||
@ -147,8 +147,8 @@ internal class Interop
|
||||
#endif
|
||||
|
||||
#if unsafe
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern unsafe int DAQmxBaseReadBinaryU32(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern unsafe int DAQmxReadBinaryU32(
|
||||
IntPtr taskHandle,
|
||||
int numSampsPerChan,
|
||||
double timeout,
|
||||
@ -159,59 +159,59 @@ internal class Interop
|
||||
IntPtr reserved);
|
||||
#endif
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseConfigureLogging(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxConfigureLogging(
|
||||
IntPtr taskHandle,
|
||||
string filePath,
|
||||
int loggingMode,
|
||||
string groupName,
|
||||
int operation);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseLoadTask(string taskName, out IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxLoadTask(string taskName, out IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCreateTask(string taskName, out IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCreateTask(string taskName, out IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseAddGlobalChansToTask(IntPtr taskHandle, string[] channelNames);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxAddGlobalChansToTask(IntPtr taskHandle, string[] channelNames);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseStartTask(IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxStartTask(IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseStopTask(IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxStopTask(IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseClearTask(IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxClearTask(IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseWaitUntilTaskDone(IntPtr taskHandle, double timeToWait);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxWaitUntilTaskDone(IntPtr taskHandle, double timeToWait);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseWaitForValidTimestamp(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxWaitForValidTimestamp(
|
||||
IntPtr taskHandle,
|
||||
int timestampEvent,
|
||||
double timeout,
|
||||
CVIAbsoluteTime timestamp);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseIsTaskDone(IntPtr taskHandle, out uint isTaskDone);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxIsTaskDone(IntPtr taskHandle, out uint isTaskDone);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseTaskControl(IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxTaskControl(IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseGetNthTaskChannel(IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxGetNthTaskChannel(IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseGetNthTaskDevice(IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxGetNthTaskDevice(IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseGetTaskAttribute(IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxGetTaskAttribute(IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCfgSampClkTiming(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCfgSampClkTiming(
|
||||
IntPtr taskHandle,
|
||||
string source,
|
||||
double rate,
|
||||
@ -219,14 +219,14 @@ internal class Interop
|
||||
int sampleMode,
|
||||
ulong sampsPerChan);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCfgHandshakingTiming(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCfgHandshakingTiming(
|
||||
IntPtr taskHandle,
|
||||
int sampleMode,
|
||||
ulong sampsPerChan);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCfgBurstHandshakingTimingImportClock(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCfgBurstHandshakingTimingImportClock(
|
||||
IntPtr taskHandle,
|
||||
int sampleMode,
|
||||
ulong sampsPerChan,
|
||||
@ -236,8 +236,8 @@ internal class Interop
|
||||
int pauseWhen,
|
||||
int readyEventActiveLevel);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCfgBurstHandshakingTimingExportClock(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCfgBurstHandshakingTimingExportClock(
|
||||
IntPtr taskHandle,
|
||||
int sampleMode,
|
||||
ulong sampsPerChan,
|
||||
@ -247,22 +247,22 @@ internal class Interop
|
||||
int pauseWhen,
|
||||
int readyEventActiveLevel);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCfgChangeDetectionTiming(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCfgChangeDetectionTiming(
|
||||
IntPtr taskHandle,
|
||||
string risingEdgeChan,
|
||||
string fallingEdgeChan,
|
||||
int sampleMode,
|
||||
ulong sampsPerChan);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCfgImplicitTiming(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCfgImplicitTiming(
|
||||
IntPtr taskHandle,
|
||||
int sampleMode,
|
||||
ulong sampsPerChan);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseCfgPipelinedSampClkTiming(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxCfgPipelinedSampClkTiming(
|
||||
IntPtr taskHandle,
|
||||
string source,
|
||||
double rate,
|
||||
@ -270,106 +270,106 @@ internal class Interop
|
||||
int sampleMode,
|
||||
ulong sampsPerChan);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseGetTimingAttribute(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxGetTimingAttribute(
|
||||
IntPtr taskHandle,
|
||||
int attribute,
|
||||
out object value);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseSetTimingAttribute(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxSetTimingAttribute(
|
||||
IntPtr taskHandle,
|
||||
int attribute,
|
||||
object value);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseResetTimingAttribute(IntPtr taskHandle, int attribute);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxResetTimingAttribute(IntPtr taskHandle, int attribute);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseGetTimingAttributeEx(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxGetTimingAttributeEx(
|
||||
IntPtr taskHandle,
|
||||
string deviceNames,
|
||||
int attribute,
|
||||
out object value);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseSetTimingAttributeEx(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxSetTimingAttributeEx(
|
||||
IntPtr taskHandle,
|
||||
string deviceNames,
|
||||
int attribute,
|
||||
object value);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxBaseResetTimingAttributeEx(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
internal static extern int DAQmxResetTimingAttributeEx(
|
||||
IntPtr taskHandle,
|
||||
string deviceNames,
|
||||
int attribute);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseDisableStartTrig(IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxDisableStartTrig(IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgDigEdgeStartTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgDigEdgeStartTrig(
|
||||
IntPtr taskHandle,
|
||||
string triggerSource,
|
||||
int triggerEdge);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgAnlgEdgeStartTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgAnlgEdgeStartTrig(
|
||||
IntPtr taskHandle,
|
||||
string triggerSource,
|
||||
int triggerSlope,
|
||||
double triggerLevel);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgAnlgMultiEdgeStartTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgAnlgMultiEdgeStartTrig(
|
||||
IntPtr taskHandle,
|
||||
string triggerSources,
|
||||
int[] triggerSlopeArray,
|
||||
double[] triggerLevelArray,
|
||||
uint arraySize);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgAnlgWindowStartTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgAnlgWindowStartTrig(
|
||||
IntPtr taskHandle,
|
||||
string triggerSource,
|
||||
int triggerWhen,
|
||||
double windowTop,
|
||||
double windowBottom);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgTimeStartTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgTimeStartTrig(
|
||||
IntPtr taskHandle,
|
||||
CVIAbsoluteTime when,
|
||||
int timescale);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgDigPatternStartTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgDigPatternStartTrig(
|
||||
IntPtr taskHandle,
|
||||
string triggerSource,
|
||||
string triggerPattern,
|
||||
int triggerWhen);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseDisableRefTrig(IntPtr taskHandle);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxDisableRefTrig(IntPtr taskHandle);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgDigEdgeRefTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgDigEdgeRefTrig(
|
||||
IntPtr taskHandle,
|
||||
string triggerSource,
|
||||
int triggerEdge,
|
||||
uint pretriggerSamples);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgAnlgEdgeRefTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgAnlgEdgeRefTrig(
|
||||
IntPtr taskHandle,
|
||||
string triggerSource,
|
||||
int triggerSlope,
|
||||
double triggerLevel,
|
||||
uint pretriggerSamples);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgAnlgMultiEdgeRefTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgAnlgMultiEdgeRefTrig(
|
||||
IntPtr taskHandle,
|
||||
string triggerSources,
|
||||
int[] triggerSlopeArray,
|
||||
@ -377,8 +377,8 @@ internal class Interop
|
||||
uint pretriggerSamples,
|
||||
uint arraySize);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgAnlgWindowRefTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgAnlgWindowRefTrig(
|
||||
IntPtr taskHandle,
|
||||
string triggerSource,
|
||||
int triggerWhen,
|
||||
@ -386,28 +386,28 @@ internal class Interop
|
||||
double windowBottom,
|
||||
uint pretriggerSamples);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseCfgDigPatternRefTrig(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxCfgDigPatternRefTrig(
|
||||
IntPtr taskHandle,
|
||||
string triggerSource,
|
||||
string triggerPattern,
|
||||
int triggerWhen,
|
||||
uint pretriggerSamples);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseGetTrigAttribute(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxGetTrigAttribute(
|
||||
IntPtr taskHandle,
|
||||
int attribute,
|
||||
out object value);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseSetTrigAttribute(IntPtr taskHandle, int attribute, object value);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxSetTrigAttribute(IntPtr taskHandle, int attribute, object value);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseResetTrigAttribute(IntPtr taskHandle, int attribute);
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxResetTrigAttribute(IntPtr taskHandle, int attribute);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseWriteAnalogF64(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxWriteAnalogF64(
|
||||
IntPtr taskHandle,
|
||||
int numSampsPerChan,
|
||||
bool autoStart,
|
||||
@ -417,8 +417,8 @@ internal class Interop
|
||||
out IntPtr sampsPerChanWritten,
|
||||
IntPtr reserved);
|
||||
|
||||
[DllImport("DAQmxBase", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxBaseWriteDigitalLines(
|
||||
[DllImport("DAQmx", CallingConvention = CallingConvention.StdCall)]
|
||||
public static extern int DAQmxWriteDigitalLines(
|
||||
IntPtr taskHandle,
|
||||
int numSampsPerChan,
|
||||
bool autoStart,
|
||||
|
@ -39,9 +39,8 @@ internal static partial class NationalInstrumentsHelper
|
||||
foreach (KeyValuePair<string, DAQmxTask> keyValuePair in _DataAcquisitionTasks)
|
||||
{
|
||||
if (appSettings.NationalInstrumentsConfiguration.UsePointerMethod)
|
||||
value = keyValuePair.Value.ReadAnalogF64(appSettings.NationalInstrumentsConfiguration.ReadTimeout);
|
||||
else
|
||||
value = keyValuePair.Value.ReadAnalogScalarF64(appSettings.NationalInstrumentsConfiguration.ReadTimeout);
|
||||
throw new NotSupportedException("Pointer method is not supported in this implementation.");
|
||||
value = keyValuePair.Value.ReadAnalogScalarF64(appSettings.NationalInstrumentsConfiguration.ReadTimeout);
|
||||
logger.LogInformation("{key}-{read}: {value}", keyValuePair.Key, keyValuePair.Value.TotalSamplesRead, value);
|
||||
}
|
||||
return true;
|
||||
|
@ -43,6 +43,11 @@ public partial class Worker : BackgroundService
|
||||
|
||||
private async Task Body(CancellationToken cancellationToken)
|
||||
{
|
||||
if (!_IsWindowsService)
|
||||
{
|
||||
_Logger.LogInformation("Set break point and skip to run {_AppSettings.FileWatcherConfiguration.Helper}!", _AppSettings.FileWatcherConfiguration.Helper);
|
||||
throw new EvaluateException($"Set break point and skip to run {_AppSettings.FileWatcherConfiguration.Helper}!");
|
||||
}
|
||||
if (!_IsWindowsService)
|
||||
{
|
||||
for (int i = 0; i < int.MaxValue; i++)
|
||||
|
Reference in New Issue
Block a user