test eDosStation
fixes find com port, return values. Add postback progress
This commit is contained in:
parent
4ceed2d191
commit
a41cb2721a
12 changed files with 154 additions and 56 deletions
|
|
@ -29,7 +29,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">
|
||||||
|
|
|
||||||
|
|
@ -227,15 +227,16 @@ int Epd3Base::Epd3U::DisconnectAndConnect()
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Epd3Base::Epd3U::Cancel()
|
void Epd3Base::Epd3U::CancelAll()
|
||||||
{
|
{
|
||||||
SetEvent(current->hCancel);
|
SetEvent(current->hCancel);
|
||||||
|
//Cancel(epdComsHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Epd3Base::Epd3U::test()
|
void Epd3Base::Epd3U::test()
|
||||||
{
|
{
|
||||||
const char* msg = "Processing step test...";
|
const char* msg = "Processing step test...";
|
||||||
progressCallback(0, msg); // Triggers the callback
|
progressCallback(StepTest); // Triggers the callback
|
||||||
}
|
}
|
||||||
DWORD Epd3Base::Epd3U::StartCom()
|
DWORD Epd3Base::Epd3U::StartCom()
|
||||||
{
|
{
|
||||||
|
|
@ -244,7 +245,7 @@ DWORD Epd3Base::Epd3U::StartCom()
|
||||||
OpenRetries = 0;
|
OpenRetries = 0;
|
||||||
int step = 1;
|
int step = 1;
|
||||||
int mx = 10;
|
int mx = 10;
|
||||||
|
EPDStep = StepStartCom;
|
||||||
epdComsHandle = nullptr;
|
epdComsHandle = nullptr;
|
||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
CommsInitialized = 1;
|
CommsInitialized = 1;
|
||||||
|
|
@ -262,14 +263,14 @@ DWORD Epd3Base::Epd3U::StartCom()
|
||||||
}
|
}
|
||||||
SetCommitReturnValue(0);
|
SetCommitReturnValue(0);
|
||||||
if (epdComsHandle) {
|
if (epdComsHandle) {
|
||||||
|
|
||||||
SetEndReturnValue(0);
|
SetEndReturnValue(0);
|
||||||
progressCallback(1, "CreateInterface"); // Triggers the callback
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
EPDStep = StepStartComFailed;
|
||||||
SetEndReturnValue(-1);
|
SetEndReturnValue(-1);
|
||||||
progressCallback(1, "Fail Interface"); // Triggers the callback
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (epdComsHandle != nullptr) {
|
if (epdComsHandle != nullptr) {
|
||||||
|
|
@ -290,14 +291,16 @@ DWORD Epd3Base::Epd3U::StartCom()
|
||||||
CommsInitialized = 1;
|
CommsInitialized = 1;
|
||||||
Dll3RV = SetMultipleDiscoveryMode(epdComsHandle, false);
|
Dll3RV = SetMultipleDiscoveryMode(epdComsHandle, false);
|
||||||
Dll3RV = SetResponseTimeout(epdComsHandle, ResponseTimeout);
|
Dll3RV = SetResponseTimeout(epdComsHandle, ResponseTimeout);
|
||||||
|
EPDStep = StepStartComOK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Dll3RV = r_FunctionFail;
|
Dll3RV = r_FunctionFail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
progressCallback(EPDStep); // Triggers the callback
|
||||||
if (Dll3RV) goto error;
|
if (Dll3RV) goto error;
|
||||||
return Dll3RV;
|
return 0;
|
||||||
error:
|
error:
|
||||||
ErrorStep = step;
|
ErrorStep = step;
|
||||||
Error = Dll3RV;
|
Error = Dll3RV;
|
||||||
|
|
@ -575,8 +578,8 @@ void Epd3Base::Epd3U::DecodeStatus()
|
||||||
OtherAlarmCarrier = checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::TelemetryAlert);
|
OtherAlarmCarrier = checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::TelemetryAlert);
|
||||||
OtherAlarmBatVolt = checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::LowBattery);
|
OtherAlarmBatVolt = checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::LowBattery);
|
||||||
|
|
||||||
eDosDoseAlarm = (eDosDose10Alarm || eDosDose07Alarm) && checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::DoseAlarm);
|
eDosDoseAlarm = (eDosDose10Alarm || eDosDose07Alarm) & checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::DoseAlarm);
|
||||||
eDosRateAlarm = (eDosRate07Alarm || eDosRate10Alarm) && checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::RateAlarm);
|
eDosRateAlarm = (eDosRate07Alarm || eDosRate10Alarm) & checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::RateAlarm);
|
||||||
|
|
||||||
hasAlarm = eDosDoseAlarm || eDosRateAlarm;
|
hasAlarm = eDosDoseAlarm || eDosRateAlarm;
|
||||||
hasFault = ((uint32_t)epd3status.FaultStatus & ~(uint32_t)FaultStatusFlags::ErrorLogged) != 0;
|
hasFault = ((uint32_t)epd3status.FaultStatus & ~(uint32_t)FaultStatusFlags::ErrorLogged) != 0;
|
||||||
|
|
@ -637,10 +640,11 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
|
||||||
//int r[maxbatch];
|
//int r[maxbatch];
|
||||||
int step = 0;
|
int step = 0;
|
||||||
uint8_t length = 0;
|
uint8_t length = 0;
|
||||||
|
EPDStep = StepReadStatus;
|
||||||
countsRead = 0; utc = 0; seconds = 0;
|
countsRead = 0; utc = 0; seconds = 0;
|
||||||
memset(WearerID, 0, WearerIDLength + 1);
|
memset(WearerID, 0, WearerIDLength + 1);
|
||||||
memset(WearerName, 0, WearerNameLength + 1);
|
memset(WearerName, 0, WearerNameLength + 1);
|
||||||
rv = SetResponseTimeout(epdComsHandle, ResponseTimeout);
|
//rv = SetResponseTimeout(epdComsHandle, ResponseTimeout);
|
||||||
Error = 0;
|
Error = 0;
|
||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
EpdID = 4567;
|
EpdID = 4567;
|
||||||
|
|
@ -675,16 +679,17 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
|
||||||
step = 2;
|
step = 2;
|
||||||
SetFunctionReturnValue(eFunctions::ReadStatus,0);
|
SetFunctionReturnValue(eFunctions::ReadStatus,0);
|
||||||
token = BeginReadStatus(epdComsHandle, nullptr);
|
token = BeginReadStatus(epdComsHandle, nullptr);
|
||||||
rv2 = CommitAndSetRV();
|
rv = CommitAndSetRV();
|
||||||
|
|
||||||
//batchstep = 0; //ReadStatus
|
|
||||||
//r = Commit3(epdComsHandle); SetCommitReturnValue(r);
|
|
||||||
if (!rv)
|
if (!rv)
|
||||||
rv = EndReadStatus(epdComsHandle, token, &epd3status);
|
rv = EndReadStatus(epdComsHandle, token, &epd3status);
|
||||||
rv2 = SetEndReturnValue(rv);
|
rv2 = SetEndReturnValue(rv);
|
||||||
current->StatusDecoded = false;
|
current->StatusDecoded = false;
|
||||||
if (rv != 0)
|
if (rv != 0) {
|
||||||
goto error;
|
EPDStep = StepFailedStatus ;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
progressCallback(EPDStep);
|
||||||
|
|
||||||
IssueCount = epd3status.IssueCount;
|
IssueCount = epd3status.IssueCount;
|
||||||
OperatingStatus = epd3status.OperatingStatus;
|
OperatingStatus = epd3status.OperatingStatus;
|
||||||
|
|
@ -701,8 +706,7 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
|
||||||
VersionNumber_t VersionNumber;
|
VersionNumber_t VersionNumber;
|
||||||
|
|
||||||
step = 3;
|
step = 3;
|
||||||
//batchstep = 1; //ReadEpdIdentities
|
EPDStep = StepReadIdentities;
|
||||||
|
|
||||||
|
|
||||||
EpdID32 = 0;
|
EpdID32 = 0;
|
||||||
MarkNumber.Major = 0;
|
MarkNumber.Major = 0;
|
||||||
|
|
@ -714,8 +718,11 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
|
||||||
rv = CommitAndSetRV();
|
rv = CommitAndSetRV();
|
||||||
if (!rv) rv = EndReadEpdIdentities(epdComsHandle, token, &EpdID32, (EpdTypes*)&EpdType, &capabilities, &MarkNumber, &VersionNumber, NULL, 0);
|
if (!rv) rv = EndReadEpdIdentities(epdComsHandle, token, &EpdID32, (EpdTypes*)&EpdType, &capabilities, &MarkNumber, &VersionNumber, NULL, 0);
|
||||||
rv = SetEndReturnValue(rv);
|
rv = SetEndReturnValue(rv);
|
||||||
if (rv != 0) goto error;
|
if (rv != 0) {
|
||||||
|
EPDStep = StepReadIdentitiesFailed;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
progressCallback(EPDStep);
|
||||||
|
|
||||||
EpdID = EpdID32;
|
EpdID = EpdID32;
|
||||||
isBG = (EpdType == EpdTypes::Mk2BetaGamma) || (EpdType == EpdTypes::Mk3BetaGamma);
|
isBG = (EpdType == EpdTypes::Mk2BetaGamma) || (EpdType == EpdTypes::Mk3BetaGamma);
|
||||||
|
|
@ -727,14 +734,17 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
|
||||||
|
|
||||||
|
|
||||||
step = 4;
|
step = 4;
|
||||||
|
EPDStep = StepReadCounts;
|
||||||
SetFunctionReturnValue(ReadCounts,0);
|
SetFunctionReturnValue(ReadCounts,0);
|
||||||
token = BeginReadCounts(epdComsHandle, nullptr, 0, nullptr);
|
token = BeginReadCounts(epdComsHandle, nullptr, 0, nullptr);
|
||||||
rv = CommitAndSetRV();
|
rv = CommitAndSetRV();
|
||||||
if (!rv) rv = EndReadCounts(epdComsHandle, token, Counts, MaxCounts, &countsRead, &utc, &seconds);
|
if (!rv) rv = EndReadCounts(epdComsHandle, token, Counts, MaxCounts, &countsRead, &utc, &seconds);
|
||||||
rv2= SetEndReturnValue(rv);
|
rv2= SetEndReturnValue(rv);
|
||||||
if (rv)
|
if (rv) {
|
||||||
goto error;
|
EPDStep = StepReadCountsFailed;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
decodeCounters(countsRead); //HG,SG ..
|
decodeCounters(countsRead); //HG,SG ..
|
||||||
|
|
||||||
//Times
|
//Times
|
||||||
|
|
@ -743,14 +753,18 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
|
||||||
step = 6;
|
step = 6;
|
||||||
//batchstep = 3;
|
//batchstep = 3;
|
||||||
if (utc == 0) {
|
if (utc == 0) {
|
||||||
|
EPDStep = StepReadRTC;
|
||||||
SetFunctionReturnValue(ReadRTC,0);
|
SetFunctionReturnValue(ReadRTC,0);
|
||||||
token = BeginReadRTC(epdComsHandle, nullptr);
|
token = BeginReadRTC(epdComsHandle, nullptr);
|
||||||
rv = CommitAndSetRV();
|
rv = CommitAndSetRV();
|
||||||
if (!rv)
|
if (!rv)
|
||||||
rv = EndReadRTC(epdComsHandle, token, &utc); //EpdClock for MK2
|
rv = EndReadRTC(epdComsHandle, token, &utc); //EpdClock for MK2
|
||||||
rv2= SetEndReturnValue(rv);
|
rv2= SetEndReturnValue(rv);
|
||||||
if (rv)
|
if (rv) {
|
||||||
|
EPDStep = StepReadRTCFailed;
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
EpdClock = utc;
|
EpdClock = utc;
|
||||||
utc = TimeFunctions::NowToEpd3Time();
|
utc = TimeFunctions::NowToEpd3Time();
|
||||||
}
|
}
|
||||||
|
|
@ -768,6 +782,7 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
|
||||||
mk3WearerID.Length = 0;
|
mk3WearerID.Length = 0;
|
||||||
//Mk2 EPDs only support Name and Primary ID
|
//Mk2 EPDs only support Name and Primary ID
|
||||||
|
|
||||||
|
EPDStep = StepReadWearerId;
|
||||||
//batchstep = 0;
|
//batchstep = 0;
|
||||||
SetFunctionReturnValue(ReadWearerId, 0);
|
SetFunctionReturnValue(ReadWearerId, 0);
|
||||||
token= BeginReadWearerId(epdComsHandle, static_cast<uint16_t>(WearerIdType::WearerId_Name), nullptr);
|
token= BeginReadWearerId(epdComsHandle, static_cast<uint16_t>(WearerIdType::WearerId_Name), nullptr);
|
||||||
|
|
@ -775,7 +790,10 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
|
||||||
|
|
||||||
if (!rv) rv = EndReadWearerId(epdComsHandle, token, &mk3WearerID);
|
if (!rv) rv = EndReadWearerId(epdComsHandle, token, &mk3WearerID);
|
||||||
rv = SetEndReturnValue(rv);
|
rv = SetEndReturnValue(rv);
|
||||||
if (rv != 0) goto error;
|
if (rv != 0) {
|
||||||
|
EPDStep = StepReadWearerIdFailed;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if (mk3WearerID.Length > WearerNameLength) mk3WearerID.Length = WearerNameLength;
|
if (mk3WearerID.Length > WearerNameLength) mk3WearerID.Length = WearerNameLength;
|
||||||
memcpy(WearerName, mk3WearerID.Utf8String, mk3WearerID.Length); WearerName[mk3WearerID.Length] = 0;
|
memcpy(WearerName, mk3WearerID.Utf8String, mk3WearerID.Length); WearerName[mk3WearerID.Length] = 0;
|
||||||
|
|
@ -787,7 +805,10 @@ int Epd3Base::Epd3U::ReadStatus(bool onlyStatus)
|
||||||
rv = CommitAndSetRV();
|
rv = CommitAndSetRV();
|
||||||
if (!rv) rv = EndReadWearerId(epdComsHandle, token, &mk3WearerID);
|
if (!rv) rv = EndReadWearerId(epdComsHandle, token, &mk3WearerID);
|
||||||
rv = SetEndReturnValue(rv);
|
rv = SetEndReturnValue(rv);
|
||||||
if (rv != 0) goto error;
|
if (rv != 0) {
|
||||||
|
EPDStep = StepReadWearerIdFailed;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (mk3WearerID.Length > WearerIDLength) mk3WearerID.Length = WearerIDLength;
|
if (mk3WearerID.Length > WearerIDLength) mk3WearerID.Length = WearerIDLength;
|
||||||
|
|
@ -850,6 +871,7 @@ int Epd3Base::Epd3U::ConnectAndStatus(int tokenSourceTimeout)
|
||||||
else rv = 0; //MK2
|
else rv = 0; //MK2
|
||||||
}
|
}
|
||||||
else rv = 1;
|
else rv = 1;
|
||||||
|
progressCallback(EPDStep);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,32 @@ namespace Epd3Base {
|
||||||
};
|
};
|
||||||
typedef void(*ProgressCallback)(int percentage, const char* message);
|
typedef void(*ProgressCallback)(int percentage, const char* message);
|
||||||
|
|
||||||
|
enum EpdSteps
|
||||||
|
{
|
||||||
|
StepTest,
|
||||||
|
StepStartCom,
|
||||||
|
StepStartComFailed,
|
||||||
|
StepStartComOK,
|
||||||
|
StepInitialized,
|
||||||
|
StepDiscovering,
|
||||||
|
StepDiscoverFailed,
|
||||||
|
StepDiscovered,
|
||||||
|
StepConnecting,
|
||||||
|
StepConnected,
|
||||||
|
StepConnectFailed,
|
||||||
|
StepReadStatus,
|
||||||
|
StepGotStatus,
|
||||||
|
StepFailedStatus,
|
||||||
|
StepReadIdentities,
|
||||||
|
StepReadIdentitiesFailed,
|
||||||
|
StepReadCounts,
|
||||||
|
StepReadCountsFailed,
|
||||||
|
StepReadRTC,
|
||||||
|
StepReadRTCFailed,
|
||||||
|
StepReadWearerId,
|
||||||
|
StepReadWearerIdFailed
|
||||||
|
};
|
||||||
|
|
||||||
class Epd3U
|
class Epd3U
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -87,7 +113,7 @@ namespace Epd3Base {
|
||||||
Epd3U(int _comport);
|
Epd3U(int _comport);
|
||||||
~Epd3U();
|
~Epd3U();
|
||||||
DWORD StartCom();
|
DWORD StartCom();
|
||||||
void Cancel();
|
void CancelAll();
|
||||||
void EndCom(bool doDiscon);
|
void EndCom(bool doDiscon);
|
||||||
int StartDiscover(int tokentimeout);
|
int StartDiscover(int tokentimeout);
|
||||||
|
|
||||||
|
|
@ -100,18 +126,7 @@ 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;
|
EpdSteps EPDStep;
|
||||||
|
|
||||||
|
|
@ -373,7 +388,7 @@ namespace Epd3Base {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
char DiagnosticsWrite[DiagnosticsWriteSize];
|
char DiagnosticsWrite[DiagnosticsWriteSize];
|
||||||
typedef void (*ProgressCallback)(int percentage, const char* message);
|
typedef void (*ProgressCallback)(EpdSteps percentage);
|
||||||
ProgressCallback progressCallback;
|
ProgressCallback progressCallback;
|
||||||
void test();
|
void test();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ typedef void (*ProgressCallback)(int percentage, const char* message);
|
||||||
|
|
||||||
void EpdBaseClr::Epd2::OnCancelRequested()
|
void EpdBaseClr::Epd2::OnCancelRequested()
|
||||||
{
|
{
|
||||||
if (epd3 != nullptr) epd3->Cancel();
|
if (epd3 != nullptr) epd3->CancelAll();
|
||||||
//if (epd != nullptr) epd->Cancel();
|
//if (epd != nullptr) epd->Cancel();
|
||||||
}
|
}
|
||||||
bool EpdBaseClr::Epd2::HasStepError()
|
bool EpdBaseClr::Epd2::HasStepError()
|
||||||
|
|
@ -33,10 +33,11 @@ int EpdBaseClr::Epd2::GetSteps()
|
||||||
return nsteps;
|
return nsteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EpdBaseClr::Epd2::OnProgress(int percentage, String^ message)
|
void EpdBaseClr::Epd2::OnProgress(Epd3Base::EpdSteps step)
|
||||||
{
|
{
|
||||||
// Handle the progress info here (e.g., print or log it)
|
// Handle the progress info here (e.g., print or log it)
|
||||||
System::Console::WriteLine(percentage.ToString() + "%: " + message);
|
System::Console::WriteLine("Step: " + ((int)step).ToString() );
|
||||||
|
if (_EpdProgress) _EpdProgress(this,step);
|
||||||
}
|
}
|
||||||
|
|
||||||
EpdBaseClr::Epd2::Epd2(int port, bool OnlyMK2)
|
EpdBaseClr::Epd2::Epd2(int port, bool OnlyMK2)
|
||||||
|
|
@ -57,7 +58,7 @@ EpdBaseClr::Epd2::Epd2(int port, bool OnlyMK2)
|
||||||
Hp07Name = gcnew String(tHp07);
|
Hp07Name = gcnew String(tHp07);
|
||||||
isTitleNG = false;
|
isTitleNG = false;
|
||||||
|
|
||||||
progressDelegate = gcnew ProgressCallbackDelegate(&Epd2::OnProgress);
|
progressDelegate = gcnew ProgressCallbackDelegate(this,&Epd2::OnProgress);
|
||||||
IntPtr ip = System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(progressDelegate);
|
IntPtr ip = System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(progressDelegate);
|
||||||
/* epd3->postgre
|
/* epd3->postgre
|
||||||
epd3->ProgressCallback = static_cast<ProgressCallback>(ip.ToPointer());
|
epd3->ProgressCallback = static_cast<ProgressCallback>(ip.ToPointer());
|
||||||
|
|
@ -1060,7 +1061,7 @@ void EpdBaseClr::Epd2::WaitEnd()
|
||||||
int tries = 5;
|
int tries = 5;
|
||||||
while (tries-->0 && waitTask->Status == System::Threading::Tasks::TaskStatus::Running) {
|
while (tries-->0 && waitTask->Status == System::Threading::Tasks::TaskStatus::Running) {
|
||||||
//tokenSource->Cancel();
|
//tokenSource->Cancel();
|
||||||
if (epd3) epd3->Cancel();
|
if (epd3) epd3->CancelAll();
|
||||||
waitTask->Wait(1000);
|
waitTask->Wait(1000);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|
@ -1075,3 +1076,4 @@ void EpdBaseClr::Epd2::WaitEnd()
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,17 @@
|
||||||
#pragma comment(lib,"dll2/Reader2.lib")
|
#pragma comment(lib,"dll2/Reader2.lib")
|
||||||
#undef EPDDLL_API
|
#undef EPDDLL_API
|
||||||
#pragma unmanaged
|
#pragma unmanaged
|
||||||
#include "..\EpdBase3\Epd3Base.h"
|
|
||||||
|
#include "../EpdBase3/Epd3Base.h"
|
||||||
#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;
|
using namespace System::Runtime::InteropServices;
|
||||||
namespace EpdBaseClr {
|
namespace EpdBaseClr {
|
||||||
|
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention::Cdecl)]
|
||||||
delegate void ProgressCallbackDelegate(int percentage, String^ message);
|
public delegate void ProgressCallbackDelegate(Epd3Base::EpdSteps step);
|
||||||
|
|
||||||
const char* cEpdError = "Setreader Error";
|
const char* cEpdError = "Setreader Error";
|
||||||
ref class Epd2;
|
ref class Epd2;
|
||||||
|
|
@ -139,15 +141,17 @@ namespace EpdBaseClr {
|
||||||
const wchar_t* tHp10G = L"HP10G";
|
const wchar_t* tHp10G = L"HP10G";
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void OnProgress(int, String^);
|
void OnProgress(Epd3Base::EpdSteps step);
|
||||||
ProgressCallbackDelegate^ progressDelegate;
|
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);
|
||||||
|
delegate void dEpdProgress(Epd2^ Sender, int step);
|
||||||
|
|
||||||
dEpdRead^ _EpdRead;
|
dEpdRead^ _EpdRead;
|
||||||
dEpdTO^ _EpdTO;
|
dEpdTO^ _EpdTO;
|
||||||
dEpdError^ _EpdError;
|
dEpdError^ _EpdError;
|
||||||
|
dEpdProgress ^ _EpdProgress;
|
||||||
|
|
||||||
|
|
||||||
event dEpdRead^ EpdRead
|
event dEpdRead^ EpdRead
|
||||||
|
|
@ -186,6 +190,18 @@ namespace EpdBaseClr {
|
||||||
_EpdTO -= handler;
|
_EpdTO -= handler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
event dEpdProgress^ EpdProgress
|
||||||
|
{
|
||||||
|
void add(dEpdProgress^ handler)
|
||||||
|
{
|
||||||
|
_EpdProgress += handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
void remove(dEpdProgress^ handler)
|
||||||
|
{
|
||||||
|
_EpdProgress -= handler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
//bool hasAlarm = false;
|
//bool hasAlarm = false;
|
||||||
|
|
@ -401,3 +417,37 @@ namespace EpdBaseClr {
|
||||||
//int PrepareForIssue();
|
//int PrepareForIssue();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ref class EpdHelpers
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static System::String^ EpdStepToString(Epd3Base::EpdSteps step)
|
||||||
|
{
|
||||||
|
switch (step)
|
||||||
|
{
|
||||||
|
case Epd3Base::StepTest: return L"Test";
|
||||||
|
case Epd3Base::StepStartCom: return L"StartCom";
|
||||||
|
case Epd3Base::StepStartComFailed: return L"StartCom Failed";
|
||||||
|
case Epd3Base::StepStartComOK: return L"StartCom OK";
|
||||||
|
case Epd3Base::StepInitialized: return L"Initialized";
|
||||||
|
case Epd3Base::StepDiscovering: return L"Discovering";
|
||||||
|
case Epd3Base::StepDiscoverFailed: return L"Discover Failed";
|
||||||
|
case Epd3Base::StepDiscovered: return L"Discovered";
|
||||||
|
case Epd3Base::StepConnecting: return L"Connecting";
|
||||||
|
case Epd3Base::StepConnected: return L"Connected";
|
||||||
|
case Epd3Base::StepConnectFailed: return L"Connect Failed";
|
||||||
|
case Epd3Base::StepReadStatus: return L"ReadStatus";
|
||||||
|
case Epd3Base::StepGotStatus: return L"Got Status";
|
||||||
|
case Epd3Base::StepFailedStatus: return L"Failed Status";
|
||||||
|
case Epd3Base::StepReadIdentities: return L"Read Identities";
|
||||||
|
case Epd3Base::StepReadIdentitiesFailed: return L"Read Identities Failed";
|
||||||
|
case Epd3Base::StepReadCounts: return L"Read Counts";
|
||||||
|
case Epd3Base::StepReadCountsFailed: return L"Read Counts Failed";
|
||||||
|
case Epd3Base::StepReadRTC: return L"Read RTC";
|
||||||
|
case Epd3Base::StepReadRTCFailed: return L"Read RTC Failed";
|
||||||
|
case Epd3Base::StepReadWearerId: return L"Read WearerId";
|
||||||
|
case Epd3Base::StepReadWearerIdFailed: return L"Read WearerId Failed";
|
||||||
|
default: return L"Unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -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">
|
||||||
|
|
|
||||||
|
|
@ -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">
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,15 @@ namespace TestEpdBaseClr
|
||||||
epdDevice = new EpdBaseClr.Epd2(3, false);
|
epdDevice = new EpdBaseClr.Epd2(3, false);
|
||||||
//epdDevice.SetFeedbackSound(thisStation.useBeep, thisStation.useBeepMK3());
|
//epdDevice.SetFeedbackSound(thisStation.useBeep, thisStation.useBeepMK3());
|
||||||
epdDevice.EpdRead += EpdDevice_EpdRead; epdDevice.EpdError += EpdDevice_EpdError; epdDevice.EpdTO += EpdDevice_EpdTO;
|
epdDevice.EpdRead += EpdDevice_EpdRead; epdDevice.EpdError += EpdDevice_EpdError; epdDevice.EpdTO += EpdDevice_EpdTO;
|
||||||
|
epdDevice.EpdProgress += EpdDevice_EpdProgress;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void EpdDevice_EpdProgress(EpdBaseClr.Epd2 Sender, int e)
|
||||||
|
{
|
||||||
|
//throw new NotImplementedException();
|
||||||
|
System.Diagnostics.Debug.WriteLine("Epd progress: " + e.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void EpdDevice_EpdTO(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdTOEventArgs e)
|
private static void EpdDevice_EpdTO(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdTOEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -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 @@
|
||||||
Thu 07/30/2026 17:58:59.17
|
Sat 08/01/2026 17:11:30.39
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
<GenerateManifests>false</GenerateManifests>
|
<GenerateManifests>false</GenerateManifests>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SignManifests>true</SignManifests>
|
<SignManifests>false</SignManifests>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
<PropertyGroup />
|
<PropertyGroup />
|
||||||
|
|
@ -420,7 +420,8 @@
|
||||||
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
|
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>%25signer%25 $(TargetPath)</PostBuildEvent>
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="..\packages\LSWDesfirePublic.1.3.9\build\LSWDesfirePublic.targets" Condition="Exists('..\packages\LSWDesfirePublic.1.3.9\build\LSWDesfirePublic.targets')" />
|
<Import Project="..\packages\LSWDesfirePublic.1.3.9\build\LSWDesfirePublic.targets" Condition="Exists('..\packages\LSWDesfirePublic.1.3.9\build\LSWDesfirePublic.targets')" />
|
||||||
<Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
|
<Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.4.0.50\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
|
||||||
|
|
|
||||||
|
|
@ -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">
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue