reconnect, step in error
This commit is contained in:
parent
0e64bb9068
commit
09aaefe69c
32 changed files with 890 additions and 475 deletions
|
|
@ -213,7 +213,7 @@ WORD EpdBase::Epd2U::ReadStatus()
|
|||
IssueCount = OperatingStatus = ErrorStatus = AlarmStatus = OtherAlarms = EEPROMBadSectors = 0;
|
||||
RealTime = EpdClock = OffTime = EpdID = 0;
|
||||
ErrorSource = ErrorReason = ErrorData = 0;
|
||||
HardVersion = SoftVersion = FunctionFlags = 0;
|
||||
HardVersion = HardVersionMinor= SoftVersion = FunctionFlags = 0;
|
||||
|
||||
if (port == 0) {
|
||||
EpdID = 4567;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace EpdBase
|
|||
//Identification
|
||||
|
||||
DWORD EpdID=0;
|
||||
WORD HardVersion;
|
||||
WORD HardVersion, HardVersionMinor;
|
||||
WORD SoftVersion;
|
||||
WORD FunctionFlags;
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ Epd3Base::Epd3U::Epd3U(int _comport)
|
|||
IssueCount = OtherAlarms = EEPROMBadSectors = 0;
|
||||
RealTime = EpdClock = OffTime = EpdID = 0;
|
||||
ErrorSource = ErrorReason = ErrorData = 0;
|
||||
HardVersion = SoftVersion = FunctionFlags = 0;
|
||||
HardVersion = HardVersionMinor= SoftVersion = FunctionFlags = 0;
|
||||
|
||||
K1 = K2 = K3 = K4 = K4 = K6 = 0.0F;
|
||||
HG = SG = BC = FB = 0;
|
||||
|
|
@ -183,7 +183,7 @@ int Epd3Base::Epd3U::OpenDev(DiscoveryId DeviceID)
|
|||
{
|
||||
Dll3RV = Connect3(epdComsHandle, DeviceID, true);
|
||||
}
|
||||
else { Dll3RV = 0; }
|
||||
else { Dll3RV = r_InvalidCommsHandle; }
|
||||
return Dll3RV;
|
||||
}
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ int Epd3Base::Epd3U::ReOpenDev()
|
|||
{
|
||||
Dll3RV = Connect3(epdComsHandle, Epd, true);
|
||||
}
|
||||
else { Dll3RV = 0; }
|
||||
else { Dll3RV = r_InvalidCommsHandle; } //no handle ..
|
||||
return Dll3RV;
|
||||
}
|
||||
|
||||
|
|
@ -327,11 +327,12 @@ void Epd3Base::Epd3U::SetTime() //Only R3
|
|||
int Epd3Base::Epd3U::ReadStatus()
|
||||
{
|
||||
int r; //0=ok
|
||||
int step = 0;
|
||||
uint8_t length = 0;
|
||||
countsRead = 0; utc = 0; seconds = 0;
|
||||
memset(WearerID, 0, WearerIDLength + 1);
|
||||
memset(WearerName, 0, WearerNameLength + 1);
|
||||
|
||||
r = SetResponseTimeout(epdComsHandle, 2000);
|
||||
Error = 0;
|
||||
if (port == 0) {
|
||||
EpdID = 4567;
|
||||
|
|
@ -352,10 +353,10 @@ int Epd3Base::Epd3U::ReadStatus()
|
|||
IssueCount = OtherAlarms = EEPROMBadSectors = 0;
|
||||
RealTime = EpdClock = OffTime = EpdID = 0;
|
||||
ErrorSource = ErrorReason = ErrorData = 0;
|
||||
HardVersion = SoftVersion = FunctionFlags = 0;
|
||||
HardVersion = HardVersionMinor = SoftVersion = FunctionFlags = 0;
|
||||
|
||||
r = SetResponseTimeout(epdComsHandle, 2000);
|
||||
|
||||
ReOpenDev();
|
||||
step = 1;
|
||||
token = BeginReadStatus(epdComsHandle, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndReadStatus(epdComsHandle, token, &epd3status);
|
||||
|
|
@ -375,6 +376,7 @@ int Epd3Base::Epd3U::ReadStatus()
|
|||
MarkNumber_t MarkNumber;
|
||||
VersionNumber_t VersionNumber;
|
||||
|
||||
step = 2;
|
||||
token = BeginReadEpdIdentities(epdComsHandle, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndReadEpdIdentities(epdComsHandle, token, &EpdID32, (EpdTypes*)&EpdType, &capabilities, &MarkNumber, &VersionNumber, NULL, 0);
|
||||
|
|
@ -387,10 +389,12 @@ int Epd3Base::Epd3U::ReadStatus()
|
|||
isBG = (EpdType == EpdTypes::Mk2BetaGamma || EpdType == EpdTypes::Mk3BetaGamma);
|
||||
isNG = (EpdType == EpdTypes::Mk2Neutron || EpdType == EpdTypes::Mk3Neutron);
|
||||
HardVersion = MarkNumber.Major;
|
||||
HardVersionMinor = MarkNumber.Minor;
|
||||
SoftVersion = VersionNumber.Major;
|
||||
VersionOK = true;
|
||||
DecodeStatus(); //Alarm status...
|
||||
|
||||
step = 3;
|
||||
token = BeginReadCounts(epdComsHandle, nullptr, 0, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndReadCounts(epdComsHandle, token, Counts, MaxCounts, &countsRead, &utc, &seconds);
|
||||
|
|
@ -403,6 +407,7 @@ int Epd3Base::Epd3U::ReadStatus()
|
|||
decodeCounters(countsRead); //HG,SG ..
|
||||
|
||||
//Wearer
|
||||
step = 4;
|
||||
if (EPDIssued) {
|
||||
IdString_t mk3WearerID;
|
||||
//Mk2 EPDs only support Name and Primary ID
|
||||
|
|
@ -417,6 +422,7 @@ int Epd3Base::Epd3U::ReadStatus()
|
|||
if (mk3WearerID.Length > WearerNameLength) mk3WearerID.Length = WearerNameLength;
|
||||
memcpy(WearerName, mk3WearerID.Utf8String, mk3WearerID.Length); WearerName[mk3WearerID.Length] = 0;
|
||||
|
||||
step = 5;
|
||||
token = BeginReadWearerId(epdComsHandle, static_cast<uint16_t>(WearerIdType::WearerId_Primary), nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndReadWearerId(epdComsHandle, token, &mk3WearerID);
|
||||
|
|
@ -434,10 +440,12 @@ int Epd3Base::Epd3U::ReadStatus()
|
|||
//Times
|
||||
//1601-01-01T00:00:00Z.
|
||||
//MK2 .. some utc... but no real time clock
|
||||
step = 6;
|
||||
if (utc == 0) {
|
||||
token = BeginReadRTC(epdComsHandle, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndReadRTC(epdComsHandle, token, &utc); //EpdClock for MK2
|
||||
if (r) goto error;
|
||||
EpdClock = utc;
|
||||
utc = TimeFunctions::NowToEpdTime(true);
|
||||
}
|
||||
|
|
@ -450,7 +458,10 @@ int Epd3Base::Epd3U::ReadStatus()
|
|||
FileTimeToSystemTime(&fUTC, &tRealTime);
|
||||
|
||||
return r;
|
||||
|
||||
error:
|
||||
Error = r;
|
||||
ErrorStep = step;
|
||||
return r;
|
||||
|
||||
}
|
||||
|
|
@ -463,6 +474,7 @@ int Epd3Base::Epd3U::ConnectAndStatus(int tokenSourceTimeout)
|
|||
{
|
||||
WORD dllStatus;
|
||||
int rv = 1;
|
||||
Error = 0; ErrorStep = 0;
|
||||
if (CommsInitialized == 0) StartCom();
|
||||
if (CommsInitialized) {
|
||||
dllStatus = StartDiscover(tokenSourceTimeout);
|
||||
|
|
@ -472,6 +484,7 @@ int Epd3Base::Epd3U::ConnectAndStatus(int tokenSourceTimeout)
|
|||
else rv = 0;
|
||||
}
|
||||
else rv = 1;
|
||||
|
||||
return rv;
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -692,6 +705,7 @@ WORD Epd3Base::Epd3U::ReadCal()
|
|||
decodeSensitivities(numSensitivities);
|
||||
return r;
|
||||
error:
|
||||
Error = r;
|
||||
return r;
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -760,6 +774,7 @@ error:
|
|||
/// <returns>0 OK</returns>
|
||||
WORD Epd3Base::Epd3U::ReadDoses()
|
||||
{
|
||||
int step = 0;
|
||||
int32_t r = 1;
|
||||
eDosDose07Warning = eDosDose07Alarm = eDosDose10Warning = eDosDose10Alarm = eDosRate07Warning = eDosRate07Alarm = eDosRate10Warning = eDosRate10Alarm = eDosBatteryWarning = 0;
|
||||
|
||||
|
|
@ -777,13 +792,16 @@ WORD Epd3Base::Epd3U::ReadDoses()
|
|||
numDoses = 0; utc = 0;
|
||||
SetResponseTimeout(epdComsHandle, 2000);
|
||||
|
||||
step = 1;
|
||||
token = BeginReadDoses(epdComsHandle, nullptr, 0, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
if (!r) r = EndReadDoses(epdComsHandle, token, doses, MaxDoses, &numDoses, &utc);
|
||||
if (r != 0)
|
||||
goto error;
|
||||
|
||||
decodeDoses(numDoses);
|
||||
|
||||
step = 2;
|
||||
token = BeginReadTotalDoses(epdComsHandle, nullptr, 0, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
if (!r) r = EndReadTotalDoses(epdComsHandle, token, totdoses, MaxDoses, &numtotDoses, &utc);
|
||||
|
|
@ -791,14 +809,17 @@ WORD Epd3Base::Epd3U::ReadDoses()
|
|||
goto error;
|
||||
decodetotDoses(numtotDoses);
|
||||
|
||||
step = 3;
|
||||
token = BeginReadQualityData(epdComsHandle, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
if (!r) r = EndReadQualityData(epdComsHandle, token, &quality);
|
||||
if (r != 0)
|
||||
goto error;
|
||||
|
||||
Knocks = quality.Knocks;
|
||||
Resets = quality.PowerCycles;
|
||||
|
||||
step = 4;
|
||||
token = BeginReadPeakRates(epdComsHandle, nullptr, 0, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
if (!r) r = EndReadPeakRates(epdComsHandle, token, peakRates, MaxPeakRates, &numRates);
|
||||
|
|
@ -806,6 +827,7 @@ WORD Epd3Base::Epd3U::ReadDoses()
|
|||
goto error;
|
||||
decodePeakRates(numRates);
|
||||
|
||||
step = 5;
|
||||
r= ReadSensitivitiesAndTresholds(); //K1 .. K6, SG , BC ,FB , HG
|
||||
if (r != 0)
|
||||
goto error;
|
||||
|
|
@ -882,34 +904,43 @@ WORD Epd3Base::Epd3U::PrepareForIssue()
|
|||
int rv = 0;
|
||||
int step = 0;
|
||||
if (port == 0) return 0;
|
||||
|
||||
rv = ReOpenDev(); ++step;
|
||||
if (WriteConfig32)
|
||||
rv = WriteConfig();
|
||||
if (rv != 0)
|
||||
goto error;
|
||||
|
||||
++step;
|
||||
|
||||
step = 1;
|
||||
if (DetectorsOn) {
|
||||
|
||||
token = BeginEpdOnOff(epdComsHandle, 0, nullptr);
|
||||
rv = Commit3(epdComsHandle);
|
||||
if (!rv) rv = EndEpdOnOff(epdComsHandle, token);
|
||||
rv = ReOpenDev();
|
||||
}
|
||||
++step;
|
||||
rv = ReOpenDev();
|
||||
++step;
|
||||
rv = ClearDoses();
|
||||
|
||||
if (rv != 0)
|
||||
goto error;
|
||||
++step;
|
||||
|
||||
step = 2;
|
||||
if (WriteConfig32) {
|
||||
rv = WriteConfig();
|
||||
if (rv != 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
step = 3;
|
||||
rv = ReOpenDev();
|
||||
|
||||
step = 4;
|
||||
rv = ClearDoses();
|
||||
if (rv != 0)
|
||||
goto error;
|
||||
|
||||
step = 5;
|
||||
rv = ClearAlarms();
|
||||
if (rv != 0)
|
||||
goto error;
|
||||
|
||||
|
||||
return rv;
|
||||
|
||||
error:
|
||||
ErrorStep = step;
|
||||
Error = rv;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
@ -996,12 +1027,18 @@ error:
|
|||
WORD Epd3Base::Epd3U::DeIssue()
|
||||
{
|
||||
int r = 1;
|
||||
int ErrorStep = 0;
|
||||
if (port == 0) return 0;
|
||||
if (CurrentDeviceID==0) return 0;
|
||||
|
||||
ReOpenDev();
|
||||
ErrorStep = 1;
|
||||
r = ClearAlarms();
|
||||
|
||||
ErrorStep = 2;
|
||||
r = ClearDoses();
|
||||
|
||||
ErrorStep = 3;
|
||||
if (EPDIssued) {
|
||||
token = BeginDeissueEPD(epdComsHandle, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
|
|
@ -1010,21 +1047,28 @@ WORD Epd3Base::Epd3U::DeIssue()
|
|||
r = 0; // goto error;
|
||||
}
|
||||
|
||||
ErrorStep = 4;
|
||||
token = BeginEpdOnOff(epdComsHandle, 0, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndEpdOnOff(epdComsHandle, token);
|
||||
if (r != 0)
|
||||
goto error;
|
||||
|
||||
ErrorStep = 5;
|
||||
EndCom();
|
||||
|
||||
return r;
|
||||
|
||||
error:
|
||||
Error = r;
|
||||
return r;
|
||||
}
|
||||
|
||||
WORD Epd3Base::Epd3U::WriteWearer() {
|
||||
|
||||
int32_t r = 0;
|
||||
int step = 0;
|
||||
|
||||
token = BeginSetBaselineCounters(epdComsHandle, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndSetBaselineCounters(epdComsHandle, token);
|
||||
|
|
@ -1038,6 +1082,7 @@ WORD Epd3Base::Epd3U::WriteWearer() {
|
|||
mk3WearerID.Length = 23;
|
||||
memcpy(mk3WearerID.Utf8String, WearerName, 23);
|
||||
|
||||
step = 1;
|
||||
token = BeginWriteWearerId(epdComsHandle, mk3WearerID, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndWriteWearerId(epdComsHandle, token);
|
||||
|
|
@ -1048,6 +1093,7 @@ WORD Epd3Base::Epd3U::WriteWearer() {
|
|||
mk3WearerID.Length = 13;
|
||||
memcpy(mk3WearerID.Utf8String, WearerID, 13);
|
||||
|
||||
step = 2;
|
||||
token = BeginWriteWearerId(epdComsHandle, mk3WearerID, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndWriteWearerId(epdComsHandle, token);
|
||||
|
|
@ -1056,7 +1102,9 @@ WORD Epd3Base::Epd3U::WriteWearer() {
|
|||
|
||||
return r;
|
||||
|
||||
error:
|
||||
error:
|
||||
ErrorStep = step;
|
||||
Error = r;
|
||||
return r;
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -1077,7 +1125,7 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone)
|
|||
if (r != 0)
|
||||
goto error;
|
||||
}
|
||||
++step; //1
|
||||
|
||||
|
||||
/*if (isMK3) {
|
||||
token = BeginEnableProtectedSession_R3(epdComsHandle, 1, nullptr);
|
||||
|
|
@ -1086,20 +1134,21 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone)
|
|||
if (r != 0)
|
||||
goto error;
|
||||
}*/
|
||||
|
||||
step = 1;
|
||||
ReOpenDev();
|
||||
|
||||
step = 2;
|
||||
r = WriteAlarmTresholds();
|
||||
if (r != 0)
|
||||
goto error;
|
||||
++step;//2
|
||||
|
||||
step = 3;
|
||||
r = WriteWearer();
|
||||
if (r != 0)
|
||||
goto error;
|
||||
/*r = WriteCal();
|
||||
if (r != 0)
|
||||
goto error;*/
|
||||
|
||||
|
||||
++step;//3
|
||||
step = 4;
|
||||
//EPDIssued
|
||||
//if (!DetectorsOn) {
|
||||
token = BeginEpdOnOff(epdComsHandle, 1, nullptr);
|
||||
|
|
@ -1111,19 +1160,22 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone)
|
|||
r=0;
|
||||
//}
|
||||
|
||||
++step;//4
|
||||
step = 5;
|
||||
ReOpenDev();
|
||||
|
||||
tries = 1;
|
||||
token = BeginIssueEPD(epdComsHandle, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndIssueEPD(epdComsHandle, token);
|
||||
if (r != 0) {
|
||||
tries++;
|
||||
if (r == r_ErrorNotConnected) ReOpenDev();
|
||||
Sleep(500);
|
||||
token = BeginIssueEPD(epdComsHandle, nullptr);
|
||||
r = Commit3(epdComsHandle);
|
||||
r = EndIssueEPD(epdComsHandle, token);
|
||||
}
|
||||
if (r)
|
||||
if (r)
|
||||
goto error;
|
||||
|
||||
/*if (isMK3) {
|
||||
|
|
@ -1134,18 +1186,21 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone)
|
|||
goto error;
|
||||
}*/
|
||||
|
||||
++step;//5
|
||||
step = 6;
|
||||
if (isMK3) {
|
||||
r = DisCon(EndSessionControl); //stops protected session
|
||||
if (r)
|
||||
goto error;
|
||||
}
|
||||
++step;
|
||||
|
||||
step = 7;
|
||||
EndCom();
|
||||
|
||||
return r;
|
||||
|
||||
error:
|
||||
ErrorStep = step;
|
||||
Error = r;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -1195,8 +1250,6 @@ WORD Epd3Base::Epd3U::WriteCal()
|
|||
|
||||
token = BeginWriteSensitivities_R2(epdComsHandle, nullptr, (uint16_t)K1, (uint16_t)K2, (uint16_t)K3, (uint16_t)K4, (uint16_t)K5, (uint16_t)K6);
|
||||
r = Commit3(epdComsHandle);
|
||||
if (r != 0)
|
||||
goto error;
|
||||
if (r != 0)
|
||||
goto error;
|
||||
r = EndWriteSensitivities_R2(epdComsHandle, token);
|
||||
|
|
@ -1219,13 +1272,32 @@ int Epd3Base::Epd3U::GetAll(bool Closeconnection)
|
|||
return rv;
|
||||
}
|
||||
|
||||
int Epd3Base::Epd3U::GetAllDeissue()
|
||||
int Epd3Base::Epd3U::GetAllDeissue(bool reconnect)
|
||||
{
|
||||
int rv = 0;
|
||||
int step = 0;
|
||||
|
||||
if (reconnect)
|
||||
rv = ReOpenDev();
|
||||
if (!rv) goto error;
|
||||
|
||||
step = 1;
|
||||
rv = ReadDoses(); //0 = success
|
||||
if (!rv) goto error;
|
||||
//rv = ReadAlarmTresholds(); //0 = success
|
||||
|
||||
step = 2;
|
||||
rv = EPDReadExtraStatus();
|
||||
if (!rv) goto error;
|
||||
|
||||
step = 3;
|
||||
rv = DeIssue(); //does close
|
||||
if (!rv) goto error;
|
||||
|
||||
return rv;
|
||||
error:
|
||||
Error = rv;
|
||||
ErrorStep = step;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
@ -1233,29 +1305,35 @@ int Epd3Base::Epd3U::IssueAndCheck(float gain,float ChirpRate)
|
|||
{
|
||||
int rv = 0;
|
||||
int step = 0;
|
||||
|
||||
ReOpenDev();
|
||||
|
||||
if (isNG) {
|
||||
step = 1;
|
||||
float kx = gain;
|
||||
rv = ReadCal();
|
||||
if (rv != 0 || K6 != 1310) { rv = 1; goto error; }
|
||||
++step;
|
||||
if (K3 != kx || K4 != kx)
|
||||
{
|
||||
step = 2;
|
||||
K3 = K4 = kx;
|
||||
rv = WriteCal();
|
||||
if (rv != 0) goto error;
|
||||
}
|
||||
}
|
||||
++step;
|
||||
step = 3;
|
||||
SetChirp( ChirpRate);
|
||||
++step;
|
||||
step = 4;
|
||||
rv = PrepareForIssue();
|
||||
if (rv != 0) goto error;
|
||||
++step;
|
||||
step = 5;
|
||||
if (!rv) rv = Issue(true); // data already loaded
|
||||
if (rv != 0) goto error;
|
||||
|
||||
return rv;
|
||||
error:
|
||||
Error = rv;
|
||||
ErrorStep = step;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
@ -1377,6 +1455,7 @@ int Epd3Base::Epd3U::SetChirp(float Sensitivity)
|
|||
{
|
||||
uint32_t r = 1;
|
||||
uint8_t enable = 0;
|
||||
|
||||
if (Sensitivity > 0.001F) {
|
||||
enable = 1;
|
||||
token = BeginWriteChirpSensitivity(epdComsHandle, Sensitivity, nullptr);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ namespace Epd3Base {
|
|||
WORD WriteConfig32 = 1;
|
||||
|
||||
WORD Error = 0;
|
||||
WORD ErrorStep = 0;
|
||||
WORD ErrorSource;
|
||||
WORD ErrorReason;
|
||||
WORD ErrorData;
|
||||
|
|
@ -108,7 +109,7 @@ namespace Epd3Base {
|
|||
//Identification
|
||||
|
||||
DWORD EpdID = 0;
|
||||
WORD HardVersion;
|
||||
WORD HardVersion, HardVersionMinor;
|
||||
WORD SoftVersion;
|
||||
WORD FunctionFlags;
|
||||
|
||||
|
|
@ -266,7 +267,7 @@ namespace Epd3Base {
|
|||
void decodePeakRates(int count);
|
||||
public:
|
||||
int GetAll(bool Closeconnection);
|
||||
int GetAllDeissue();
|
||||
int GetAllDeissue(bool reconnect);
|
||||
int IssueAndCheck(float gain, float ChirpRate);
|
||||
int SetChirp(float Sensitivity);
|
||||
WORD ReadCal();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using namespace System::Security::Permissions;
|
|||
[assembly:AssemblyConfigurationAttribute(L"")];
|
||||
[assembly:AssemblyCompanyAttribute(L"SCK CEN")];
|
||||
[assembly:AssemblyProductAttribute(L"EpdBaseClr")];
|
||||
[assembly:AssemblyCopyrightAttribute(L"Copyright (c) 2019-2021 Luc Vandenbroucke")];
|
||||
[assembly:AssemblyCopyrightAttribute(L"Copyright (c) 2019-2024 Luc Vandenbroucke")];
|
||||
[assembly:AssemblyTrademarkAttribute(L"")];
|
||||
[assembly:AssemblyCultureAttribute(L"")];
|
||||
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ int EpdBaseClr::Epd2::AfterGetStatus(EpdBase::Epd2U *epd)
|
|||
operatingStatus = epd->OperatingStatus;
|
||||
hasAlarm = epd->hasAlarm;
|
||||
EpdID = epd->EpdID;
|
||||
HardVersion = epd->HardVersion;
|
||||
HardVersion = epd->HardVersion;
|
||||
SoftVersion = epd->SoftVersion;
|
||||
FunctionFlags = epd->FunctionFlags;
|
||||
CountsClock = epd->EpdClock;
|
||||
|
|
@ -207,6 +207,7 @@ int EpdBaseClr::Epd2::AfterGetStatus(Epd3Base::Epd3U* epd)
|
|||
hasAlarm = epd->hasAlarm;
|
||||
EpdID = epd->EpdID;
|
||||
HardVersion = epd->HardVersion;
|
||||
HardVersionMinor = epd->HardVersionMinor;
|
||||
SoftVersion = epd->SoftVersion;
|
||||
FunctionFlags = epd->FunctionFlags;
|
||||
CountsClock = epd->EpdClock;
|
||||
|
|
@ -339,7 +340,12 @@ int EpdBaseClr::Epd2::ClearAlarms()
|
|||
int EpdBaseClr::Epd2::SetDeIssued()
|
||||
{
|
||||
int rv = 0;
|
||||
if (isMK3) rv = epd3->DeIssue();
|
||||
ErrorStep = 0; ErrorRV = 0;
|
||||
if (isMK3) {
|
||||
rv = epd3->DeIssue();
|
||||
ErrorStep = epd3->ErrorStep;
|
||||
ErrorRV = epd3->Error;
|
||||
}
|
||||
else rv = epd->DeIssue();
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -348,7 +354,12 @@ int EpdBaseClr::Epd2::PrepareForIssue()
|
|||
{
|
||||
int rv = 0;
|
||||
PrepareForIssueError = 0;
|
||||
if (isMK3) rv= epd3->PrepareForIssue();
|
||||
ErrorStep = 0; ErrorRV = 0;
|
||||
if (isMK3) {
|
||||
rv = epd3->PrepareForIssue();
|
||||
ErrorStep = epd3->ErrorStep;
|
||||
ErrorRV = epd3->Error;
|
||||
}
|
||||
else rv= epd->PrepareForIssue();
|
||||
if (rv != 0) PrepareForIssueError = epd->Error;
|
||||
return rv;
|
||||
|
|
@ -360,7 +371,12 @@ int EpdBaseClr::Epd2::PrepareForIssue()
|
|||
int EpdBaseClr::Epd2::SetIssued()
|
||||
{
|
||||
int rv = 0;
|
||||
if (isMK3) rv=SetIssued(epd3);
|
||||
ErrorStep = 0; ErrorRV = 0;
|
||||
if (isMK3) {
|
||||
rv=SetIssued(epd3);
|
||||
ErrorStep = epd3->ErrorStep;
|
||||
ErrorRV = epd3->Error;
|
||||
}
|
||||
else rv=SetIssued(epd);
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -369,15 +385,15 @@ int EpdBaseClr::Epd2::BeforeSetIssued(Epd3Base::Epd3U* epd)
|
|||
int rv = 0;
|
||||
SetIssuedError = 0;
|
||||
epd->Hp07THDose = (float)Hp07THDose;
|
||||
epd->Hp10THDose1 = Hp10THDose1;
|
||||
epd->Hp10THDose2 = Hp10THDose2;
|
||||
epd->Hp10THDose1 = (float)Hp10THDose1;
|
||||
epd->Hp10THDose2 = (float)Hp10THDose2;
|
||||
|
||||
epd->Hp10Rate1On = Hp10Rate1On;
|
||||
epd->Hp10Rate2On = Hp10Rate2On;
|
||||
epd->Hp07RateOn = Hp07RateOn;
|
||||
epd->Hp10Rate1Off = Hp10Rate1Off;
|
||||
epd->Hp10Rate2Off = Hp10Rate2Off;
|
||||
epd->Hp07RateOff = Hp07RateOff;
|
||||
epd->Hp10Rate1On = (float)Hp10Rate1On;
|
||||
epd->Hp10Rate2On = (float)Hp10Rate2On;
|
||||
epd->Hp07RateOn = (float)Hp07RateOn;
|
||||
epd->Hp10Rate1Off = (float)Hp10Rate1Off;
|
||||
epd->Hp10Rate2Off = (float)Hp10Rate2Off;
|
||||
epd->Hp07RateOff = (float)Hp07RateOff;
|
||||
|
||||
memset(epd->WearerID, ' ', WearerIDLength); epd->WearerID[WearerIDLength] = 0;
|
||||
char* str1 = (char*)(void*)Runtime::InteropServices::Marshal::StringToHGlobalAnsi(WearerID);
|
||||
|
|
@ -571,10 +587,10 @@ int EpdBaseClr::Epd2::AfterReadTresholds(Epd3Base::Epd3U* epd)
|
|||
Hp07Total = (double)epd->Hp07Total;
|
||||
|
||||
K1 = (int)epd->K1;
|
||||
K2 = epd->K2;
|
||||
K3 = epd->K3;
|
||||
K4 = epd->K4;
|
||||
K5 = epd->K5;
|
||||
K2 = (int)epd->K2;
|
||||
K3 = (int)epd->K3;
|
||||
K4 = (int)epd->K4;
|
||||
K5 = (int)epd->K5;
|
||||
K6 = (int)epd->K6;
|
||||
SG = epd->SG;
|
||||
BC = epd->BC;
|
||||
|
|
@ -640,9 +656,7 @@ int EpdBaseClr::Epd2::ReadExtraStatus(Epd3Base::Epd3U* epd)
|
|||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
int EpdBaseClr::Epd2::AfterGetDoses(EpdBase::Epd2U* epd)
|
||||
int EpdBaseClr::Epd2::AfterGetDoses(EpdBase::Epd2U* epd)
|
||||
{
|
||||
eDoshasAlarm = eDosHasFault = false;
|
||||
int rv = 0;
|
||||
|
|
@ -709,7 +723,6 @@ int EpdBaseClr::Epd2::AfterGetDoses(EpdBase::Epd2U* epd)
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get Doses and tresholds, and close if requested
|
||||
/// </summary>
|
||||
|
|
@ -731,8 +744,9 @@ int EpdBaseClr::Epd2::GetAll(bool close)
|
|||
}
|
||||
return rv;
|
||||
}
|
||||
int EpdBaseClr::Epd2::GetAllDeissue()
|
||||
int EpdBaseClr::Epd2::GetAllDeissue(bool reconnect)
|
||||
{
|
||||
ErrorRV = ErrorStep = 0;
|
||||
int rv = 0;
|
||||
if (!isMK3) {
|
||||
rv = epd->GetAllDeissue();
|
||||
|
|
@ -741,7 +755,9 @@ int EpdBaseClr::Epd2::GetAllDeissue()
|
|||
}
|
||||
else
|
||||
{
|
||||
rv = epd3->GetAllDeissue();
|
||||
rv = epd3->GetAllDeissue(reconnect);
|
||||
ErrorRV = epd3->Error;
|
||||
ErrorStep = epd3->ErrorStep;
|
||||
rv = AfterGetDoses(epd3);
|
||||
rv = AfterReadTresholds(epd3);
|
||||
}
|
||||
|
|
@ -761,7 +777,7 @@ int EpdBaseClr::Epd2::IssueAndCheck(float gain,float ChirpRate)
|
|||
}
|
||||
else
|
||||
{
|
||||
BeforeSetIssued(epd3);
|
||||
BeforeSetIssued(epd3); //geen interactie met epd
|
||||
rv = epd3->IssueAndCheck(gain, ChirpRate);
|
||||
}
|
||||
return rv;
|
||||
|
|
@ -802,7 +818,7 @@ void EpdBaseClr::Epd2::InitData()
|
|||
otherAlarms = 0;
|
||||
errorStatus = 0;
|
||||
operatingStatus = 0;
|
||||
HardVersion = 0;
|
||||
HardVersion = 0; HardVersionMinor = 0;
|
||||
SoftVersion = 0;
|
||||
FunctionFlags = 0;
|
||||
CountsClock = 0;
|
||||
|
|
@ -815,13 +831,20 @@ void EpdBaseClr::Epd2::InitData()
|
|||
int EpdBaseClr::Epd2::ConnectAndStatus()
|
||||
{
|
||||
int rv = 1;
|
||||
int step = 0;
|
||||
ErrorStep = ErrorRV = 0;
|
||||
|
||||
if (!onlyMK2) epd->EndCom(); //indien Mk2
|
||||
|
||||
InitData();
|
||||
//Sleep(100);
|
||||
if (onlyMK2)
|
||||
step = 1;
|
||||
if (onlyMK2 || !epd3)
|
||||
rv = epd->ConnectAndStatus(tokenSourceTimeout);
|
||||
else
|
||||
else {
|
||||
rv = epd3->ConnectAndStatus(tokenSourceTimeout);
|
||||
}
|
||||
|
||||
if (rv==0) {
|
||||
if (onlyMK2) {
|
||||
DeviceCount = epd->DeviceCount;
|
||||
|
|
@ -860,8 +883,13 @@ int EpdBaseClr::Epd2::ConnectAndStatus()
|
|||
else {
|
||||
if (epd == nullptr) ConnectError = 99;
|
||||
else ConnectError = epd->Error;
|
||||
goto error;
|
||||
}
|
||||
return rv;
|
||||
error:
|
||||
ErrorStep = step;
|
||||
ErrorRV = rv;
|
||||
return rv;
|
||||
}
|
||||
void EpdBaseClr::Epd2::WaitEpd()
|
||||
{
|
||||
|
|
@ -879,7 +907,7 @@ void EpdBaseClr::Epd2::WaitEpd()
|
|||
_EpdTO(this, gcnew EpdTOEventArgs(0, 0)); // epd3->ConnectTries, epd3->ConnectTimerFired));
|
||||
}
|
||||
else if (rv > 0 && _EpdError != nullptr) {
|
||||
_EpdError(this, gcnew EpdErrorEventArgs(rv));
|
||||
_EpdError(this, gcnew EpdErrorEventArgs(rv,ErrorRV,ErrorStep));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ namespace EpdBaseClr {
|
|||
public:
|
||||
int deviceID;
|
||||
bool isIssued, isBG, isMK3;
|
||||
|
||||
|
||||
EpdEventArgs(int epdID, bool epdIssued, bool isBG, bool isMK3) : EventArgs()
|
||||
{
|
||||
|
|
@ -43,10 +44,19 @@ namespace EpdBaseClr {
|
|||
{
|
||||
public:
|
||||
int returnValue;
|
||||
int ErrorRV; int ErrorStep;
|
||||
EpdErrorEventArgs(int ReturnValue) : EventArgs()
|
||||
{
|
||||
ErrorRV= ErrorStep = 0;
|
||||
this->returnValue = ReturnValue;
|
||||
}
|
||||
EpdErrorEventArgs(int ReturnValue, int errorRV, int errorStep) : EventArgs()
|
||||
{
|
||||
this->ErrorRV = errorRV;
|
||||
this->ErrorStep = errorStep;
|
||||
this->returnValue = ReturnValue;
|
||||
}
|
||||
|
||||
};
|
||||
public ref class EpdTOEventArgs : EventArgs
|
||||
{
|
||||
|
|
@ -156,6 +166,8 @@ namespace EpdBaseClr {
|
|||
int ConnectError;
|
||||
int ReadDosesRV;
|
||||
int DeviceCount = 0;
|
||||
int ErrorStep=0;
|
||||
int ErrorRV = 0;
|
||||
|
||||
double Hp07;
|
||||
double Hp10;
|
||||
|
|
@ -202,7 +214,7 @@ namespace EpdBaseClr {
|
|||
int errorStatus ;
|
||||
int operatingStatus ;
|
||||
unsigned int EpdID ;
|
||||
int HardVersion ;
|
||||
int HardVersion, HardVersionMinor;
|
||||
int SoftVersion ;
|
||||
int FunctionFlags ;
|
||||
|
||||
|
|
@ -296,13 +308,14 @@ namespace EpdBaseClr {
|
|||
int tokenSourceTimeout;
|
||||
int readRetries;
|
||||
System::Threading::Tasks::Task^ waitTask;
|
||||
int SetDeIssued();
|
||||
|
||||
public:
|
||||
int SetDeIssued();
|
||||
|
||||
System::Threading::Tasks::Task^ Wait(int timeout, int Retries);
|
||||
void WaitEnd();
|
||||
int GetAll(bool close);
|
||||
int GetAllDeissue();
|
||||
int GetAllDeissue(bool reconnect);
|
||||
int IssueAndCheck(float gain, float ChirpRate);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -125,7 +125,11 @@
|
|||
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
|
||||
<KeyContainer>
|
||||
</KeyContainer>
|
||||
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>%signer% $(TargetPath)</Command>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -281,6 +281,25 @@ namespace eDosStation
|
|||
|
||||
if (oldState == ConnectionState.Closed) localConnection.Close();
|
||||
}
|
||||
|
||||
public int? ParaIntValue(SqlCommand cmd, string name)
|
||||
{
|
||||
int? rv = null;
|
||||
if (cmd.Parameters.Contains(name) && cmd.Parameters[name].Value != DBNull.Value) rv = (int?)cmd.Parameters[name].Value;
|
||||
return rv;
|
||||
}
|
||||
public bool? ParaBoolValue(SqlCommand cmd, string name)
|
||||
{
|
||||
bool? rv = null;
|
||||
if (cmd.Parameters.Contains(name) && cmd.Parameters[name].Value != DBNull.Value) rv = (bool?)cmd.Parameters[name].Value;
|
||||
return rv;
|
||||
}
|
||||
public string ParaStringValue(SqlCommand cmd, string name)
|
||||
{
|
||||
string rv = null;
|
||||
if (cmd.Parameters.Contains(name) && cmd.Parameters[name].Value != DBNull.Value) rv = (string)cmd.Parameters[name].Value;
|
||||
return rv;
|
||||
}
|
||||
public int VisitInfo(int EpdVisitID, out string name)
|
||||
{
|
||||
int? rv = 0;
|
||||
|
|
@ -292,10 +311,10 @@ namespace eDosStation
|
|||
checkCon(true);
|
||||
VisitInfoCommand.Connection = localConnection;
|
||||
VisitInfoCommand.ExecuteScalar();
|
||||
rv = (int?)VisitInfoCommand.Parameters["RETURN_VALUE"].Value;
|
||||
bool? hasExited = (bool?)VisitInfoCommand.Parameters["hasExited"].Value;
|
||||
bool? isManualExit = (bool?)VisitInfoCommand.Parameters["isManualExit"].Value;
|
||||
name = (string )VisitInfoCommand.Parameters["name"].Value;
|
||||
rv = ParaIntValue(VisitInfoCommand, "RETURN_VALUE");
|
||||
bool? hasExited = ParaBoolValue(VisitInfoCommand, "hasExited");
|
||||
bool? isManualExit = ParaBoolValue(VisitInfoCommand, "isManualExit");
|
||||
name = ParaStringValue(VisitInfoCommand, "name");
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,10 +15,7 @@ namespace eDosStation
|
|||
|
||||
public partial class EntryBadge : Window
|
||||
{
|
||||
private enum eEntryState { none, getuser, gettask, getepd, epdtimeout, epdError, epdOK, final,
|
||||
NotAllowed,
|
||||
Initial
|
||||
}
|
||||
private enum eEntryState { none, getuser, gettask, getepd, epdtimeout, epdError, epdOK, final, NotAllowed, Initial }
|
||||
private eEntryState EntryState;
|
||||
bool taskLoading = false;
|
||||
const int PageTimeout = 10000;
|
||||
|
|
@ -64,7 +61,7 @@ namespace eDosStation
|
|||
EntryState = eEntryState.epdError;
|
||||
System.Diagnostics.Debug.WriteLine("ERROR ");
|
||||
Dispatcher.InvokeAsync(() => {
|
||||
MessageBox.Show($"EPD Error {e.returnValue}");
|
||||
MessageBox.Show($"EPD Error {e.returnValue} {e.ErrorRV} {e.ErrorStep}");
|
||||
Dispatcher.InvokeAsync(() => { SetTimedOutAndEnd(); });
|
||||
});
|
||||
}
|
||||
|
|
@ -550,6 +547,7 @@ namespace eDosStation
|
|||
}
|
||||
EpdReading = false;
|
||||
dispatcherTimer?.Stop();
|
||||
|
||||
dispatcherTimer = null;
|
||||
this.Close();
|
||||
}
|
||||
|
|
@ -651,14 +649,12 @@ namespace eDosStation
|
|||
else ShowAndEnd(null,null);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowAndEnd(object sender, EventArgs e)
|
||||
{
|
||||
dispatcherTimer?.Stop();
|
||||
dispatcherTimer = null;
|
||||
endPage();
|
||||
}
|
||||
|
||||
private void CountDown(object sender, EventArgs e)
|
||||
{
|
||||
double v = (ResultTime - DateTime.Now).TotalSeconds;
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@
|
|||
<TextBlock Grid.Row="1" Grid.Column="2" Text="Visit:" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5,5,20,5" Foreground="{DynamicResource sckbP}" FontWeight="Bold" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="3" Name= "EpdVisit" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,5,20,5" Text="12345545" Foreground="{DynamicResource sckbP}" />
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4" Name="Name" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="50,5,20,5" Text="...." Foreground="{DynamicResource sckbP}" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4" Name="PersonName" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="50,5,20,5" Text="...." Foreground="{DynamicResource sckbP}" />
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Dose:" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5,5,20,5" Foreground="{DynamicResource sckbP}" FontWeight="Bold" />
|
||||
<StackPanel Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Vertical" VerticalAlignment="Center" Name="DosePanel" >
|
||||
|
|
|
|||
|
|
@ -27,8 +27,6 @@ namespace eDosStation
|
|||
|
||||
thisStation = curStation;
|
||||
dataInterface = curStation.dataInterface;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void CountDown(object sender, EventArgs e)
|
||||
|
|
@ -61,7 +59,6 @@ namespace eDosStation
|
|||
EpdReading = false;
|
||||
dispatcherTimer?.Stop();
|
||||
Dispatcher.InvokeAsync(() => LoadDoses());
|
||||
|
||||
}
|
||||
|
||||
private void startEPDRead()
|
||||
|
|
@ -115,7 +112,7 @@ namespace eDosStation
|
|||
{
|
||||
Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
rv = ep.SetDeIssued();
|
||||
//rv = ep.SetDeIssued();
|
||||
endWithMessage("This EPD is not issued");
|
||||
});
|
||||
return;
|
||||
|
|
@ -126,9 +123,10 @@ namespace eDosStation
|
|||
return;
|
||||
}
|
||||
|
||||
if (int.TryParse(ep.WearerID, out EpdVisitID) && EpdVisitID % 100 != thisStation.ID_Station)
|
||||
int station = EpdVisitID % 100;
|
||||
if (int.TryParse(ep.WearerID, out EpdVisitID) && station != thisStation.ID_Station)
|
||||
{
|
||||
endWithMessage($"This EPD was issued on another station (ID:{EpdVisitID % 100})");
|
||||
endWithMessage($"This EPD was issued on another station (ID:{station})");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -137,11 +135,10 @@ namespace eDosStation
|
|||
int Exited = dataInterface.VisitInfo(EpdVisitID, out WearerFullName);
|
||||
if (Exited>0)
|
||||
{
|
||||
endWithMessage($"This EPD was already returned or had a manual exit (ID:{EpdVisitID % 100})");
|
||||
endWithMessage($"This EPD was already returned or had a manual exit (ID:{station})");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//bool NoTimeout = false;
|
||||
|
||||
if (ep.alarmStatus != 0)
|
||||
|
|
@ -162,9 +159,9 @@ namespace eDosStation
|
|||
ok.IsSelected = true;
|
||||
}
|
||||
|
||||
rv = ep.GetAllDeissue();
|
||||
rv = ep.GetAllDeissue(true); //reconnect
|
||||
if (rv != 0)
|
||||
MessageBox.Show($"GetDoses {rv} er:{ep.GetDosesError}");
|
||||
MessageBox.Show($"GetDoses {rv} rv:{ep.ErrorRV} step:{ep.ErrorStep} er:{ep.GetDosesError}");
|
||||
|
||||
Wearer.Text = $"{ep.WearerName}";
|
||||
Wearer.Name = WearerFullName;
|
||||
|
|
@ -190,7 +187,7 @@ namespace eDosStation
|
|||
}
|
||||
l.Dispose();
|
||||
}
|
||||
Name.Text = "";
|
||||
PersonName.Text = string.Empty;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -215,19 +212,17 @@ namespace eDosStation
|
|||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation.splunkLog.WriteException(null, "StartEpd", ex);
|
||||
MessageBox.Show($"{ex.Message}");
|
||||
MessageBox.Show(ex.Message);
|
||||
ep = null;
|
||||
}
|
||||
|
||||
|
||||
if (ep!=null)
|
||||
if (ep != null)
|
||||
{
|
||||
ResultTime = DateTime.Now.AddSeconds(thisStation.ScreenEPDTimeout);
|
||||
Progress.Value= Progress.Maximum = thisStation.ScreenEPDTimeout;
|
||||
Progress.Value = Progress.Maximum = thisStation.ScreenEPDTimeout;
|
||||
dispatcherTimer.Start();
|
||||
startEPDRead();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void BCloseExit_Click(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace eDosStation
|
|||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
const string className = "MainWindow";
|
||||
public DataInterface dataInterface;
|
||||
public Station thisStation;
|
||||
DispatcherTimer bgTimer;
|
||||
|
|
@ -25,10 +26,10 @@ namespace eDosStation
|
|||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string ers = string.Empty;
|
||||
|
||||
if (thisStation.RestartCom && (thisStation.RestartComFirst == true))
|
||||
{
|
||||
ers = devcon.Restart();
|
||||
if (!string.IsNullOrEmpty(ers)) thisStation.splunkLog?.WriteSplunkLog("Restart USB error", LSWLib.CLog.iseverity.err, null, ers); ;
|
||||
thisStation.DeviceRestart();
|
||||
}
|
||||
|
||||
var w = new ShowEPDDose(thisStation);
|
||||
|
|
@ -36,64 +37,65 @@ namespace eDosStation
|
|||
|
||||
if (thisStation.RestartCom && (thisStation.RestartComFirst == true))
|
||||
{
|
||||
ers = devcon.Restart();
|
||||
if (!string.IsNullOrEmpty(ers)) thisStation.splunkLog?.WriteSplunkLog("Restart USB error", LSWLib.CLog.iseverity.err, null, ers); ;
|
||||
thisStation.DeviceRestart();
|
||||
}
|
||||
|
||||
thisStation.splunkLog?.WriteSplunkLog("Show Dose done", LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
private void BEntry_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
const string module = "BEntry_Click";
|
||||
string ers = string.Empty;
|
||||
thisStation.splunkLog?.WriteSplunkLog("Entry", LSWLib.CLog.iseverity.info);
|
||||
thisStation.splunkLog?.WriteSplunkLog(module, LSWLib.CLog.iseverity.info);
|
||||
string step = "DeviceRestart";
|
||||
try
|
||||
{
|
||||
if (thisStation.RestartCom && (thisStation.RestartComFirst == true))
|
||||
{
|
||||
ers = devcon.Restart();
|
||||
if (!string.IsNullOrEmpty(ers)) thisStation.splunkLog?.WriteSplunkLog("Restart USB error", LSWLib.CLog.iseverity.err, null, ers); ;
|
||||
thisStation.DeviceRestart();
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation.splunkLog.WriteException(null, "Devcon, rqstart 2", ex);
|
||||
thisStation.splunkLog?.WriteException(module, step, ex);
|
||||
}
|
||||
|
||||
step = "EntryBadge";
|
||||
try
|
||||
{
|
||||
var w = new EntryBadge(thisStation);
|
||||
w.ShowDialog();
|
||||
#if SimulateEPD
|
||||
simulData = w.simulData;
|
||||
simulData = w.simulData;
|
||||
#endif
|
||||
w = null;
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation.splunkLog.WriteException(null, "Start entry", ex);
|
||||
thisStation.splunkLog?.WriteException(module, step, ex);
|
||||
}
|
||||
|
||||
step = "DeviceReset2";
|
||||
try
|
||||
{
|
||||
if (thisStation.RestartCom && !(thisStation.RestartComFirst == true))
|
||||
{
|
||||
ers = devcon.Restart();
|
||||
if (!string.IsNullOrEmpty(ers)) thisStation.splunkLog?.WriteSplunkLog("Restart USB error", LSWLib.CLog.iseverity.err, null, ers); ;
|
||||
thisStation.DeviceRestart();
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation.splunkLog.WriteException(null, "Devcon, rqstart 2", ex);
|
||||
thisStation.splunkLog.WriteException(module, step, ex);
|
||||
}
|
||||
thisStation.splunkLog?.WriteSplunkLog("Entry done", LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
private void BExit_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
const string module = "BExit_Click";
|
||||
string ers = string.Empty;
|
||||
thisStation.splunkLog?.WriteSplunkLog("Exit", LSWLib.CLog.iseverity.info);
|
||||
if (thisStation.RestartCom && thisStation.RestartComFirst==true)
|
||||
thisStation.splunkLog?.WriteSplunkLog(module, LSWLib.CLog.iseverity.info);
|
||||
if (thisStation.RestartCom && thisStation.RestartComFirst)
|
||||
{
|
||||
ers = devcon.Restart();
|
||||
if (!string.IsNullOrEmpty(ers)) thisStation?.splunkLog.WriteSplunkLog("Restart USB error", LSWLib.CLog.iseverity.err, null, ers); ;
|
||||
ers = thisStation.DeviceRestart();
|
||||
}
|
||||
|
||||
var w = new EpdExit(thisStation);
|
||||
|
|
@ -102,17 +104,23 @@ namespace eDosStation
|
|||
#endif
|
||||
w.ShowDialog();
|
||||
w = null;
|
||||
if (thisStation.RestartCom && !(thisStation.RestartComFirst==true))
|
||||
if (thisStation.RestartCom && !(thisStation.RestartComFirst))
|
||||
{
|
||||
ers = devcon.Restart();
|
||||
if (!string.IsNullOrEmpty(ers)) thisStation?.splunkLog.WriteSplunkLog("Restart USB error", LSWLib.CLog.iseverity.err, null, ers); ;
|
||||
ers = thisStation.DeviceRestart();
|
||||
}
|
||||
thisStation.splunkLog?.WriteSplunkLog("Exit Done", LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Settings s = new Settings(thisStation);
|
||||
s.ShowDialog();
|
||||
const string module = "MenuSettings";
|
||||
try
|
||||
{
|
||||
var s = new Settings(thisStation);
|
||||
s.ShowDialog();
|
||||
} catch (System.Exception ex)
|
||||
{
|
||||
thisStation?.splunkLog?.WriteException(className, module, ex);
|
||||
}
|
||||
}
|
||||
private void setLocalStatus()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -51,5 +51,5 @@ using System.Windows;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2.14.0.0")]
|
||||
[assembly: AssemblyFileVersion("2.14.0.0")]
|
||||
[assembly: AssemblyVersion("2.15.0.0")]
|
||||
[assembly: AssemblyFileVersion("2.15.0.0")]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Thu 05/16/2024 15:51:50.20
|
||||
Fri 05/24/2024 15:12:34.56
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace eDosStation
|
|||
public byte Value { get; set; }
|
||||
public beepclass(string txt, byte val)
|
||||
{
|
||||
Text = txt; Value = val;
|
||||
Text = txt; Value = val;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -24,78 +24,142 @@ namespace eDosStation
|
|||
public string Text { get; set; }
|
||||
public readerclass(string txt)
|
||||
{
|
||||
Text = txt;
|
||||
Text = txt;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Settings : Window
|
||||
{
|
||||
public LSWDesfirePublic.CCard dfReader = null;
|
||||
private System.Threading.Tasks.Task ReaderTask = null;
|
||||
User _User;
|
||||
const string className = "Settings";
|
||||
//private System.Threading.Tasks.Task ReaderTask;
|
||||
//User _User;
|
||||
Station thisStation;
|
||||
ObservableCollection<beepclass> beepValues = new ObservableCollection<beepclass>();
|
||||
ObservableCollection<readerclass> readerValues = new ObservableCollection<readerclass>();
|
||||
public Settings( Station tStation)
|
||||
ObservableCollection<beepclass> beepValues;
|
||||
ObservableCollection<readerclass> readerValues;
|
||||
public Settings(Station tStation)
|
||||
{
|
||||
thisStation = tStation;
|
||||
InitializeComponent();
|
||||
try
|
||||
{
|
||||
//_User = null;
|
||||
thisStation = null;
|
||||
//dfReader = null; ReaderTask = null;
|
||||
beepValues = new ObservableCollection<beepclass>();
|
||||
readerValues = new ObservableCollection<readerclass>();
|
||||
InitializeComponent();
|
||||
if (tStation != null) thisStation = tStation;
|
||||
if (tStation != null) tStation.splunkLog?.WriteSplunkLog(className, LSWLib.CLog.iseverity.info, "created");
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
if (tStation != null) tStation.splunkLog?.WriteException(className, className, ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void BOK_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string thiscom = cComPort.SelectedItem.ToString().Replace("COM","");
|
||||
thisStation.ComPort = int.Parse(thiscom);
|
||||
|
||||
DataSet1.InstallationRow ir = CIns1.SelectedItem as DataSet1.InstallationRow;
|
||||
thisStation.Inst_CODE1 = ir.Inst_CODE;
|
||||
thisStation.Inst_Name1 = ir.InstallationName;
|
||||
|
||||
ir = CIns2.SelectedItem as DataSet1.InstallationRow;
|
||||
thisStation.Inst_CODE2 = ir.Inst_CODE;
|
||||
thisStation.Inst_Name2 = ir.InstallationName;
|
||||
|
||||
thisStation.useBeep = (byte)tBeep.SelectedValue;
|
||||
|
||||
if (cbValidation.IsChecked == null) cbValidation.IsChecked = false;
|
||||
thisStation.useTestButtons = cbValidation.IsChecked.Value;
|
||||
thisStation.Reader = (string)cbReaders.SelectedValue;
|
||||
thisStation.checkUser = cbCheckUsers.IsChecked != null ? cbCheckUsers.IsChecked.Value : false;
|
||||
thisStation.RestartCom = cbRestartCom.IsChecked != null ? cbRestartCom.IsChecked.Value : false;
|
||||
thisStation.EPDTimeOut = int.Parse(tEPDTimeout.Text);
|
||||
|
||||
thisStation.OnlyMK2 = cbOnlyMK2.IsChecked != null ? cbOnlyMK2.IsChecked.Value : false;
|
||||
|
||||
thisStation.RestartComFirst = cbRestartComFirst.IsChecked != null ? cbRestartComFirst.IsChecked.Value : false;
|
||||
|
||||
thisStation.AllowMultipleEPD = cbAllowMultipleEPD.IsChecked != null ? cbAllowMultipleEPD.IsChecked.Value : false;
|
||||
|
||||
//thisStation.WriteConfig32 = cbWriteConfig32.IsChecked != null ? cbWriteConfig32.IsChecked.Value : false;
|
||||
thisStation.Update();
|
||||
this.Close();
|
||||
if (thisStation.Error > 0)
|
||||
const string module = "BOK_Click";
|
||||
string step="init";
|
||||
try
|
||||
{
|
||||
MessageBox.Show($"Error {thisStation.ErrorMessage}");
|
||||
step = "comport";
|
||||
string thiscom = cComPort.SelectedItem.ToString().Replace("COM", string.Empty);
|
||||
thisStation.ComPort = int.Parse(thiscom);
|
||||
|
||||
DataSet1.InstallationRow ir;
|
||||
step = "code1";
|
||||
ir = CIns1.SelectedItem as DataSet1.InstallationRow;
|
||||
if (ir != null)
|
||||
{
|
||||
thisStation.Inst_CODE1 = ir.Inst_CODE;
|
||||
thisStation.Inst_Name1 = ir.InstallationName;
|
||||
} else
|
||||
{
|
||||
thisStation.Inst_CODE1 = 0;
|
||||
thisStation.Inst_Name1 = string.Empty;
|
||||
}
|
||||
|
||||
step = "code2";
|
||||
ir = CIns2.SelectedItem as DataSet1.InstallationRow;
|
||||
if (ir != null)
|
||||
{
|
||||
thisStation.Inst_CODE2 = ir.Inst_CODE;
|
||||
thisStation.Inst_Name2 = ir.InstallationName;
|
||||
}
|
||||
else
|
||||
{
|
||||
thisStation.Inst_CODE2 = 0;
|
||||
thisStation.Inst_Name2 = string.Empty;
|
||||
}
|
||||
|
||||
step = "usebeep";
|
||||
if (tBeep.HasItems && tBeep.SelectedIndex != -1) {
|
||||
thisStation.useBeep = (byte)tBeep.SelectedValue;
|
||||
} else
|
||||
thisStation.useBeep = (byte)0b00011110;
|
||||
|
||||
step = "validation++";
|
||||
if (cbValidation.IsChecked == null) cbValidation.IsChecked = false;
|
||||
thisStation.useTestButtons = cbValidation.IsChecked.Value;
|
||||
step = "Reader";
|
||||
thisStation.Reader = (string)cbReaders.SelectedValue;
|
||||
step = "checkUser";
|
||||
thisStation.checkUser = cbCheckUsers.IsChecked != null ? cbCheckUsers.IsChecked.Value : false;
|
||||
thisStation.RestartCom = cbRestartCom.IsChecked != null ? cbRestartCom.IsChecked.Value : false;
|
||||
step = "EPDTimeOut";
|
||||
thisStation.EPDTimeOut = int.Parse(tEPDTimeout.Text);
|
||||
|
||||
step = "OnlyMK2";
|
||||
thisStation.OnlyMK2 = cbOnlyMK2.IsChecked != null ? cbOnlyMK2.IsChecked.Value : false;
|
||||
|
||||
step = "RestartComFirst";
|
||||
thisStation.RestartComFirst = cbRestartComFirst.IsChecked != null ? cbRestartComFirst.IsChecked.Value : false;
|
||||
|
||||
step = "AllowMultipleEPD";
|
||||
thisStation.AllowMultipleEPD = cbAllowMultipleEPD.IsChecked != null ? cbAllowMultipleEPD.IsChecked.Value : false;
|
||||
|
||||
//thisStation.WriteConfig32 = cbWriteConfig32.IsChecked != null ? cbWriteConfig32.IsChecked.Value : false;
|
||||
step = "Update";
|
||||
thisStation.Update();
|
||||
|
||||
if (thisStation.Error > 0)
|
||||
{
|
||||
thisStation?.splunkLog?.WriteSplunkLog(module, LSWLib.CLog.iseverity.err, thisStation.ErrorMessage);
|
||||
MessageBox.Show($"Error {thisStation.ErrorMessage}");
|
||||
}
|
||||
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation?.splunkLog?.WriteException(module, step, ex);
|
||||
}
|
||||
thisStation?.splunkLog?.WriteSplunkLog(module, LSWLib.CLog.iseverity.info, "done");
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void BCancel_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
const string module = "BCancel_Click";
|
||||
thisStation?.splunkLog?.WriteSplunkLog(module, LSWLib.CLog.iseverity.info, "saved");
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string step = "devcon";
|
||||
string eDosCom = null;
|
||||
|
||||
try
|
||||
{
|
||||
eDosCom = devcon.FindEdosCom();
|
||||
eDosCom = thisStation?.find();
|
||||
thisStation.splunkLog?.WriteSplunkLog(step, LSWLib.CLog.iseverity.info, eDosCom);
|
||||
}
|
||||
catch { }
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation?.splunkLog?.WriteException(className, step, ex);
|
||||
}
|
||||
|
||||
step = "GetReaderList";
|
||||
try
|
||||
{
|
||||
|
||||
using (var a = new LSWDesfirePublic.CCard())
|
||||
{
|
||||
a.GetReaderList();
|
||||
|
|
@ -103,30 +167,46 @@ namespace eDosStation
|
|||
}
|
||||
cbReaders.ItemsSource = readerValues;
|
||||
cbReaders.SelectedValue = thisStation.Reader;
|
||||
} catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Readers err {ex.Message}");
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
foreach (string cn in System.IO.Ports.SerialPort.GetPortNames())
|
||||
{
|
||||
cComPort.Items.Add(cn);
|
||||
}
|
||||
thisStation.splunkLog?.WriteSplunkLog(step, LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Serial err {ex.Message}");
|
||||
thisStation?.splunkLog?.WriteException(className, step, ex);
|
||||
MessageBox.Show($"Readers err {ex.Message}");
|
||||
}
|
||||
|
||||
|
||||
beepValues.Add(new beepclass("Loud High freq Beep" , 0b00010111 ));
|
||||
beepValues.Add(new beepclass("Loud Low freq Beep" , 0b00011111 ));
|
||||
beepValues.Add(new beepclass("Normal High freq Beep", 0b00010110 ));
|
||||
beepValues.Add(new beepclass("Normal Low freq Beep" , 0b00011110 ));
|
||||
beepValues.Add(new beepclass("No Beep (only led)" , 0b00011010 ));
|
||||
step = "GetPortNames";
|
||||
try
|
||||
{
|
||||
foreach (string cn in System.IO.Ports.SerialPort.GetPortNames())
|
||||
{
|
||||
cComPort.Items.Add(cn);
|
||||
}
|
||||
thisStation.splunkLog?.WriteSplunkLog(step, LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation?.splunkLog?.WriteException(className, step, ex);
|
||||
MessageBox.Show($"Serial err {ex.Message}");
|
||||
}
|
||||
|
||||
step = "BeepValues";
|
||||
try
|
||||
{
|
||||
beepValues.Add(new beepclass("Loud High freq Beep", 0b00010111));
|
||||
beepValues.Add(new beepclass("Loud Low freq Beep", 0b00011111));
|
||||
beepValues.Add(new beepclass("Normal High freq Beep", 0b00010110));
|
||||
beepValues.Add(new beepclass("Normal Low freq Beep", 0b00011110));
|
||||
beepValues.Add(new beepclass("No Beep (only led)", 0b00011010));
|
||||
tBeep.ItemsSource = beepValues;
|
||||
thisStation.splunkLog?.WriteSplunkLog(step, LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation?.splunkLog?.WriteException(className, step, ex);
|
||||
MessageBox.Show($"Serial err {ex.Message}");
|
||||
}
|
||||
|
||||
// 7 6 5 4 3210
|
||||
// 1 0 0 1 1 1 0 0 1 1 1 0 0001
|
||||
|
|
@ -160,17 +240,28 @@ namespace eDosStation
|
|||
|
||||
//beepValues.Add(new beepclass("Beep", 22));
|
||||
//beepValues.Add(new beepclass("No Beep", 18));
|
||||
tBeep.ItemsSource = beepValues;
|
||||
|
||||
string thisComport = $"COM{thisStation.ComPort}";
|
||||
if (!string.IsNullOrEmpty(eDosCom)) thisComport = eDosCom;
|
||||
if (!cComPort.Items.Contains(thisComport)) cComPort.Items.Add(thisComport);
|
||||
cComPort.SelectedItem = thisComport;
|
||||
step = "Select com";
|
||||
try
|
||||
{
|
||||
string thisComport = $"COM{thisStation.ComPort}";
|
||||
if (!string.IsNullOrEmpty(eDosCom)) thisComport = eDosCom;
|
||||
if (!cComPort.Items.Contains(thisComport)) cComPort.Items.Add(thisComport);
|
||||
cComPort.SelectedItem = thisComport;
|
||||
thisStation.splunkLog?.WriteSplunkLog(step, LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation?.splunkLog?.WriteException(className, step, ex);
|
||||
MessageBox.Show($"Serial err {ex.Message}");
|
||||
}
|
||||
|
||||
try {
|
||||
DataSet1.InstallationDataTable tbInstallations;
|
||||
using (var ta = new DataSet1TableAdapters.InstallationTableAdapter())
|
||||
tbInstallations = ta.GetData();
|
||||
step = "tbInstallations";
|
||||
try
|
||||
{
|
||||
DataSet1.InstallationDataTable tbInstallations;
|
||||
using (var ta = new DataSet1TableAdapters.InstallationTableAdapter())
|
||||
tbInstallations = ta.GetData();
|
||||
tbInstallations.AddInstallationRow(0, "-");
|
||||
foreach (DataSet1.InstallationRow r in tbInstallations.Rows)
|
||||
{
|
||||
|
|
@ -179,112 +270,123 @@ namespace eDosStation
|
|||
}
|
||||
CIns1.SelectedValue = thisStation.Inst_CODE1;
|
||||
CIns2.SelectedValue = thisStation.Inst_CODE2;
|
||||
thisStation.splunkLog?.WriteSplunkLog(step, LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show($"SerINstallations err {ex.Message}");
|
||||
thisStation?.splunkLog?.WriteException(className, step, ex);
|
||||
MessageBox.Show($"SetINstallations err {ex.Message}");
|
||||
}
|
||||
|
||||
step = "setCheckBoxes";
|
||||
try
|
||||
{
|
||||
tBeep.SelectedValue = thisStation.useBeep;
|
||||
cbValidation.IsChecked = thisStation.useTestButtons;
|
||||
cbCheckUsers.IsChecked= thisStation.checkUser;
|
||||
cbCheckUsers.IsChecked = thisStation.checkUser;
|
||||
cbRestartCom.IsChecked = thisStation.RestartCom;
|
||||
tEPDTimeout.Text = thisStation.EPDTimeOut.ToString();
|
||||
cbRestartComFirst.IsChecked = thisStation.RestartComFirst;
|
||||
cbOnlyMK2.IsChecked = thisStation.OnlyMK2;
|
||||
cbAllowMultipleEPD.IsChecked = thisStation.AllowMultipleEPD;
|
||||
thisStation.splunkLog?.WriteSplunkLog(step, LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation?.splunkLog?.WriteException(className, step, ex);
|
||||
MessageBox.Show($"Settings err {ex.Message}");
|
||||
}
|
||||
|
||||
try {
|
||||
step = "CheckCon";
|
||||
try
|
||||
{
|
||||
bool rv = thisStation.dataInterface.checkCon(false);
|
||||
thisStation.splunkLog?.WriteSplunkLog(step, LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
thisStation?.splunkLog?.WriteException(className, step, ex);
|
||||
MessageBox.Show($"Interface check {ex.Message}");
|
||||
}
|
||||
//StartReader();
|
||||
step = "endLoaded";
|
||||
thisStation?.splunkLog?.WriteSplunkLog(step, LSWLib.CLog.iseverity.info);
|
||||
}
|
||||
|
||||
#region BadgeReader
|
||||
public void StartReader()
|
||||
{
|
||||
if (dfReader == null)
|
||||
{
|
||||
dfReader = new LSWDesfirePublic.CCard();
|
||||
dfReader.GetReaderList();
|
||||
if (dfReader.readersList.Contains(thisStation.Reader))
|
||||
{
|
||||
dfReader.SetReader(thisStation.Reader);
|
||||
dfReader.Badged += DFReader_Badged;
|
||||
dfReader.BadgeTO += DfReader_BadgeTO;
|
||||
dfReader.BadgeError += DfReader_BadgeError;
|
||||
ReaderTask = dfReader.Wait(5000, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder er = new StringBuilder($"Badgelezer \"{thisStation.Reader}\" niet gevonden!.\nDeze lezers zijn beschikbaar:\n");
|
||||
dfReader.GetReaderList();
|
||||
foreach (string r in dfReader.readersList) er.AppendLine($"-> {r}");
|
||||
MessageBox.Show(er.ToString(), "Badge Lezer", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
dfReader.Dispose(); dfReader = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
void CheckBadge()
|
||||
{
|
||||
thisStation.splunkLog?.KvSet(LSWLib.CLog.skeys.persID, _User.PersID);
|
||||
thisStation.splunkLog?.WriteSplunkLog("CheckBadge", LSWLib.CLog.iseverity.info, _User.PersID.ToString(), null);
|
||||
//Dispatcher.InvokeAsync(() => { ShowUserInfo(); });
|
||||
}
|
||||
public void showBadge(int persID, string csn)
|
||||
{
|
||||
//CSN.Text = csn;
|
||||
//Site.Text = string.Empty;
|
||||
//Code.Text = persID.ToString();
|
||||
_User = thisStation.dataInterface.GetUser(null, persID.ToString(), true);
|
||||
Dispatcher.InvokeAsync(CheckBadge, DispatcherPriority.Normal);
|
||||
}
|
||||
private void DfReader_BadgeError(LSWDesfirePublic.CCard Sender, LSWDesfirePublic.BadgeErrorEventArgs e)
|
||||
{
|
||||
// endPage();
|
||||
}
|
||||
private void DfReader_BadgeTO(LSWDesfirePublic.CCard Sender, EventArgs e)
|
||||
{
|
||||
//this.Dispatcher.InvokeAsync(new Action(() => endPage()), DispatcherPriority.Normal);
|
||||
}
|
||||
private void DFReader_Badged(LSWDesfirePublic.CCard Sender, LSWDesfirePublic.BadgeEventArgs e)
|
||||
{
|
||||
if (e.PersID > 0)
|
||||
this.Dispatcher.InvokeAsync(new Action(() => showBadge(e.PersID, e.UID)), DispatcherPriority.Background);
|
||||
else
|
||||
{
|
||||
string msg = $"No PersID found on badge {e.UID}";
|
||||
MessageBox.Show(msg, "Error", MessageBoxButton.OK);
|
||||
thisStation.splunkLog?.WriteSplunkLog("Badged", LSWLib.CLog.iseverity.warning, null, msg);
|
||||
}
|
||||
}
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
//try
|
||||
//{
|
||||
// if (dfReader != null )
|
||||
// {
|
||||
// dfReader.WaitEnd();
|
||||
// System.Threading.Thread.Sleep(2000);
|
||||
// dfReader.Dispose();
|
||||
// dfReader = null;
|
||||
// }
|
||||
//}
|
||||
//catch (System.Exception ex)
|
||||
//{
|
||||
// System.Diagnostics.Debug.WriteLine(ex.Message);
|
||||
//}
|
||||
}
|
||||
//public void StartReader()
|
||||
//{
|
||||
// if (dfReader == null)
|
||||
// {
|
||||
// dfReader = new LSWDesfirePublic.CCard();
|
||||
// dfReader.GetReaderList();
|
||||
// if (dfReader.readersList.Contains(thisStation.Reader))
|
||||
// {
|
||||
// dfReader.SetReader(thisStation.Reader);
|
||||
// dfReader.Badged += DFReader_Badged;
|
||||
// dfReader.BadgeTO += DfReader_BadgeTO;
|
||||
// dfReader.BadgeError += DfReader_BadgeError;
|
||||
// ReaderTask = dfReader.Wait(5000, 10);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// StringBuilder er = new StringBuilder($"Badgelezer \"{thisStation.Reader}\" niet gevonden!.\nDeze lezers zijn beschikbaar:\n");
|
||||
// dfReader.GetReaderList();
|
||||
// foreach (string r in dfReader.readersList) er.AppendLine($"-> {r}");
|
||||
// MessageBox.Show(er.ToString(), "Badge Lezer", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
// dfReader.Dispose(); dfReader = null;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//void CheckBadge()
|
||||
//{
|
||||
// thisStation.splunkLog?.KvSet(LSWLib.CLog.skeys.persID, _User.PersID);
|
||||
// thisStation.splunkLog?.WriteSplunkLog("CheckBadge", LSWLib.CLog.iseverity.info, _User.PersID.ToString(), null);
|
||||
// //Dispatcher.InvokeAsync(() => { ShowUserInfo(); });
|
||||
//}
|
||||
//public void showBadge(int persID, string csn)
|
||||
//{
|
||||
// //CSN.Text = csn;
|
||||
// //Site.Text = string.Empty;
|
||||
// //Code.Text = persID.ToString();
|
||||
// _User = thisStation.dataInterface.GetUser(null, persID.ToString(), true);
|
||||
// Dispatcher.InvokeAsync(CheckBadge, DispatcherPriority.Normal);
|
||||
//}
|
||||
//private void DfReader_BadgeError(LSWDesfirePublic.CCard Sender, LSWDesfirePublic.BadgeErrorEventArgs e)
|
||||
//{
|
||||
// // endPage();
|
||||
//}
|
||||
//private void DfReader_BadgeTO(LSWDesfirePublic.CCard Sender, EventArgs e)
|
||||
//{
|
||||
// //this.Dispatcher.InvokeAsync(new Action(() => endPage()), DispatcherPriority.Normal);
|
||||
//}
|
||||
//private void DFReader_Badged(LSWDesfirePublic.CCard Sender, LSWDesfirePublic.BadgeEventArgs e)
|
||||
//{
|
||||
// if (e.PersID > 0)
|
||||
// this.Dispatcher.InvokeAsync(new Action(() => showBadge(e.PersID, e.UID)), DispatcherPriority.Background);
|
||||
// else
|
||||
// {
|
||||
// string msg = $"No PersID found on badge {e.UID}";
|
||||
// MessageBox.Show(msg, "Error", MessageBoxButton.OK);
|
||||
// thisStation.splunkLog?.WriteSplunkLog("Badged", LSWLib.CLog.iseverity.warning, null, msg);
|
||||
// }
|
||||
//}
|
||||
//private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
//{
|
||||
// //try
|
||||
// //{
|
||||
// // if (dfReader != null )
|
||||
// // {
|
||||
// // dfReader.WaitEnd();
|
||||
// // System.Threading.Thread.Sleep(2000);
|
||||
// // dfReader.Dispose();
|
||||
// // dfReader = null;
|
||||
// // }
|
||||
// //}
|
||||
// //catch (System.Exception ex)
|
||||
// //{
|
||||
// // System.Diagnostics.Debug.WriteLine(ex.Message);
|
||||
// //}
|
||||
//}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ namespace eDosStation
|
|||
{
|
||||
InitializeComponent();
|
||||
thisStation = curStation;
|
||||
EpdReading = false;
|
||||
FinalTimeOut = false;
|
||||
EntryState = eEntryState.none;
|
||||
}
|
||||
|
||||
|
|
@ -43,6 +45,7 @@ namespace eDosStation
|
|||
}
|
||||
}
|
||||
|
||||
#region EPD Callback
|
||||
private void Ep_EpdTO(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdTOEventArgs e)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("TIME OUT");
|
||||
|
|
@ -53,17 +56,20 @@ namespace eDosStation
|
|||
{
|
||||
System.Diagnostics.Debug.WriteLine("ERROR ");
|
||||
Dispatcher.InvokeAsync(() => {
|
||||
MessageBox.Show($"EPD Error {e.returnValue}");
|
||||
MessageBox.Show($"EPD Error {e.returnValue} {e.ErrorRV} {e.ErrorStep}");
|
||||
Dispatcher.InvokeAsync(() => { SetTimedOutAndEnd(); });
|
||||
});
|
||||
}
|
||||
|
||||
private void Ep_EpdRead(EpdBaseClr.Epd2 Sender, EpdBaseClr.EpdEventArgs e)
|
||||
{
|
||||
EpdReading = false; dispatcherTimer?.Stop();
|
||||
EpdReading = false;
|
||||
dispatcherTimer?.Stop();
|
||||
Dispatcher.InvokeAsync(() => LoadDoses());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void LoadDoses()
|
||||
{
|
||||
int rv = 0;
|
||||
|
|
@ -82,7 +88,7 @@ namespace eDosStation
|
|||
{
|
||||
hasAlarm.Text = "Yes";
|
||||
} else
|
||||
hasAlarm.Text = "no";
|
||||
hasAlarm.Text = "No";
|
||||
|
||||
epdid.Text = ep.EpdID.ToString();
|
||||
var stype = new StringBuilder();
|
||||
|
|
|
|||
|
|
@ -41,6 +41,13 @@ namespace eDosStation
|
|||
public double InfoScreenTimeout { get; internal set; }
|
||||
public bool WriteConfig32 { get; internal set; }
|
||||
|
||||
|
||||
public const int defInst_CODE1 = 1;
|
||||
public const int defInst_CODE2 = 11;
|
||||
public const string defInst_Name1 = "BR1";
|
||||
public const string defInst_Name2 = "Venus";
|
||||
|
||||
public cDevCon DevCon;
|
||||
public bool Changed = false;
|
||||
public int Error = 0;
|
||||
public string ErrorMessage;
|
||||
|
|
@ -63,10 +70,10 @@ namespace eDosStation
|
|||
Error = 0;
|
||||
ErrorMessage = string.Empty;
|
||||
ComPort = 0;
|
||||
Inst_CODE1 = 1;
|
||||
Inst_CODE2 = 11;
|
||||
Inst_Name1 = "BR1";
|
||||
Inst_Name2 = "Venus";
|
||||
Inst_CODE1 = defInst_CODE1;
|
||||
Inst_CODE2 = defInst_CODE2;
|
||||
Inst_Name1 = defInst_Name1;
|
||||
Inst_Name2 = defInst_Name2;
|
||||
TestCSN = System.Configuration.ConfigurationManager.AppSettings["TestCSN"];
|
||||
TestCode = System.Configuration.ConfigurationManager.AppSettings["TestCode"];
|
||||
insComments = new StringBuilder();
|
||||
|
|
@ -121,7 +128,7 @@ namespace eDosStation
|
|||
RestartComFirst = rs.BoolOrDefault("RestartComFirst", false);
|
||||
OnlyMK2 = rs.BoolOrDefault("OnlyMK2", false);
|
||||
AllowMultipleEPD = rs.BoolOrDefault("AllowMultipleEPD", false);
|
||||
WriteConfig32 = false; // rs.BoolOrDefault("WriteConfig32", false);
|
||||
WriteConfig32 = true; // rs.BoolOrDefault("WriteConfig32", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -138,7 +145,7 @@ namespace eDosStation
|
|||
EPDTimeOut = 10000;
|
||||
EPDRetries = 2;
|
||||
AllowMultipleEPD = false;
|
||||
WriteConfig32 = false;
|
||||
WriteConfig32 = true;
|
||||
}
|
||||
rs.Close();
|
||||
splunkLog.WriteSplunkLog("StationInit", spl1.iseverity.info);
|
||||
|
|
@ -193,12 +200,11 @@ namespace eDosStation
|
|||
}
|
||||
co?.Close();
|
||||
}
|
||||
DevCon = new cDevCon(ComPort, splunkLog);
|
||||
}
|
||||
private void CmdSetParams(SqlCommand cmd)
|
||||
{
|
||||
//for (int ix = 0; ix < cmd.Parameters.Count; ix++)
|
||||
// System.Diagnostics.Debug.WriteLine(cmd.Parameters[ix].ParameterName);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
cmd.SetIfExists("ComPort", ComPort);
|
||||
|
|
@ -228,10 +234,10 @@ namespace eDosStation
|
|||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
splunkLog.WriteException("Station", "SetParams", ex);
|
||||
splunkLog?.WriteException("Station", "SetParams", ex);
|
||||
Error = 1;
|
||||
ErrorMessage = ex.Message;
|
||||
if (stationLog != null) stationLog.WriteLine($"GetStationSettings error {ex.Message} {System.DateTime.Now}");
|
||||
stationLog?.WriteLine($"GetStationSettings error {ex.Message} {System.DateTime.Now}");
|
||||
}
|
||||
}
|
||||
private void UpdateToDb(SqlConnection co, SqlCommand cmd)
|
||||
|
|
@ -243,14 +249,15 @@ namespace eDosStation
|
|||
cmd.Parameters.Clear();
|
||||
SqlCommandBuilder.DeriveParameters(cmd);
|
||||
CmdSetParams(cmd);
|
||||
splunkLog.KvAddCommand(spl1.skeys.sqlQuery, cmd);
|
||||
splunkLog?.KvAddCommand(spl1.skeys.sqlQuery, cmd);
|
||||
cmd.ExecuteNonQuery();
|
||||
splunkLog?.WriteSplunkLog(taskName,spl1.iseverity.info);
|
||||
}
|
||||
catch (System.Exception ex) {
|
||||
splunkLog.WriteException(moduleName, taskName, ex);
|
||||
if (stationLog != null) stationLog.WriteLine($"{taskName} error {ex.Message} co {co.DataSource} {System.DateTime.Now}");
|
||||
splunkLog?.WriteException(moduleName, taskName, ex);
|
||||
stationLog?.WriteLine($"{taskName} error {ex.Message} co {co.DataSource} {System.DateTime.Now}");
|
||||
}
|
||||
splunkLog.KvClear();
|
||||
splunkLog?.KvClear();
|
||||
}
|
||||
public void Update()
|
||||
{
|
||||
|
|
@ -262,26 +269,46 @@ namespace eDosStation
|
|||
try
|
||||
{
|
||||
co = dataInterface.getCon(true);
|
||||
splunkLog.KvAddCommand(spl1.skeys.sqlQuery,cmd);
|
||||
splunkLog?.KvAddCommand(spl1.skeys.sqlQuery,cmd);
|
||||
UpdateToDb(co, cmd);
|
||||
co.Close();
|
||||
|
||||
co = dataInterface.getConCentral(true);
|
||||
splunkLog.KvClear(spl1.skeys.sqlQuery);
|
||||
splunkLog.KvAddCommand(spl1.skeys.sqlQuery, cmd);
|
||||
splunkLog?.KvClear(spl1.skeys.sqlQuery);
|
||||
splunkLog?.KvAddCommand(spl1.skeys.sqlQuery, cmd);
|
||||
UpdateToDb(co, cmd);
|
||||
splunkLog?.WriteSplunkLog(taskName,spl1.iseverity.info);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Error = 1;
|
||||
ErrorMessage = ex.Message;
|
||||
splunkLog.WriteException(moduleName, taskName, ex);
|
||||
if (stationLog != null) stationLog.WriteLine($"{taskName} error {ex.Message} co {co.DataSource} {System.DateTime.Now}");
|
||||
splunkLog?.WriteException(moduleName, taskName, ex);
|
||||
stationLog?.WriteLine($"{taskName} error {ex.Message} co {co.DataSource} {System.DateTime.Now}");
|
||||
}
|
||||
co?.Close();
|
||||
splunkLog.KvClear();
|
||||
splunkLog?.KvClear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string find()
|
||||
{
|
||||
string rv = "COM" + ComPort.ToString();
|
||||
if (DevCon != null)
|
||||
{
|
||||
if (DevCon.hasCommand) rv = DevCon.FindEdosCom();
|
||||
else rv = DevCon.comdefault;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
public string DeviceRestart()
|
||||
{
|
||||
string er = null;
|
||||
if (DevCon != null && DevCon.hasCommand) er=DevCon.Restart();
|
||||
if (!string.IsNullOrEmpty(er)) splunkLog?.WriteSplunkLog("DeviceRestart", spl1.iseverity.err, er);
|
||||
return er;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,72 +1,72 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">>
|
||||
<assemblyIdentity version="1.0.0.0" name="SCKCEN.HPH.eDosStation"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
|
||||
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
|
||||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
|
||||
<ws2:longPathAware>true</ws2:longPathAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
|
||||
</assembly>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">>
|
||||
<assemblyIdentity version="1.0.0.0" name="SCKCEN.HPH.eDosStation"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!--<requestedExecutionLevel level="asInvoker" uiAccess="false" />-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<!--<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
|
||||
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
|
||||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
|
||||
<ws2:longPathAware>true</ws2:longPathAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
|
||||
</assembly>
|
||||
|
|
|
|||
120
eDosStation/cDevCon.cs
Normal file
120
eDosStation/cDevCon.cs
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using cspl = LSWLib.CLog;
|
||||
|
||||
namespace eDosStation
|
||||
{
|
||||
public class cDevCon
|
||||
{
|
||||
public StringBuilder error = null;
|
||||
public bool hasError;
|
||||
public bool hasCommand;
|
||||
public string DevConFolder, DevConExePath;
|
||||
public string comdefault;
|
||||
cspl spl;
|
||||
System.Diagnostics.Process DevConProcess = null;
|
||||
|
||||
const string usbIdentifier = @"USB\VID_0EBB&PID_0340&MI_00";
|
||||
const string cDevConFolder = "extra";
|
||||
const string cDevConexe = "devcon.exe";
|
||||
const string className = "devcon";
|
||||
|
||||
public static bool IsAdministrator()
|
||||
{
|
||||
return (new System.Security.Principal.WindowsPrincipal(System.Security.Principal.WindowsIdentity.GetCurrent()))
|
||||
.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
public cDevCon(int iCOM, cspl _spl)
|
||||
{
|
||||
spl = _spl;
|
||||
comdefault = "COM" + iCOM.ToString();
|
||||
hasCommand = false;
|
||||
DevConProcess = null;
|
||||
error = new StringBuilder();
|
||||
hasError = false;
|
||||
if (IsAdministrator())
|
||||
{
|
||||
DevConFolder = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, cDevConFolder);
|
||||
if (System.IO.Directory.Exists(DevConFolder))
|
||||
{
|
||||
DevConExePath = System.IO.Path.Combine(DevConFolder, cDevConexe);
|
||||
if (System.IO.File.Exists(DevConExePath)) hasCommand = true;
|
||||
}
|
||||
}
|
||||
else spl?.WriteSplunkLog("cDecCon", cspl.iseverity.warning, "No Admin");
|
||||
}
|
||||
private string ExecuteDevcon(string command)
|
||||
{
|
||||
const string module = "ExecuteDevcon";
|
||||
if (!hasCommand) return string.Empty;
|
||||
hasError = false;
|
||||
error.Clear();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try
|
||||
{
|
||||
using (DevConProcess = new System.Diagnostics.Process())
|
||||
{
|
||||
DevConProcess.StartInfo.WorkingDirectory = DevConFolder;
|
||||
DevConProcess.StartInfo.FileName = DevConExePath;
|
||||
DevConProcess.StartInfo.Arguments = $"{command} \"{usbIdentifier}\"";
|
||||
DevConProcess.StartInfo.RedirectStandardOutput = true;
|
||||
DevConProcess.StartInfo.UseShellExecute = false;
|
||||
DevConProcess.Start();
|
||||
var i = DevConProcess.StandardOutput;
|
||||
if (i!=null)
|
||||
while (!i.EndOfStream)
|
||||
{
|
||||
sb.AppendLine(i.ReadLine());
|
||||
}
|
||||
DevConProcess.WaitForExit();
|
||||
spl?.WriteSplunkLog(module, cspl.iseverity.info);
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
spl?.WriteException(className, module, ex);
|
||||
hasError = true;
|
||||
sb.Clear();
|
||||
error.Append(ex.Message);
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public string FindEdosCom()
|
||||
{
|
||||
const string module = "FindEdosCom";
|
||||
string eDosCom = comdefault;
|
||||
if (hasCommand)
|
||||
try
|
||||
{
|
||||
string cp = ExecuteDevcon("find");
|
||||
if (!string.IsNullOrEmpty(cp))
|
||||
{
|
||||
var ix = cp.IndexOf("(COM");
|
||||
if (ix >= 0) eDosCom = cp.Substring(ix + 1, 4);
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
spl?.WriteException(className, module, ex);
|
||||
}
|
||||
return eDosCom;
|
||||
}
|
||||
|
||||
public string Restart()
|
||||
{
|
||||
string rv = string.Empty;
|
||||
error.Clear();
|
||||
hasError = false;
|
||||
if (hasCommand)
|
||||
{
|
||||
rv = ExecuteDevcon("restart");
|
||||
if (hasError) rv = error.ToString();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace eDosStation
|
||||
{
|
||||
class devcon
|
||||
{
|
||||
static StringBuilder error = null;
|
||||
static bool hasError;
|
||||
static private string ExecuteDevcon(string command)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
System.Diagnostics.Process p = null;
|
||||
string curPath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "extra");
|
||||
string devcon;
|
||||
|
||||
if (System.IO.Directory.Exists(curPath))
|
||||
{
|
||||
devcon = System.IO.Path.Combine(curPath, "devcon.exe");
|
||||
if (System.IO.File.Exists(devcon))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (p = new System.Diagnostics.Process())
|
||||
{
|
||||
p.StartInfo.WorkingDirectory = curPath;
|
||||
p.StartInfo.FileName = devcon;
|
||||
p.StartInfo.Arguments = $"{command} \"USB\\VID_0EBB&PID_0340&MI_00\"";
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.Start();
|
||||
var i = p.StandardOutput;
|
||||
while (!i.EndOfStream)
|
||||
{
|
||||
sb.AppendLine(i.ReadLine());
|
||||
}
|
||||
p.WaitForExit();
|
||||
}
|
||||
} catch(System.Exception ex)
|
||||
{
|
||||
hasError = true;
|
||||
error.Append(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
static public string FindEdosCom()
|
||||
{
|
||||
string eDosCom = null;
|
||||
try
|
||||
{
|
||||
string cp = devcon.ExecuteDevcon("find");
|
||||
var ix = cp.IndexOf("(COM");
|
||||
if (ix >= 0) eDosCom = cp.Substring(ix + 1, 4);
|
||||
}
|
||||
catch { }
|
||||
return eDosCom;
|
||||
}
|
||||
|
||||
static public string Restart()
|
||||
{
|
||||
error = new StringBuilder(); hasError = false;
|
||||
string cp = devcon.ExecuteDevcon("restart");
|
||||
if (hasError) return error.ToString(); else return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -303,7 +303,7 @@
|
|||
<DependentUpon>DataSet1.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Decoder.cs" />
|
||||
<Compile Include="devcon.cs" />
|
||||
<Compile Include="cDevCon.cs" />
|
||||
<Compile Include="EntryBadge.xaml.cs">
|
||||
<DependentUpon>EntryBadge.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
@ -489,7 +489,7 @@
|
|||
<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>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>"C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64\signtool.exe" sign /sha1 857150b64ef7d3e679c8cbde425d2a0b5e58ffaa /fd sha256 /d "Integrity & Authenticity" /tr "http://timestamp.digicert.com" $(TargetPath)</PostBuildEvent>
|
||||
<PostBuildEvent>%25signer%25 $(TargetPath)</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<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')" />
|
||||
|
|
|
|||
BIN
eDosStation/eDosStation.tar
Normal file
BIN
eDosStation/eDosStation.tar
Normal file
Binary file not shown.
BIN
eDosStation/eDosStation.zip
Normal file
BIN
eDosStation/eDosStation.zip
Normal file
Binary file not shown.
31
eDosStation/sync.cmd
Normal file
31
eDosStation/sync.cmd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
pause "eDosStation to Sqlsrv7 "
|
||||
|
||||
|
||||
set src="D:\l\src\cs2024\eDosStation\eDosStation\bin\Release"
|
||||
set C="%cd:"=%\bin\release"
|
||||
if /I %src%==%C% (echo "Path OK ") else (echo "Path issue !")
|
||||
Pause was ok ?
|
||||
|
||||
set dst="\\sqlsrv7\c$\Soft\eDos2023"
|
||||
|
||||
::set zip="eDosStation.tar"
|
||||
::tar -cf %zip% -C %src% --exclude *.zip *.*
|
||||
|
||||
set zip="eDosStation.zip"
|
||||
"c:\program files\7-zip\7z.exe" a -r %zip% .\bin\release\*.*
|
||||
|
||||
xcopy %zip% %dst% /i /h /R /y
|
||||
|
||||
|
||||
:: %src:"=% remove quotes
|
||||
:: %src:"=%\*.*9 remove quotes and add \*.*
|
||||
:: /i If destination does not exist and copying more than one file, assumes that destination must be a directory.
|
||||
:: /h Copies hidden and system files also.
|
||||
:: /r Overwrites read-only files
|
||||
:: /y uppresses prompting to confirm you want to overwrite an existing destination file.
|
||||
:: /s Copies directories and subdirectories except empty ones
|
||||
|
||||
pause
|
||||
|
||||
|
||||
|
||||
BIN
eDosStation/x.zip
Normal file
BIN
eDosStation/x.zip
Normal file
Binary file not shown.
|
|
@ -11,7 +11,7 @@ namespace syncEdosLocal
|
|||
|
||||
class cResult
|
||||
{
|
||||
|
||||
const string className = "cResult";
|
||||
public DateTime timestamp;
|
||||
public int VisitsNew, VisitsSkipped, VisitsAddedExits, VisitsAddedEntries;
|
||||
public int ID_Visit_Min, ID_Visit_Max;
|
||||
|
|
@ -441,20 +441,20 @@ namespace syncEdosLocal
|
|||
DataSet1.CentralVisitsRow cr;
|
||||
try
|
||||
{
|
||||
using (var ta = new DataSet1TableAdapters.LocalVisitsTableAdapter())
|
||||
using (var tc = new DataSet1TableAdapters.CentralVisitsTableAdapter())
|
||||
using (var localTA = new DataSet1TableAdapters.LocalVisitsTableAdapter())
|
||||
using (var centralTA = new DataSet1TableAdapters.CentralVisitsTableAdapter())
|
||||
{
|
||||
ta.Connection = coLocal;
|
||||
tc.Connection = coCentral;
|
||||
tc.ClearBeforeFill = false;
|
||||
ta.Fill(ds.LocalVisits);
|
||||
localTA.Connection = coLocal;
|
||||
centralTA.Connection = coCentral;
|
||||
centralTA.ClearBeforeFill = false;
|
||||
localTA.Fill(ds.LocalVisits);
|
||||
spLog.KvAdd(spl.skeys.recordsAffected, ds.LocalVisits.Rows.Count);
|
||||
foreach (DataSet1.LocalVisitsRow lr in ds.LocalVisits.Rows)
|
||||
{
|
||||
Result.CheckVisitID(lr.ID_Visit); //min max
|
||||
cr = ds.CentralVisits.FindByID_StationID_Visit(lr.ID_Station, lr.ID_Visit);
|
||||
if (cr == null)
|
||||
tc.Fill(ds.CentralVisits, lr.ID_Station, lr.ID_Visit);
|
||||
centralTA.Fill(ds.CentralVisits, lr.ID_Station, lr.ID_Visit);
|
||||
cr = ds.CentralVisits.FindByID_StationID_Visit(lr.ID_Station, lr.ID_Visit);
|
||||
if (cr == null)
|
||||
{
|
||||
|
|
@ -470,34 +470,48 @@ namespace syncEdosLocal
|
|||
case 2: if ((lr.VisitStatus & 1) == 1) { copyEntry(lr, cr); lr.syncedEntry = lr.syncedExit = true; Result.VisitsAddedEntries++; } break;
|
||||
}
|
||||
}
|
||||
ta.Update(ds.LocalVisits);
|
||||
tc.Update(ds.CentralVisits);
|
||||
localTA.Update(ds.LocalVisits);
|
||||
centralTA.Update(ds.CentralVisits);
|
||||
}
|
||||
spLog.KvAdd(spl.skeys.recordsAffected, Result.VisitsNew);
|
||||
spLog?.WriteSplunkLog(sStep, spl.iseverity.info);
|
||||
spLog.KvClear();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
error = true;
|
||||
Result.ErrorMessage = ex.Message;
|
||||
spLog.WriteException(null, sStep, ex);
|
||||
spLog.WriteException(moduleName, sStep, ex);
|
||||
}
|
||||
ds.Dispose();
|
||||
}
|
||||
private static void copyEntry(DataSet1.LocalVisitsRow lr, DataSet1.CentralVisitsRow cr)
|
||||
{
|
||||
cr["ID_Station"] = lr["ID_Station"];
|
||||
cr["ID_Visit"] = lr["ID_Visit"];
|
||||
cr["Inst_CODE"] = lr["Inst_CODE"];
|
||||
cr["PersID"] = lr["PersID"];
|
||||
cr["ID_Task"] = lr["ID_Task"];
|
||||
cr["EntryTime"] = lr["EntryTime"];
|
||||
cr["ID_EPD"] = lr["ID_EPD"];
|
||||
cr["isBG"] = lr["isBG"];
|
||||
cr["ENTRY_EPD_CLOCK"] = lr["ENTRY_EPD_CLOCK"];
|
||||
cr["epdType"] = lr["epdType"];
|
||||
const string module = "copyEntry";
|
||||
try
|
||||
{
|
||||
cr["ID_Station"] = lr["ID_Station"];
|
||||
cr["ID_Visit"] = lr["ID_Visit"];
|
||||
cr["Inst_CODE"] = lr["Inst_CODE"];
|
||||
cr["PersID"] = lr["PersID"];
|
||||
cr["ID_Task"] = lr["ID_Task"];
|
||||
cr["EntryTime"] = lr["EntryTime"];
|
||||
cr["ID_EPD"] = lr["ID_EPD"];
|
||||
cr["isBG"] = lr["isBG"];
|
||||
cr["ENTRY_EPD_CLOCK"] = lr["ENTRY_EPD_CLOCK"];
|
||||
cr["epdType"] = lr["epdType"];
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
spLog?.WriteException(moduleName, null, ex);
|
||||
}
|
||||
}
|
||||
private static void copyExit(DataSet1.LocalVisitsRow lr, DataSet1.CentralVisitsRow cr)
|
||||
{
|
||||
cr["ReturnTime"] = lr["ReturnTime"];
|
||||
const string module = "copyExit";
|
||||
try
|
||||
{
|
||||
cr["ReturnTime"] = lr["ReturnTime"];
|
||||
cr["Hp10Dose"] = lr["Hp10Dose"];
|
||||
cr["Hp07Dose"] = lr["Hp07Dose"];
|
||||
cr["Hp10Total"] = lr["Hp10Total"];
|
||||
|
|
@ -535,18 +549,31 @@ namespace syncEdosLocal
|
|||
cr["eDosDose10Alarm"] = lr["eDosDose10Alarm"];
|
||||
cr["eDosRate10Warning"] = lr["eDosRate10Warning"];
|
||||
cr["eDosRate10Alarm"] = lr["eDosRate10Alarm"];
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
spLog?.WriteException(moduleName, null, ex);
|
||||
}
|
||||
}
|
||||
private static DataSet1.CentralVisitsRow copyrow(DataSet1.LocalVisitsRow lr, DataSet1.CentralVisitsDataTable centralVisits)
|
||||
{
|
||||
DataSet1.CentralVisitsRow cr = centralVisits.NewCentralVisitsRow();
|
||||
foreach (DataColumn sc in lr.Table.Columns)
|
||||
if (lr.Table.Columns.Contains(sc.ColumnName)) cr[sc.ColumnName] = lr[sc.ColumnName];
|
||||
centralVisits.AddCentralVisitsRow(cr);
|
||||
const string module = "copyExit";
|
||||
try
|
||||
{
|
||||
foreach (DataColumn sc in lr.Table.Columns)
|
||||
if (lr.Table.Columns.Contains(sc.ColumnName)) cr[sc.ColumnName] = lr[sc.ColumnName];
|
||||
centralVisits.AddCentralVisitsRow(cr);
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
spLog?.WriteException(moduleName, null, ex);
|
||||
}
|
||||
return cr;
|
||||
}
|
||||
private static void Connection_InfoMessage(object sender, System.Data.SqlClient.SqlInfoMessageEventArgs e)
|
||||
{
|
||||
spLog.Connection_InfoMessageLog(e, ref messages);
|
||||
spLog?.Connection_InfoMessageLog(e, ref messages);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
31
syncEdosLocal/sync.cmd
Normal file
31
syncEdosLocal/sync.cmd
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
pause syndEdosLocal to Sqlsrv7 "
|
||||
|
||||
|
||||
set src="D:\l\src\cs2024\eDosStation\syncEdosLocal\bin\Release"
|
||||
set C="%cd:"=%\bin\release"
|
||||
if /I %src%==%C% (echo "Path OK ") else (echo "Path issue !")
|
||||
Pause was ok ?
|
||||
|
||||
set dst="\\sqlsrv7\c$\Soft\eDos2023"
|
||||
|
||||
::set zip="eDosStation.tar"
|
||||
::tar -cf %zip% -C %src% --exclude *.zip *.*
|
||||
|
||||
set zip="syncEdosLocal.zip"
|
||||
"c:\program files\7-zip\7z.exe" a -r %zip% .\bin\release\*.*
|
||||
|
||||
xcopy %zip% %dst% /i /h /R /y
|
||||
|
||||
|
||||
:: %src:"=% remove quotes
|
||||
:: %src:"=%\*.*9 remove quotes and add \*.*
|
||||
:: /i If destination does not exist and copying more than one file, assumes that destination must be a directory.
|
||||
:: /h Copies hidden and system files also.
|
||||
:: /r Overwrites read-only files
|
||||
:: /y uppresses prompting to confirm you want to overwrite an existing destination file.
|
||||
:: /s Copies directories and subdirectories except empty ones
|
||||
|
||||
pause
|
||||
|
||||
|
||||
|
||||
BIN
syncEdosLocal/syncEdosLocal.7z
Normal file
BIN
syncEdosLocal/syncEdosLocal.7z
Normal file
Binary file not shown.
BIN
syncEdosLocal/syncEdosLocal.zip
Normal file
BIN
syncEdosLocal/syncEdosLocal.zip
Normal file
Binary file not shown.
BIN
x.zip
Normal file
BIN
x.zip
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue