cleanup
This commit is contained in:
parent
a6a23510e9
commit
bd44ce11d6
9 changed files with 193 additions and 105 deletions
|
|
@ -23,11 +23,13 @@ void EpdBase::Epd2U::StartDiscover()
|
|||
{
|
||||
FlushDiscoveryCache(port);
|
||||
DiscRV= Discover(port, DeviceIDs, MaxDevices, &DeviceCount);
|
||||
Commit();
|
||||
if (DiscRV == 1 && DeviceCount == 0) {
|
||||
OnRV = EpdOn();
|
||||
Commit();
|
||||
Sleep(1100);
|
||||
DiscRV = Discover(port, DeviceIDs, MaxDevices, &DeviceCount);
|
||||
Commit();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -96,70 +98,65 @@ WORD EpdBase::Epd2U::ReadStatus()
|
|||
|
||||
EpdClock = RealTime = IssueCount = OffTime = OperatingStatus = ErrorStatus = AlarmStatus = OtherAlarms = EEPROMBadSectors = 0;
|
||||
ErrorSource = ErrorReason = ErrorData = 0;
|
||||
|
||||
ReadStatusRV= ReadEpdStatus(&EpdClock, &RealTime, &IssueCount, &OffTime, &OperatingStatus, &ErrorStatus, &AlarmStatus, &OtherAlarms, &EEPROMBadSectors);
|
||||
if (ReadStatusRV == 0) {
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return ErrorReason;
|
||||
}
|
||||
|
||||
EpdID = HardVersion = SoftVersion = FunctionFlags = 0;
|
||||
ReadEpdIDRV = ReadEpdID(
|
||||
|
||||
|
||||
CommitRV = ReadEpdStatus(&EpdClock, &RealTime, &IssueCount, &OffTime, &OperatingStatus, &ErrorStatus, &AlarmStatus, &OtherAlarms, &EEPROMBadSectors);
|
||||
if (CommitRV==1) CommitRV= ReadEpdID(
|
||||
&EpdID,
|
||||
&HardVersion,
|
||||
&SoftVersion,
|
||||
&FunctionFlags);
|
||||
if (ReadEpdIDRV == 0) {
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return ErrorReason;
|
||||
}
|
||||
|
||||
CommitRV = Commit();
|
||||
if (CommitRV==1) CommitRV = Commit();
|
||||
if(CommitRV == 0) {
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return ErrorReason;
|
||||
}
|
||||
else {
|
||||
if (CurrentDeviceID == 0) CurrentDeviceID = EpdID;
|
||||
time_t t = RealTime;
|
||||
TimeFunctions::UnixTimeToSystemTime(t, &tRealTime);
|
||||
DecodeStatus();
|
||||
DecodeFunctionFlags();
|
||||
}
|
||||
|
||||
if (ReadStatusRV == 1 && EPDIssued == 1) {
|
||||
ReadWearerRV = 3;
|
||||
ReadWearerRV = ReadWearer(
|
||||
if (CommitRV == 1 && EPDIssued == 1)
|
||||
{
|
||||
CommitRV = ReadWearer(
|
||||
WearerID,
|
||||
WearerIDLength,
|
||||
WearerName,
|
||||
WearerNameLength);
|
||||
CommitRV = Commit();
|
||||
if(CommitRV==1) CommitRV = Commit();
|
||||
if (CommitRV == 0) {
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return ErrorReason;
|
||||
}
|
||||
for (int i = 0; i < WearerIDLength; i++)
|
||||
if (WearerID[i] == 0xb) WearerID[i] = '0'; else WearerID[i] |= 0x30;
|
||||
|
||||
else {
|
||||
for (int i = 0; i < WearerIDLength; i++)
|
||||
if (WearerID[i] == 0xb) WearerID[i] = '0'; else WearerID[i] |= 0x30;
|
||||
}
|
||||
}
|
||||
else
|
||||
ReadWearerRV = 4;
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
WORD EpdBase::Epd2U::EPDReadExtraStatus()
|
||||
{
|
||||
CommitRV = ReadA2ConfigStatus(
|
||||
byBatADC = bySupplyADC = 0;
|
||||
/*CommitRV = ReadA2ConfigStatus(
|
||||
&byBatADC,
|
||||
&bySupplyADC,
|
||||
&byStatus3,
|
||||
&byStatus4);
|
||||
if (CommitRV == 1) CommitRV = Commit();*/
|
||||
|
||||
if (CommitRV == 1) CommitRV = ReadCounts(&D1, &D2, &D3, &D4, &CountsClock);
|
||||
if (CommitRV == 1) CommitRV = Commit();
|
||||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
if (CommitRV == 1) CommitRV = ReadBaseCounts(&BaseD1, &BaseD2, &BaseD3, &BaseD4, &BaseCountsClock);
|
||||
if (CommitRV == 1) CommitRV = Commit();
|
||||
if (CommitRV == 0)
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
|
|
@ -221,11 +218,17 @@ WORD EpdBase::Epd2U::TurnOn()
|
|||
|
||||
WORD EpdBase::Epd2U::WriteCal()
|
||||
{
|
||||
|
||||
if (K6 > 2000)
|
||||
{ CommitRV = 0;
|
||||
return 0;
|
||||
}
|
||||
Password = 9;
|
||||
//((BYTE *)&Password)[0] = 9;
|
||||
|
||||
CommitRV = MFRLogin(Password);
|
||||
if (CommitRV == 1) CommitRV = Commit();
|
||||
|
||||
if (CommitRV == 1) CommitRV = MFRWriteCalFactors(K1, K2, K3, K4, K5, K6);
|
||||
if (CommitRV == 1) CommitRV = Commit();
|
||||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
|
|
@ -359,8 +362,13 @@ WORD EpdBase::Epd2U::Issue()
|
|||
if (OKRV) OKRV = Commit();
|
||||
if (OKRV) OKRV = WriteWearerName(WearerName,strlen((char *)WearerName));
|
||||
if (OKRV) OKRV = Commit();
|
||||
if (OKRV) OKRV = ClearFailFlag(); // all actions have been completed
|
||||
if (OKRV) OKRV = Commit();
|
||||
if (OKRV) OKRV = BaseLineCounts();
|
||||
if (OKRV == 0)
|
||||
{
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
}
|
||||
ClearFailFlag(); // all actions have been completed
|
||||
Commit();
|
||||
|
||||
if (!DetectorsOn) {
|
||||
OKRV = EpdOn(); OKRV=Commit(); Sleep(1000);
|
||||
|
|
@ -373,7 +381,8 @@ WORD EpdBase::Epd2U::Issue()
|
|||
else
|
||||
{
|
||||
FlushBuffers(port);
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); EndSession(0x5E, 40);
|
||||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
EndSession(0x5E, 40);
|
||||
}
|
||||
|
||||
//DeinitComms(port);
|
||||
|
|
|
|||
|
|
@ -125,6 +125,19 @@ namespace EpdBase
|
|||
WORD FB;
|
||||
WORD HG;
|
||||
|
||||
DWORD D1;
|
||||
DWORD D2;
|
||||
DWORD D3;
|
||||
DWORD D4;
|
||||
DWORD CountsClock;
|
||||
|
||||
DWORD BaseD1;
|
||||
DWORD BaseD2;
|
||||
DWORD BaseD3;
|
||||
DWORD BaseD4;
|
||||
DWORD BaseCountsClock;
|
||||
|
||||
|
||||
//Config
|
||||
WORD CountDownTime;
|
||||
DWORD ReturnTime;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ int EpdBaseClr::Epd2::Connect()
|
|||
b->CurrentDeviceID = 0;
|
||||
epd->StartDiscover();
|
||||
DiscRV = epd->DiscRV;
|
||||
if (epd->DiscRV == 1 && epd->DeviceCount > 0) b->CurrentDeviceID = epd->DeviceIDs[0];
|
||||
if (epd->DiscRV == 1 && epd->DeviceCount >= 0) b->CurrentDeviceID = epd->DeviceIDs[0];
|
||||
return DiscRV;
|
||||
}
|
||||
|
||||
|
|
@ -81,11 +81,11 @@ int EpdBaseClr::Epd2::GetDoses()
|
|||
|
||||
}
|
||||
|
||||
if (Hp10Peak > 0 && epd->Hp10Time > 0)
|
||||
if (epd->Hp10Time > 0)
|
||||
Hp10PeakTime = System::DateTime::Now.AddSeconds(-(epd->EpdClock - epd->Hp10Time));
|
||||
else
|
||||
Hp10PeakTime = System::Nullable<System::DateTime>();;
|
||||
if (Hp07Peak>0 && epd->Hp07Time>0)
|
||||
if (epd->Hp07Time>0)
|
||||
Hp07PeakTime = System::DateTime::Now.AddSeconds(-(epd->EpdClock - epd->Hp07Time ));
|
||||
else
|
||||
Hp10PeakTime = System::Nullable<System::DateTime>();
|
||||
|
|
@ -96,7 +96,9 @@ int EpdBaseClr::Epd2::GetDoses()
|
|||
K2 = epd->K2;
|
||||
K3 = epd->K3;
|
||||
K4 = epd->K4;
|
||||
SG= epd->SG;
|
||||
K5 = epd->K5;
|
||||
K6 = epd->K6;
|
||||
SG = epd->SG;
|
||||
BC = epd->SG;
|
||||
FB = epd->FB;
|
||||
HG = epd->HG;
|
||||
|
|
@ -145,9 +147,22 @@ int EpdBaseClr::Epd2::SetIssued()
|
|||
|
||||
int EpdBaseClr::Epd2::WriteCalibration()
|
||||
{
|
||||
|
||||
epd->K1 = K1;
|
||||
epd->K2 = K2;
|
||||
|
||||
epd->K3 = K3;
|
||||
epd->K4 = K4;
|
||||
int rv= epd->WriteCal();
|
||||
|
||||
epd->K5 = K5;
|
||||
epd->K6 = K6;
|
||||
|
||||
//epd->K1 = 903;
|
||||
//epd->K2 = 613;
|
||||
//epd->K5 = 13100;
|
||||
//epd->K6 = 1310;
|
||||
|
||||
int rv = epd->WriteCal();
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
|
@ -190,5 +205,11 @@ int EpdBaseClr::Epd2::ReadExtraStatus()
|
|||
BatADC = epd->byBatADC;
|
||||
SupplyADC = epd->bySupplyADC;
|
||||
|
||||
D1 = epd->D1 - epd->BaseD1;
|
||||
D2 = epd->D2 - epd->BaseD2;
|
||||
D3 = epd->D3 - epd->BaseD3;
|
||||
D4 = epd->D4 - epd->BaseD4;
|
||||
CountsClock = epd->CountsClock;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
@ -68,8 +68,7 @@ namespace EpdBaseClr {
|
|||
int HG;
|
||||
int QualityData;
|
||||
|
||||
|
||||
|
||||
unsigned int D1, D2, D3, D4, CountsClock;
|
||||
|
||||
int epdType;
|
||||
int alarmStatus ;
|
||||
|
|
|
|||
|
|
@ -46,19 +46,21 @@ namespace eDosStation
|
|||
_User = null;
|
||||
}
|
||||
|
||||
private void LoadDoses()
|
||||
private bool LoadDoses()
|
||||
{
|
||||
bool rv = true;
|
||||
ep.GetStatus();
|
||||
|
||||
if (ep.Issued)
|
||||
{
|
||||
MessageBox.Show("EPD is currently issued\nPlease take an other", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
|
||||
this.Close();
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
statusEPD.Text = $"EPD: {ep.b.CurrentDeviceID}";
|
||||
ep.ReadTresholds();
|
||||
|
||||
return rv;
|
||||
//ep.Hp07THDose =
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +68,7 @@ namespace eDosStation
|
|||
{
|
||||
dispatcherTimer.Stop();
|
||||
ep.Connect();
|
||||
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID > 0)
|
||||
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID >= 0)
|
||||
{
|
||||
EpdFound = true;
|
||||
DoEPD();
|
||||
|
|
@ -91,51 +93,71 @@ namespace eDosStation
|
|||
|
||||
private void DoEPD()
|
||||
{
|
||||
LoadDoses();
|
||||
|
||||
|
||||
bool isBG = (ep.epdType == 3);
|
||||
int? VisitID = null;
|
||||
using (var co = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.RemoteSQL))
|
||||
if (LoadDoses())
|
||||
{
|
||||
using (var cmd1 = new SqlCommand("VisitInit", co))
|
||||
bool isBG = (ep.epdType == 3);
|
||||
int? VisitID = null;
|
||||
using (var co = new System.Data.SqlClient.SqlConnection(Properties.Settings.Default.RemoteSQL))
|
||||
{
|
||||
cmd1.CommandType = CommandType.StoredProcedure;
|
||||
var pa = new SqlParameter("PersID", SqlDbType.Int, 4); pa.Value = _User.PersID; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("ID_Task", SqlDbType.Int, 4); pa.Value = CurTaskRow.ID_Task; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("Inst_CODE", SqlDbType.Int, 4); pa.Value = CurTaskRow.Inst_CODE; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("EPD_InternalID", SqlDbType.Int, 4); pa.Value = (int)ep.EpdID; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("isBG", SqlDbType.Bit, 4); pa.Value = isBG; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("ID_Visit", SqlDbType.Int, 4); pa.Direction = ParameterDirection.Output; cmd1.Parameters.Add(pa);
|
||||
co.Open();
|
||||
cmd1.ExecuteNonQuery();
|
||||
VisitID = (int?)cmd1.Parameters["ID_Visit"].Value;
|
||||
co.Close();
|
||||
using (var cmd1 = new SqlCommand("VisitInit", co))
|
||||
{
|
||||
cmd1.CommandType = CommandType.StoredProcedure;
|
||||
var pa = new SqlParameter("PersID", SqlDbType.Int, 4); pa.Value = _User.PersID; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("ID_Task", SqlDbType.Int, 4); pa.Value = CurTaskRow.ID_Task; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("Inst_CODE", SqlDbType.Int, 4); pa.Value = CurTaskRow.Inst_CODE; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("EPD_InternalID", SqlDbType.Int, 4); pa.Value = (int)ep.EpdID; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("isBG", SqlDbType.Bit, 4); pa.Value = isBG; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("ID_Visit", SqlDbType.Int, 4); pa.Direction = ParameterDirection.Output; cmd1.Parameters.Add(pa);
|
||||
co.Open();
|
||||
cmd1.ExecuteNonQuery();
|
||||
VisitID = (int?)cmd1.Parameters["ID_Visit"].Value;
|
||||
co.Close();
|
||||
}
|
||||
}
|
||||
|
||||
ep.WearerID = VisitID.ToString();
|
||||
ep.WearerName = _User.PersID.ToString();
|
||||
|
||||
ep.Hp07RateOn = CurTaskRow.HP07RateON;
|
||||
ep.Hp07RateOff = CurTaskRow.HP07RateOFF;
|
||||
ep.Hp10Rate1On = CurTaskRow.HP10Rate1ON;
|
||||
ep.Hp10Rate1Off = CurTaskRow.HP10Rate1ON;
|
||||
ep.Hp10Rate2On = CurTaskRow.HP10Rate2ON;
|
||||
ep.Hp10Rate2Off = CurTaskRow.HP10Rate2ON;
|
||||
ep.Hp10THDose1 = CurTaskRow.Hp10Dose1;
|
||||
ep.Hp10THDose2 = CurTaskRow.Hp10Dose2;
|
||||
ep.Hp07THDose = CurTaskRow.Hp07Dose;
|
||||
|
||||
int? kx = null;
|
||||
if (!CurTaskRow.IsFNGain_ANGainValueNull()) kx = (int)CurTaskRow.FNGain_ANGainValue;
|
||||
if (kx != null && (ep.K3 != kx || ep.K4 != kx))
|
||||
{
|
||||
ep.K3 = ep.K4 = kx.Value;
|
||||
|
||||
//ep.K1 = 903;
|
||||
//ep.K2 = 613;
|
||||
//ep.K3 = 90;
|
||||
//ep.K4 = 90;
|
||||
//ep.K5 = 13100;
|
||||
//ep.K6 = 1310;
|
||||
|
||||
//ep.K1 = 857;
|
||||
//ep.K2 = 595;
|
||||
//ep.K3 = 100;
|
||||
//ep.K4 = 100;
|
||||
//ep.K5 = 13100;
|
||||
//ep.K6 = 1310;
|
||||
|
||||
if (ep.K6!=1310)
|
||||
{
|
||||
MessageBox.Show("Alarm");
|
||||
}
|
||||
|
||||
ep.WriteCalibration();
|
||||
}
|
||||
|
||||
ep.SetIssued();
|
||||
}
|
||||
|
||||
ep.WearerID = VisitID.ToString();
|
||||
ep.WearerName = _User.PersID.ToString();
|
||||
|
||||
ep.Hp07RateOn = CurTaskRow.HP07RateON;
|
||||
ep.Hp07RateOff = CurTaskRow.HP07RateOFF;
|
||||
ep.Hp10Rate1On = CurTaskRow.HP10Rate1ON;
|
||||
ep.Hp10Rate1Off = CurTaskRow.HP10Rate1ON;
|
||||
ep.Hp10Rate2On = CurTaskRow.HP10Rate2ON;
|
||||
ep.Hp10Rate2Off = CurTaskRow.HP10Rate2ON;
|
||||
ep.Hp10THDose1 = CurTaskRow.Hp10Dose1;
|
||||
ep.Hp10THDose2 = CurTaskRow.Hp10Dose2;
|
||||
ep.Hp07THDose = CurTaskRow.Hp07Dose;
|
||||
|
||||
int kx = (int)CurTaskRow.FNGain_ANGainValue;
|
||||
if (ep.K3 != kx || ep.K4 != kx)
|
||||
{
|
||||
ep.K3 = ep.K4 = kx;
|
||||
ep.WriteCalibration();
|
||||
|
||||
}
|
||||
|
||||
ep.SetIssued();
|
||||
}
|
||||
|
||||
private void GetEPD()
|
||||
|
|
@ -144,10 +166,9 @@ namespace eDosStation
|
|||
|
||||
ep = new EpdBaseClr.Epd2(Properties.Settings.Default.comport);
|
||||
ep.Connect();
|
||||
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID > 0)
|
||||
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID >= 0)
|
||||
{
|
||||
EpdFound = true;
|
||||
|
||||
DoEPD();
|
||||
}
|
||||
if (!EpdFound)
|
||||
|
|
@ -283,12 +304,12 @@ namespace eDosStation
|
|||
getTaskListViewSource.View.MoveCurrentToFirst();
|
||||
|
||||
|
||||
//Real
|
||||
////Real
|
||||
//t = new System.Threading.Thread(() => Starter());
|
||||
//t.Start();
|
||||
|
||||
|
||||
//Debug
|
||||
////Debug
|
||||
_User = new User("0428790A0B4E80",string.Empty);
|
||||
Dispatcher.Invoke(AskTask);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<StatusBar DockPanel.Dock="Bottom" >
|
||||
<StatusBarItem Name="statusEPD" Content="Epd" />
|
||||
</StatusBar>
|
||||
<Grid TextBlock.FontSize="48" TextBlock.FontFamily="comic sans ms">
|
||||
<Grid TextBlock.FontSize="40" TextBlock.FontFamily="comic sans ms">
|
||||
<Grid.RowDefinitions >
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
|
|
@ -18,17 +18,17 @@
|
|||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition />
|
||||
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Name= "Wearer" Text="persID:" TextBlock.FontSize="20"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Name= "EpdVisit" Text="Visit:" TextBlock.FontSize="20"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Name= "Wearer" Text="persID:" TextBlock.FontSize="20"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Name= "EpdVisit" Text="Visit:" TextBlock.FontSize="20"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Dose" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Grid.RowSpan="1" Text="Dose" />
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Vertical" VerticalAlignment="Center" Name="DosePanel">
|
||||
<TextBlock Name="HpDose07" />
|
||||
<TextBlock Name="HpDose10" />
|
||||
|
|
|
|||
|
|
@ -39,6 +39,17 @@ namespace eDosStation
|
|||
|
||||
private void LoadDoses()
|
||||
{
|
||||
if (dispatcherTimer == null)
|
||||
{
|
||||
dispatcherTimer = new DispatcherTimer();
|
||||
dispatcherTimer.Interval = new TimeSpan(0, 0, 2);
|
||||
} else
|
||||
{
|
||||
dispatcherTimer.Stop();
|
||||
dispatcherTimer.Tick += DispatcherTimer_TickTO; ;
|
||||
}
|
||||
|
||||
|
||||
ep.GetStatus();
|
||||
if (!ep.Issued)
|
||||
{
|
||||
|
|
@ -49,6 +60,7 @@ namespace eDosStation
|
|||
|
||||
|
||||
if (ep.alarmStatus != 0) DosePanel.Background = AlarmBrush; else DosePanel.Background = GreenBrush;
|
||||
int rv = ep.ReadExtraStatus(); //D1 BaseD1 ...
|
||||
|
||||
Wearer.Text = $"Wearer: {ep.WearerName}";
|
||||
EpdVisit.Text = $"Visit: {ep.WearerID}";
|
||||
|
|
@ -81,6 +93,8 @@ namespace eDosStation
|
|||
pa = new SqlParameter("K2", SqlDbType.Int); pa.Value = ep.K2; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("K3", SqlDbType.Int); pa.Value = ep.K3; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("K4", SqlDbType.Int); pa.Value = ep.K4; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("K5", SqlDbType.Int); pa.Value = ep.K5; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("K6", SqlDbType.Int); pa.Value = ep.K6; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("SG", SqlDbType.Int); pa.Value = ep.SG; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("BC", SqlDbType.Int); pa.Value = ep.BC; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("FB", SqlDbType.Int); pa.Value = ep.FB; cmd1.Parameters.Add(pa);
|
||||
|
|
@ -88,6 +102,13 @@ namespace eDosStation
|
|||
|
||||
pa = new SqlParameter("QualityData", SqlDbType.Int); pa.Value = ep.QualityData; cmd1.Parameters.Add(pa);
|
||||
|
||||
pa = new SqlParameter("D1", SqlDbType.Int); pa.Value = ep.D1; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("D2", SqlDbType.Int); pa.Value = ep.D2; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("D3", SqlDbType.Int); pa.Value = ep.D3; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("D4", SqlDbType.Int); pa.Value = ep.D4; cmd1.Parameters.Add(pa);
|
||||
|
||||
|
||||
|
||||
pa = new SqlParameter("alarmStatus", SqlDbType.Int); pa.Value = ep.alarmStatus; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("otherAlarms", SqlDbType.Int); pa.Value = ep.otherAlarms; cmd1.Parameters.Add(pa);
|
||||
pa = new SqlParameter("errorStatus", SqlDbType.Int); pa.Value = ep.errorStatus; cmd1.Parameters.Add(pa);
|
||||
|
|
@ -102,12 +123,18 @@ namespace eDosStation
|
|||
ep.SetDeIssued();
|
||||
|
||||
|
||||
HpDose07.Text = ep.Hp07.ToString()+" µSv";
|
||||
HpDose10.Text = ep.Hp10.ToString() + " µSv";
|
||||
|
||||
|
||||
dispatcherTimer.Start();
|
||||
return;
|
||||
}
|
||||
|
||||
private void DispatcherTimer_TickTO(object sender, EventArgs e)
|
||||
{
|
||||
dispatcherTimer.Stop();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ep = new EpdBaseClr.Epd2(Properties.Settings.Default.comport);
|
||||
|
|
@ -116,6 +143,7 @@ namespace eDosStation
|
|||
{
|
||||
EpdFound = true;
|
||||
statusEPD.Content = $"EPD: {ep.b.CurrentDeviceID}";
|
||||
|
||||
LoadDoses();
|
||||
}
|
||||
if (!EpdFound)
|
||||
|
|
@ -134,7 +162,7 @@ namespace eDosStation
|
|||
{
|
||||
dispatcherTimer.Stop();
|
||||
ep.Connect();
|
||||
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID > 0)
|
||||
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID >= 0)
|
||||
{
|
||||
EpdFound = true;
|
||||
statusEPD.Content = $"EPD: {ep.b.CurrentDeviceID}";
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
<TextBlock Grid.Row="0" Grid.Column="1" Name ="Wearer" Text=""/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="2" Name ="EpdVisit" Text=""/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Dose" Margin="5,10,0,0" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Dose" Margin="5,10,0,0" />
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Vertical" Margin="5,10,0,0">
|
||||
<TextBlock Name="HpDose07" />
|
||||
<TextBlock Name="HpDose10" />
|
||||
|
|
@ -43,10 +43,7 @@
|
|||
<TextBlock Name="HP10AlarmDose2" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Battery" Grid.RowSpan="2" VerticalAlignment="Center" />
|
||||
|
||||
<TextBlock Grid.Row="3" Grid.Column="1" Name="BatVolt" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="1" Name="SupplyVolt" />
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ namespace eDosStation
|
|||
HP10AlarmDose2.Text = $"Alarm HP10(2) {ep.Hp10THDose2:0.00} µSv";
|
||||
HP07AlarmDose.Text = $"Alarm HP07 {ep.Hp07THDose:0.00} µSv";
|
||||
|
||||
ep.ReadExtraStatus();
|
||||
//ep.ReadExtraStatus();
|
||||
|
||||
BatVolt.Text = $" {ep.BatADC * 16.0} mV";
|
||||
SupplyVolt.Text = $" {ep.SupplyADC* 16.0} mV";
|
||||
//BatVolt.Text = $" {ep.BatADC * 16.0} mV";
|
||||
//SupplyVolt.Text = $" {ep.SupplyADC* 16.0} mV";
|
||||
|
||||
//int Hp10THDose2;
|
||||
//int Hp07THDose;
|
||||
|
|
@ -59,7 +59,7 @@ namespace eDosStation
|
|||
{
|
||||
ep = new EpdBaseClr.Epd2(Properties.Settings.Default.comport);
|
||||
ep.Connect();
|
||||
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID > 0)
|
||||
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID >= 0)
|
||||
{
|
||||
EpdFound = true;
|
||||
statusEPD.Content = $"EPD: {ep.b.CurrentDeviceID}";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue