faster response to discovery
implements on/off
This commit is contained in:
parent
d7855e8c63
commit
4ceed2d191
14 changed files with 157 additions and 55 deletions
|
|
@ -30,7 +30,7 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#pragma unmanaged
|
#pragma unmanaged
|
||||||
#include "Epd3Base.h"
|
#include "Epd3Base.h"
|
||||||
#include "TimeFunctions.h"
|
#include "TimeFunctions.h"
|
||||||
|
//#include "../EpdBaseClr/EpdBaseClr.h"
|
||||||
#pragma unmanaged
|
#pragma unmanaged
|
||||||
#define noDeissueWithClear
|
#define noDeissueWithClear
|
||||||
#define ProtectSession
|
#define ProtectSession
|
||||||
|
|
@ -13,7 +14,7 @@
|
||||||
#define DebugWrite(f,...) ;
|
#define DebugWrite(f,...) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
constexpr int SleepAfterClear = 1000;
|
constexpr int SleepAfterClear = 2000;
|
||||||
|
|
||||||
//-102 = permission
|
//-102 = permission
|
||||||
Epd3Base::Epd3U* current;
|
Epd3Base::Epd3U* current;
|
||||||
|
|
@ -117,6 +118,7 @@ void WINAPI discovery(CommsHandle hComms, DiscoveryId const discovered[], int32_
|
||||||
current->EpdID = current->Epd.Id;
|
current->EpdID = current->Epd.Id;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
current->isMK3 = true;
|
||||||
current->EpdID = 0;
|
current->EpdID = 0;
|
||||||
current->CurrentDeviceID = 0;
|
current->CurrentDeviceID = 0;
|
||||||
current->DeviceCount = 0;
|
current->DeviceCount = 0;
|
||||||
|
|
@ -230,6 +232,11 @@ void Epd3Base::Epd3U::Cancel()
|
||||||
SetEvent(current->hCancel);
|
SetEvent(current->hCancel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Epd3Base::Epd3U::test()
|
||||||
|
{
|
||||||
|
const char* msg = "Processing step test...";
|
||||||
|
progressCallback(0, msg); // Triggers the callback
|
||||||
|
}
|
||||||
DWORD Epd3Base::Epd3U::StartCom()
|
DWORD Epd3Base::Epd3U::StartCom()
|
||||||
{
|
{
|
||||||
ErrorReason = 0;
|
ErrorReason = 0;
|
||||||
|
|
@ -248,13 +255,22 @@ DWORD Epd3Base::Epd3U::StartCom()
|
||||||
step = 2;
|
step = 2;
|
||||||
SetFunctionReturnValue(fCreateReaderInterface, 0);
|
SetFunctionReturnValue(fCreateReaderInterface, 0);
|
||||||
epdComsHandle = CreateReaderInterface();
|
epdComsHandle = CreateReaderInterface();
|
||||||
if (!epdComsHandle ) step = 3;
|
if (!epdComsHandle) step = 3;
|
||||||
while (epdComsHandle == nullptr && ++ConnectRetries < 4) {
|
while (epdComsHandle == nullptr && ++ConnectRetries < 4) {
|
||||||
Sleep(200);
|
Sleep(200);
|
||||||
epdComsHandle = CreateReaderInterface(); //try again;
|
epdComsHandle = CreateReaderInterface(); //try again;
|
||||||
}
|
}
|
||||||
SetCommitReturnValue(0);
|
SetCommitReturnValue(0);
|
||||||
if (epdComsHandle) SetEndReturnValue(0); else SetEndReturnValue(-1);
|
if (epdComsHandle) {
|
||||||
|
|
||||||
|
SetEndReturnValue(0);
|
||||||
|
progressCallback(1, "CreateInterface"); // Triggers the callback
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
SetEndReturnValue(-1);
|
||||||
|
progressCallback(1, "Fail Interface"); // Triggers the callback
|
||||||
|
}
|
||||||
|
|
||||||
if (epdComsHandle != nullptr) {
|
if (epdComsHandle != nullptr) {
|
||||||
step = 4;
|
step = 4;
|
||||||
|
|
@ -323,7 +339,7 @@ void Epd3Base::Epd3U::EndCom(bool doDiscon)
|
||||||
int Epd3Base::Epd3U::StartDiscover(int tokentimeout)
|
int Epd3Base::Epd3U::StartDiscover(int tokentimeout)
|
||||||
{
|
{
|
||||||
ResetEvent(current->hCancel);
|
ResetEvent(current->hCancel);
|
||||||
EPDStep = EPDStepStartDiscover;
|
EPDStep = StepDiscovering;
|
||||||
DiscoverStep = 0;
|
DiscoverStep = 0;
|
||||||
DiscoverError = DiscoverErrorNone;
|
DiscoverError = DiscoverErrorNone;
|
||||||
int32_t rv = 1;
|
int32_t rv = 1;
|
||||||
|
|
@ -374,13 +390,14 @@ int Epd3Base::Epd3U::StartDiscover(int tokentimeout)
|
||||||
|
|
||||||
|
|
||||||
if (DiscoverError == DiscoverErrorNone && DeviceCount > 0 && Epd.Id >0) {
|
if (DiscoverError == DiscoverErrorNone && DeviceCount > 0 && Epd.Id >0) {
|
||||||
|
|
||||||
Dll3RV = Connect3(epdComsHandle, Epd, true);
|
Dll3RV = Connect3(epdComsHandle, Epd, true);
|
||||||
if (Dll3RV != 0) {
|
if (Dll3RV != 0) {
|
||||||
DiscoverError = DiscoverErrorConnecting;
|
DiscoverError = DiscoverErrorConnecting;
|
||||||
|
EPDStep = StepConnectFailed;
|
||||||
rv = 2;
|
rv = 2;
|
||||||
} else
|
} else
|
||||||
EPDStep = EPDStepConnected;
|
EPDStep = StepConnected;
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
@ -525,9 +542,6 @@ void Epd3Base::Epd3U::DecodeStatus()
|
||||||
EPDTrhFault = checkStatus(epd3status.FaultStatus, FaultStatusFlags::BadThreshold);
|
EPDTrhFault = checkStatus(epd3status.FaultStatus, FaultStatusFlags::BadThreshold);
|
||||||
EPDTimeFault = checkStatus(epd3status.FaultStatus, FaultStatusFlags::TimeInvalid);
|
EPDTimeFault = checkStatus(epd3status.FaultStatus, FaultStatusFlags::TimeInvalid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int ix = 0; ix < 4; ix++)
|
for (int ix = 0; ix < 4; ix++)
|
||||||
{
|
{
|
||||||
DoseAlarmFlags status = epd3status.DoseAlarms[ix].Status;
|
DoseAlarmFlags status = epd3status.DoseAlarms[ix].Status;
|
||||||
|
|
@ -801,24 +815,39 @@ int Epd3Base::Epd3U::ConnectAndStatus(int tokenSourceTimeout)
|
||||||
{
|
{
|
||||||
WORD dllStatus;
|
WORD dllStatus;
|
||||||
int rv = 1;
|
int rv = 1;
|
||||||
EPDStep = EPDConnectAndStatus;
|
|
||||||
Error = 0; ErrorStep = 0; hasAlarm = hasFault = 0;
|
Error = 0; ErrorStep = 0; hasAlarm = hasFault = 0;
|
||||||
ResetStepReturnValues();
|
ResetStepReturnValues();
|
||||||
if (CommsInitialized == 0) StartCom();
|
if (CommsInitialized == 0) StartCom();
|
||||||
if (CommsInitialized) {
|
if (CommsInitialized) {
|
||||||
SetFunctionReturnValue(fStartDiscover,0);
|
SetFunctionReturnValue(fStartDiscover,0);
|
||||||
|
EPDStep = StepDiscovering;
|
||||||
dllStatus = StartDiscover(tokenSourceTimeout);
|
dllStatus = StartDiscover(tokenSourceTimeout);
|
||||||
SetCommitReturnValue(0);
|
SetCommitReturnValue(0);
|
||||||
if (dllStatus==1) SetEndReturnValue(0); else SetEndReturnValue(dllStatus);
|
if (dllStatus == 1) {
|
||||||
|
SetEndReturnValue(0);
|
||||||
|
}
|
||||||
|
else SetEndReturnValue(dllStatus);
|
||||||
|
|
||||||
if (dllStatus != 1) rv = 1; //Connect error
|
if (dllStatus != 1) {
|
||||||
|
rv = 1; //Connect error
|
||||||
|
EPDStep = StepDiscoverFailed;
|
||||||
|
}
|
||||||
else if (DeviceCount < 1) {
|
else if (DeviceCount < 1) {
|
||||||
rv = 2;
|
rv = 2;
|
||||||
Error = r_OperationTimeout;
|
Error = r_OperationTimeout;
|
||||||
}
|
EPDStep = StepDiscoverFailed;
|
||||||
else if (isMK3 && ReadStatus(false) != 0) rv = 3; //Read Error
|
}
|
||||||
else rv = 0;
|
else if (isMK3) {
|
||||||
|
if (ReadStatus(false) != 0) {
|
||||||
|
rv = 3; //Read Error
|
||||||
|
EPDStep = StepFailedStatus;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
EPDStep = StepGotStatus;
|
||||||
|
rv = 0;
|
||||||
|
}
|
||||||
|
else rv = 0; //MK2
|
||||||
}
|
}
|
||||||
else rv = 1;
|
else rv = 1;
|
||||||
return rv;
|
return rv;
|
||||||
|
|
@ -1271,8 +1300,10 @@ int Epd3Base::Epd3U::ClearDoses()
|
||||||
|
|
||||||
//rv = r[0];
|
//rv = r[0];
|
||||||
//for (int b = 1; !rv && b < maxbatch;++b) if (r[b]) rv = r[b];
|
//for (int b = 1; !rv && b < maxbatch;++b) if (r[b]) rv = r[b];
|
||||||
|
|
||||||
error:
|
error:
|
||||||
Error = rv;
|
Error = rv;
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1284,8 +1315,12 @@ int Epd3Base::Epd3U::ClearAlarms()
|
||||||
int s[maxbatch];
|
int s[maxbatch];
|
||||||
int batchstep = 0;
|
int batchstep = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
s[batchstep] = SetFunctionReturnValue(eFunctions::ClearFaultStatus,0);
|
s[batchstep] = SetFunctionReturnValue(eFunctions::ClearFaultStatus,0);
|
||||||
btoken[batchstep]= BeginClearFaultStatus(epdComsHandle, nullptr);
|
btoken[batchstep]= BeginClearFaultStatus(epdComsHandle, nullptr);
|
||||||
|
|
||||||
batchstep = 1;
|
batchstep = 1;
|
||||||
s[batchstep] = SetFunctionReturnValue(eFunctions::ClearLatchedAlarms, 0);
|
s[batchstep] = SetFunctionReturnValue(eFunctions::ClearLatchedAlarms, 0);
|
||||||
btoken[batchstep] = BeginClearLatchedAlarms(epdComsHandle, nullptr);
|
btoken[batchstep] = BeginClearLatchedAlarms(epdComsHandle, nullptr);
|
||||||
|
|
@ -1294,6 +1329,7 @@ int Epd3Base::Epd3U::ClearAlarms()
|
||||||
|
|
||||||
batchstep = 0;
|
batchstep = 0;
|
||||||
r[batchstep] = End2RV(s[batchstep],EndClearFaultStatus, btoken[batchstep]);
|
r[batchstep] = End2RV(s[batchstep],EndClearFaultStatus, btoken[batchstep]);
|
||||||
|
|
||||||
batchstep = 1;
|
batchstep = 1;
|
||||||
r[batchstep] = End2RV(s[batchstep],EndClearLatchedAlarms, btoken[batchstep]);
|
r[batchstep] = End2RV(s[batchstep],EndClearLatchedAlarms, btoken[batchstep]);
|
||||||
|
|
||||||
|
|
@ -1309,20 +1345,6 @@ WORD Epd3Base::Epd3U::PrepareForIssue()
|
||||||
if (port == 0) return 0;
|
if (port == 0) return 0;
|
||||||
|
|
||||||
|
|
||||||
/*if (DetectorsOn) {
|
|
||||||
token = BeginEpdOnOff(epdComsHandle, 0, nullptr);
|
|
||||||
rv = Commit3(epdComsHandle);
|
|
||||||
if (!rv) rv = EndEpdOnOff(epdComsHandle, token);
|
|
||||||
rv = ReOpenDev();
|
|
||||||
}
|
|
||||||
if (rv != 0)
|
|
||||||
goto error;*/
|
|
||||||
|
|
||||||
/* gebeurt bij clearalrms
|
|
||||||
SetFunctionReturnValue(eFunctions::ClearLatchedAlarms,0);
|
|
||||||
token = BeginEpdOnOff(epdComsHandle, 1, nullptr);
|
|
||||||
rv = CommitAndEnd2RV(EndEpdOnOff, token);
|
|
||||||
*/
|
|
||||||
step = 2;
|
step = 2;
|
||||||
if (WriteConfig32) {
|
if (WriteConfig32) {
|
||||||
rv = WriteConfig();
|
rv = WriteConfig();
|
||||||
|
|
@ -1334,8 +1356,18 @@ WORD Epd3Base::Epd3U::PrepareForIssue()
|
||||||
if (!isConnected)
|
if (!isConnected)
|
||||||
rv = ReOpenDev();
|
rv = ReOpenDev();
|
||||||
|
|
||||||
|
|
||||||
|
step = 4;
|
||||||
|
if (!DetectorsOn) {
|
||||||
|
token = BeginEpdOnOff(epdComsHandle, 1, nullptr);
|
||||||
|
rv = Commit3(epdComsHandle);
|
||||||
|
if (!rv) rv = EndEpdOnOff(epdComsHandle, token);
|
||||||
|
rv = ReOpenDev();
|
||||||
|
DetectorsOn = 1;
|
||||||
|
}
|
||||||
|
|
||||||
step = 5;
|
step = 5;
|
||||||
rv = ClearAlarms();
|
rv = ClearAlarms();
|
||||||
if (rv != 0)
|
if (rv != 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
@ -1540,8 +1572,7 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
step = 4;
|
step = 4;
|
||||||
//EPDIssued
|
|
||||||
//if (!DetectorsOn) {
|
|
||||||
SetFunctionReturnValue(eFunctions::EpdOnOff, 0);
|
SetFunctionReturnValue(eFunctions::EpdOnOff, 0);
|
||||||
token = BeginEpdOnOff(epdComsHandle, 1, nullptr);
|
token = BeginEpdOnOff(epdComsHandle, 1, nullptr);
|
||||||
r = CommitAndEnd2RV(EndEpdOnOff, token);
|
r = CommitAndEnd2RV(EndEpdOnOff, token);
|
||||||
|
|
@ -1753,10 +1784,22 @@ int Epd3Base::Epd3U::IssueAndCheck(float gain, float ChirpRate)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
step = 1;
|
step = 1;
|
||||||
|
|
||||||
|
//todo: Set off
|
||||||
|
|
||||||
|
if (DetectorsOn) {
|
||||||
|
token = BeginEpdOnOff(epdComsHandle, 0, nullptr);
|
||||||
|
rv = Commit3(epdComsHandle);
|
||||||
|
if (!rv) rv = EndEpdOnOff(epdComsHandle, token);
|
||||||
|
rv = ReOpenDev();
|
||||||
|
DetectorsOn = 0;
|
||||||
|
}
|
||||||
|
|
||||||
OutputDebugStringW(L"**** IssueAndCheck step 1 settime ****\n");
|
OutputDebugStringW(L"**** IssueAndCheck step 1 settime ****\n");
|
||||||
rv = SetTime();
|
rv = SetTime();
|
||||||
//synctime
|
//synctime
|
||||||
|
|
||||||
|
//Tpodo :: Set ON
|
||||||
OutputDebugStringW(L"**** Prepare IssueAndCheck ****\n");
|
OutputDebugStringW(L"**** Prepare IssueAndCheck ****\n");
|
||||||
step = 2;
|
step = 2;
|
||||||
rv = PrepareForIssue(); //Set epd on, clear doses and alarms
|
rv = PrepareForIssue(); //Set epd on, clear doses and alarms
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "Epd2.h"
|
#include "Epd2.h"
|
||||||
|
|
||||||
#pragma unmanaged
|
#pragma unmanaged
|
||||||
|
|
||||||
#define MaxPeakRates 10
|
#define MaxPeakRates 10
|
||||||
#define MaxSensitivities 10
|
#define MaxSensitivities 10
|
||||||
#define MaxGains 10
|
#define MaxGains 10
|
||||||
|
|
@ -19,7 +20,8 @@
|
||||||
#define MaxTresholds 10
|
#define MaxTresholds 10
|
||||||
#define MaxSteps 50
|
#define MaxSteps 50
|
||||||
#define MaxBatch 4
|
#define MaxBatch 4
|
||||||
#define ResponseTimeout 2500
|
//ResponseTimeout was set to 2500 in code, but initial this was 500ms
|
||||||
|
#define ResponseTimeout 500
|
||||||
#define DiagnosticsWriteSize 256
|
#define DiagnosticsWriteSize 256
|
||||||
|
|
||||||
namespace Epd3Base {
|
namespace Epd3Base {
|
||||||
|
|
@ -37,6 +39,8 @@ namespace Epd3Base {
|
||||||
, fCreateReaderInterface,fOpenReader
|
, fCreateReaderInterface,fOpenReader
|
||||||
, TestVibe
|
, TestVibe
|
||||||
};
|
};
|
||||||
|
typedef void(*ProgressCallback)(int percentage, const char* message);
|
||||||
|
|
||||||
class Epd3U
|
class Epd3U
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -87,8 +91,6 @@ namespace Epd3Base {
|
||||||
void EndCom(bool doDiscon);
|
void EndCom(bool doDiscon);
|
||||||
int StartDiscover(int tokentimeout);
|
int StartDiscover(int tokentimeout);
|
||||||
|
|
||||||
enum EPDStepEnum { EPDNone, EPDConnectAndStatus, EPDStepConnecting, EPDStepConnected , EPDStepStartDiscover };
|
|
||||||
EPDStepEnum EPDStep;
|
|
||||||
int DiscoverStep;
|
int DiscoverStep;
|
||||||
enum DiscoverErrorCodes
|
enum DiscoverErrorCodes
|
||||||
{
|
{
|
||||||
|
|
@ -98,8 +100,20 @@ namespace Epd3Base {
|
||||||
DiscoverErrorOther=4,
|
DiscoverErrorOther=4,
|
||||||
DiscoverErrorConnecting=5
|
DiscoverErrorConnecting=5
|
||||||
};
|
};
|
||||||
|
enum EpdSteps
|
||||||
|
{
|
||||||
|
StepInitialized = 0,
|
||||||
|
StepDiscovering = 1,
|
||||||
|
StepDiscoverFailed = 2,
|
||||||
|
StepDiscovered,
|
||||||
|
StepConnecting = 3,
|
||||||
|
StepConnected,
|
||||||
|
StepConnectFailed,
|
||||||
|
StepGotStatus,
|
||||||
|
StepFailedStatus
|
||||||
|
};
|
||||||
DiscoverErrorCodes DiscoverError;
|
DiscoverErrorCodes DiscoverError;
|
||||||
|
EpdSteps EPDStep;
|
||||||
|
|
||||||
//OperatingStatus
|
//OperatingStatus
|
||||||
BYTE DetectorsOn = 0;
|
BYTE DetectorsOn = 0;
|
||||||
|
|
@ -359,6 +373,9 @@ namespace Epd3Base {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
char DiagnosticsWrite[DiagnosticsWriteSize];
|
char DiagnosticsWrite[DiagnosticsWriteSize];
|
||||||
|
typedef void (*ProgressCallback)(int percentage, const char* message);
|
||||||
|
ProgressCallback progressCallback;
|
||||||
|
void test();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "EpdBaseClr.h"
|
#include "EpdBaseClr.h"
|
||||||
#pragma managed
|
#pragma managed
|
||||||
|
#include "../EpdBase3/Epd3Base.h" // or "Epd3Base.h" if on include path
|
||||||
|
|
||||||
|
typedef void (*ProgressCallback)(int percentage, const char* message);
|
||||||
|
|
||||||
void EpdBaseClr::Epd2::OnCancelRequested()
|
void EpdBaseClr::Epd2::OnCancelRequested()
|
||||||
{
|
{
|
||||||
|
|
@ -31,6 +33,12 @@ int EpdBaseClr::Epd2::GetSteps()
|
||||||
return nsteps;
|
return nsteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EpdBaseClr::Epd2::OnProgress(int percentage, String^ message)
|
||||||
|
{
|
||||||
|
// Handle the progress info here (e.g., print or log it)
|
||||||
|
System::Console::WriteLine(percentage.ToString() + "%: " + message);
|
||||||
|
}
|
||||||
|
|
||||||
EpdBaseClr::Epd2::Epd2(int port, bool OnlyMK2)
|
EpdBaseClr::Epd2::Epd2(int port, bool OnlyMK2)
|
||||||
{
|
{
|
||||||
//HANDLE hMod = LoadLibrary(L"Reader2.dll");
|
//HANDLE hMod = LoadLibrary(L"Reader2.dll");
|
||||||
|
|
@ -48,7 +56,18 @@ EpdBaseClr::Epd2::Epd2(int port, bool OnlyMK2)
|
||||||
Hp10Name = gcnew String(tHp10);
|
Hp10Name = gcnew String(tHp10);
|
||||||
Hp07Name = gcnew String(tHp07);
|
Hp07Name = gcnew String(tHp07);
|
||||||
isTitleNG = false;
|
isTitleNG = false;
|
||||||
|
|
||||||
|
progressDelegate = gcnew ProgressCallbackDelegate(&Epd2::OnProgress);
|
||||||
|
IntPtr ip = System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(progressDelegate);
|
||||||
|
/* epd3->postgre
|
||||||
|
epd3->ProgressCallback = static_cast<ProgressCallback>(ip.ToPointer());
|
||||||
|
epd3.prog*/
|
||||||
|
if (epd3 != nullptr) {
|
||||||
|
epd3->progressCallback = static_cast<Epd3Base::Epd3U::ProgressCallback>(ip.ToPointer());
|
||||||
|
epd3->test();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EpdBaseClr::Epd2::~Epd2()
|
EpdBaseClr::Epd2::~Epd2()
|
||||||
{
|
{
|
||||||
if (epd != nullptr) {
|
if (epd != nullptr) {
|
||||||
|
|
@ -63,9 +82,11 @@ EpdBaseClr::Epd2::~Epd2()
|
||||||
}
|
}
|
||||||
this->!Epd2();
|
this->!Epd2();
|
||||||
}
|
}
|
||||||
|
|
||||||
EpdBaseClr::Epd2::!Epd2()
|
EpdBaseClr::Epd2::!Epd2()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int EpdBaseClr::Epd2::SetFeedbackSound(byte sound, UINT16 sound3)
|
int EpdBaseClr::Epd2::SetFeedbackSound(byte sound, UINT16 sound3)
|
||||||
{
|
{
|
||||||
epd->EndSessionControl = sound;
|
epd->EndSessionControl = sound;
|
||||||
|
|
@ -878,6 +899,12 @@ void EpdBaseClr::Epd2::InitData()
|
||||||
SoftVersion = 0;
|
SoftVersion = 0;
|
||||||
FunctionFlags = 0;
|
FunctionFlags = 0;
|
||||||
CountsClock = 0;
|
CountsClock = 0;
|
||||||
|
|
||||||
|
ErrorStep = ErrorRV = 0;
|
||||||
|
ConnectError = 0; eDoshasAlarm = eDosHasFault = false;
|
||||||
|
ErrorEPD = EpdErrorCodes::EpdErrorNone;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//void EpdBaseClr::Epd2::OnCancelRequested()
|
//void EpdBaseClr::Epd2::OnCancelRequested()
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,18 @@
|
||||||
#pragma comment(lib,"dll2/Reader32.lib")
|
#pragma comment(lib,"dll2/Reader32.lib")
|
||||||
#pragma managed
|
#pragma managed
|
||||||
using namespace System;
|
using namespace System;
|
||||||
|
using namespace System::Runtime::InteropServices;
|
||||||
namespace EpdBaseClr {
|
namespace EpdBaseClr {
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
|
||||||
|
delegate void ProgressCallbackDelegate(int percentage, String^ message);
|
||||||
|
|
||||||
const char* cEpdError = "Setreader Error";
|
const char* cEpdError = "Setreader Error";
|
||||||
ref class Epd2;
|
ref class Epd2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ref class cStepValues
|
public ref class cStepValues
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -44,6 +50,7 @@ namespace EpdBaseClr {
|
||||||
EpdErrorOther = 4,
|
EpdErrorOther = 4,
|
||||||
EpdErrorConnecting = 5
|
EpdErrorConnecting = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
public ref class EpdEventArgs : EventArgs
|
public ref class EpdEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
|
|
@ -132,6 +139,8 @@ namespace EpdBaseClr {
|
||||||
const wchar_t* tHp10G = L"HP10G";
|
const wchar_t* tHp10G = L"HP10G";
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static void OnProgress(int, String^);
|
||||||
|
ProgressCallbackDelegate^ progressDelegate;
|
||||||
delegate void dEpdRead(Epd2^ Sender, EpdEventArgs^ e);
|
delegate void dEpdRead(Epd2^ Sender, EpdEventArgs^ e);
|
||||||
delegate void dEpdTO(Epd2^ Sender, EpdTOEventArgs^ e);
|
delegate void dEpdTO(Epd2^ Sender, EpdTOEventArgs^ e);
|
||||||
delegate void dEpdError(Epd2^ Sender, EpdErrorEventArgs^ e);
|
delegate void dEpdError(Epd2^ Sender, EpdErrorEventArgs^ e);
|
||||||
|
|
@ -218,6 +227,7 @@ namespace EpdBaseClr {
|
||||||
int ErrorStep=0;
|
int ErrorStep=0;
|
||||||
int ErrorRV = 0;
|
int ErrorRV = 0;
|
||||||
EpdErrorCodes ErrorEPD;
|
EpdErrorCodes ErrorEPD;
|
||||||
|
|
||||||
|
|
||||||
double Hp07;
|
double Hp07;
|
||||||
double Hp10;
|
double Hp10;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
<CLRSupport>true</CLRSupport>
|
<CLRSupport>true</CLRSupport>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -107,11 +107,13 @@ int startCom()
|
||||||
FALSE, // initial state is nonsignaled
|
FALSE, // initial state is nonsignaled
|
||||||
TEXT("WriteEvent") // object name
|
TEXT("WriteEvent") // object name
|
||||||
);
|
);
|
||||||
uint32_t ms, slots; bool state = true;
|
uint32_t ms1, ms, slots; bool state = true;
|
||||||
|
GetResponseTimeout(epdComsHandle, &ms1);
|
||||||
r = GetMultipleDiscoveryMode(epdComsHandle, &state);
|
r = GetMultipleDiscoveryMode(epdComsHandle, &state);
|
||||||
r = GetDiscoveryTimeslots(epdComsHandle, &slots);
|
r = GetDiscoveryTimeslots(epdComsHandle, &slots);
|
||||||
r = GetDiscoveryTimeout(epdComsHandle, &ms);
|
r = GetDiscoveryTimeout(epdComsHandle, &ms);
|
||||||
//SetDiscoveryTimeout(epdComsHandle, 2000);
|
SetDiscoveryCacheTimeout(epdComsHandle, 2000);
|
||||||
|
SetResponseTimeout(epdComsHandle, 500);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,17 +144,19 @@ void detectepd()
|
||||||
auto t1 = high_resolution_clock::now();
|
auto t1 = high_resolution_clock::now();
|
||||||
//memset(DevceIDs, 0, sizeof(DeviceIDs));
|
//memset(DevceIDs, 0, sizeof(DeviceIDs));
|
||||||
r = StartDiscovery(epdComsHandle, discovery2);
|
r = StartDiscovery(epdComsHandle, discovery2);
|
||||||
auto t2 = high_resolution_clock::now();
|
|
||||||
auto elapsed = duration_cast<milliseconds>(t2 - t1);
|
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
r = WaitForSingleObject(Ev1, 20000);
|
r = WaitForSingleObject(Ev1, 10000);
|
||||||
r2 = StopDiscovery(epdComsHandle);
|
|
||||||
std::cout << "EPD " << EpdID << "\n";
|
std::cout << "EPD " << EpdID << "\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cout << "StartDiscovery failed " << r << "\n";
|
std::cout << "StartDiscovery failed " << r << "\n";
|
||||||
}
|
}
|
||||||
|
r2 = StopDiscovery(epdComsHandle);
|
||||||
|
auto t2 = high_resolution_clock::now();
|
||||||
|
auto elapsed = duration_cast<milliseconds>(t2 - t1);
|
||||||
|
std::cout << "Elapsed time: " << elapsed.count() << " ms\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,13 @@
|
||||||
<ModelCollation>1033, CI</ModelCollation>
|
<ModelCollation>1033, CI</ModelCollation>
|
||||||
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
<DefaultFileStructure>BySchemaAndSchemaType</DefaultFileStructure>
|
||||||
<DeployToDatabase>True</DeployToDatabase>
|
<DeployToDatabase>True</DeployToDatabase>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
<TargetLanguage>CS</TargetLanguage>
|
<TargetLanguage>CS</TargetLanguage>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<SqlServerVerification>False</SqlServerVerification>
|
<SqlServerVerification>False</SqlServerVerification>
|
||||||
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
<IncludeCompositeObjects>True</IncludeCompositeObjects>
|
||||||
<TargetDatabaseSet>True</TargetDatabaseSet>
|
<TargetDatabaseSet>True</TargetDatabaseSet>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
<PlatformToolset>v145</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Wed 01/07/2026 14:54:13.44
|
Thu 07/30/2026 17:58:59.17
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue