tested with NG labels
This commit is contained in:
parent
161074da6b
commit
04efa1be62
8 changed files with 105 additions and 105 deletions
|
|
@ -124,14 +124,22 @@ int EpdBase::Epd2U::Open(DWORD DeviceID)
|
|||
|
||||
void EpdBase::Epd2U::Close()
|
||||
{
|
||||
if (port > 0)
|
||||
if (port > 0) CloseDevice();
|
||||
CurrentDeviceID = 0;
|
||||
}
|
||||
|
||||
int EpdBase::Epd2U::CloseAndSignal(WORD EndSessionControl, WORD duration)
|
||||
{
|
||||
|
||||
CloseDevice();
|
||||
int rv = 0;
|
||||
WORD r;
|
||||
Sleep(250);
|
||||
r = EndSession(EndSessionControl, duration);
|
||||
if (r == 1) rv = 0; else rv = 1;
|
||||
Close();
|
||||
return rv;
|
||||
}
|
||||
|
||||
//DeinitComms(port); CommsInitialized = 0;
|
||||
}
|
||||
|
||||
void EpdBase::Epd2U::DecodeFunctionFlags()
|
||||
{
|
||||
EpdType = (FunctionFlags & 0x1F00) >> 8;
|
||||
|
|
@ -300,39 +308,7 @@ WORD EpdBase::Epd2U::EPDReadConfig()
|
|||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return CommitRV;
|
||||
}
|
||||
WORD EpdBase::Epd2U::TurnOff()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
|
||||
OffRV = EpdOff();
|
||||
if (OffRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
EndSessionRV = EndSession(EndSessionControl,10);
|
||||
if (EndSessionRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
|
||||
else {
|
||||
CommitRV = Commit();
|
||||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
}
|
||||
return CommitRV;
|
||||
}
|
||||
WORD EpdBase::Epd2U::TurnOn()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
//OnRV = EpdOn();
|
||||
//if (OnRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
|
||||
EndSessionRV = EndSession(EndSessionControl, 10);
|
||||
if (EndSessionRV == 0) {
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
CommitRV = Commit();
|
||||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);*/
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
|
@ -507,21 +483,17 @@ WORD EpdBase::Epd2U::DeIssue()
|
|||
if (!VersionOK) Sleep(1000);// Versie < .. Commit & Sleep
|
||||
}
|
||||
|
||||
if (CommitRV &&!VersionOK ) {
|
||||
if (EPDIssued)
|
||||
{
|
||||
EndSession(EndSessionControl, 12); Commit();
|
||||
}
|
||||
if (CommitRV ) {
|
||||
CloseAndSignal(EndSessionControl, 12);
|
||||
rv = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
FlushBuffers(port);
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
EndSession(EndSessionControl, 40);
|
||||
CloseAndSignal(EndSessionControl, 40);
|
||||
rv = ErrorReason;
|
||||
}
|
||||
Close();
|
||||
return rv;
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -530,7 +502,7 @@ WORD EpdBase::Epd2U::DeIssue()
|
|||
/// <returns>O = OK</returns>
|
||||
WORD EpdBase::Epd2U::Issue()
|
||||
{
|
||||
WORD rv=0;
|
||||
int rv=0;
|
||||
IssueEpdRV = WriteAlarmDoseThresholdsRV = WriteAlarmRateThresholdsRV = WriteWearerNameRV = OnRV = CommitRV = 0;
|
||||
if (port == 0) return 0;
|
||||
WORD OKRV = SetFailFlag(); // all actions have been completed
|
||||
|
|
@ -543,27 +515,32 @@ WORD EpdBase::Epd2U::Issue()
|
|||
if (OKRV) OKRV = Commit();
|
||||
if (OKRV) OKRV = WriteWearerName(WearerName,(WORD)strlen((char *)WearerName));
|
||||
if (OKRV) OKRV = Commit();
|
||||
|
||||
if (OKRV == 0)
|
||||
{
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
rv = 1;
|
||||
}
|
||||
ClearFailFlag(); // all actions have been completed
|
||||
Commit();
|
||||
|
||||
|
||||
if (OKRV)
|
||||
{
|
||||
if (!DetectorsOn) {
|
||||
OKRV = EpdOn(); OKRV=Commit(); if (!VersionOK) Sleep(1500);
|
||||
OKRV = EpdOn();
|
||||
OKRV = Commit();
|
||||
if (!VersionOK) Sleep(1500);
|
||||
}
|
||||
else {
|
||||
EndSession(EndSessionControl, 12);
|
||||
Commit();
|
||||
CloseAndSignal(EndSessionControl, 12);
|
||||
rv = 0;
|
||||
}
|
||||
if (!OKRV)
|
||||
else
|
||||
{
|
||||
FlushBuffers(port);
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
EndSession(EndSessionControl, 40);
|
||||
CloseAndSignal(EndSessionControl, 40);
|
||||
rv = 1;
|
||||
}
|
||||
Close();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ namespace EpdBase
|
|||
int StartDiscover(int EpdTimeout);
|
||||
int Open(DWORD DeviceID);
|
||||
void Close();
|
||||
|
||||
int CloseAndSignal(WORD EndSessionControl, WORD duration);
|
||||
void DecodeFunctionFlags();
|
||||
|
||||
void DecodeStatus();
|
||||
|
|
|
|||
|
|
@ -555,7 +555,6 @@ void Epd3Base::Epd3U::decodeBaseCounters(int count)
|
|||
case CounterType::Counter_Fb1: D4 = Counts[ix].value; break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void Epd3Base::Epd3U::decodeTreshold(Mk3AlarmThresholds_t* th)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@ EpdBaseClr::Epd2::Epd2(int port)
|
|||
{
|
||||
//HANDLE hMod = LoadLibrary(L"Reader2.dll");
|
||||
EpdID = 0;
|
||||
//Jan2000 = gcnew DateTime(2000, 1, 1);
|
||||
isMK3 = EPDIssued = isBG = 0;
|
||||
epd = new EpdBase::Epd2U(port);
|
||||
epd3 = new Epd3Base::Epd3U(port);
|
||||
this->InitRV = epd->InitRv;
|
||||
//epd->StartCom();
|
||||
Hp10Name = gcnew String(tHp10);
|
||||
Hp07Name = gcnew String(tHp07);
|
||||
isTitleNG = false;
|
||||
}
|
||||
EpdBaseClr::Epd2::~Epd2()
|
||||
{
|
||||
|
|
@ -285,6 +286,7 @@ int EpdBaseClr::Epd2::AfterGetDoses(Epd3Base::Epd3U* epd)
|
|||
BC = epd->SG;
|
||||
FB = epd->FB;
|
||||
HG = epd->HG;
|
||||
NGgain = K3;
|
||||
return rv;
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -514,6 +516,8 @@ int EpdBaseClr::Epd2::AfterReadTresholds(EpdBase::Epd2U* epd)
|
|||
FB = epd->FB;
|
||||
HG = epd->HG;
|
||||
|
||||
NGgain = K3;
|
||||
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
|
@ -562,6 +566,7 @@ int EpdBaseClr::Epd2::AfterReadTresholds(Epd3Base::Epd3U* epd)
|
|||
FB = epd->FB;
|
||||
HG = epd->HG;
|
||||
|
||||
NGgain = K3;
|
||||
return rv;
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -620,7 +625,6 @@ int EpdBaseClr::Epd2::ReadExtraStatus(Epd3Base::Epd3U* epd)
|
|||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int EpdBaseClr::Epd2::AfterGetDoses(EpdBase::Epd2U* epd)
|
||||
{
|
||||
int rv = 0;
|
||||
|
|
@ -669,6 +673,8 @@ int EpdBaseClr::Epd2::AfterGetDoses(EpdBase::Epd2U* epd)
|
|||
BC = epd->SG;
|
||||
FB = epd->FB;
|
||||
HG = epd->HG;
|
||||
|
||||
NGgain = K3;
|
||||
return rv;
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -692,7 +698,6 @@ int EpdBaseClr::Epd2::GetAll(bool close)
|
|||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int EpdBaseClr::Epd2::GetAllDeissue()
|
||||
{
|
||||
int rv = 0;
|
||||
|
|
@ -709,7 +714,6 @@ int EpdBaseClr::Epd2::GetAllDeissue()
|
|||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clear Doses, for Neutron : get and check K, Issue
|
||||
/// </summary>
|
||||
|
|
@ -729,8 +733,6 @@ int EpdBaseClr::Epd2::IssueAndCheck(float gain)
|
|||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
int EpdBaseClr::Epd2::SwitchCon()
|
||||
{
|
||||
int rv = 0;
|
||||
|
|
@ -794,6 +796,15 @@ int EpdBaseClr::Epd2::ConnectAndStatus()
|
|||
rv = SwitchCon();
|
||||
AfterGetStatus(epd);
|
||||
}
|
||||
if (isTitleNG != isNG) {
|
||||
if (isNG) {
|
||||
Hp10Name = gcnew String(tHp10G); Hp07Name = gcnew String(tHp07N);
|
||||
}
|
||||
else {
|
||||
Hp10Name = gcnew String(tHp10); Hp07Name = gcnew String(tHp07);
|
||||
}
|
||||
isTitleNG = isNG;
|
||||
}
|
||||
}
|
||||
else
|
||||
ConnectError = epd->Error;
|
||||
|
|
@ -837,8 +848,8 @@ void EpdBaseClr::Epd2::WaitEnd()
|
|||
{
|
||||
if (waitTask != nullptr)
|
||||
{
|
||||
if (epd3->hWaitTimer!= nullptr)
|
||||
SetEvent(epd3->hWaitTimer);
|
||||
//if (epd3->hWaitTimer!= nullptr)
|
||||
// SetEvent(epd3->hWaitTimer);
|
||||
waitTask->Wait(750);
|
||||
if (waitTask->Status == System::Threading::Tasks::TaskStatus::Running) {
|
||||
tokenSource->Cancel();
|
||||
|
|
|
|||
|
|
@ -75,6 +75,10 @@ namespace EpdBaseClr {
|
|||
{
|
||||
/*private:
|
||||
DateTime^ Jan2000;*/
|
||||
const wchar_t* tHp07 = L"HP07";
|
||||
const wchar_t* tHp10 = L"HP10";
|
||||
const wchar_t* tHp07N = L"HPN";
|
||||
const wchar_t* tHp10G = L"HP10G";
|
||||
|
||||
public:
|
||||
delegate void dEpdRead(Epd2^ Sender, EpdEventArgs^ e);
|
||||
|
|
@ -126,7 +130,11 @@ namespace EpdBaseClr {
|
|||
public:
|
||||
EpdBase::Epd2U *epd;
|
||||
Epd3Base::Epd3U* epd3;
|
||||
//sEpdBase^ b;
|
||||
|
||||
String^ Hp07Name;
|
||||
String^ Hp10Name;
|
||||
bool isTitleNG;
|
||||
|
||||
DateTime^ RealTime;
|
||||
String^ WearerName;
|
||||
String^ WearerID;
|
||||
|
|
@ -148,7 +156,6 @@ namespace EpdBaseClr {
|
|||
int ReadDosesRV;
|
||||
int DeviceCount = 0;
|
||||
|
||||
|
||||
double Hp07;
|
||||
double Hp10;
|
||||
double Hp07Peak;
|
||||
|
|
@ -161,7 +168,6 @@ namespace EpdBaseClr {
|
|||
double alarmHP07;
|
||||
double alarmHP10;
|
||||
|
||||
|
||||
double Hp10THDose1;
|
||||
double Hp10THDose2;
|
||||
double Hp07THDose;
|
||||
|
|
@ -173,6 +179,8 @@ namespace EpdBaseClr {
|
|||
double Hp10Rate2Off;
|
||||
double Hp07RateOff;
|
||||
|
||||
double NGgain;
|
||||
|
||||
int K1;
|
||||
int K2;
|
||||
int K3;
|
||||
|
|
@ -245,7 +253,6 @@ namespace EpdBaseClr {
|
|||
int SetFeedbackSound(byte sound, UINT16 sound3);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
int Connect(bool reinit, int EPDTimeout);
|
||||
int Close();
|
||||
|
|
@ -256,18 +263,11 @@ namespace EpdBaseClr {
|
|||
int GetDoses(EpdBase::Epd2U* epd);
|
||||
int AfterGetDoses(Epd3Base::Epd3U* epd);
|
||||
int GetDoses(Epd3Base::Epd3U* epd);
|
||||
|
||||
int SetIssued();
|
||||
|
||||
int BeforeSetIssued(Epd3Base::Epd3U* epd);
|
||||
|
||||
int SetIssued(Epd3Base::Epd3U* epd);
|
||||
|
||||
int BeforeSetIssued(EpdBase::Epd2U* epd);
|
||||
|
||||
int SetIssued(EpdBase::Epd2U* epd);
|
||||
|
||||
|
||||
int PrepareForIssue();
|
||||
int WriteCalibration();
|
||||
int WriteCalibration(EpdBase::Epd2U* epd);
|
||||
|
|
@ -281,9 +281,7 @@ namespace EpdBaseClr {
|
|||
int ReadExtraStatus(EpdBase::Epd2U* epd);
|
||||
int ReadExtraStatus(Epd3Base::Epd3U* epd);
|
||||
int AfterGetDoses(EpdBase::Epd2U* epd);
|
||||
|
||||
int ConnectAndStatus();
|
||||
|
||||
System::Threading::CancellationTokenSource^ tokenSource;
|
||||
int tokenSourceTimeout;
|
||||
int readRetries;
|
||||
|
|
|
|||
|
|
@ -90,21 +90,18 @@ namespace eDosStation
|
|||
if (!ep.EPDIssued)
|
||||
{
|
||||
Dispatcher.InvokeAsync(() => {
|
||||
(new InstMessage("This EPD is not issued")).ShowDialog();
|
||||
rv = ep.SetDeIssued();
|
||||
endPage();
|
||||
endWithMessage("This EPD is not issued");
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (ep.EpdID == 0)
|
||||
{
|
||||
(new InstMessage("The EPD is not found")).ShowDialog();
|
||||
//endPage();
|
||||
endWithMessage("This EPD is not found");
|
||||
}
|
||||
|
||||
//bool NoTimeout = false;
|
||||
|
||||
|
||||
if (ep.alarmStatus != 0)
|
||||
{
|
||||
DosePanel.Background = AlarmBrush;
|
||||
|
|
@ -127,12 +124,11 @@ namespace eDosStation
|
|||
if (rv != 0)
|
||||
MessageBox.Show($"GetDoses {rv} er:{ep.GetDosesError}");
|
||||
|
||||
|
||||
Wearer.Text = $"{ep.WearerName}";
|
||||
EpdVisit.Text = $"{ep.WearerID}";
|
||||
|
||||
HpDose07.Text = $"Hp07: {ep.Hp07:0.00} µSv ";
|
||||
HpDose10.Text = $"Hp10: {ep.Hp10:0.00} µSv";
|
||||
HpDose07.Text = $"{ep.Hp07Name}: {ep.Hp07:0.00} µSv ";
|
||||
HpDose10.Text = $"{ep.Hp10Name}: {ep.Hp10:0.00} µSv";
|
||||
if (int.TryParse(ep.WearerID, out int EpdVisitID))
|
||||
{
|
||||
bool isBG = ep.isBG;
|
||||
|
|
@ -186,6 +182,12 @@ namespace eDosStation
|
|||
catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); }
|
||||
}
|
||||
|
||||
public void endWithMessage(string message)
|
||||
{
|
||||
new InstMessage(message).ShowDialog();
|
||||
endPage();
|
||||
}
|
||||
|
||||
public void endPage()
|
||||
{
|
||||
this.Close();
|
||||
|
|
|
|||
|
|
@ -61,8 +61,11 @@
|
|||
<TextBlock Grid.Row="4" Grid.Column="0" Text="Issued :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Text="..." Name ="isIssued" Padding="20,0,20,0" />
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="2" Text="Gain :" Name="lNGain" Padding="20,0,20,0" HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="3" Text="..." Name ="NGain" Padding="20,0,20,0" />
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Text="Alarm :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
|
||||
|
||||
<TextBlock Grid.Row="5" Grid.Column="0" Text="Alarm :" Padding="20,0,20,0" HorizontalAlignment="Right" Margin="0,6.2,0.2,88.4" Grid.RowSpan="2"/>
|
||||
<TextBlock Grid.Row="5" Grid.Column="1" Text="..." Name ="hasAlarm" Padding="20,0,20,0"/>
|
||||
<StackPanel Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="2" Name="sAlarm" Margin="50,0,20,0"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ namespace eDosStation
|
|||
|
||||
if (rv != 0) MessageBox.Show("Communication error");
|
||||
|
||||
|
||||
|
||||
isIssued.Text = ep.EPDIssued ? "Yes" : "no";
|
||||
string sPersID = ep.WearerName.Trim();
|
||||
Wearer.Text = sPersID;
|
||||
|
|
@ -98,21 +100,29 @@ namespace eDosStation
|
|||
|
||||
Decoder.AlarmToTextBox(sAlarm, ep);
|
||||
|
||||
HpDose07l.Text = $"Hp07";
|
||||
HpDose10l.Text = $"Hp10";
|
||||
HpDose07l.Text = ep.Hp07Name;
|
||||
HpDose10l.Text = ep.Hp10Name;
|
||||
|
||||
HpDose07.Text = $"{ep.Hp07:0.00} µSv";
|
||||
HpDose10.Text = $"{ep.Hp10:0.00} µSv";
|
||||
|
||||
|
||||
HP10AlarmDose1l.Text = "Warning HP10";
|
||||
HP10AlarmDose2l.Text = "Alarm HP10";
|
||||
HP07AlarmDosel.Text = "Alarm HP07";
|
||||
HP10AlarmDose1l.Text = "Warning "+ ep.Hp10Name;
|
||||
HP10AlarmDose2l.Text = "Alarm "+ ep.Hp10Name;
|
||||
HP07AlarmDosel.Text = "Alarm "+ ep.Hp07Name;
|
||||
|
||||
HP10AlarmDose1.Text = $"{ep.Hp10THDose1:0.00} µSv";
|
||||
HP10AlarmDose2.Text = $"{ep.Hp10THDose2:0.00} µSv";
|
||||
HP07AlarmDose.Text = $"{ep.Hp07THDose:0.00} µSv";
|
||||
|
||||
if (ep.isNG) {
|
||||
lNGain.Visibility = NGain.Visibility = Visibility.Visible;
|
||||
NGain.Text = ep.NGgain.ToString();
|
||||
} else {
|
||||
lNGain.Visibility = NGain.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(sPersID))
|
||||
{
|
||||
try
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue