aanpassingen

This commit is contained in:
Luc Vandenbroucke 2019-02-04 11:48:08 +01:00
parent 4b89e19073
commit 9d4c4993d0
12 changed files with 530 additions and 376 deletions

View file

@ -46,6 +46,7 @@ void EpdBase::Epd2U::Open(DWORD DeviceID)
void EpdBase::Epd2U::Close()
{
CloseDevice();
DeinitComms(port);
}
void EpdBase::Epd2U::DecodeFunctionFlags()
@ -204,7 +205,10 @@ WORD EpdBase::Epd2U::TurnOn()
WORD EpdBase::Epd2U::ReadTresHolds()
{
Hp10THDose1 = Hp10THDose2 = Hp07THDose = 0;
ReadDoseTresholdRV = ReadAlarmDoseThresholds(&Hp10THDose1, &Hp10THDose2, &Hp07THDose);
CommitRV = Commit();
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
ReadAlarmRateThresholdsRV = ReadAlarmRateThresholds(
&Hp10Rate1On,
&Hp10Rate2On,
@ -286,7 +290,7 @@ WORD EpdBase::Epd2U::DeIssue()
if (CommitRV) { EndSession(0x16, 12); Commit(); }// Continuous high tone for 1.2 seconds
else
{
FlushBuffers();
FlushBuffers(port);
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); EndSession(0x5E, 40); return 0;
}
@ -323,7 +327,7 @@ WORD EpdBase::Epd2U::Issue()
} // Continuous high tone for 1.2 seconds
else
{
FlushBuffers();
FlushBuffers(port);
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData); EndSession(0x5E, 40);
}

View file

@ -10,6 +10,16 @@ EpdBaseClr::Epd2::Epd2(int port)
}
EpdBaseClr::Epd2::~Epd2()
{
delete b;
this->!Epd2();
}
EpdBaseClr::Epd2::!Epd2()
{
}
int EpdBaseClr::Epd2::Connect()
{
b->CurrentDeviceID = 0;
@ -19,6 +29,16 @@ int EpdBaseClr::Epd2::Connect()
return DiscRV;
}
int EpdBaseClr::Epd2::Close()
{
b->CurrentDeviceID = 0;
epd->Close();
delete epd;
return 0;
}
int EpdBaseClr::Epd2::GetStatus()
{
//ReadStatus
@ -29,6 +49,16 @@ int EpdBaseClr::Epd2::GetStatus()
WearerID = gcnew String((char *)epd->WearerID);
WearerName = gcnew String((char *)epd->WearerName);
isOn = (epd->DetectorsOn != 0);
epdType = epd->EpdType;
alarmStatus = epd->AlarmStatus;
otherAlarms = epd->OtherAlarms;
errorStatus = epd->ErrorStatus;
operatingStatus = epd->OperatingStatus;
EpdID = epd->EpdID;
HardVersion = epd->HardVersion;
SoftVersion = epd->SoftVersion;
FunctionFlags = epd->FunctionFlags;
return StatusRV;
}
@ -45,7 +75,10 @@ int EpdBaseClr::Epd2::GetDoses()
Hp10Peak = (double)epd->Hp10Peak / 64.0;
}
//epd->SoftVersion
Hp10PeakTime = System::DateTime::Now.AddSeconds(-(epd->Hp10Time - epd->EpdClock));
Hp07PeakTime = System::DateTime::Now.AddSeconds(-(epd->Hp07Time - epd->EpdClock));
return ReadDosesRV;
}
@ -56,8 +89,9 @@ int EpdBaseClr::Epd2::SetDeIssued()
int EpdBaseClr::Epd2::SetIssued()
{
epd->AlarmDoseHP07N = alarmHP07;
epd->AlarmDoseHP101G = alarmHP10;
epd->AlarmDoseHP07N = Hp07THDose;
epd->AlarmDoseHP101G = Hp10THDose1;
epd->AlarmDoseHP102G = Hp10THDose1;
memset(epd->WearerID, ' ', WearerIDLength); epd->WearerID[WearerIDLength] = 0;
char* str1 = (char*)(void *)Runtime::InteropServices::Marshal::StringToHGlobalAnsi(WearerID);
@ -66,7 +100,6 @@ int EpdBaseClr::Epd2::SetIssued()
_memccpy( epd->WearerID+WearerIDLength-l, str1, l, WearerIDLength);
Runtime::InteropServices::Marshal::FreeHGlobal((IntPtr)str1);
memset(epd->WearerName, 0, WearerNameLength + 1);
char* str2 = (char*)(void*)Runtime::InteropServices::Marshal::StringToHGlobalAnsi(WearerName);
_memccpy(epd->WearerName, str2, strlen(str2), WearerNameLength);
@ -76,3 +109,32 @@ int EpdBaseClr::Epd2::SetIssued()
epd->Issue();
return 0;
}
int EpdBaseClr::Epd2::ReadTresholds()
{
epd->ReadTresHolds();
Hp10THDose1 = (double)epd->Hp10THDose1 / 64.0;
Hp10THDose2 = (double)epd->Hp10THDose2 / 64.0;
Hp07THDose = (double)epd->Hp07THDose / 64.0;
Hp10Rate1On = (double)epd->Hp10Rate1On;
Hp10Rate2On = (double)epd->Hp10Rate2On ;
Hp07RateOn = (double)epd->Hp07RateOn ;
Hp10Rate1Off = (double)epd->Hp10Rate1Off ;
Hp10Rate2Off = (double)epd->Hp10Rate2Off ;
Hp07RateOff = (double)epd->Hp07RateOff ;
K1 = epd->K1;
K2 = epd->K2;
K3 = epd->K3;
K4 = epd->K4;
K5 = epd->K5;
K6 = epd->K6;
SG = epd->SG;
BC = epd->BC;
FB = epd->FB;
HG = epd->HG;
return 0;
}

