met Desfire lezer
This commit is contained in:
parent
aa0c371186
commit
b22cef9f46
20 changed files with 212 additions and 205 deletions
|
|
@ -1,12 +1,11 @@
|
|||
#include "stdafx.h"
|
||||
#include "EpdBase.h"
|
||||
|
||||
#define DiscoveryTimeslotPeriod 100
|
||||
#define DiscoveryExpirationPeriod 6000
|
||||
#define RxRetryCount 5
|
||||
#define TxRetryCount 5
|
||||
|
||||
#pragma unmanaged
|
||||
|
||||
EpdBase::Epd2U::Epd2U(int comport)
|
||||
{
|
||||
port = comport;
|
||||
|
|
@ -16,14 +15,12 @@ EpdBase::Epd2U::Epd2U(int comport)
|
|||
Error = 123;
|
||||
//SetTimeouts(port, 20, 1000, 1000);
|
||||
}
|
||||
|
||||
DWORD EpdBase::Epd2U::WriteConfig()
|
||||
WORD EpdBase::Epd2U::WriteConfig()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
return WriteDisplayConfig(00,2,40,10, 2,displayConfig, 56);
|
||||
}
|
||||
|
||||
DWORD EpdBase::Epd2U::StartCom()
|
||||
DWORD EpdBase::Epd2U::StartCom()
|
||||
{
|
||||
DWORD rv;
|
||||
ErrorReason = 0;
|
||||
|
|
@ -53,16 +50,14 @@ DWORD EpdBase::Epd2U::StartCom()
|
|||
CommsInitialized = InitRv;
|
||||
return ErrorReason;
|
||||
}
|
||||
|
||||
EpdBase::Epd2U::~Epd2U()
|
||||
{
|
||||
if (port>0) DeinitComms(port);
|
||||
CommsInitialized = 0;
|
||||
}
|
||||
|
||||
int EpdBase::Epd2U::StartDiscover()
|
||||
{
|
||||
WORD rv;
|
||||
//WORD rv;
|
||||
//System::Diagnostics::Trace::WriteLine("StartDiscover");
|
||||
Error = 0;
|
||||
|
||||
|
|
@ -94,7 +89,6 @@ int EpdBase::Epd2U::StartDiscover()
|
|||
//System::Diagnostics::Trace::WriteLine(System::String::Format("Discover DeviceCount = {0}", DeviceCount));
|
||||
return DiscRV;
|
||||
}
|
||||
|
||||
void EpdBase::Epd2U::Open(DWORD DeviceID)
|
||||
{
|
||||
CurrentDeviceID = DeviceID;
|
||||
|
|
@ -108,18 +102,15 @@ void EpdBase::Epd2U::Open(DWORD DeviceID)
|
|||
}
|
||||
else { OpenRV = ConRV = 1; }
|
||||
}
|
||||
|
||||
void EpdBase::Epd2U::Close()
|
||||
{
|
||||
if (port>0) CloseDevice();
|
||||
//DeinitComms(port); CommsInitialized = 0;
|
||||
}
|
||||
|
||||
void EpdBase::Epd2U::DecodeFunctionFlags()
|
||||
{
|
||||
EpdType = (FunctionFlags & 0x1F00) >> 8;
|
||||
}
|
||||
|
||||
void EpdBase::Epd2U::DecodeStatus()
|
||||
{
|
||||
DetectorsOn = (OperatingStatus & 1) != 0;
|
||||
|
|
@ -154,16 +145,16 @@ void EpdBase::Epd2U::DecodeStatus()
|
|||
OtherAlarmBatVolt = (OtherAlarms & 0x40) != 0;
|
||||
|
||||
}
|
||||
|
||||
WORD EpdBase::Epd2U::ReadStatus()
|
||||
WORD EpdBase::Epd2U::ReadStatus()
|
||||
{
|
||||
Error = 0; ReadStatusRV = 0;
|
||||
memset(WearerID, 0, WearerIDLength + 1);
|
||||
memset(WearerName, 0, WearerNameLength + 1);
|
||||
|
||||
EpdClock = RealTime = IssueCount = OffTime = OperatingStatus = ErrorStatus = AlarmStatus = OtherAlarms = EEPROMBadSectors = 0;
|
||||
IssueCount = OperatingStatus = ErrorStatus = AlarmStatus = OtherAlarms = EEPROMBadSectors = 0;
|
||||
RealTime = EpdClock = OffTime = EpdID = 0;
|
||||
ErrorSource = ErrorReason = ErrorData = 0;
|
||||
EpdID = HardVersion = SoftVersion = FunctionFlags = 0;
|
||||
HardVersion = SoftVersion = FunctionFlags = 0;
|
||||
|
||||
if (port == 0) {
|
||||
EpdID = 4567;
|
||||
|
|
@ -216,8 +207,7 @@ WORD EpdBase::Epd2U::ReadStatus()
|
|||
}
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
WORD EpdBase::Epd2U::EPDReadExtraStatus()
|
||||
WORD EpdBase::Epd2U::EPDReadExtraStatus()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
|
||||
|
|
@ -237,8 +227,7 @@ WORD EpdBase::Epd2U::EPDReadExtraStatus()
|
|||
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
WORD EpdBase::Epd2U::EPDReadConfig()
|
||||
WORD EpdBase::Epd2U::EPDReadConfig()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
|
||||
|
|
@ -261,8 +250,7 @@ WORD EpdBase::Epd2U::EPDReadConfig()
|
|||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
WORD EpdBase::Epd2U::TurnOff()
|
||||
WORD EpdBase::Epd2U::TurnOff()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
|
||||
|
|
@ -277,8 +265,7 @@ WORD EpdBase::Epd2U::TurnOff()
|
|||
}
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
WORD EpdBase::Epd2U::TurnOn()
|
||||
WORD EpdBase::Epd2U::TurnOn()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
//OnRV = EpdOn();
|
||||
|
|
@ -296,8 +283,7 @@ WORD EpdBase::Epd2U::TurnOn()
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD EpdBase::Epd2U::WriteCal()
|
||||
WORD EpdBase::Epd2U::WriteCal()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
|
||||
|
|
@ -316,8 +302,7 @@ WORD EpdBase::Epd2U::WriteCal()
|
|||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
WORD EpdBase::Epd2U::ReadTresHolds()
|
||||
WORD EpdBase::Epd2U::ReadTresHolds()
|
||||
{
|
||||
if (port == 0) {
|
||||
Hp10THDose1 = Hp10THDose2 = Hp10THDose2 = 123;
|
||||
|
|
@ -350,13 +335,14 @@ WORD EpdBase::Epd2U::ReadTresHolds()
|
|||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
WORD EpdBase::Epd2U::ReadDoses()
|
||||
WORD EpdBase::Epd2U::ReadDoses()
|
||||
{
|
||||
if (port == 0) {
|
||||
Hp10Dose = Hp07Dose = Hp10Total = Hp07Total = Knocks = Resets = QualityData = 21;
|
||||
Hp10Peak = Hp07Peak = Hp10Time = Hp07Time = 1000;
|
||||
ErrorSource = ErrorReason = ErrorData = 0;
|
||||
K1 = 1; K2 = 2; K3 = 3; K4 = 4; K5 = 5; K6 = 6;
|
||||
SG = 7; BC = 8; FB = 9; HG = 10;
|
||||
return 1;
|
||||
}
|
||||
ReadDosesQualityRV = ReadPeaksRV = CommitRV = 0;
|
||||
|
|
@ -402,9 +388,7 @@ WORD EpdBase::Epd2U::ReadDoses()
|
|||
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
|
||||
WORD EpdBase::Epd2U::PrepareForIssue()
|
||||
WORD EpdBase::Epd2U::PrepareForIssue()
|
||||
{
|
||||
if (port == 0) return 1;
|
||||
CommitRV = WriteConfig();
|
||||
|
|
@ -415,7 +399,7 @@ WORD EpdBase::Epd2U::PrepareForIssue()
|
|||
if (CommitRV) CommitRV = Commit();
|
||||
return CommitRV;
|
||||
}
|
||||
WORD EpdBase::Epd2U::DeIssue()
|
||||
WORD EpdBase::Epd2U::DeIssue()
|
||||
{
|
||||
ClearDoseRV = ClearTotalDoseRV = ClearPeakRatesRV = DeIssueEpdRV = 0;
|
||||
if (port == 0) return 1;
|
||||
|
|
@ -444,13 +428,11 @@ WORD EpdBase::Epd2U::DeIssue()
|
|||
Close();
|
||||
return CommitRV;
|
||||
}
|
||||
|
||||
|
||||
WORD EpdBase::Epd2U::Issue()
|
||||
WORD EpdBase::Epd2U::Issue()
|
||||
{
|
||||
IssueEpdRV = WriteAlarmDoseThresholdsRV = WriteAlarmRateThresholdsRV = WriteWearerNameRV = OnRV = CommitRV = 0;
|
||||
if (port == 0) return 1;
|
||||
DWORD OKRV = SetFailFlag(); // all actions have been completed
|
||||
WORD OKRV = SetFailFlag(); // all actions have been completed
|
||||
if (OKRV) OKRV = Commit();
|
||||
|
||||
if (OKRV) OKRV = WriteAlarmDoseThresholds(Hp10THDose1, Hp10THDose2, Hp07THDose);
|
||||
|
|
@ -458,7 +440,7 @@ WORD EpdBase::Epd2U::Issue()
|
|||
if (OKRV) OKRV = Commit();
|
||||
if (OKRV) OKRV = IssueEpd(WearerID, WearerIDLength);
|
||||
if (OKRV) OKRV = Commit();
|
||||
if (OKRV) OKRV = WriteWearerName(WearerName,strlen((char *)WearerName));
|
||||
if (OKRV) OKRV = WriteWearerName(WearerName,(WORD)strlen((char *)WearerName));
|
||||
if (OKRV) OKRV = Commit();
|
||||
if (OKRV) OKRV = BaseLineCounts();
|
||||
if (OKRV == 0)
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ namespace EpdBase
|
|||
void DecodeStatus();
|
||||
|
||||
Epd2U(int comport);
|
||||
DWORD WriteConfig();
|
||||
WORD WriteConfig();
|
||||
DWORD StartCom();
|
||||
WORD ReadStatus();
|
||||
WORD EPDReadExtraStatus();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include <windows.h>
|
||||
#include <time.h>
|
||||
|
||||
static class TimeFunctions
|
||||
class TimeFunctions
|
||||
{
|
||||
public:
|
||||
TimeFunctions();
|
||||
|
|
|
|||
|
|
@ -131,16 +131,19 @@ int EpdBaseClr::Epd2::GetDoses()
|
|||
GetDosesError = epd->Error;
|
||||
}
|
||||
|
||||
if (epd->Hp10Time > 0)
|
||||
Hp10PeakTime = System::DateTime::Now.AddSeconds(-(epd->EpdClock - epd->Hp10Time));
|
||||
if (epd->Hp10Time > 0) {
|
||||
double x = (epd->EpdClock - epd->Hp10Time) * -1.0;
|
||||
Hp10PeakTime = System::DateTime::Now.AddSeconds(x);
|
||||
}
|
||||
else
|
||||
Hp10PeakTime = System::Nullable<System::DateTime>();;
|
||||
if (epd->Hp07Time>0)
|
||||
Hp07PeakTime = System::DateTime::Now.AddSeconds(-(epd->EpdClock - epd->Hp07Time ));
|
||||
if (epd->Hp07Time > 0) {
|
||||
double x = (epd->EpdClock - epd->Hp07Time) * -1.0;
|
||||
Hp07PeakTime = System::DateTime::Now.AddSeconds(x);
|
||||
}
|
||||
else
|
||||
Hp10PeakTime = System::Nullable<System::DateTime>();
|
||||
|
||||
|
||||
QualityData = epd->QualityData;
|
||||
K1 = epd->K1;
|
||||
K2 = epd->K2;
|
||||
|
|
@ -172,16 +175,16 @@ int EpdBaseClr::Epd2::PrepareForIssue()
|
|||
int EpdBaseClr::Epd2::SetIssued()
|
||||
{
|
||||
SetIssuedError = 0;
|
||||
epd->Hp07THDose = Hp07THDose*64;
|
||||
epd->Hp10THDose1 = Hp10THDose1*64;
|
||||
epd->Hp10THDose2 = Hp10THDose2*64;
|
||||
epd->Hp07THDose = (DWORD)(Hp07THDose*64.0);
|
||||
epd->Hp10THDose1 = (DWORD)(Hp10THDose1*64.0);
|
||||
epd->Hp10THDose2 = (DWORD)(Hp10THDose2*64.0);
|
||||
|
||||
epd->Hp10Rate1On = Hp10Rate1On;
|
||||
epd->Hp10Rate2On = Hp10Rate2On;
|
||||
epd->Hp07RateOn = Hp07RateOn;
|
||||
epd->Hp10Rate1Off = Hp10Rate1Off;
|
||||
epd->Hp10Rate2Off = Hp10Rate2Off;
|
||||
epd->Hp07RateOff = Hp07RateOff;
|
||||
epd->Hp10Rate1On = (DWORD)(Hp10Rate1On);
|
||||
epd->Hp10Rate2On = (DWORD)(Hp10Rate2On);
|
||||
epd->Hp07RateOn = (DWORD)(Hp07RateOn);
|
||||
epd->Hp10Rate1Off = (DWORD)(Hp10Rate1Off);
|
||||
epd->Hp10Rate2Off = (DWORD)(Hp10Rate2Off);
|
||||
epd->Hp07RateOff = (DWORD)(Hp07RateOff);
|
||||
|
||||
memset(epd->WearerID, ' ', WearerIDLength); epd->WearerID[WearerIDLength] = 0;
|
||||
char* str1 = (char*)(void *)Runtime::InteropServices::Marshal::StringToHGlobalAnsi(WearerID);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{F1F47B79-9930-48B0-8DDE-56E2C4BED2A2}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<Keyword>ManagedCProj</Keyword>
|
||||
<RootNamespace>EpdBaseClr</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--For more information on using transformations see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<connectionStrings>
|
||||
<add name="eDosStation.Properties.Settings.eDosConnectionString" connectionString="Data Source=HPHDB;Initial Catalog=eDosx;User ID=eDosStation;Password=Infopla+8" xdt:Locator="Match(name)" xdt:Transform="Replace"/>
|
||||
<add name="eDosStation.Properties.Settings.localConnectionString" connectionString="Data Source=HPHDB;Initial Catalog=eDosLocal;User ID=eDosStation;Password=Infopla+8" xdt:Locator="Match(name)" xdt:Transform="Replace"/>
|
||||
</connectionStrings>
|
||||
<appSettings >
|
||||
<add key="Reader" value="HID Global OMNIKEY 5022 Smart Card Reader 0" xdt:Locator="Match(key)" xdt:Transform="Replace" />
|
||||
<add key="TestCSN" value="0428790A0B4E80" xdt:Locator="Match(key)" xdt:Transform="Replace" />
|
||||
<add key="TestCode" value="12925" xdt:Locator="Match(key)" xdt:Transform="Replace" />
|
||||
</appSettings>
|
||||
</configuration>
|
||||
|
|
@ -1,22 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?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 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>
|
||||
<connectionStrings>
|
||||
<add name="eDosStation.Properties.Settings.masterConnectionString"
|
||||
connectionString="Data Source=scksrv23;Initial Catalog=master;Integrated Security=True"
|
||||
providerName="System.Data.SqlClient" />
|
||||
<add name="eDosStation.Properties.Settings.eDosConnectionString"
|
||||
connectionString="Data Source=HPHDB;Initial Catalog=eDosx;User ID=eDosStation;Password=Infopla+8"
|
||||
providerName="System.Data.SqlClient" />
|
||||
<add name="eDosStation.Properties.Settings.localConnectionString"
|
||||
connectionString="Data Source=HPHDB;Initial Catalog=eDosLocal;User ID=eDosStation;Password=Infopla+8" />
|
||||
<add name="eDosStation.Properties.Settings.masterConnectionString" connectionString="Data Source=scksrv23;Initial Catalog=master;Integrated Security=True" providerName="System.Data.SqlClient"/>
|
||||
<add name="eDosStation.Properties.Settings.eDosConnectionString" connectionString="Data Source=HPHDB;Initial Catalog=eDosx;User ID=eDosStation;Password=Infopla+8" providerName="System.Data.SqlClient"/>
|
||||
<add name="eDosStation.Properties.Settings.localConnectionString" connectionString="Data Source=HPHDB;Initial Catalog=eDosLocal;User ID=eDosStation;Password=Infopla+8"/>
|
||||
</connectionStrings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
</startup>
|
||||
<userSettings>
|
||||
<eDosStation.Properties.Settings>
|
||||
|
|
@ -43,4 +38,9 @@
|
|||
</setting>
|
||||
</eDosStation.Properties.Settings>
|
||||
</userSettings>
|
||||
<appSettings >
|
||||
<add key="Reader" value="HID Global OMNIKEY 5022 Smart Card Reader 0" />
|
||||
<add key="TestCSN" value=""/>
|
||||
<add key="TestCode" value=""/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
|
@ -21,18 +22,18 @@ namespace eDosStation
|
|||
int Search, UserSeconds;
|
||||
Boolean Inst1 = false, Inst2 = false;
|
||||
|
||||
public static OkReadBadge.Badging a;
|
||||
System.Threading.Thread t;
|
||||
bool nextCSN = false;
|
||||
bool nextSite = false;
|
||||
bool nextCode = false;
|
||||
bool nextFinish = false;
|
||||
string csn, site, code;
|
||||
public static LSWDesfirePublic.CCard dfReader;
|
||||
//System.Threading.Thread t;
|
||||
//bool nextCSN = false;
|
||||
//bool nextSite = false;
|
||||
//bool nextCode = false;
|
||||
//bool nextFinish = false;
|
||||
//string csn, site, code;
|
||||
static User _User;
|
||||
|
||||
DataSet1.GetTaskInfoRow CurTaskRow;
|
||||
enum eCOE { quiz=1} ;
|
||||
private bool StopReadBadge=true;
|
||||
|
||||
|
||||
#if SimulateEPD
|
||||
public SimulateData simulData = new SimulateData();
|
||||
|
|
@ -164,9 +165,9 @@ namespace eDosStation
|
|||
ep.WearerName = _User.PersID.ToString();
|
||||
|
||||
#if SimulateEPD
|
||||
simulData.DebugEpdType = ep.epdType;
|
||||
simulData.DebugWearerID = ep.WearerID;
|
||||
simulData.DebugWearerName = ep.WearerName;
|
||||
simulData.EdpType = ep.epdType;
|
||||
simulData.WearerID = ep.WearerID;
|
||||
simulData.WearerName = ep.WearerName;
|
||||
#endif
|
||||
|
||||
ep.Hp07RateOn = CurTaskRow.HP07RateON;
|
||||
|
|
@ -365,43 +366,17 @@ namespace eDosStation
|
|||
_User = LocalRemote.GetUser(CSN.Text, Code.Text);
|
||||
ShowUserInfo(); //AskTask();
|
||||
}
|
||||
public void showBadge()
|
||||
public void showBadge(int persID, string csn)
|
||||
{
|
||||
CSN.Text = csn;
|
||||
Site.Text = site;
|
||||
Code.Text = code;
|
||||
|
||||
Site.Text = string.Empty;
|
||||
Code.Text = persID.ToString();
|
||||
Dispatcher.Invoke(CheckBadge);
|
||||
}
|
||||
bool Msg(int err)
|
||||
{
|
||||
//decodeert verschillende USB messages. (callback )
|
||||
if (StopReadBadge )
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("msg dropped:");
|
||||
if (err!=0) System.Diagnostics.Debug.WriteLine($"msg result={a.clr.Result}");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (err == 0)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"msg result={a.clr.Result} {a.clr.Final}");
|
||||
if (a.clr.Final)
|
||||
{
|
||||
csn = a.clr.CSN;
|
||||
site = a.clr.Site;
|
||||
code = a.clr.Badge;
|
||||
this.Dispatcher.Invoke(new Action(() => showBadge()));
|
||||
StopReadBadge = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
System.Diagnostics.Debug.WriteLine($"Error {err}");
|
||||
return false;
|
||||
}
|
||||
|
||||
private void bClose_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
dfReader?.Dispose(); dfReader = null;
|
||||
this.Close();
|
||||
}
|
||||
private void BClear_Click(object sender, RoutedEventArgs e)
|
||||
|
|
@ -523,10 +498,8 @@ namespace eDosStation
|
|||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
t = null;
|
||||
a = null;
|
||||
dfReader?.Dispose(); dfReader = null;
|
||||
ep.Close();
|
||||
//t.Abort();
|
||||
}
|
||||
|
||||
private void CbInst2_Click(object sender, RoutedEventArgs e)
|
||||
|
|
@ -537,23 +510,6 @@ namespace eDosStation
|
|||
SetFilter(isAlara);
|
||||
}
|
||||
|
||||
private void Starter()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (a == null)
|
||||
{
|
||||
a = new OkReadBadge.Badging(Msg);
|
||||
StopReadBadge = false;
|
||||
a.Start();
|
||||
}
|
||||
} catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Badgereader error {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void AddTestButtons()
|
||||
{
|
||||
//pTestButtons
|
||||
|
|
@ -594,28 +550,57 @@ namespace eDosStation
|
|||
|
||||
LocalRemote.FillComment();
|
||||
|
||||
string TestCSN = thisStation.TestCSN;
|
||||
//string TestCSN = null; // thisStation.TestCSN;
|
||||
initialising = false;
|
||||
|
||||
if (Properties.Settings.Default.useTestButtons)
|
||||
AddTestButtons();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(TestCSN))
|
||||
if (dfReader == null)
|
||||
{
|
||||
t = new System.Threading.Thread(() => Starter());
|
||||
t.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
////Debug
|
||||
_User = LocalRemote.GetUser(TestCSN, string.Empty);
|
||||
if (_User.Error > 0)
|
||||
dfReader = new LSWDesfirePublic.CCard();
|
||||
dfReader.GetReaderList();
|
||||
if (dfReader.readersList.Contains(thisStation.Reader))
|
||||
{
|
||||
MessageBox.Show(_User.ErrorMessage, "DB Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
} else {
|
||||
Dispatcher.InvokeAsync(ShowUserInfo); //AskTask
|
||||
dfReader.SetReader(thisStation.Reader);
|
||||
dfReader.Badged += DFReader_Badged;
|
||||
dfReader.WaitForBadge();
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder er = new StringBuilder($"Badgelezer \"{thisStation.Reader}\" niet gevonden!.\nDeze 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;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dfReader.WaitForBadge();
|
||||
}
|
||||
|
||||
//if (string.IsNullOrWhiteSpace(TestCSN) && a==null)
|
||||
//{
|
||||
|
||||
//t = new System.Threading.Thread(() => Starter());
|
||||
//t.Start();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// ////Debug
|
||||
// _User = LocalRemote.GetUser(TestCSN, string.Empty);
|
||||
// if (_User.Error > 0)
|
||||
// {
|
||||
// MessageBox.Show(_User.ErrorMessage, "DB Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||
// } else {
|
||||
// Dispatcher.InvokeAsync(ShowUserInfo); //AskTask
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
private void DFReader_Badged(LSWDesfirePublic.CCard Sender, LSWDesfirePublic.BadgeEventArgs e)
|
||||
{
|
||||
this.Dispatcher.Invoke(new Action(() => showBadge(e.PersID,e.UID)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,18 +69,17 @@ namespace eDosStation
|
|||
MessageBox.Show($"GetStatus {rv} error {er}");
|
||||
}
|
||||
|
||||
|
||||
#if SimulateEPD
|
||||
ep.epdType = simulData.DebugEpdType;
|
||||
ep.epdType = simulData.EdpType;
|
||||
ep.Issued = true;
|
||||
ep.alarmStatus = 0;
|
||||
ep.otherAlarms = 0;
|
||||
ep.WearerID = simulData.DebugWearerID;
|
||||
ep.WearerName = simulData.DebugWearerName;
|
||||
ep.WearerID = simulData.WearerID;
|
||||
ep.WearerName = simulData.WearerName;
|
||||
ep.Hp07 = 1;
|
||||
ep.Hp10 = 2;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if (!ep.Issued)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,20 +49,21 @@ namespace eDosStation
|
|||
#if DEBUG
|
||||
cs.ConnectTimeout = 10;
|
||||
#endif
|
||||
isLocal = false;
|
||||
Connection = new System.Data.SqlClient.SqlConnection(cs.ConnectionString);
|
||||
try
|
||||
{
|
||||
Connection.Open();
|
||||
isLocal = false;
|
||||
}
|
||||
catch { }
|
||||
catch { }
|
||||
if (Connection.State != System.Data.ConnectionState.Open)
|
||||
{
|
||||
switchLocal(); //wijzigt currentConStr
|
||||
switchLocal(true); //wijzigt currentConStr als isLocal niet al gezet is.
|
||||
}
|
||||
else
|
||||
{
|
||||
currentConStr = serverConstr;
|
||||
isLocal = false;
|
||||
rv = true;
|
||||
}
|
||||
if (!rv)
|
||||
|
|
@ -72,7 +73,7 @@ namespace eDosStation
|
|||
Connection.Open();
|
||||
rv = true;
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
catch
|
||||
{
|
||||
Connection.Dispose();
|
||||
Connection = null;
|
||||
|
|
@ -116,9 +117,9 @@ namespace eDosStation
|
|||
MakeCommands();
|
||||
}
|
||||
|
||||
static void switchLocal()
|
||||
static void switchLocal(bool force=false)
|
||||
{
|
||||
if (!isLocal)
|
||||
if (force || !isLocal)
|
||||
{
|
||||
isLocal = true;
|
||||
currentConStr = localConstr;
|
||||
|
|
@ -286,15 +287,17 @@ namespace eDosStation
|
|||
}
|
||||
}
|
||||
|
||||
static public User GetUser(string CSN, string Code)
|
||||
static public User GetUser( string CSN, string Code)
|
||||
{
|
||||
User u = new User();
|
||||
object[] Values = null;
|
||||
if (int.TryParse(Code,out int PersID))
|
||||
using (var cmd = new SqlCommand("GetPersonInfo", Connection))
|
||||
{
|
||||
cmd.CommandType = System.Data.CommandType.StoredProcedure;
|
||||
cmd.Parameters.AddWithValue("csn", CSN);
|
||||
if (!string.IsNullOrWhiteSpace(Code)) cmd.Parameters.AddWithValue("Badge", Code);
|
||||
cmd.Parameters.AddWithValue("PersID", PersID);
|
||||
//if (!string.IsNullOrWhiteSpace(Code)) cmd.Parameters.AddWithValue("Badge", Code);
|
||||
checkCon(true);
|
||||
cmd.Connection = Connection;
|
||||
var rs = cmd.ExecuteReader(System.Data.CommandBehavior.SingleRow);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ namespace eDosStation
|
|||
Status.Content = ">>> Online >>>";
|
||||
Status.Foreground = Brushes.Green;
|
||||
Status.Background = Brushes.White;
|
||||
|
||||
}
|
||||
}
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
|
|
@ -145,6 +144,8 @@ namespace eDosStation
|
|||
else
|
||||
ibComment.Visibility = Visibility.Hidden;
|
||||
}
|
||||
// nog niet in db
|
||||
|
||||
}
|
||||
setLocalStatus();
|
||||
}
|
||||
|
|
|
|||
30
eDosStation/Properties/Resources.Designer.cs
generated
30
eDosStation/Properties/Resources.Designer.cs
generated
|
|
@ -8,8 +8,8 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace eDosStation.Properties
|
||||
{
|
||||
namespace eDosStation.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -19,31 +19,26 @@ namespace eDosStation.Properties
|
|||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("eDosStation.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
|
|
@ -56,14 +51,11 @@ namespace eDosStation.Properties
|
|||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
eDosStation/Properties/Settings.Designer.cs
generated
2
eDosStation/Properties/Settings.Designer.cs
generated
|
|
@ -12,7 +12,7 @@ namespace eDosStation.Properties {
|
|||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
|
|
|||
|
|
@ -13,7 +13,11 @@
|
|||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
|
||||
<RowDefinition Height="20" />
|
||||
<RowDefinition Height="auto" />
|
||||
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150"/>
|
||||
|
|
@ -35,10 +39,12 @@
|
|||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Test CSN"></TextBlock>
|
||||
<TextBox Grid.Row="3" Name="tTestCSN" Text="" Grid.Column="1" />
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="Badgelezers"></TextBlock>
|
||||
<ComboBox Grid.Row="4" Grid.ColumnSpan="2" Name="cbReaders" Text="" Grid.Column="1" />
|
||||
|
||||
|
||||
<Button Grid.Row="4" Grid.Column="0" Content="OK" Name="bOK" Click="BOK_Click" />
|
||||
<Button Grid.Row="4" Grid.Column="1" Content="Cancel" Name="bCancel" Click="BCancel_Click" />
|
||||
<Button Grid.Row="6" Grid.Column="0" Content="OK" Name="bOK" Click="BOK_Click" />
|
||||
<Button Grid.Row="6" Grid.Column="2" Content="Cancel" Name="bCancel" Click="BCancel_Click" />
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ namespace eDosStation
|
|||
thisStation.Inst_Name1= tInsName1.Text;
|
||||
thisStation.Inst_Name2 = tInsName2.Text;
|
||||
thisStation.TestCSN = tTestCSN.Text;
|
||||
thisStation.Reader = cbReaders.Text;
|
||||
thisStation.Update();
|
||||
this.Close();
|
||||
if (thisStation.Error>0)
|
||||
|
|
@ -55,6 +56,23 @@ namespace eDosStation
|
|||
tInsName1.Text = thisStation.Inst_Name1.ToString();
|
||||
tInsName2.Text = thisStation.Inst_Name2.ToString();
|
||||
tTestCSN.Text = thisStation.TestCSN;
|
||||
|
||||
var a = new LSWDesfirePublic.CCard();
|
||||
a.GetReaderList();
|
||||
cbReaders.Items.Clear();
|
||||
foreach (string s in a.readersList )
|
||||
{
|
||||
ComboBoxItem b = new ComboBoxItem();
|
||||
b.Content = s;
|
||||
if (s.Equals(thisStation.Reader))
|
||||
{
|
||||
b.IsSelected = true;
|
||||
b.Background = Brushes.Green;
|
||||
}
|
||||
cbReaders.Items.Add(b);
|
||||
}
|
||||
|
||||
a.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ namespace eDosStation
|
|||
ConnectRV = ep.Connect(false);
|
||||
} catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show("Error loading dll's");
|
||||
MessageBox.Show($"Error loading dll's {ex.Message}");
|
||||
}
|
||||
if (ep.DeviceCount == 1 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ namespace eDosStation
|
|||
{
|
||||
public class SimulateData
|
||||
{
|
||||
public string DebugWearerID;
|
||||
public string DebugWearerName;
|
||||
public int DebugEpdType;
|
||||
public string WearerID;
|
||||
public string WearerName;
|
||||
public int EdpType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ namespace eDosStation
|
|||
public string Inst_Name1 { get; set; }
|
||||
public string Inst_Name2 { get; set; }
|
||||
public string TestCSN { get; set; }
|
||||
public string TestCode { get; set; }
|
||||
public string Reader { get; internal set; }
|
||||
|
||||
public bool Changed = false;
|
||||
public int Error = 0;
|
||||
|
|
@ -33,8 +35,10 @@ namespace eDosStation
|
|||
ComPort = 0;
|
||||
Inst_CODE1 = 1;
|
||||
Inst_CODE2 = 11;
|
||||
Inst_Name1 = "BR1"; Inst_Name2 = "Venus";
|
||||
TestCSN = "0428790A0B4E80";
|
||||
Inst_Name1 = "BR1";
|
||||
Inst_Name2 = "Venus";
|
||||
TestCSN = System.Configuration.ConfigurationManager.AppSettings["TestCSN"];
|
||||
TestCode = System.Configuration.ConfigurationManager.AppSettings["TestCode"];
|
||||
insComments = new StringBuilder();
|
||||
tbComments = new TextBlock();
|
||||
tbComments.FontSize = 20;
|
||||
|
|
@ -60,6 +64,7 @@ namespace eDosStation
|
|||
Inst_Name1 = Values[rs.GetOrdinal("Inst_Name1")].ToString();
|
||||
Inst_Name2 = Values[rs.GetOrdinal("Inst_Name2")].ToString();
|
||||
TestCSN = Values[rs.GetOrdinal("TestCSN")].ToString();
|
||||
Reader = Values[rs.GetOrdinal("Reader")].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -68,8 +73,10 @@ namespace eDosStation
|
|||
Inst_CODE1 = 1;
|
||||
Inst_CODE2 = 11;
|
||||
Inst_Name1 = "BR1"; Inst_Name2 = "Venus";
|
||||
TestCSN = "0428790A0B4E80";
|
||||
TestCSN = System.Configuration.ConfigurationManager.AppSettings["TestCSN"];
|
||||
TestCode = System.Configuration.ConfigurationManager.AppSettings["TestCode"];
|
||||
Changed = true;
|
||||
Reader= System.Configuration.ConfigurationManager.AppSettings["Reader"];
|
||||
}
|
||||
rs.Close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\LSWDesfirePublic.1.2.5\build\LSWDesfirePublic.props" Condition="Exists('..\packages\LSWDesfirePublic.1.2.5\build\LSWDesfirePublic.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
|
@ -8,7 +9,7 @@
|
|||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>eDosStation</RootNamespace>
|
||||
<AssemblyName>eDosStation</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
<BootstrapperEnabled>false</BootstrapperEnabled>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
|
|
@ -266,10 +268,6 @@
|
|||
<Project>{f1f47b79-9930-48b0-8dde-56e2c4bed2a2}</Project>
|
||||
<Name>EpdBaseClr</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OkReadBadge\OkReadBadge.vcxproj">
|
||||
<Project>{f98f3496-8a4c-4bdb-9f17-c7af47a60739}</Project>
|
||||
<Name>OkReadBadge</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Images\EPD-MK2.png" />
|
||||
|
|
@ -303,5 +301,8 @@
|
|||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\LSWDesfirePublic.1.2.5\build\LSWDesfirePublic.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LSWDesfirePublic.1.2.5\build\LSWDesfirePublic.props'))" />
|
||||
<Error Condition="!Exists('..\packages\LSWDesfirePublic.1.2.5\build\LSWDesfirePublic.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LSWDesfirePublic.1.2.5\build\LSWDesfirePublic.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\LSWDesfirePublic.1.2.5\build\LSWDesfirePublic.targets" Condition="Exists('..\packages\LSWDesfirePublic.1.2.5\build\LSWDesfirePublic.targets')" />
|
||||
</Project>
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="LSWDesfirePublic" version="1.2.5" targetFramework="net48" />
|
||||
<package id="Microsoft.VisualStudio.SlowCheetah" version="3.2.26" targetFramework="net472" developmentDependency="true" />
|
||||
</packages>
|
||||
Loading…
Add table
Reference in a new issue