bevesitig visit start

This commit is contained in:
Luc Vandenbroucke 2024-09-06 16:00:41 +02:00
parent d05577d0c9
commit 2849b54adc
9 changed files with 261 additions and 167 deletions

View file

@ -18,7 +18,7 @@ void Epd3Base::Epd3U::ResetStepReturnValues()
for (int i = MaxSteps - 1; i >= 0; --i) for (int j = 0; j < 4; j++) StepReturnValues[i][j] = 0;
}
void Epd3Base::Epd3U::SetFunctionReturnValue(enum eFunctions f, BYTE CanIgnore)
int Epd3Base::Epd3U::SetFunctionReturnValue(enum eFunctions f, BYTE CanIgnore)
{
if (CurrentStep < -1) CurrentStep = -1;
if (CurrentStep < MaxSteps - 1) {
@ -29,26 +29,38 @@ void Epd3Base::Epd3U::SetFunctionReturnValue(enum eFunctions f, BYTE CanIgnore)
StepReturnValues[CurrentStep][2] = -1;
StepReturnValues[CurrentStep][3] = CanIgnore;
}
return CurrentStep;
}
void Epd3Base::Epd3U::SetCommitReturnValue(int step, int32_t rv)
{
if (CurrentStep >= 0 && CurrentStep < MaxSteps)
StepReturnValues[step][1] = rv;
}
void Epd3Base::Epd3U::SetCommitReturnValue(int32_t rv)
{
if (CurrentStep>=0 && CurrentStep<MaxSteps)
StepReturnValues[CurrentStep][1] = rv;
SetCommitReturnValue(CurrentStep, rv);
}
uint32_t Epd3Base::Epd3U::SetEndReturnValue(int32_t rv)
uint32_t Epd3Base::Epd3U::SetEndReturnValue(int step, int32_t rv)
{
if (CurrentStep >= 0 && CurrentStep < MaxSteps)
StepReturnValues[CurrentStep][2] = rv;
if (step >= 0 && step < MaxSteps)
StepReturnValues[step][2] = rv;
if (rv != 0) {
HasStepError = 1;
if (StepReturnValues[CurrentStep][3]) rv = 0; //if canIngore set rv ok
if (StepReturnValues[step][3]) rv = 0; //if canIngore set rv ok
Error = GetErrorCode();
}
return rv;
}
uint32_t Epd3Base::Epd3U::SetEndReturnValue(int32_t rv)
{
return SetEndReturnValue(CurrentStep, rv);
}
int32_t Epd3Base::Epd3U::CommitAndSetRV()
@ -58,6 +70,15 @@ int32_t Epd3Base::Epd3U::CommitAndSetRV()
return r;
}
int32_t Epd3Base::Epd3U::CommitAndSetRV(int idx[], int len)
{
int32_t r = Commit3(epdComsHandle);
for(int i = 0; i < len ;++i)
SetCommitReturnValue(idx[i],r);
return r;
}
int32_t Epd3Base::Epd3U::CommitAndEnd2RV(int32_t (WINAPI *endFunction2)(CommsHandle hComms, CompletionToken token), CompletionToken token)
{
int32_t r = Commit3(epdComsHandle);
@ -67,6 +88,14 @@ int32_t Epd3Base::Epd3U::CommitAndEnd2RV(int32_t (WINAPI *endFunction2)(CommsHa
return r;
}
int32_t Epd3Base::Epd3U::End2RV(int step, int32_t(WINAPI* endFunction2)(CommsHandle hComms, CompletionToken token), CompletionToken token)
{
int32_t r = (*endFunction2)(epdComsHandle, token);
r = SetEndReturnValue(step,r);
return r;
}
void WINAPI completion(CommsHandle hComms, CompletionToken token)
{
SetEvent(current->hCompletion);
@ -154,7 +183,7 @@ Epd3Base::Epd3U::Epd3U(int _comport)
if (_comport == 0) return;
if (hCompletion == 0) hCompletion = CreateEvent(NULL, TRUE, FALSE, NULL);
//if (hWaitTimer == 0) hWaitTimer = CreateEvent(NULL, TRUE, FALSE, NULL);
}
Epd3Base::Epd3U::~Epd3U()
@ -559,7 +588,6 @@ int Epd3Base::Epd3U::ReadStatus()
r = SetEndReturnValue(r);
if (r != 0) goto error;
if (mk3WearerID.Length > WearerNameLength) mk3WearerID.Length = WearerNameLength;
memcpy(WearerName, mk3WearerID.Utf8String, mk3WearerID.Length); WearerName[mk3WearerID.Length] = 0;
@ -1002,63 +1030,60 @@ error:
/// <returns>0 success</returns>
int Epd3Base::Epd3U::ClearDoses()
{
int r = 1;
constexpr int maxbatch = 3;
int rv;
int r[maxbatch];
int s[maxbatch];
int batchstep = 0;
s[batchstep]= SetFunctionReturnValue(eFunctions::ClearTotalDose,0);
btoken[batchstep] = BeginClearTotalDose(epdComsHandle, nullptr);
batchstep = 1;
s[batchstep] =SetFunctionReturnValue(eFunctions::ClearDose,0);
btoken[batchstep] = BeginClearDose(epdComsHandle, nullptr);
batchstep = 2;
s[batchstep]= SetFunctionReturnValue(eFunctions::ClearPeakRates,0);
btoken[batchstep] = BeginClearPeakRates(epdComsHandle, nullptr);
SetFunctionReturnValue(eFunctions::ClearTotalDose,0);
token = BeginClearTotalDose(epdComsHandle, nullptr);
r = CommitAndEnd2RV(EndClearTotalDose, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndClearTotalDose(epdComsHandle, token); SetEndReturnValue(r);
if (r != 0 && r != r_InvalidOp)
goto error;
rv = CommitAndSetRV(s, maxbatch);
batchstep = 0;
r[batchstep] = End2RV(s[batchstep], EndClearTotalDose, btoken[batchstep]);
batchstep = 1;
r[batchstep] = End2RV(s[batchstep], EndClearDose, btoken[batchstep]);
batchstep = 2;
r[batchstep] = End2RV(s[batchstep], EndClearPeakRates, btoken[batchstep]);
rv = r[0];
for (int b = 1; !rv && b < maxbatch;++b) if (r[b]) rv = r[b];
Error = rv;
return rv;
SetFunctionReturnValue(eFunctions::ClearDose,0);
token = BeginClearDose(epdComsHandle, nullptr);
r = CommitAndEnd2RV(EndClearDose, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndClearDose(epdComsHandle, token); SetEndReturnValue(r);
if (r != 0 && r != r_InvalidOp)
goto error;
SetFunctionReturnValue(eFunctions::ClearPeakRates,0);
token = BeginClearPeakRates(epdComsHandle, nullptr);
r = CommitAndEnd2RV(EndClearPeakRates,token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndClearPeakRates(epdComsHandle, token); SetEndReturnValue(r);
if (r != 0 && r != r_InvalidOp)
goto error;
if (r == r_InvalidOp) r = 0;
return r;
error:
Error = r;
return r;
}
int Epd3Base::Epd3U::ClearAlarms()
{
int r = 0;
constexpr int maxbatch = 2;
int rv;
int r[maxbatch];
int s[maxbatch];
int batchstep = 0;
SetFunctionReturnValue(eFunctions::ClearFaultStatus,0);
token = BeginClearFaultStatus(epdComsHandle, nullptr);
r = CommitAndEnd2RV(EndClearFaultStatus, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndClearFaultStatus(epdComsHandle, token); SetEndReturnValue(r);
if (r != 0 && r != -105)
goto error;
s[batchstep] = SetFunctionReturnValue(eFunctions::ClearFaultStatus,0);
btoken[batchstep]= BeginClearFaultStatus(epdComsHandle, nullptr);
batchstep = 1;
s[batchstep] = SetFunctionReturnValue(eFunctions::ClearLatchedAlarms, 0);
btoken[batchstep] = BeginClearLatchedAlarms(epdComsHandle, nullptr);
SetFunctionReturnValue(eFunctions::ClearLatchedAlarms,0);
token = BeginClearLatchedAlarms(epdComsHandle, nullptr);
r = CommitAndEnd2RV(EndClearLatchedAlarms, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndClearLatchedAlarms(epdComsHandle, token); SetEndReturnValue(r);
if (r != 0 && r != -105)
goto error;
rv = CommitAndSetRV(s, maxbatch);
if (r == -105) r = 0;
return r;
batchstep = 0;
r[batchstep] = End2RV(s[batchstep],EndClearFaultStatus, btoken[batchstep]);
batchstep = 1;
r[batchstep] = End2RV(s[batchstep],EndClearLatchedAlarms, btoken[batchstep]);
error:
//-102 is permissieprobleem (65434)
return r;
rv = r[0];
for (int b = 1; !rv && b < maxbatch; ++b) if (r[b]) rv = r[b];
Error = rv;
return rv;
}
WORD Epd3Base::Epd3U::PrepareForIssue()
@ -1093,17 +1118,17 @@ WORD Epd3Base::Epd3U::PrepareForIssue()
if (!isConnected)
rv = ReOpenDev();
step = 4;
rv = ClearDoses();
if (rv != 0)
goto error;
step = 5;
rv = ClearAlarms();
if (rv != 0)
goto error;
Sleep(2100);
step = 4;
rv = ClearDoses();
if (rv != 0)
goto error;
Sleep(2000);
return rv;
@ -1118,7 +1143,7 @@ WORD Epd3Base::Epd3U::ReadAlarmConfig() {
SetFunctionReturnValue(eFunctions::ReadAlarmConfiguration,0);
token = BeginReadAlarmConfiguration(epdComsHandle, nullptr, 0, nullptr);
int32_t r = Commit3(epdComsHandle); SetCommitReturnValue(r);
int32_t r = CommitAndSetRV();
if (!r) { r = EndReadAlarmConfiguration(epdComsHandle, token, alarmConfig, MaxAlarmConfig, &numAlarm); SetEndReturnValue(r); }
return numAlarm;
}
@ -1166,7 +1191,6 @@ WORD Epd3Base::Epd3U::WriteAlarmTresholds() {
SetFunctionReturnValue(eFunctions::WriteAlarmThresholds,0);
token = BeginWriteAlarmThresholds(epdComsHandle, (uint8_t)hp10tresholds.MeasId, (uint8_t)hp10tresholds.NumberThresholds, hp10tresholds.Thresholds, nullptr);
r = CommitAndEnd2RV(EndWriteAlarmThresholds, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (r != 0) goto error; r = EndWriteAlarmThresholds(epdComsHandle, token); SetEndReturnValue(r);
if (r != 0) goto error;
@ -1177,13 +1201,11 @@ WORD Epd3Base::Epd3U::WriteAlarmTresholds() {
SetFunctionReturnValue(eFunctions::WriteAlarmThresholds,0);
token = BeginWriteAlarmThresholds(epdComsHandle, (uint8_t)hp07tresholds.MeasId, (uint8_t)hp07tresholds.NumberThresholds, hp07tresholds.Thresholds, nullptr);
r = CommitAndEnd2RV(EndWriteAlarmThresholds, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (r != 0) goto error; r = EndWriteAlarmThresholds(epdComsHandle, token); SetEndReturnValue(r);
if (r != 0) goto error;
SetFunctionReturnValue(eFunctions::WriteRateOffPercentage,0);
token = BeginWriteRateOffPercentage(epdComsHandle, RatePct, 2, nullptr);
r = CommitAndEnd2RV(EndWriteRateOffPercentage, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (r != 0) goto error; r = EndWriteRateOffPercentage(epdComsHandle, token); SetEndReturnValue(r);
if (r != 0)
goto error;
@ -1306,7 +1328,6 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru
if (!isConnected) r = ReOpenDev();
if (r) goto error;
step = 4;
//EPDIssued
//if (!DetectorsOn) {
@ -1356,7 +1377,6 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru
step = 6;
if (isMK3) {
r = DisCon(Control); //stops protected session if control is EndSessionCOntrol
}
@ -1534,7 +1554,6 @@ int Epd3Base::Epd3U::WriteConfig(void)
SetFunctionReturnValue(eFunctions::WriteAccessLevel,0);
token = BeginWriteAccessLevel(epdComsHandle, AccessLevel_t::Admin, EC, ECLen, nullptr);
r = CommitAndEnd2RV(EndWriteAccessLevel,token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteAccessLevel(epdComsHandle, token); SetEndReturnValue(r);
if (!r) {
displayIds = new QuickAccessDisplay_t[6]{
@ -1550,7 +1569,6 @@ int Epd3Base::Epd3U::WriteConfig(void)
SetFunctionReturnValue(eFunctions::WriteQuickAccessDisplays_R3,1);
token = BeginWriteQuickAccessDisplays_R3(epdComsHandle, displayIds, numDisplays, nullptr);
r = CommitAndEnd2RV(EndWriteQuickAccessDisplays_R3, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteQuickAccessDisplays_R3(epdComsHandle, token); SetEndReturnValue(r);
}
if (!r) {
//Unmanaged%20HtmlFiles/_display_ids.html
@ -1572,7 +1590,6 @@ int Epd3Base::Epd3U::WriteConfig(void)
SetFunctionReturnValue(eFunctions::WriteDisplayEnables_R3,1);
token = BeginWriteDisplayEnables_R3(epdComsHandle, enables, numItems, nullptr);
r = CommitAndEnd2RV(EndWriteDisplayEnables_R3, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteDisplayEnables_R3(epdComsHandle, token); SetEndReturnValue(r);
}
if (!r) {
uint8_t numMenus = 9;
@ -1591,9 +1608,6 @@ int Epd3Base::Epd3U::WriteConfig(void)
SetFunctionReturnValue(eFunctions::WriteDisplayEnablePermissions_R3,1);
token = BeginWriteDisplayEnablePermissions_R3(epdComsHandle, AccessLevel_t::Admin, permissions, numDisplays, nullptr);
r = CommitAndEnd2RV(EndWriteDisplayEnablePermissions_R3, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r);
//r = EndWriteDisplayEnablePermissions_R3(epdComsHandle, token); SetEndReturnValue(r);
//r = 0; //override
}
if (!r) {
//AlarmConfiguration
@ -1618,28 +1632,39 @@ int Epd3Base::Epd3U::WriteConfig(void)
SetFunctionReturnValue(eFunctions::WriteAlarmConfiguration_R3,1);
token = BeginWriteAlarmConfiguration_R3(epdComsHandle, alarmConfigIds, alarmConfigLen, nullptr);
r = CommitAndEnd2RV(EndWriteAlarmConfiguration_R3, token);
//r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteAlarmConfiguration_R3(epdComsHandle, token); SetEndReturnValue(r);
}
//OffModeDisplay
constexpr int maxbatch= 2;
int s[maxbatch];
int rv[maxbatch];
int batchstep;
if (!r) {
//OffModeDisplay
batchstep = 0;
dutyCycle = (OffModeDutyCycle)0;
offModeDispId = (OffModeDisplayId_t)1;
SetFunctionReturnValue(eFunctions::WriteOffModeDisplay_R3,1);
token = BeginWriteOffModeDisplay_R3(epdComsHandle, dutyCycle, offModeDispId, nullptr);
r = CommitAndEnd2RV(EndWriteOffModeDisplay_R3, token);
/*r = Commit3(epdComsHandle); SetCommitReturnValue(r);
r = EndWriteOffModeDisplay_R3(epdComsHandle, token); SetEndReturnValue(r);*/
}
s[batchstep] =SetFunctionReturnValue(eFunctions::WriteOffModeDisplay_R3,1);
btoken[batchstep] = BeginWriteOffModeDisplay_R3(epdComsHandle, dutyCycle, offModeDispId, nullptr);
//SwitchOnFromButton
if (!r) {
batchstep = 1;
uint8_t OnOfenabled = 0;
SetFunctionReturnValue(eFunctions::WriteSwitchOnFromButton_R3,0);
token = BeginWriteSwitchOnFromButton_R3(epdComsHandle, OnOfenabled, nullptr);
r = CommitAndEnd2RV(EndWriteSwitchOnFromButton_R3, token);
/*r = Commit3(epdComsHandle); SetCommitReturnValue(r);
r = EndWriteSwitchOnFromButton_R3(epdComsHandle, token); SetEndReturnValue(r);*/
s[batchstep] = SetFunctionReturnValue(eFunctions::WriteSwitchOnFromButton_R3, 0);
btoken[batchstep] = BeginWriteSwitchOnFromButton_R3(epdComsHandle, OnOfenabled, nullptr);
r = CommitAndSetRV(s, maxbatch);
batchstep = 0;
rv[batchstep] = End2RV(batchstep,EndWriteOffModeDisplay_R3, btoken[batchstep]);
batchstep = 1;
rv[batchstep] = End2RV(batchstep, EndWriteSwitchOnFromButton_R3, btoken[batchstep]);
r = rv[0];
for (int b = 1; !r && b < maxbatch; ++b) if (rv[b]) r = rv[b];
Error = r;
}
return r;
}

View file

@ -16,6 +16,7 @@
#define MaxAlarmConfig 10
#define MaxTresholds 10
#define MaxSteps 50
#define MaxBatch 3
namespace Epd3Base {
enum eFunctions {
@ -37,7 +38,7 @@ namespace Epd3Base {
uint32_t CurrentDeviceID;
EpdGeneration EpdGen;
DiscoveryId Epd;
CompletionToken token;
CompletionToken token, btoken[MaxBatch];
WORD port = 3;
const WORD MaxDevices = 10;
WORD DeviceCount = 0;
@ -288,12 +289,16 @@ namespace Epd3Base {
void decodePeakRates(int count);
public:
void SetFunctionReturnValue(eFunctions f, BYTE CanIgnore);
int SetFunctionReturnValue(eFunctions f, BYTE CanIgnore);
void SetCommitReturnValue(int rv);
void SetCommitReturnValue(int step, int rv);
uint32_t SetEndReturnValue(int rv);
uint32_t SetEndReturnValue(int step, int rv);
int32_t CommitAndSetRV();
int32_t CommitAndSetRV(int idx[], int len);
int32_t CommitAndEnd2RV(int32_t (WINAPI *endFunction2)(CommsHandle hComms, CompletionToken token), CompletionToken token);
int32_t End2RV(int step, int32_t(WINAPI* endFunction2)(CommsHandle hComms, CompletionToken token), CompletionToken token);
int GetAll(bool Closeconnection);
int GetAllDeissue(bool reconnect);
int IssueAndCheck(float gain, float ChirpRate);

View file

@ -374,3 +374,19 @@ GO
GRANT EXECUTE ON [dbo].[VisitInfo] TO [eDosStation];
GO
--2024-09-06
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id=OBJECT_ID('[dbo].[Visit]') AND name='InitError')
ALTER TABLE [dbo].[Visit] ADD InitError INT
go
CREATE OR ALTER PROCEDURE [dbo].[VisitInitConfirm]
@ID_Station INT NULL,
@ID_Visit INT,
@InitError INT
as
UPDATE [dbo].[Visit] SET InitError=@InitError WHERE ID_Station=@ID_Station AND ID_Visit=@ID_Visit;
go
GRANT EXECUTE ON [dbo].[VisitInitConfirm] TO [eDosStation];
go

View file

@ -15,7 +15,7 @@ namespace eDosStation
public SqlConnection localConnection, centralConnection;
internal CLog splunkLog;
public System.Data.SqlClient.SqlCommand VisitInitCommand, VisitInfoCommand;
public System.Data.SqlClient.SqlCommand VisitInitCommand, VisitInfoCommand, VisitInitConfirmCommand;
public static SqlCommand VisitExitCommand;
public static SqlCommand NextIDCommand;
public static SqlCommand LastIDCommand;
@ -89,6 +89,7 @@ namespace eDosStation
LastIDCommand.Parameters["ID_Station"].Value = curIDStation;
VisitInitCommand.Parameters["ID_Station"].Value = curIDStation;
CheckStatus.Parameters["ID_Station"].Value = curIDStation;
VisitInitConfirmCommand.Parameters["ID_Station"].Value = curIDStation;
}
public bool isOnline()
{
@ -221,6 +222,13 @@ namespace eDosStation
, new System.Data.SqlClient.SqlParameter("epdType",SqlDbType.TinyInt,0,System.Data.ParameterDirection.Input,false,0,0,null,System.Data.DataRowVersion.Default,null)
});
VisitInitConfirmCommand = new System.Data.SqlClient.SqlCommand("[dbo].[VisitInitConfirm]", localConnection) { CommandType = System.Data.CommandType.StoredProcedure };
VisitInitConfirmCommand.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] {
new System.Data.SqlClient.SqlParameter("ID_Station",SqlDbType.Int,0,System.Data.ParameterDirection.Input,false,0,0,null,System.Data.DataRowVersion.Default,null)
, new System.Data.SqlClient.SqlParameter("ID_Visit",SqlDbType.Int,0,System.Data.ParameterDirection.Input,false,0,0,null,System.Data.DataRowVersion.Default,null)
, new System.Data.SqlClient.SqlParameter("InitError",SqlDbType.Int,0,System.Data.ParameterDirection.Input,false,0,0,null,System.Data.DataRowVersion.Default,null)
});
VisitExitCommand = new System.Data.SqlClient.SqlCommand("[dbo].[VisitExit]", localConnection) { CommandType = System.Data.CommandType.StoredProcedure };
VisitExitCommand.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] {
new System.Data.SqlClient.SqlParameter("EPDVisitID",SqlDbType.Int,0,System.Data.ParameterDirection.Input,false,0,0,null,System.Data.DataRowVersion.Default,null)

View file

@ -303,7 +303,11 @@
<StackPanel Grid.Row="0" Name="panelWait" VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Vertical" >
<StackPanel Orientation="Horizontal">
<Image Source="/Images/Mannetjet.png" Width="87" HorizontalAlignment="Left"/>
<TextBlock Name="tWaitFor" Text="Configuring EPD. Please wait for confirmation." Margin="10,100,10,100" FontWeight="Bold" >
<TextBlock Name="tWaitFor" Margin="10,100,10,100" FontWeight="Bold" TextAlignment="Center" >
<Run Text="Configuring EPD."/>
<LineBreak/>
<Run Text="Please wait for confirmation" Foreground="Red"/>
<TextBlock.Foreground>
<SolidColorBrush Color="{DynamicResource sckcP}"/>
</TextBlock.Foreground>
@ -331,7 +335,12 @@
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Text="Take your EPD" Style="{StaticResource tblHeaderLabel}" />
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Style="{StaticResource tblHeaderLabel}" >
<Run>Ready</Run>
<LineBreak/>
<Run Foreground="Green">Please take your EPD</Run>
<LineBreak/>
</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" Text="Task" Style="{StaticResource tblIssuedLabel}" />
<TextBlock Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2">
<Run Text="{Binding Task_Name,Mode=OneWay}" />

View file

@ -70,6 +70,7 @@ namespace eDosStation
EntryState = eEntryState.epdOK;
EpdReading = false;
dispatcherTimer?.Stop();
Dispatcher.InvokeAsync(() => pWaitEpd.Visibility = Visibility.Collapsed );
Dispatcher.InvokeAsync(() => GetEPD());
}
private bool LoadDoses()
@ -197,13 +198,13 @@ namespace eDosStation
private void DoEPD()
{
const string module = "EntryBadge DoEpd";
string step = null;
int? StationVisitID = null;
int? ID_Visit = null;
if (LoadDoses())
{
tWaitFor.Text = "Writing alarms";
try
{
ID_Visit = DataInterface.NextID();
@ -214,6 +215,7 @@ namespace eDosStation
}
if (ID_Visit.HasValue)
{
step = "SqlInitVisit";
bool isBG = ep.isBG; // (ep.epdType != 3); //3 = zwarte 0=grijs
var co = dataInterface.getCon(true);
dataInterface.VisitInitCommand.Connection = co;
@ -240,7 +242,8 @@ namespace eDosStation
}
StationVisitID = (int?)dataInterface.VisitInitCommand.Parameters["EPDVisitID"].Value;
StationVisitID = ID_Visit * 100 + thisStation.ID_Station;
co.Close();
//co.Close();
step = "EPD writing";
ep.WearerID = StationVisitID.ToString();
ep.WearerName = _User.PersID.ToString();
@ -304,11 +307,9 @@ namespace eDosStation
if (!CurTaskRow.IsFNGain_ANGainValueNull()) gain = (int)CurTaskRow.FNGain_ANGainValue;
if (!CurTaskRow.IsChirpRateNull()) ChirpRate = (int)CurTaskRow.ChirpRate;
//doing stuff on EPD
int rv = ep.IssueAndCheck(gain, ChirpRate, thisStation.WriteConfig);
if (rv != 0)
{
MessageBox.Show($"SetIssued error {rv}");
}
if (rv != 0 || thisStation.LogAll || ep.HasStepError())
{
//MessageBox.Show($"GetDoses {rv} rv:{ep.ErrorRV} step:{ep.ErrorStep} er:{ep.GetDosesError}");
@ -316,10 +317,31 @@ namespace eDosStation
if (rv != 0) MessageBox.Show(DecodeResults.decodesteps(ep.StepReturnValues));
DecodeResults.logsteps(module, ep.StepReturnValues, thisStation.splunkLog);
}
if (rv != 0)
{
MessageBox.Show($"SetIssued error {rv}");
}
lbHP07.Text = ep.Hp07Name;
lbHP10.Text = ep.Hp10Name;
step = "SqlConfirmVisit";
dataInterface.VisitInitConfirmCommand.Connection = co;
dataInterface.VisitInitConfirmCommand.Parameters["ID_Station"].Value = thisStation.ID_Station;
dataInterface.VisitInitConfirmCommand.Parameters["ID_Visit"].Value = ID_Visit;
dataInterface.VisitInitConfirmCommand.Parameters["InitError"].Value = rv;
try
{
dataInterface.VisitInitConfirmCommand.ExecuteNonQuery();
//l.LogCommand(dataInterface.VisitInitCommand);
}
catch (System.Exception ex)
{
//l.LogCommand(ex.Message);
MessageBox.Show(ex.Message);
thisStation.splunkLog.WriteException(module, step, ex);
}
co.Close();
ShowFinal();
}
}
@ -329,10 +351,15 @@ namespace eDosStation
System.Diagnostics.Debug.WriteLine("Not loaded");
FinalTimeOut = false;
SetTimedOutAndEnd();
}
}
public static void DoEvents()
{
Application.Current.Dispatcher.Invoke(DispatcherPriority.Background,
new Action(delegate { }));
}
private void ShowFinal()
{
FinalTimeOut = false;
@ -341,6 +368,7 @@ namespace eDosStation
dispatcherTimer.Tick += CountDown;
ResultTime = DateTime.Now.AddSeconds(thisStation.InfoScreenTimeout);
pWaitEpd.Value = pWaitEpd.Maximum = thisStation.InfoScreenTimeout;
pWaitEpd.Visibility = Visibility.Visible;
tWaitFor.Text = "EPD Ready ";
panelWait.Visibility = Visibility.Collapsed;
panelDone.Visibility = Visibility.Visible;
@ -359,8 +387,9 @@ namespace eDosStation
if (ep.DeviceCount == 1 && ep.EpdID > 0)
{
statusEPD.Text = string.Empty;
DoEPD();
statusEPD.Text = "Found Device : writing config";
DoEvents();
Dispatcher.InvokeAsync(() => { DoEPD(); });
}
else
{
@ -621,6 +650,7 @@ namespace eDosStation
dispatcherTimer.Tick += CountDown;
ResultTime = DateTime.Now.AddSeconds(thisStation.ScreenEPDTimeout);
pWaitEpd.Value = pWaitEpd.Maximum = thisStation.ScreenEPDTimeout;
pWaitEpd.Visibility = Visibility.Visible;
dispatcherTimer.Start();
startEPDRead();
}

View file

@ -56,5 +56,6 @@ using System.Windows;
//2.18 : more tested
//2.20 Thermo : workflow bij issue ( en toevoegen time set)
//2.22 No clear bij deissue.
[assembly: AssemblyVersion("2.26.0.0")]
[assembly: AssemblyFileVersion("2.26.0.0")]
//2.27 Display wait while issuing
[assembly: AssemblyVersion("2.27.0.0")]
[assembly: AssemblyFileVersion("2.27.0.0")]

View file

@ -1 +1 @@
Thu 09/05/2024 16:05:02.21
Fri 09/06/2024 15:29:44.75