View file

@ -36,16 +36,58 @@ namespace EpdBaseClr {
double Hp10;
double Hp07Peak;
double Hp10Peak;
System::DateTime Hp10PeakTime;
System::DateTime Hp07PeakTime;
double alarmHP07;
double alarmHP10;
double Hp10THDose1;
double Hp10THDose2;
double Hp07THDose;
double Hp10Rate1On;
double Hp10Rate2On;
double Hp07RateOn;
double Hp10Rate1Off;
double Hp10Rate2Off;
double Hp07RateOff;
int K1;
int K2;
int K3;
int K4;
int K5;
int K6;
int SG;
int BC;
int FB;
int HG;
int epdType;
int alarmStatus ;
int otherAlarms ;
int errorStatus ;
int operatingStatus ;
unsigned int EpdID ;
int HardVersion ;
int SoftVersion ;
int FunctionFlags ;
Epd2(int port);
~Epd2();
!Epd2();
int Connect();
int Close();
int GetStatus();
int GetDoses();
@ -54,6 +96,8 @@ namespace EpdBaseClr {
int SetIssued();
int ReadTresholds();
};

View file

@ -1,6 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="eDosStation.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<userSettings>
<eDosStation.Properties.Settings>
<setting name="comport" serializeAs="String">
<value>6</value>
</setting>
</eDosStation.Properties.Settings>
</userSettings>
</configuration>

View file

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:eDosStation"
mc:Ignorable="d"
Title="Entry" Height="450" Width="800" Loaded="Window_Loaded">
Title="Entry" Height="450" Width="800" Loaded="Window_Loaded" Unloaded="Window_Unloaded">
<DockPanel>
<StatusBar DockPanel.Dock="Bottom" >
<StatusBarItem Name="statusEPD" Content="Epd" />
@ -34,12 +34,15 @@
<TextBox Grid.Row="1" Grid.Column="1" Name="wName" Text="..Name .." />
<TextBlock Grid.Row="2" Grid.Column="0" Text="Hp07Alarm" />
<TextBox Grid.Row="2" Grid.Column="1" Name="aHP07" Text="100" />
<TextBox Grid.Row="2" Grid.Column="1" Name="HP07AlarmDose" Text="100" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="Hp10Alarm" />
<TextBox Grid.Row="3" Grid.Column="1" Name="aHP10" Text="100" />
<TextBox Grid.Row="3" Grid.Column="1" Name="HP10AlarmDose1" Text="100" />
<Button Grid.Row="4" Grid.Column="1" Name="bIssue" Content="Issue" Click="BIssue_Click" Height="20" VerticalAlignment="Top" />
<TextBlock Grid.Row="4" Grid.Column="0" Text="Hp10 Alarm2" />
<TextBox Grid.Row="4" Grid.Column="1" Name="HP10AlarmDose2" Text="100" />
<Button Grid.Row="5" Grid.Column="1" Name="bIssue" Content="Issue" Click="BIssue_Click" Height="20" VerticalAlignment="Top" />
</Grid>

View file

@ -50,7 +50,7 @@ namespace eDosStation
private void Window_Loaded(object sender, RoutedEventArgs e)
{
ep = new EpdBaseClr.Epd2(3);
ep = new EpdBaseClr.Epd2(Properties.Settings.Default.comport);
ep.Connect();
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID > 0)
{
@ -98,14 +98,20 @@ namespace eDosStation
private void BIssue_Click(object sender, RoutedEventArgs e)
{
bIssue.IsEnabled = false;
ep.alarmHP07 = double.Parse(aHP07.Text);
ep.alarmHP10 = double.Parse(aHP10.Text);
ep.Hp07THDose = double.Parse(HP07AlarmDose.Text);
ep.Hp10THDose1 = double.Parse(HP10AlarmDose1.Text);
ep.Hp10THDose2 = double.Parse(HP10AlarmDose2.Text);
ep.WearerID = wID.Text;
ep.WearerName = wName.Text;
ep.SetIssued();
this.Close();
}
private void Window_Unloaded(object sender, RoutedEventArgs e)
{
ep.Dispose();
}
}
}

View file

@ -55,7 +55,7 @@ namespace eDosStation
private void Window_Loaded(object sender, RoutedEventArgs e)
{
ep = new EpdBaseClr.Epd2(3);
ep = new EpdBaseClr.Epd2(Properties.Settings.Default.comport);
ep.Connect();
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID > 0)
{

0
eDosStation/LOG.INI Normal file
View file

View file

@ -8,23 +8,31 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace eDosStation.Properties
{
namespace eDosStation.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("6")]
public int comport {
get {
return ((int)(this["comport"]));
}
set {
this["comport"] = value;
}
}
}
}

View file

@ -1,7 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="eDosStation.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="comport" Type="System.Int32" Scope="User">
<Value Profile="(Default)">6</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:eDosStation"
mc:Ignorable="d"
Title="ShowEPDDose" Height="450" Width="800" Loaded="Window_Loaded">
Title="ShowEPDDose" Height="450" Width="800" Loaded="Window_Loaded" Unloaded="Window_Unloaded">
<DockPanel>
<StatusBar DockPanel.Dock="Bottom" >
<StatusBarItem Name="statusEPD" Content="Epd" />
@ -14,7 +14,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition />
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -26,11 +26,17 @@
<CheckBox Grid.Row="0" Grid.Column="0" Content="Issued" IsChecked="False" Name ="isIssued"/>
<TextBlock Grid.Row="0" Grid.Column="1" Name ="Wearer" Text=""/>
<TextBlock Grid.Row="1" Grid.Column="0" Text="Dose" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="Dose Alarm" />
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Vertical" >
<TextBlock Name="HpDose07" />
<TextBlock Name="HpDose10" />
</StackPanel>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Dose" />
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Vertical" >
<TextBlock Name="HP07AlarmDose" />
<TextBlock Name="HP10AlarmDose1" />
<TextBlock Name="HP10AlarmDose2" />
</StackPanel>
</Grid>
</DockPanel>
</Window>

View file

@ -30,8 +30,6 @@ namespace eDosStation
InitializeComponent();
}
private void LoadDoses()
{
ep.GetStatus();
@ -42,13 +40,17 @@ namespace eDosStation
HpDose07.Text = $"HP07: {ep.Hp07:0.00 µ Sv} ";
HpDose10.Text = $"Hp10: {ep.Hp10:0.00 µ Sv}";
ep.ReadTresholds();
HP10AlarmDose1.Text = $"Alarm HP10(1) {ep.Hp10THDose1:0.00 µ Sv}";
HP10AlarmDose2.Text = $"Alarm HP10(2) {ep.Hp10THDose2:0.00 µ Sv}";
HP07AlarmDose.Text = $"Alarm HP07 {ep.Hp07THDose:0.00 µ Sv}";
//int Hp10THDose2;
//int Hp07THDose;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
ep = new EpdBaseClr.Epd2(3);
ep = new EpdBaseClr.Epd2(Properties.Settings.Default.comport);
ep.Connect();
if (ep.DiscRV == 1 && ep.b.CurrentDeviceID > 0)
{
@ -92,5 +94,10 @@ namespace eDosStation
}
}
private void Window_Unloaded(object sender, RoutedEventArgs e)
{
ep.Dispose();
}
}
}