met conversie doses
This commit is contained in:
parent
be5664e38c
commit
f1b7a96cf2
7 changed files with 48 additions and 39 deletions
|
|
@ -110,6 +110,7 @@ void EpdBase::Epd2U::Close()
|
||||||
void EpdBase::Epd2U::DecodeFunctionFlags()
|
void EpdBase::Epd2U::DecodeFunctionFlags()
|
||||||
{
|
{
|
||||||
EpdType = (FunctionFlags & 0x1F00) >> 8;
|
EpdType = (FunctionFlags & 0x1F00) >> 8;
|
||||||
|
//0=BG 3=Neutron 4=BG Mk3 7=Neutron Mk4
|
||||||
}
|
}
|
||||||
void EpdBase::Epd2U::DecodeStatus()
|
void EpdBase::Epd2U::DecodeStatus()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@ int EpdBaseClr::Epd2::GetStatus()
|
||||||
WearerName = gcnew String((char *)epd->WearerName);
|
WearerName = gcnew String((char *)epd->WearerName);
|
||||||
isOn = (epd->DetectorsOn != 0);
|
isOn = (epd->DetectorsOn != 0);
|
||||||
epdType = epd->EpdType;
|
epdType = epd->EpdType;
|
||||||
|
isBG = (epd->EpdType == 0 || epd->EpdType==4); //MK2 BG=0 or MK3 BG=4 3=MK2 Neuruon 7=MK3 neutron
|
||||||
alarmStatus = epd->AlarmStatus;
|
alarmStatus = epd->AlarmStatus;
|
||||||
otherAlarms = epd->OtherAlarms;
|
otherAlarms = epd->OtherAlarms;
|
||||||
errorStatus = epd->ErrorStatus;
|
errorStatus = epd->ErrorStatus;
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ namespace EpdBaseClr {
|
||||||
String^ WearerID;
|
String^ WearerID;
|
||||||
bool Issued;
|
bool Issued;
|
||||||
bool isOn;
|
bool isOn;
|
||||||
|
bool isBG;
|
||||||
|
|
||||||
int InitRV;
|
int InitRV;
|
||||||
int DiscRV;
|
int DiscRV;
|
||||||
|
|
@ -110,7 +111,6 @@ namespace EpdBaseClr {
|
||||||
BYTE EPDTrhFault = 0;
|
BYTE EPDTrhFault = 0;
|
||||||
BYTE EPDOthFault = 0;
|
BYTE EPDOthFault = 0;
|
||||||
|
|
||||||
|
|
||||||
//AlarmStatus
|
//AlarmStatus
|
||||||
BYTE AlarmDoseHP101G = 0;
|
BYTE AlarmDoseHP101G = 0;
|
||||||
BYTE AlarmDoseHP102G = 0;
|
BYTE AlarmDoseHP102G = 0;
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ MK3::Epd2U::Epd2U(int _comport)
|
||||||
epdComsHandle = INVALID_HANDLE_VALUE;
|
epdComsHandle = INVALID_HANDLE_VALUE;
|
||||||
//SetAutoCommit(0); alleen epd2
|
//SetAutoCommit(0); alleen epd2
|
||||||
Error = 123;
|
Error = 123;
|
||||||
|
if (Ev1 != nullptr) Ev1 = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||||
if (_comport == 0) return;
|
if (_comport == 0) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -62,6 +63,10 @@ void MK3::Epd2U::EndCom()
|
||||||
MK3::Epd2U::~Epd2U()
|
MK3::Epd2U::~Epd2U()
|
||||||
{
|
{
|
||||||
EndCom();
|
EndCom();
|
||||||
|
if (Ev1 != nullptr) {
|
||||||
|
CloseHandle(Ev1); Ev1 = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WINAPI discovery(CommsHandle hComms, DiscoveryId const discovered[], int32_t count)
|
void WINAPI discovery(CommsHandle hComms, DiscoveryId const discovered[], int32_t count)
|
||||||
|
|
@ -95,7 +100,6 @@ int MK3::Epd2U::StartDiscover()
|
||||||
{
|
{
|
||||||
//memset(DevceIDs, 0, sizeof(DeviceIDs));
|
//memset(DevceIDs, 0, sizeof(DeviceIDs));
|
||||||
current = this;
|
current = this;
|
||||||
Ev1 = CreateEvent(NULL, TRUE,FALSE,NULL);
|
|
||||||
rv = StartDiscovery(epdComsHandle, discovery);
|
rv = StartDiscovery(epdComsHandle, discovery);
|
||||||
if (rv==0) rv = WaitForSingleObject(Ev1, 10000);
|
if (rv==0) rv = WaitForSingleObject(Ev1, 10000);
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +201,7 @@ void MK3::Epd2U::DecodeStatus()
|
||||||
void MK3::Epd2U::SetTime() //Only R3
|
void MK3::Epd2U::SetTime() //Only R3
|
||||||
{
|
{
|
||||||
if (Epd.Gen == EpdGeneration::Mk3) {
|
if (Epd.Gen == EpdGeneration::Mk3) {
|
||||||
utc = TimeFunctions::NowToEpdTime();
|
utc = TimeFunctions::NowToEpdTime(Epd.Gen == EpdGeneration::Mk2);
|
||||||
ResetEvent(Ev1);
|
ResetEvent(Ev1);
|
||||||
token = BeginWriteRTC_R3(epdComsHandle, utc, completion);
|
token = BeginWriteRTC_R3(epdComsHandle, utc, completion);
|
||||||
uint32_t r = Commit(epdComsHandle);
|
uint32_t r = Commit(epdComsHandle);
|
||||||
|
|
@ -229,7 +233,6 @@ WORD MK3::Epd2U::ReadStatus()
|
||||||
ErrorStatus = epd3status.FaultStatus;
|
ErrorStatus = epd3status.FaultStatus;
|
||||||
OtherAlarms = epd3status.OtherBits;
|
OtherAlarms = epd3status.OtherBits;
|
||||||
|
|
||||||
|
|
||||||
Error = 0; ReadStatusRV = 0;
|
Error = 0; ReadStatusRV = 0;
|
||||||
|
|
||||||
uint32_t EpdID32;
|
uint32_t EpdID32;
|
||||||
|
|
@ -246,11 +249,9 @@ WORD MK3::Epd2U::ReadStatus()
|
||||||
EpdID = EpdID32;
|
EpdID = EpdID32;
|
||||||
|
|
||||||
isBG = (EpdType == EpdTypes::Mk2BetaGamma || EpdType == EpdTypes::Mk3BetaGamma);
|
isBG = (EpdType == EpdTypes::Mk2BetaGamma || EpdType == EpdTypes::Mk3BetaGamma);
|
||||||
|
|
||||||
|
|
||||||
DecodeStatus();
|
DecodeStatus();
|
||||||
|
memset(WearerID, 0, WearerIDLength + 1);
|
||||||
memset(WearerID, 0, WearerIDLength + 1);
|
|
||||||
memset(WearerName, 0, WearerNameLength + 1);
|
memset(WearerName, 0, WearerNameLength + 1);
|
||||||
|
|
||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
|
|
@ -307,7 +308,7 @@ WORD MK3::Epd2U::ReadStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
FILETIME fUTC;
|
FILETIME fUTC;
|
||||||
TimeFunctions::EpdTimeToFileTime(utc, &fUTC);
|
TimeFunctions::EpdTimeToFileTime(utc, &fUTC, Epd.Gen== EpdGeneration::Mk2);
|
||||||
FileTimeToSystemTime(&fUTC, &tRealTime);
|
FileTimeToSystemTime(&fUTC, &tRealTime);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -429,23 +430,25 @@ void MK3::Epd2U::decodeBaseCounters(int count)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void MK3::Epd2U::decodeTreshold(Mk3AlarmThresholds_t *th)
|
void MK3::Epd2U::decodeTreshold(Mk3AlarmThresholds_t* th)
|
||||||
{
|
{
|
||||||
//th.MeasId
|
float* pThDose = nullptr, * pThRate = nullptr, * pTHDoseWarning = nullptr, * pTHRateWarning = nullptr;
|
||||||
float* pThDose = nullptr, *pThRate = nullptr;
|
switch ((MeasurementId)th->MeasId)
|
||||||
|
{
|
||||||
switch ((MeasurementId)th->MeasId) {
|
|
||||||
case MeasurementId::Meas_Hp07:
|
case MeasurementId::Meas_Hp07:
|
||||||
case MeasurementId::Meas_Hp10N:
|
case MeasurementId::Meas_Hp10N:
|
||||||
Hp07THDose = 0; Hp07RateOn = 0; Hp07RateOff = 0;
|
Hp07THDose = 0; Hp07RateOn = 0; Hp07RateOff = 0;
|
||||||
pThDose = &Hp07THDose;
|
pThDose = &Hp07THDose;
|
||||||
pThRate = &Hp07RateOn;
|
pThRate = &Hp07RateOn;
|
||||||
|
pTHDoseWarning = pTHRateWarning = nullptr;
|
||||||
break;
|
break;
|
||||||
case MeasurementId::Meas_Hp10:
|
case MeasurementId::Meas_Hp10:
|
||||||
Hp10THDose1 = 0; Hp10THDose2 = 0;
|
Hp10THDose1 = 0; Hp10THDose2 = 0;
|
||||||
Hp10Rate1On = Hp10Rate2On = Hp10Rate1Off = Hp10Rate2Off = 0;
|
Hp10Rate1On = Hp10Rate2On = Hp10Rate1Off = Hp10Rate2Off = 0;
|
||||||
pThDose = &Hp10THDose1;
|
pThDose = &Hp10THDose2;
|
||||||
pThRate = &Hp10Rate1On;
|
pThRate = &Hp10Rate2On;
|
||||||
|
pTHDoseWarning = &Hp10THDose1;
|
||||||
|
pTHRateWarning = &Hp10Rate1Off;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -453,12 +456,13 @@ void MK3::Epd2U::decodeTreshold(Mk3AlarmThresholds_t *th)
|
||||||
{
|
{
|
||||||
switch ((ThresholdId)th->Thresholds[ix].Id) {
|
switch ((ThresholdId)th->Thresholds[ix].Id) {
|
||||||
case ThresholdId::Thres_DoseAlarm: if (pThDose != nullptr) *pThDose = th->Thresholds[ix].Value; break;
|
case ThresholdId::Thres_DoseAlarm: if (pThDose != nullptr) *pThDose = th->Thresholds[ix].Value; break;
|
||||||
case ThresholdId::Thres_DoseWarning: break;
|
case ThresholdId::Thres_DoseWarning: if (pTHDoseWarning != nullptr) *pTHDoseWarning = = th->Thresholds[ix].Value; break;
|
||||||
case ThresholdId::Thres_RateAlarm: if (pThRate != nullptr) *pThRate = th->Thresholds[ix].Value; break;
|
case ThresholdId::Thres_RateAlarm: if (pThRate != nullptr) *pThRate = th->Thresholds[ix].Value; break;
|
||||||
case ThresholdId::Thres_RateWarning: break;
|
case ThresholdId::Thres_RateWarning: if (pTHRateWarning != nullptr) *pTHRateWarning = th->Thresholds[ix].Value; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MK3::Epd2U::encodeTreshold(Mk3AlarmThresholds_t* th)
|
void MK3::Epd2U::encodeTreshold(Mk3AlarmThresholds_t* th)
|
||||||
{
|
{
|
||||||
//th.MeasId
|
//th.MeasId
|
||||||
|
|
@ -466,7 +470,7 @@ void MK3::Epd2U::encodeTreshold(Mk3AlarmThresholds_t* th)
|
||||||
pThDose = &Hp07THDose;
|
pThDose = &Hp07THDose;
|
||||||
pTHDoseWarning = &Hp07THDose;
|
pTHDoseWarning = &Hp07THDose;
|
||||||
pThRate = &Hp07RateOn;
|
pThRate = &Hp07RateOn;
|
||||||
pTHRateWarning = &Hp07RateOn;
|
pTHRateWarning = &Hp07RateOff;
|
||||||
|
|
||||||
switch ((MeasurementId)th->MeasId) {
|
switch ((MeasurementId)th->MeasId) {
|
||||||
case MeasurementId::Meas_Hp07:
|
case MeasurementId::Meas_Hp07:
|
||||||
|
|
@ -474,14 +478,14 @@ void MK3::Epd2U::encodeTreshold(Mk3AlarmThresholds_t* th)
|
||||||
pThDose = &Hp07THDose;
|
pThDose = &Hp07THDose;
|
||||||
pTHDoseWarning = &Hp07THDose;
|
pTHDoseWarning = &Hp07THDose;
|
||||||
pThRate = &Hp07RateOn;
|
pThRate = &Hp07RateOn;
|
||||||
pTHRateWarning = &Hp07RateOn;
|
pTHRateWarning = &Hp07RateOff;
|
||||||
break;
|
break;
|
||||||
case MeasurementId::Meas_Hp10:
|
case MeasurementId::Meas_Hp10:
|
||||||
case MeasurementId::Meas_Hp10G:
|
case MeasurementId::Meas_Hp10G:
|
||||||
pThDose = &Hp10THDose1;
|
pThDose = &Hp10THDose1;
|
||||||
pThRate = &Hp10Rate2On;
|
pThRate = &Hp10Rate2On;
|
||||||
pTHDoseWarning = &Hp10THDose1;
|
pTHDoseWarning = &Hp10THDose1;
|
||||||
pTHRateWarning = &Hp10Rate1On;
|
pTHRateWarning = &Hp10Rate1Off;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
th->NumberThresholds = 4;
|
th->NumberThresholds = 4;
|
||||||
|
|
@ -685,7 +689,6 @@ WORD MK3::Epd2U::WriteAlarmTresholds() {
|
||||||
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
|
||||||
r = EndWriteAlarmThresholds(epdComsHandle, token);
|
r = EndWriteAlarmThresholds(epdComsHandle, token);
|
||||||
|
|
||||||
|
|
||||||
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10G; else measID = (uint8_t)MeasurementId::Meas_Hp10;
|
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10G; else measID = (uint8_t)MeasurementId::Meas_Hp10;
|
||||||
hp10tresholds.MeasId = measID;
|
hp10tresholds.MeasId = measID;
|
||||||
encodeTreshold(&hp10tresholds);
|
encodeTreshold(&hp10tresholds);
|
||||||
|
|
|
||||||
|
|
@ -7,27 +7,34 @@ TimeFunctions::TimeFunctions()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeFunctions::EpdTimeToFileTime( INT32 t, LPFILETIME pft)
|
|
||||||
|
void TimeFunctions::EpdTimeToFileTime( INT32 t, LPFILETIME pft, bool isMK2) //MK3
|
||||||
{
|
{
|
||||||
|
LONGLONG offset ;
|
||||||
|
if (isMK2) offset = 116444736000000000; else offset = 125911584000000000;;
|
||||||
LONGLONG ll;
|
LONGLONG ll;
|
||||||
ll = Int32x32To64(t, 10000000) + 125911584000000000; //1601-1-1 -> 2000
|
ll = Int32x32To64(t, 10000000) + offset; //1601-1-1 -> 2000
|
||||||
pft->dwLowDateTime = (DWORD)ll;
|
pft->dwLowDateTime = (DWORD)ll;
|
||||||
pft->dwHighDateTime = ll >> 32;
|
pft->dwHighDateTime = ll >> 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeFunctions::FileTimeToEpdTime( FILETIME pft, INT32* t)
|
void TimeFunctions::FileTimeToEpdTime( FILETIME pft, INT32* t, bool isMK2)
|
||||||
{
|
{
|
||||||
LONGLONG ll = ((((LONGLONG)pft.dwHighDateTime << 32) + pft.dwLowDateTime) - 125911584000000000) / 10000000;
|
LONGLONG offset;
|
||||||
|
if (isMK2) offset = 116444736000000000; else offset = 125911584000000000;
|
||||||
|
LONGLONG ll = ((((LONGLONG)pft.dwHighDateTime << 32) + pft.dwLowDateTime) - offset) / 10000000;
|
||||||
*t = (DWORD)ll;
|
*t = (DWORD)ll;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT32 TimeFunctions::NowToEpdTime( )
|
INT32 TimeFunctions::NowToEpdTime(bool isMK2)
|
||||||
{
|
{
|
||||||
|
LONGLONG offset;
|
||||||
|
if (isMK2) offset = 116444736000000000; else offset = 125911584000000000;
|
||||||
SYSTEMTIME t;
|
SYSTEMTIME t;
|
||||||
GetSystemTime(&t);
|
GetSystemTime(&t);
|
||||||
FILETIME ft;
|
FILETIME ft;
|
||||||
SystemTimeToFileTime((const SYSTEMTIME *)&t, &ft);
|
SystemTimeToFileTime((const SYSTEMTIME *)&t, &ft);
|
||||||
LONGLONG ll = ((((LONGLONG)ft.dwHighDateTime << 32U) + ft.dwLowDateTime) - 125911584000000000) / 10000000;
|
LONGLONG ll = ((((LONGLONG)ft.dwHighDateTime << 32U) + ft.dwLowDateTime) - offset) / 10000000;
|
||||||
return (DWORD)ll;
|
return (DWORD)ll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,10 @@ class TimeFunctions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TimeFunctions();
|
TimeFunctions();
|
||||||
static void EpdTimeToFileTime(INT32 t, LPFILETIME pft);
|
static void EpdTimeToFileTime(INT32 t, LPFILETIME pft, bool isMK2);
|
||||||
void FileTimeToEpdTime(FILETIME pft, INT32* t);
|
void FileTimeToEpdTime(FILETIME pft, INT32* t,bool isMK2);
|
||||||
static INT32 NowToEpdTime();
|
static INT32 NowToEpdTime(bool isMK2);
|
||||||
static void UnixTimeToFileTime(time_t t, LPFILETIME pft);
|
static void UnixTimeToFileTime(time_t t, LPFILETIME pft);
|
||||||
static void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst);
|
static void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,6 @@ namespace eDosStation
|
||||||
DataSet1.GetTaskInfoRow CurTaskRow;
|
DataSet1.GetTaskInfoRow CurTaskRow;
|
||||||
enum eCOE { quiz = 1 };
|
enum eCOE { quiz = 1 };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if SimulateEPD
|
#if SimulateEPD
|
||||||
public SimulateData simulData = new SimulateData();
|
public SimulateData simulData = new SimulateData();
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -96,8 +94,9 @@ namespace eDosStation
|
||||||
this.Close();
|
this.Close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool isBG = ep.epdType == 0;
|
|
||||||
if (isBG != CurTaskRow.EPDRad.Equals("BG"))
|
//bool isBG = ep.epdType == 0;
|
||||||
|
if (ep.isBG != CurTaskRow.EPDRad.Equals("BG"))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Wrong EPD Type", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
|
MessageBox.Show("Wrong EPD Type", "EDP", MessageBoxButton.OK, MessageBoxImage.Hand, MessageBoxResult.OK, MessageBoxOptions.ServiceNotification);
|
||||||
this.Close();
|
this.Close();
|
||||||
|
|
@ -155,7 +154,7 @@ namespace eDosStation
|
||||||
}
|
}
|
||||||
if (ID_Visit.HasValue && LoadDoses())
|
if (ID_Visit.HasValue && LoadDoses())
|
||||||
{
|
{
|
||||||
bool isBG = (ep.epdType != 3); //3 = zwarte 0=grijs
|
bool isBG = ep.isBG; // (ep.epdType != 3); //3 = zwarte 0=grijs
|
||||||
var co = dataInterface.getCon(true);
|
var co = dataInterface.getCon(true);
|
||||||
dataInterface.VisitInitCommand.Connection = co;
|
dataInterface.VisitInitCommand.Connection = co;
|
||||||
dataInterface.VisitInitCommand.Parameters["ID_Station"].Value = thisStation.ID_Station;
|
dataInterface.VisitInitCommand.Parameters["ID_Station"].Value = thisStation.ID_Station;
|
||||||
|
|
@ -208,8 +207,7 @@ namespace eDosStation
|
||||||
if (kx != null && (ep.K3 != kx || ep.K4 != kx))
|
if (kx != null && (ep.K3 != kx || ep.K4 != kx))
|
||||||
{
|
{
|
||||||
ep.K3 = ep.K4 = kx.Value;
|
ep.K3 = ep.K4 = kx.Value;
|
||||||
|
if (!ep.isBG)
|
||||||
if (!isBG)
|
|
||||||
{
|
{
|
||||||
if (ep.K6 != 1310)
|
if (ep.K6 != 1310)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue