testing on Neutron

This commit is contained in:
Luc 2021-05-19 16:38:54 +02:00
parent ef8362bb60
commit be5664e38c
17 changed files with 1828 additions and 296944 deletions

View file

@ -91,6 +91,22 @@ int MK3::Epd2::DecodeStatus()
return 1;
}
int MK3::Epd2::SetTime() {
epd->SetTime();
return epd->utc;
}
int MK3::Epd2::ReadAlarmConfig() {
epd->ReadAlarmConfig();
return epd->numAlarm;
}
int MK3::Epd2::ReadAlarmTresholds() {
epd->ReadAlarmTresholds();
return 0;
}
int MK3::Epd2::GetStatus()
{
GetStatusError = 0; StatusRV = 0; Issued = false;
@ -102,7 +118,8 @@ int MK3::Epd2::GetStatus()
WearerID = gcnew String((char*)epd->WearerID);
WearerName = gcnew String((char*)epd->WearerName);
isOn = (epd->DetectorsOn != 0);
epdType = epd->EpdType;
epdType = (int)epd->EpdType;
isBG = (epd->EpdType == EpdTypes::Mk2BetaGamma || epd->EpdType == EpdTypes::Mk3BetaGamma);
alarmStatus = epd->AlarmStatus;
otherAlarms = epd->OtherAlarms;
errorStatus = epd->ErrorStatus;
@ -163,122 +180,121 @@ int MK3::Epd2::GetDoses()
//
return ReadDosesRV;
}
//
//int MK3::Epd2::SetDeIssued()
//{
// return epd->DeIssue();
//}
//
//int MK3::Epd2::PrepareForIssue()
//{
// PrepareForIssueError = 0;
// int rv = epd->PrepareForIssue();
// if (rv != 1) PrepareForIssueError = epd->Error;
// return rv;
//}
//int MK3::Epd2::SetIssued()
//{
// SetIssuedError = 0;
// epd->Hp07THDose = (DWORD)(Hp07THDose * 64.0);
// epd->Hp10THDose1 = (DWORD)(Hp10THDose1 * 64.0);
// epd->Hp10THDose2 = (DWORD)(Hp10THDose2 * 64.0);
//
// 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);
// int l = strlen(str1);
// if (l > WearerIDLength) l = WearerIDLength;
// _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);
// l = strlen(str2);
// if (l > WearerNameLength) l = WearerNameLength;
// _memccpy(epd->WearerName, str2, l, WearerNameLength);
// Runtime::InteropServices::Marshal::FreeHGlobal((IntPtr)str2);
//
// int rv = epd->Issue();
// if (rv != 1) SetIssuedError = epd->Error;
// return rv;
//}
int MK3::Epd2::SetDeIssued()
{
return epd->DeIssue();
}
//int MK3::Epd2::WriteCalibration()
//{
// epd->K1 = K1;
// epd->K2 = K2;
//
// epd->K3 = K3;
// epd->K4 = K4;
//
// epd->K5 = K5;
// epd->K6 = K6;
//
// //epd->K1 = 903;
// //epd->K2 = 613;
// //epd->K5 = 13100;
// //epd->K6 = 1310;
//
// int rv = epd->WriteCal();
// return rv;
//
//}
//
//int MK3::Epd2::ReadTresholds()
//{
// ReadTresholdsError = 0;
// int rv = epd->ReadTresHolds();
// if (rv != 0) ReadTresholdsError = epd->Error;
//
// Hp10THDose1 = (double)epd->Hp10THDose1 / 64.0;
// Hp10THDose2 = (double)epd->Hp10THDose2 / 64.0;
// Hp07THDose = (double)epd->Hp07THDose / 64.0;
//
// Hp10Total = (double)epd->Hp10Total / 64.0;
// Hp07Total = (double)epd->Hp07Total / 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 rv;
//}
int MK3::Epd2::PrepareForIssue()
{
PrepareForIssueError = 0;
int rv = epd->PrepareForIssue();
if (rv != 1) PrepareForIssueError = epd->Error;
return rv;
}
//int MK3::Epd2::ReadExtraStatus()
//{
// int rv = epd->EPDReadExtraStatus();
// 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;
// CountsClockBase = epd->BaseCountsClock;
//
// return rv;
//}
int MK3::Epd2::SetIssued()
{
SetIssuedError = 0;
epd->Hp07THDose = (float)Hp07THDose ;
epd->Hp10THDose1 = (float)Hp10THDose1 ;
epd->Hp10THDose2 = (float)Hp10THDose2 ;
epd->Hp10Rate1On = (float)(Hp10Rate1On);
epd->Hp10Rate2On = (float)(Hp10Rate2On);
epd->Hp07RateOn = (float)(Hp07RateOn);
epd->Hp10Rate1Off = (float)(Hp10Rate1Off);
epd->Hp10Rate2Off = (float)(Hp10Rate2Off);
epd->Hp07RateOff = (float)(Hp07RateOff);
memset(epd->WearerID, ' ', WearerIDLength); epd->WearerID[WearerIDLength] = 0;
char* str1 = (char*)(void*)Runtime::InteropServices::Marshal::StringToHGlobalAnsi(WearerID);
int l = strlen(str1);
if (l > WearerIDLength) l = WearerIDLength;
_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);
l = strlen(str2);
if (l > WearerNameLength) l = WearerNameLength;
_memccpy(epd->WearerName, str2, l, WearerNameLength);
Runtime::InteropServices::Marshal::FreeHGlobal((IntPtr)str2);
int rv = epd->Issue();
if (rv != 1) SetIssuedError = epd->Error;
return rv;
}
int MK3::Epd2::WriteCalibration()
{
epd->K1 = K1;
epd->K2 = K2;
epd->K3 = K3;
epd->K4 = K4;
epd->K5 = K5;
epd->K6 = K6;
//epd->K1 = 903;
//epd->K2 = 613;
//epd->K5 = 13100;
//epd->K6 = 1310;
int rv = epd->WriteCal();
return rv;
}
int MK3::Epd2::ReadTresholds()
{
ReadTresholdsError = 0;
int rv = epd->ReadAlarmTresholds();
if (rv != 0) ReadTresholdsError = epd->Error;
Hp10THDose1 = (double)epd->Hp10THDose1 / 64.0;
Hp10THDose2 = (double)epd->Hp10THDose2 / 64.0;
Hp07THDose = (double)epd->Hp07THDose / 64.0;
Hp10Total = (double)epd->Hp10Total / 64.0;
Hp07Total = (double)epd->Hp07Total / 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 rv;
}
int MK3::Epd2::ReadExtraStatus()
{
int rv = epd->EPDReadExtraStatus();
BatADC = epd->byBatADC;
SupplyADC = epd->bySupplyADC;
D1 = epd->D1 ;
D2 = epd->D2 ;
D3 = epd->D3 ;
D4 = epd->D4 ;
CountsClock = epd->CountsClock;
CountsClockBase = epd->BaseCountsClock;
return rv;
}

View file

@ -23,6 +23,7 @@ namespace MK3 {
String^ WearerID;
bool Issued;
bool isOn;
bool isBG;
int InitRV;
int DiscRV;
@ -61,12 +62,13 @@ namespace MK3 {
double Hp10Rate2Off;
double Hp07RateOff;
int K1;
int K2;
int K3;
int K4;
int K5;
int K6;
float K1;
float K2;
float K3;
float K4;
float K5;
float K6;
int SG;
int BC;
int FB;
@ -132,15 +134,21 @@ namespace MK3 {
int DecodeStatus();
int SetTime();
int ReadAlarmConfig();
int ReadAlarmTresholds();
int GetStatus();
int GetDoses();
//int SetDeIssued();
//int SetIssued();
//int PrepareForIssue();
//int WriteCalibration();
//int ReadTresholds();
//int ReadExtraStatus();
int SetDeIssued();
int SetIssued();
int PrepareForIssue();
int WriteCalibration();
int ReadTresholds();
int ReadExtraStatus();

View file

@ -30,6 +30,7 @@ DWORD MK3::Epd2U::StartCom()
{
ErrorReason = 0;
int mx = 10;
epdComsHandle = INVALID_HANDLE_VALUE;
if (port == 0) {
CommsInitialized = 1;
return 1;
@ -40,19 +41,27 @@ DWORD MK3::Epd2U::StartCom()
if (InitRv == 0)
{
SetMultipleDiscoveryMode(epdComsHandle, false);
//SetRetryCount(epdComsHandle, retry);
//SetDiscoveryTimeslotPeriod(port, DiscoveryTimeslotPeriod);
//DiscoveryTimeout(epdComsHandle,DiscoveryExpirationPeriod);
CommsInitialized = 1;
}
}
return InitRv;
}
void MK3::Epd2U::EndCom()
{
if (CommsInitialized == 1) {
if (epdComsHandle != INVALID_HANDLE_VALUE) {
CloseReader(epdComsHandle);
DestroyReaderInterface(epdComsHandle);
}
}
CommsInitialized = 0;
epdComsHandle = INVALID_HANDLE_VALUE;
}
MK3::Epd2U::~Epd2U()
{
if (epdComsHandle != INVALID_HANDLE_VALUE) DestroyReaderInterface(epdComsHandle);
CommsInitialized = 0;
EndCom();
}
void WINAPI discovery(CommsHandle hComms, DiscoveryId const discovered[], int32_t count)
@ -68,7 +77,7 @@ void WINAPI discovery(CommsHandle hComms, DiscoveryId const discovered[], int32_
int MK3::Epd2U::StartDiscover()
{
int32_t rv,rv2;
int32_t rv;
//System::Diagnostics::Trace::WriteLine("StartDiscover");
Error = 0;
@ -184,12 +193,22 @@ void MK3::Epd2U::DecodeStatus()
OtherAlarmCarrier = checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::TelemetryAlert);
OtherAlarmBatVolt = checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::LowBattery);
}
void MK3::Epd2U::SetTime() //Only R3
{
if (Epd.Gen == EpdGeneration::Mk3) {
utc = TimeFunctions::NowToEpdTime();
ResetEvent(Ev1);
token = BeginWriteRTC_R3(epdComsHandle, utc, completion);
uint32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndWriteRTC_R3(epdComsHandle, token);
}
}
WORD MK3::Epd2U::ReadStatus()
{
int32_t r;
OperatingStatus = (OpStatusFlags)0U;
AlarmStatus = (AlarmStatusFlags)0U;
ErrorStatus = (FaultStatusFlags)0;
@ -225,6 +244,9 @@ WORD MK3::Epd2U::ReadStatus()
r = EndReadEpdIdentities(epdComsHandle, token, &EpdID32, (EpdTypes*)&EpdType, &capabilities, &MarkNumber, &VersionNumber, NULL, 0);
EpdID = EpdID32;
isBG = (EpdType == EpdTypes::Mk2BetaGamma || EpdType == EpdTypes::Mk3BetaGamma);
DecodeStatus();
@ -233,7 +255,8 @@ WORD MK3::Epd2U::ReadStatus()
if (port == 0) {
EpdID = 4567;
EpdType = 0;
EpdType = EpdTypes::Mk2BetaGamma;
isBG = 1;
FunctionFlags = 0x000;
Epd.Gen = EpdGeneration::None;
Epd.MaxBaud = 0;
@ -242,38 +265,15 @@ WORD MK3::Epd2U::ReadStatus()
}
uint8_t length = 0;
if (Epd.Gen == EpdGeneration::Mk2 ) {
counterIdLen = 4;
counterIds[0] = (uint8_t)CounterType::Counter_Hg1; // MK2 HG;
counterIds[1] = (uint8_t)CounterType::Counter_Sg1; // MK2 SG;
counterIds[2] = (uint8_t)CounterType::Counter_Sg2; // MK2 BC;
counterIds[3] = (uint8_t)CounterType::Counter_Fb1; // MK2 FB;
}
else {
counterIdLen = 4;
counterIds[0] = (uint8_t)CounterType::Counter_Hg1; // MK2 HG;
counterIds[1] = (uint8_t)CounterType::Counter_Sg1; // MK2 SG;
counterIds[2] = (uint8_t)CounterType::Counter_Sg2; // MK2 BC;
counterIds[3] = (uint8_t)CounterType::Counter_Fb1; // MK2 FB;
}
for (int ix = 0; ix < 10; ix++) {
Counts[ix].type = 0; Counts[ix].value = 0;
}
countsRead = 0; utc = 0; seconds = 0;
//There are only four counters in Mk2 EPD.TruDose has six counters
//uint8_t x = sizeof(Counts);
ResetEvent(Ev1);
token = BeginReadCounts(epdComsHandle, counterIds, 4, completion);
token = BeginReadCounts(epdComsHandle, nullptr, 0, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadCounts(epdComsHandle,token,Counts,10, &countsRead,&utc,&seconds);
r = EndReadCounts(epdComsHandle,token,Counts,MaxCounts, &countsRead,&utc,&seconds);
// - 101 = InvalidParam
// - 104 = FunctionFail,
decodeCounters(countsRead); //HG,SG ..
IdString_t mk3WearerID;
//Mk2 EPDs only support Name and Primary ID
@ -297,11 +297,20 @@ WORD MK3::Epd2U::ReadStatus()
//1601-01-01T00:00:00Z.
//MK2 .. some utc... but no real time clock
if (utc == 0) {
ResetEvent(Ev1);
token = BeginReadRTC(epdComsHandle, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadRTC(epdComsHandle, token, &utc);
}
FILETIME fUTC;
TimeFunctions::EpdTimeToFileTime(utc, &fUTC);
FileTimeToSystemTime(&fUTC, &tRealTime);
//CommitRV = ReadEpdStatus(&EpdClock, &RealTime, &IssueCount, &OffTime, &OperatingStatus, &ErrorStatus, &AlarmStatus, &OtherAlarms, &EEPROMBadSectors);
//if (port == 0) {
// EpdClock = 123; ErrorStatus = 0;
@ -344,12 +353,156 @@ WORD MK3::Epd2U::ReadStatus()
//}
return CommitRV;
}
void MK3::Epd2U::decodeSensitivities(int count) {
K1 = K2 = K3 = K4 = K4 = K6 = 0.0F;
for (int ix = count - 1; ix >= 0; ix--) {
switch ((SensitivityId)sensitivities[ix].id)
{
case SensitivityId::Hg1Sens10G: K1 = sensitivities[ix].value; break;
case SensitivityId::Sg1Sens10G: K2 = sensitivities[ix].value; break;
case SensitivityId::Hg1Sens07G: K3 = sensitivities[ix].value; break;
case SensitivityId::Sg1Sens07G: K4 = sensitivities[ix].value; break;
case SensitivityId::Fb1Sens07B: K5 = sensitivities[ix].value; break;
case SensitivityId::Sg2Sens07B: K6 = sensitivities[ix].value; break;
}
}
}
void MK3::Epd2U::decodeDoses(int count)
{
//doses
Hp10Dose = Hp07Dose = 0;
for (int ix = 0; ix < count; ix++)
{
switch ((MeasurementId)doses[ix].id) {
case MeasurementId::Meas_Hp07: Hp07Dose = doses[ix].value; break;
case MeasurementId::Meas_Hp10: Hp10Dose = doses[ix].value; break;
case MeasurementId::Meas_Hp10N: Hp07Dose = doses[ix].value; break;
case MeasurementId::Meas_Hp10G: Hp10Dose= doses[ix].value; break;
}
}
}
void MK3::Epd2U::decodePeakRates(int count)
{
//Rates
Hp10Peak = Hp07Peak = 0;
Hp10Time = Hp07Time = 0;
for (int ix = 0; ix < count; ix++)
{
switch ((MeasurementId)peakRates[ix].id) {
case MeasurementId::Meas_Hp07:
case MeasurementId::Meas_Hp10N:
Hp07Peak= peakRates[ix].value;
Hp07Time = peakRates[ix].timestamp;
break;
case MeasurementId::Meas_Hp10:
case MeasurementId::Meas_Hp10G:
Hp10Peak = peakRates[ix].value;
Hp10Time = peakRates[ix].timestamp;
break;
}
}
}
void MK3::Epd2U::decodeCounters(int count)
{
HG = SG = BC = FB = 0;
for (int ix = 0; ix < count; ix++)
{
switch ((CounterType)Counts[ix].type) {
case CounterType::Counter_Hg1: HG = Counts[ix].value; break;
case CounterType::Counter_Sg1: SG = Counts[ix].value; break;
case CounterType::Counter_Sg2: BC = Counts[ix].value; break;
case CounterType::Counter_Fb1: FB = Counts[ix].value; break;
}
}
}
void MK3::Epd2U::decodeBaseCounters(int count)
{
for (int ix = 0; ix < count; ix++)
{
switch ((CounterType)Counts[ix].type) {
case CounterType::Counter_Hg1: D1 = Counts[ix].value; break;
case CounterType::Counter_Sg1: D2 = Counts[ix].value; break;
case CounterType::Counter_Sg2: D3 = Counts[ix].value; break;
case CounterType::Counter_Fb1: D4 = Counts[ix].value; break;
}
}
}
void MK3::Epd2U::decodeTreshold(Mk3AlarmThresholds_t *th)
{
//th.MeasId
float* pThDose = nullptr, *pThRate = nullptr;
switch ((MeasurementId)th->MeasId) {
case MeasurementId::Meas_Hp07:
case MeasurementId::Meas_Hp10N:
Hp07THDose = 0; Hp07RateOn = 0; Hp07RateOff = 0;
pThDose = &Hp07THDose;
pThRate = &Hp07RateOn;
break;
case MeasurementId::Meas_Hp10:
Hp10THDose1 = 0; Hp10THDose2 = 0;
Hp10Rate1On = Hp10Rate2On = Hp10Rate1Off = Hp10Rate2Off = 0;
pThDose = &Hp10THDose1;
pThRate = &Hp10Rate1On;
break;
}
for (int ix = 0; ix < th->NumberThresholds; ix++)
{
switch ((ThresholdId)th->Thresholds[ix].Id) {
case ThresholdId::Thres_DoseAlarm: if (pThDose != nullptr) *pThDose = th->Thresholds[ix].Value; break;
case ThresholdId::Thres_DoseWarning: break;
case ThresholdId::Thres_RateAlarm: if (pThRate != nullptr) *pThRate = th->Thresholds[ix].Value; break;
case ThresholdId::Thres_RateWarning: break;
}
}
}
void MK3::Epd2U::encodeTreshold(Mk3AlarmThresholds_t* th)
{
//th.MeasId
float* pThDose , *pThRate , *pTHDoseWarning,* pTHRateWarning;
pThDose = &Hp07THDose;
pTHDoseWarning = &Hp07THDose;
pThRate = &Hp07RateOn;
pTHRateWarning = &Hp07RateOn;
switch ((MeasurementId)th->MeasId) {
case MeasurementId::Meas_Hp07:
case MeasurementId::Meas_Hp10N:
pThDose = &Hp07THDose;
pTHDoseWarning = &Hp07THDose;
pThRate = &Hp07RateOn;
pTHRateWarning = &Hp07RateOn;
break;
case MeasurementId::Meas_Hp10:
case MeasurementId::Meas_Hp10G:
pThDose = &Hp10THDose1;
pThRate = &Hp10Rate2On;
pTHDoseWarning = &Hp10THDose1;
pTHRateWarning = &Hp10Rate1On;
break;
}
th->NumberThresholds = 4;
th->Thresholds[0].Id = (uint16_t)ThresholdId::Thres_DoseAlarm;
th->Thresholds[0].Value = *pThDose;
th->Thresholds[1].Id = (uint16_t)ThresholdId::Thres_RateAlarm;
th->Thresholds[1].Value = *pThRate;
th->Thresholds[2].Id = (uint16_t)ThresholdId::Thres_DoseWarning;
th->Thresholds[2].Value = *pThDose;
th->Thresholds[3].Id = (uint16_t)ThresholdId::Thres_RateWarning;
th->Thresholds[3].Value = *pThRate;
}
WORD MK3::Epd2U::ReadDoses()
{
if (port == 0) {
Hp10Dose = Hp07Dose = Hp10Total = Hp07Total = Knocks = Resets = QualityData = 21;
Hp10Peak = Hp07Peak = Hp10Time = Hp07Time = 1000;
Hp10Dose = Hp07Dose = Hp10Total = Hp07Total = 0.0;
Knocks = Resets = QualityData = 21;
Hp10Peak = Hp07Peak = 0.0;
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;
@ -363,10 +516,34 @@ WORD MK3::Epd2U::ReadDoses()
token = BeginReadDoses(epdComsHandle, nullptr, 0, completion);
int32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadDoses(epdComsHandle, token, doses, 2, &numDoses, &utc);
r = EndReadDoses(epdComsHandle, token, doses, MaxDoses, &numDoses, &utc);
decodeDoses(numDoses);
ResetEvent(Ev1);
//token = BeginReadDoses(epdComsHandle, new uint8_t[]{ 0, 1 }, 2 , completion);
token = BeginReadQualityData(epdComsHandle, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadQualityData(epdComsHandle, token, &quality);
Knocks = quality.Knocks;
Resets = quality.PowerCycles;
ResetEvent(Ev1);
token = BeginReadPeakRates(epdComsHandle, nullptr, 0, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadPeakRates(epdComsHandle, token, peakRates, MaxPeakRates, &numRates);
decodePeakRates(numRates);
ResetEvent(Ev1);
token = BeginReadSensitivities(epdComsHandle, nullptr, 0, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadSensitivities(epdComsHandle, token, sensitivities, MaxSensitivities, &numSensitivities);
decodeSensitivities(numSensitivities);
//int32_t EPDDLL_API EndReadQualityData(CommsHandle hComms, CompletionToken token, Mk3QualityData_t * quality )
//ReadDosesQualityRV = ReadDosesQuality(
// &Hp10Dose,
// &Hp07Dose,
@ -410,16 +587,285 @@ WORD MK3::Epd2U::ReadDoses()
// &HG);
//CommitRV = Commit();
//if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
return 0;
}
void MK3::Epd2U::ClearDoses()
{
ResetEvent(Ev1);
token = BeginClearDose(epdComsHandle, completion);
int32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndClearDose(epdComsHandle, token);
ResetEvent(Ev1);
token = BeginClearTotalDose(epdComsHandle, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndClearTotalDose(epdComsHandle, token);
ResetEvent(Ev1);
token = BeginClearPeakRates(epdComsHandle, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndClearPeakRates(epdComsHandle, token);
}
void MK3::Epd2U::ClearAlarms()
{
ResetEvent(Ev1);
token = BeginClearFaultStatus(epdComsHandle, completion);
int32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndClearFaultStatus(epdComsHandle, token);
ResetEvent(Ev1);
token = BeginClearLatchedAlarms(epdComsHandle, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndClearLatchedAlarms(epdComsHandle, token);
ResetEvent(Ev1);
token = BeginClearAllStatus(epdComsHandle, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndClearAllStatus(epdComsHandle, token);
}
WORD MK3::Epd2U::PrepareForIssue()
{
if (port == 0) return 1;
CommitRV = WriteConfig();
ClearDoses();
ClearAlarms();
return 0;
}
WORD MK3::Epd2U::ReadAlarmConfig() {
//Alleen MK3 ? leeg bij MK2
ResetEvent(Ev1);
token = BeginReadAlarmConfiguration(epdComsHandle, nullptr, 0, completion);
int32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadAlarmConfiguration(epdComsHandle, token, alarmConfig, MaxAlarmConfig, &numAlarm);
return numAlarm;
}
WORD MK3::Epd2U::ReadAlarmTresholds() {
//Alleen MK3 ? leeg bij MK2
bool isNeutron = (EpdType == EpdTypes::Mk2Neutron || EpdType == EpdTypes::Mk3Neutron);
uint8_t measID;
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10N; else measID = (uint8_t)MeasurementId::Meas_Hp07;
ResetEvent(Ev1);
token = BeginReadAlarmThresholds(epdComsHandle, measID,nullptr,0, completion);
int32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadAlarmThresholds(epdComsHandle, token, &hp07tresholds);
decodeTreshold(&hp07tresholds);
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10G; else measID = (uint8_t)MeasurementId::Meas_Hp10;
ResetEvent(Ev1);
token = BeginReadAlarmThresholds(epdComsHandle, (uint8_t)MeasurementId::Meas_Hp10, nullptr, 0, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadAlarmThresholds(epdComsHandle, token, &hp10tresholds);
decodeTreshold(&hp10tresholds);
return r;
}
WORD MK3::Epd2U::WriteAlarmTresholds() {
//Alleen MK3 ? leeg bij MK2
bool isNeutron = (EpdType == EpdTypes::Mk2Neutron || EpdType == EpdTypes::Mk3Neutron);
uint8_t measID;
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10N; else measID = (uint8_t)MeasurementId::Meas_Hp07;
hp07tresholds.MeasId = measID;
encodeTreshold(&hp07tresholds);
ResetEvent(Ev1);
token = BeginWriteAlarmThresholds(epdComsHandle, (uint8_t)hp07tresholds.MeasId, (uint8_t)hp07tresholds.NumberThresholds, hp07tresholds.Thresholds, completion);
int32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndWriteAlarmThresholds(epdComsHandle, token);
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10G; else measID = (uint8_t)MeasurementId::Meas_Hp10;
hp10tresholds.MeasId = measID;
encodeTreshold(&hp10tresholds);
ResetEvent(Ev1);
token = BeginWriteAlarmThresholds(epdComsHandle,(uint8_t) hp10tresholds.MeasId, (uint8_t)hp10tresholds.NumberThresholds, hp10tresholds.Thresholds, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndWriteAlarmThresholds(epdComsHandle, token);
return r;
}
WORD MK3::Epd2U::DeIssue()
{
ClearDoseRV = ClearTotalDoseRV = ClearPeakRatesRV = DeIssueEpdRV = 0;
if (port == 0) return 1;
ClearDoses();
ClearAlarms();
ResetEvent(Ev1);
token = BeginDeissueEPD(epdComsHandle, completion);
int32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndDeissueEPD(epdComsHandle, token);
ResetEvent(Ev1);
token = BeginEpdOnOff(epdComsHandle,0, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndEpdOnOff(epdComsHandle, token);
EndCom();
return 0;
}
WORD MK3::Epd2U::WriteWearer() {
ResetEvent(Ev1);
token = BeginSetBaselineCounters(epdComsHandle, completion);
int32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndSetBaselineCounters(epdComsHandle, token);
IdString_t mk3WearerID;
//Mk2 EPDs only support Name and Primary ID
mk3WearerID.IdType = (uint16_t)WearerIdType::WearerId_Name;
mk3WearerID.Length = 23;
memcpy(mk3WearerID.Utf8String, WearerName, 23);
ResetEvent(Ev1);
token = BeginWriteWearerId(epdComsHandle, mk3WearerID, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndWriteWearerId(epdComsHandle, token);
mk3WearerID.IdType = (uint16_t)WearerIdType::WearerId_Primary;
mk3WearerID.Length = 13;
memcpy(mk3WearerID.Utf8String, WearerID, 13);
token = BeginWriteWearerId(epdComsHandle, mk3WearerID, completion);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndWriteWearerId(epdComsHandle, token);
return 0;
}
WORD MK3::Epd2U::Issue()
{
IssueEpdRV = WriteAlarmDoseThresholdsRV = WriteAlarmRateThresholdsRV = WriteWearerNameRV = OnRV = CommitRV = 0;
if (port == 0) return 1;
//WORD OKRV = SetFailFlag(); // all actions have been completed
//if (OKRV) OKRV = Commit();
ClearAlarms();
WriteAlarmTresholds();
WriteWearer();
token = BeginIssueEPD(epdComsHandle, completion);
int32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndIssueEPD(epdComsHandle, token);
if (!DetectorsOn) {
token = BeginEpdOnOff(epdComsHandle, 1, completion);
int32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndEpdOnOff(epdComsHandle, token);
// OKRV = EpdOn(); OKRV = Commit();
Sleep(1500);
}
EndCom();
//if (OKRV) OKRV = WriteAlarmDoseThresholds(Hp10THDose1, Hp10THDose2, Hp07THDose);
//if (OKRV) OKRV = WriteAlarmRateThresholds(Hp10Rate1On, Hp10Rate2On, Hp07RateOn, Hp10Rate1Off, Hp10Rate2Off, Hp07RateOff);
//if (OKRV) OKRV = Commit();
//if (OKRV) OKRV = IssueEpd(WearerID, WearerIDLength);
//if (OKRV) OKRV = Commit();
//if (OKRV) OKRV = WriteWearerName(WearerName, (WORD)strlen((char*)WearerName));
//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(1500);
//}
//if (OKRV) {
// EndSession(EndSessionControl, 12);
// Commit();
//} // Continuous high tone for 1.2 seconds
//else
//{
// FlushBuffers(port);
// Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
// EndSession(0x5E, 40);
//}
//Close();
////DeinitComms(port);
//return OKRV;
return 0;
}
WORD MK3::Epd2U::EPDReadExtraStatus()
{
if (port == 0) return 1;
byBatADC = bySupplyADC = 0;
/*CommitRV = ReadA2ConfigStatus(
&byBatADC,
&bySupplyADC,
&byStatus3,
&byStatus4);
if (CommitRV == 1) CommitRV = Commit();*/
ResetEvent(Ev1);
token = BeginReadBaselineCounts(epdComsHandle, completion);
uint32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadBaselineCounts(epdComsHandle, token,Counts,10,&utc,&countsRead);
decodeBaseCounters(countsRead);
//if (CommitRV == 1) CommitRV = ReadCounts(&D1, &D2, &D3, &D4, &CountsClock);
//if (CommitRV == 1) CommitRV = Commit();
//if (CommitRV == 1) CommitRV = ReadBaseCounts(&BaseD1, &BaseD2, &BaseD3, &BaseD4, &BaseCountsClock);
//if (CommitRV == 1) CommitRV = Commit();
return CommitRV;
}
//WORD EpdBase::Epd2U::PrepareForIssue()
//{
// if (port == 0) return 1;
// CommitRV = WriteConfig();
// if (CommitRV) CommitRV = Commit();
// if (CommitRV) CommitRV = ClearDose();
// if (CommitRV) CommitRV = ClearTotalDose();
// if (CommitRV) CommitRV = ClearPeakRates();
// if (CommitRV) CommitRV = Commit();
// return CommitRV;
//}
WORD MK3::Epd2U::WriteCal()
{
if (port == 0) return 1;
if (K6 > 2000)
{
CommitRV = 0;
return 0;
}
if (EpdType == EpdTypes::Mk2Neutron)
{
Password = 9;
ResetEvent(Ev1);
token = BeginMfrLogin_R2(epdComsHandle, Password, completion);
uint32_t r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndMfrLogin_R2(epdComsHandle, token);
token = BeginWriteSensitivities_R2(epdComsHandle, completion, (uint16_t)K1, (uint16_t)K2, (uint16_t)K3, (uint16_t)K4, (uint16_t)K5, (uint16_t)K6);
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndWriteSensitivities_R2(epdComsHandle, token);
//if (CommitRV == 1) CommitRV = MFRWriteCalFactors(K1, K2, K3, K4, K5, K6);
//if (CommitRV == 1) CommitRV = Commit();
//if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
}
return CommitRV;
}

View file

@ -2,8 +2,18 @@
#pragma unmanaged
#include <windows.h>
#include "EpdCommon.h"
#include "Epd3.h"
#include "Epd2.h"
#include "TimeFunctions.h"
#define MaxPeakRates 10
#define MaxSensitivities 10
#define MaxDoses 4
#define MaxCounts 6
#define MaxAlarmConfig 10
#define MaxTresholds 10
namespace MK3
{
class Epd2U
@ -14,24 +24,16 @@ namespace MK3
uint32_t CurrentDeviceID;
EpdGeneration EpdGen;
DiscoveryId Epd;
CompletionToken token;
WORD port = 3;
const WORD MaxDevices = 10;
WORD DeviceCount = 0;
DWORD DeviceIDs[10];
//DWORD CurrentDeviceID;
//WORD AlarmCtrl = 0b01111110;
WORD AlarmCtrl = 0b01111010; // NO sound
WORD EndSessionControl = 0b00010010;
BYTE displayConfig[56] = { 0,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
DWORD EpdClock;
DWORD RealTime;
WORD IssueCount;
@ -85,12 +87,11 @@ namespace MK3
WORD SoftVersion;
WORD FunctionFlags;
WORD EpdType = 0xff;
EpdTypes EpdType = EpdTypes::Mk2Gamma;
bool isBG = false;
SYSTEMTIME tRealTime;
//Wearer
#define WearerIDLength 12
BYTE WearerID[(WearerIDLength)+1];
#define WearerNameLength 22
@ -99,44 +100,44 @@ namespace MK3
// Dose
DWORD Hp10Dose;
DWORD Hp07Dose;
DWORD Hp10Total;
DWORD Hp07Total;
float Hp10Dose;
float Hp07Dose;
float Hp10Total;
float Hp07Total;
WORD Knocks;
WORD Resets;
WORD QualityData;
//Peaks
DWORD Hp10Peak;
DWORD Hp07Peak;
float Hp10Peak;
float Hp07Peak;
DWORD Hp10Time;
DWORD Hp07Time;
//AlarmDoseTreshold
DWORD Hp10THDose1;
DWORD Hp10THDose2;
DWORD Hp07THDose;
float Hp10THDose1;
float Hp10THDose2;
float Hp07THDose;
DWORD Hp10Rate1On;
DWORD Hp10Rate2On;
DWORD Hp07RateOn;
DWORD Hp10Rate1Off;
DWORD Hp10Rate2Off;
DWORD Hp07RateOff;
float Hp10Rate1On;
float Hp10Rate2On;
float Hp07RateOn;
float Hp10Rate1Off;
float Hp10Rate2Off;
float Hp07RateOff;
WORD K1;
WORD K2;
WORD K3;
WORD K4;
WORD K5;
WORD K6;
WORD SG;
WORD BC;
WORD FB;
WORD HG;
float K1;
float K2;
float K3;
float K4;
float K5;
float K6;
uint32_t SG;
uint32_t BC;
uint32_t FB;
uint32_t HG;
DWORD D1;
DWORD D2;
@ -212,9 +213,19 @@ namespace MK3
BYTE byStatus3;
BYTE byStatus4;
MeasValue_t doses[4];
uint8_t numDoses;
MeasValue_t doses[MaxDoses];
PeakRate_t peakRates[MaxPeakRates];
AlarmConfig_t alarmConfig[MaxAlarmConfig];
CalSensitivity_t sensitivities[MaxSensitivities];
Counter_t Counts[MaxCounts];
uint8_t countsRead;
uint32_t seconds;
uint8_t numDoses, numRates, numSensitivities;
uint16_t numAlarm;
uint32_t utc;
Mk3QualityData_t quality;
Mk3AlarmThresholds_t hp07tresholds;
Mk3AlarmThresholds_t hp10tresholds;
int StartDiscover();
void Open(DiscoveryId DeviceID);
@ -223,33 +234,52 @@ namespace MK3
void DecodeFunctionFlags();
void DecodeStatus();
void decodeTreshold(Mk3AlarmThresholds_t *th);
void encodeTreshold(Mk3AlarmThresholds_t* th);
Epd2U(int comport);
WORD WriteConfig();
DWORD StartCom();
void EndCom();
WORD ReadStatus();
//WORD EPDReadExtraStatus();
WORD EPDReadConfig();
WORD TurnOff();
WORD TurnOn();
//WORD WriteCal();
WORD WriteCal();
//WORD ReadTresHolds();
WORD ReadDoses();
void decodeDoses(int count);
void decodeSensitivities(int count);
void decodePeakRates(int count);
void decodeCounters(int count);
//WORD PrepareForIssue();
//WORD DeIssue();
//WORD Issue();
void decodeBaseCounters(int count);
void SetTime();
WORD ReadAlarmConfig();
WORD ReadAlarmTresholds();
WORD WriteAlarmTresholds();
WORD WriteWearer();
void ClearDoses();
void ClearAlarms();
WORD PrepareForIssue();
WORD DeIssue();
WORD Issue();
~Epd2U();
StatusData_t epd3status;
uint8_t counterIds[6]; //max 6 for mk3
uint8_t counterIds[MaxCounts]; //max 6 for mk3
uint8_t counterIdLen;
//Voor read counters
Counter_t Counts[10];
uint8_t countsRead;
uint32_t utc, seconds;
WORD EPDReadExtraStatus();
//static HANDLE Ev1 ;
//static Epd2U* current;

BIN
MK3/Reader2.DLL Normal file

Binary file not shown.

Binary file not shown.

View file

@ -15,6 +15,22 @@ void TimeFunctions::EpdTimeToFileTime( INT32 t, LPFILETIME pft)
pft->dwHighDateTime = ll >> 32;
}
void TimeFunctions::FileTimeToEpdTime( FILETIME pft, INT32* t)
{
LONGLONG ll = ((((LONGLONG)pft.dwHighDateTime << 32) + pft.dwLowDateTime) - 125911584000000000) / 10000000;
*t = (DWORD)ll;
}
INT32 TimeFunctions::NowToEpdTime( )
{
SYSTEMTIME t;
GetSystemTime(&t);
FILETIME ft;
SystemTimeToFileTime((const SYSTEMTIME *)&t, &ft);
LONGLONG ll = ((((LONGLONG)ft.dwHighDateTime << 32U) + ft.dwLowDateTime) - 125911584000000000) / 10000000;
return (DWORD)ll;
}
void TimeFunctions::UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
// Note that LONGLONG is a 64-bit value

View file

@ -7,6 +7,8 @@ class TimeFunctions
public:
TimeFunctions();
static void EpdTimeToFileTime(INT32 t, LPFILETIME pft);
void FileTimeToEpdTime(FILETIME pft, INT32* t);
static INT32 NowToEpdTime();
static void UnixTimeToFileTime(time_t t, LPFILETIME pft);
static void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst);

135
MK3/reader2.def Normal file
View file

@ -0,0 +1,135 @@
LIBRARY reader2
EXPORTS
?GetLogDirectory@@YGXPA_WG@Z @1
?GetLogFilename@@YGXPA_WG@Z @2
?GetLogIniFilename@@YGXPA_WG@Z @3
?GetLoggingLevel@@YGGXZ @4
?GetRawLoggingLevel@@YGGXZ @5
?GetRejectLogFilename@@YGXPA_WG@Z @6
?GetRejectLoggingLevel@@YGGXZ @7
?InitLogDirectory@@YGXXZ @8
?Initialize@@YGXXZ @9
?Log@@YAXQBDIGQB_WZZ @10
?LogPort@@YGXPA_WG@Z @11
?LogReject@@YGXGPAEK@Z @12
?SetLogFilename@@YGXQB_W@Z @13
?SetLogIniFilename@@YGXQB_W@Z @14
?SetLoggingLevel@@YGXG@Z @15
?SetRawLoggingLevel@@YGXG@Z @16
?SetRejectLogFilename@@YGXQB_W@Z @17
?SetRejectLoggingLevel@@YGXG@Z @18
ADSClearData @19
ADSClearOffEnable @20
ADSClearWearer @21
ADSDeIssue @22
ADSIssue @23
ADSLogin @24
ADSReadData @25
ADSReadWearer @26
ADSSetOffEnable @27
ADSWritePassword @28
Abort @29
AllocateMemory @30
BaseLineCounts @31
ClearDose @32
ClearErrorStore @33
ClearFailFlag @34
ClearFaultFlags @35
ClearLatchedAlarms @36
ClearPeakRates @37
ClearTotalDose @38
CloseDevice @39
Commit @40
Connect @41
DeIssueEpd @42
DeinitComms @43
Discover @44
DisplayFaultCode @45
EndSession @46
EpdOff @47
EpdOn @48
GetDataMetric @51
GetErrorDetails @52
InitComms @53
IssueEpd @54
MFRClearAlwaysCount @55
MFRClearGolden @56
MFRFormatEEPROM @57
MFRLogin @58
MFRResetEpd @59
MFRSetAlwaysCount @60
MFRSetGolden @61
MFRWriteASIC @62
MFRWriteCalFactors @63
MFRWriteDetectorThresholds @64
MFRWriteDirectEEPROM @65
MFRWriteEpdID @66
MFRWritePassword @67
MFRWriteRAM @68
MemoryAllocated @69
OpenDevice @70
ReadA2Config @71
ReadA2ConfigStatus @72
ReadASIC @73
ReadAlarmConfig @74
ReadAlarmDoseThresholds @75
ReadAlarmRateThresholds @76
ReadBaseCounts @77
ReadCalibrationData @78
ReadCommsStats @79
ReadConfig @80
ReadCounts @81
ReadDirectEEPROM @82
ReadDisplayConfig @83
ReadDoseProfile @84
ReadDoseProfileCache @85
ReadDoseProfileSince @86
ReadDosesQuality @87
ReadEpdID @88
ReadEpdStatus @89
ReadErrorStore @90
ReadMemory @91
ReadPeaks @92
ReadProfileControl @93
ReadRAM @94
ReadRates @95
ReadScratchPad @96
ReadSpecialDoseStore @97
ReadSpecialWriteTimes @98
ReadWearer @99
ReadWearerID @100
ReadWearerName @101
ReleaseMemory @103
SetAutoCommit @104
SetDiscoveryExpirationPeriod @105
SetDiscoveryTimeslotCount @106
SetDiscoveryTimeslotPeriod @107
SetFailFlag @108
SetRetryCounts @109
SetTimeouts @110
TestBattery @111
TestDetectors @112
WriteA2Config @114
WriteAlarmConfig @115
WriteAlarmDoseThresholds @116
WriteAlarmRateThresholds @117
WriteChirpRate @118
WriteConfig @119
WriteCountdownTimer @120
WriteDisplayConfig @121
WriteDisplayControlBits @122
WriteDisplayEnables @123
WriteDose @124
WriteMemory @125
WriteProfileControl @126
WriteReturnForReadTime @127
WriteScratchPad @128
WriteSpecialWriteTimes @129
WriteTotalDose @130
WriteWearerName @131
FlushBuffers@4 @49
FlushDiscoveryCache@4 @50
Receive@8 @102
Transmit@8 @113

BIN
MK3/reader2.exp Normal file

Binary file not shown.

BIN
MK3/reader2.lib Normal file

Binary file not shown.

476
MK3/reader3.def Normal file
View file

@ -0,0 +1,476 @@
LIBRARY reader3
EXPORTS
AwaitRemoval@20 @1
BeginClearAllStatus@8 @2
BeginClearDose@8 @3
BeginClearDoseProfile_R3@8 @4
BeginClearEEPROM_R3@8 @5
BeginClearFaultStatus@8 @6
BeginClearGraphic_R3@12 @7
BeginClearLatchedAlarms@8 @8
BeginClearPeakRates@8 @9
BeginClearScratchPad@12 @10
BeginClearTotalDose@8 @11
BeginClearWearerOrTaskId_R3@16 @12
BeginDeissueEPD@8 @13
BeginEnableCovertMode_R3@12 @14
BeginEnableDeepSleep_R3@12 @15
BeginEnableManufacturerLockout_R3@12 @16
BeginEnableProtectedSession_R3@12 @17
BeginEnableResponderMode_R3@12 @18
BeginEpdOnOff@12 @19
BeginInitiateFirmwareUpdate_R3@8 @20
BeginIssueEPD@8 @21
BeginMfrLogin_R2@12 @22
BeginReadAccessPermissionsForLevel_R3@12 @23
BeginReadAlarmConfiguration@16 @24
BeginReadAlarmConfigurationLock_R3@8 @25
BeginReadAlarmConfiguration_R3@16 @26
BeginReadAlarmThresholds@20 @27
BeginReadBacklightBrightness_R3@8 @28
BeginReadBacklightEnable_R3@8 @29
BeginReadBacklightPeriod_R3@8 @30
BeginReadBaselineCounts@8 @31
BeginReadBatteryCriticalTiming_R3@8 @32
BeginReadBatteryLowThreshold@12 @33
BeginReadBatteryTestInterval@8 @34
BeginReadBatteryTypeFitted_R3@8 @35
BeginReadBatteryTypeOverride_R3@8 @36
BeginReadCalDueDate@8 @37
BeginReadCalDueDate_R3@8 @38
BeginReadCalReference_R3@8 @39
BeginReadCalibrationData_R2@8 @40
BeginReadCalibrationFacility_R3@8 @41
BeginReadCapabilities@8 @42
BeginReadChirpEnable_R3@8 @43
BeginReadChirpSensitivity@8 @44
BeginReadCounts@16 @45
BeginReadCurrentAccessLevel@8 @46
BeginReadDeadTimeFactors_R3@16 @47
BeginReadDebugRegister_R3@12 @48
BeginReadDetectorTestLimits_R3@16 @49
BeginReadDetectorThresholdLimits_R3@16 @50
BeginReadDetectorThresholds@16 @51
BeginReadDetectorThresholds_R3@16 @52
BeginReadDisplayCapability_R3@12 @53
BeginReadDisplayEnablePermissions_R3@12 @54
BeginReadDisplayEnables_R3@16 @55
BeginReadDisplayOptions@8 @56
BeginReadDisplayOptionsLock_R3@8 @57
BeginReadDisplayTimeout@8 @58
BeginReadDoseProfileByIndex_R3@16 @59
BeginReadDoseProfileByTime@16 @60
BeginReadDoseProfileConfiguration_R3@8 @61
BeginReadDoseProfileInterval@8 @62
BeginReadDoseSaveInterval_R3@8 @63
BeginReadDoses@16 @64
BeginReadEEProm@16 @65
BeginReadEpdIdentities@8 @66
BeginReadEpdPartNumber_R3@8 @67
BeginReadEpdRevision_R3@8 @68
BeginReadEpdSerialNum@8 @69
BeginReadEpdType@8 @70
BeginReadEventLogLevel_R3@8 @71
BeginReadEventsByIndex@16 @72
BeginReadFactoryCalDate@8 @73
BeginReadFemSerialNum_R3@8 @74
BeginReadFirmwarePartNumber_R3@8 @75
BeginReadFirmwareVersion@8 @76
BeginReadFlashTestCounts_R3@16 @77
BeginReadFpgaVersion_R3@8 @78
BeginReadGains@16 @79
BeginReadGains_R3@16 @80
BeginReadGraphicData_R3@12 @81
BeginReadGraphicSize_R3@12 @82
BeginReadLastCalibrationProcess_R3@8 @83
BeginReadMarkNumber@8 @84
BeginReadMeasurandIds_R3@8 @85
BeginReadModelName_R3@8 @86
BeginReadOffModeBatteryTestInterval_R3@8 @87
BeginReadOffModeDisplay_R3@8 @88
BeginReadPcbPartNumber_R3@8 @89
BeginReadPcbRevision_R3@8 @90
BeginReadPcbSerialNum_R3@8 @91
BeginReadPeakRates@16 @92
BeginReadPulseModeEnable_R3@8 @93
BeginReadPulseModeIndustrial_R3@8 @94
BeginReadPulseModeThreshold_R3@8 @95
BeginReadPulsedModeOverrangeThreshold_R3@8 @96
BeginReadQualityData@8 @97
BeginReadQuickAccessDisplays_R3@16 @98
BeginReadRTC@8 @99
BeginReadRadioFirmwareVersion_R3@8 @100
BeginReadRateOffPercentage@16 @101
BeginReadRates@16 @102
BeginReadResponderTriggerUtc_R3@8 @103
BeginReadReturnForReadTime@8 @104
BeginReadRunTime_R3@8 @105
BeginReadScratchPad@16 @106
BeginReadScratchpadSize@8 @107
BeginReadSelfTestInterval@8 @108
BeginReadSensitivities@16 @109
BeginReadSensitivities_R3@16 @110
BeginReadSnapshotAlarmThresholds_R3@12 @111
BeginReadSnapshotCounters_R3@12 @112
BeginReadSnapshotMeasurements_R3@12 @113
BeginReadSnapshotSummary_R3@12 @114
BeginReadStatus@8 @115
BeginReadStayTime_R3@8 @116
BeginReadSwitchOnFromButton_R3@8 @117
BeginReadTaskDatabaseId_R3@8 @118
BeginReadTaskId_R3@12 @119
BeginReadTelemetryAdvConfig_R3@12 @120
BeginReadTelemetryAdvContent_R3@12 @121
BeginReadTelemetryCxnConfig_R3@8 @122
BeginReadTelemetryEnable_R3@12 @123
BeginReadTelemetryMode_R2@8 @124
BeginReadTelemetryReportInterval_R3@8 @125
BeginReadTelemetryTxPower_R3@12 @126
BeginReadTotalDoses@16 @127
BeginReadTriggeredDoses_R3@16 @128
BeginReadVoltages@8 @129
BeginReadWearerDatabaseId_R3@8 @130
BeginReadWearerId@12 @131
BeginReadZoneAccessPermitted@12 @132
BeginReadZoneControlMap@8 @133
BeginSetBaselineCounters@8 @134
BeginStartDetectorTest@8 @135
BeginTriggerBacklight_R3@8 @136
BeginTriggerResponderMode_R3@8 @137
BeginValidateEpdOwnerKey_R3@12 @138
BeginWriteAccessKey@20 @139
BeginWriteAccessLevel@20 @140
BeginWriteAccessPermissionsForLevel_R3@20 @141
BeginWriteAlarmConfigurationLock_R3@16 @142
BeginWriteAlarmConfiguration_R3@16 @143
BeginWriteAlarmThresholds@20 @144
BeginWriteBacklightBrightness_R3@12 @145
BeginWriteBacklightEnable_R3@12 @146
BeginWriteBacklightPeriod_R3@12 @147
BeginWriteBatteryCriticalTiming_R3@16 @148
BeginWriteBatteryLowThreshold@16 @149
BeginWriteBatteryTestInterval@12 @150
BeginWriteBatteryTypeOverride_R3@12 @151
BeginWriteCalDueDate@12 @152
BeginWriteCalDueDate_R3@12 @153
BeginWriteCalReference_R3@12 @154
BeginWriteCalibrationFacility_R3@16 @155
BeginWriteCapabilities_R3@12 @156
BeginWriteChirpEnable_R3@12 @157
BeginWriteChirpSensitivity@12 @158
BeginWriteClearDoseOnSwitchOn@12 @159
BeginWriteDeadTimeFactors_R3@16 @160
BeginWriteDebugRegister_R3@16 @161
BeginWriteDetectorTestLimits_R3@16 @162
BeginWriteDetectorThresholds_R2@24 @163
BeginWriteDetectorThresholds_R3@16 @164
BeginWriteDisplayEnablePermissions_R3@20 @165
BeginWriteDisplayEnables_R3@16 @166
BeginWriteDisplayOptions@16 @167
BeginWriteDisplayOptionsLock_R3@16 @168
BeginWriteDisplayTimeout@12 @169
BeginWriteDoseProfileDoseIncrement_R3@12 @170
BeginWriteDoseProfileInterval@12 @171
BeginWriteDoseProfileMeasurands_R3@16 @172
BeginWriteDoseSaveInterval_R3@12 @173
BeginWriteDoseWritableFlag@12 @174
BeginWriteDoses@16 @175
BeginWriteEEProm@20 @176
BeginWriteEpdPartNumber_R3@12 @177
BeginWriteEpdRevision_R3@12 @178
BeginWriteEpdSerialNumber@12 @179
BeginWriteEventLogLevel_R3@12 @180
BeginWriteFactoryCalDate@12 @181
BeginWriteFemSerialNumber_R3@12 @182
BeginWriteGainableFlag_R3@12 @183
BeginWriteGains_R3@16 @184
BeginWriteGoldenFlag_R3@12 @185
BeginWriteGraphicBitmap_R3@352 @186
BeginWriteLastCalibrationProcess_R3@20 @187
BeginWriteMarkNumber_R3@12 @188
BeginWriteModelName_R3@40 @189
BeginWriteNotCalibratedFlag_R3@12 @190
BeginWriteOffModeBatteryTestInterval_R3@12 @191
BeginWriteOffModeDisplay_R3@16 @192
BeginWritePcbPartNumber_R3@12 @193
BeginWritePcbRevision_R3@12 @194
BeginWritePcbSerialNumber_R3@12 @195
BeginWritePulseModeEnable_R3@12 @196
BeginWritePulseModeIndustrial_R3@12 @197
BeginWritePulseModeThreshold_R3@12 @198
BeginWritePulsedModeOverrangeThreshold_R3@12 @199
BeginWriteQuickAccessDisplays_R3@16 @200
BeginWriteRTC_R3@12 @201
BeginWriteRateOffPercentage@16 @202
BeginWriteReturnForReadTime@12 @203
BeginWriteScratchPad@20 @204
BeginWriteSelfTestInterval@12 @205
BeginWriteSensitivities_R2@32 @206
BeginWriteSensitivities_R3@16 @207
BeginWriteStayTime_R3@12 @208
BeginWriteSwitchOnFromButton_R3@12 @209
BeginWriteTaskDatabaseId_R3@24 @210
BeginWriteTaskId_R3@76 @211
BeginWriteTelemetryAdvConfig_R3@12 @212
BeginWriteTelemetryAdvContent_R3@16 @213
BeginWriteTelemetryCxnConfig_R3@12 @214
BeginWriteTelemetryEnable_R3@16 @215
BeginWriteTelemetryMode_R2@12 @216
BeginWriteTelemetryReportInterval_R3@12 @217
BeginWriteTelemetryTxPower_R3@16 @218
BeginWriteTotalDoses@16 @219
BeginWriteTriggeredDoses_R3@16 @220
BeginWriteWearerDatabaseId_R3@24 @221
BeginWriteWearerId@76 @222
BeginWriteZoneControlMap@16 @223
CleanUpReadDoseProfile@4 @224
CleanUpReadEventLog@4 @225
CloseReader@4 @226
Commit@4 @227
Connect@20 @228
CreateReaderInterface@0 @229
DestroyReaderInterface@4 @230
Disconnect@4 @231
DisconnectAndNotify@12 @232
EndClearAllStatus@8 @233
EndClearDose@8 @234
EndClearDoseProfile_R3@8 @235
EndClearEEPROM_R3@8 @236
EndClearFaultStatus@8 @237
EndClearGraphic_R3@8 @238
EndClearLatchedAlarms@8 @239
EndClearPeakRates@8 @240
EndClearScratchpad@8 @241
EndClearTotalDose@8 @242
EndClearWearerOrTaskId_R3@8 @243
EndDeissueEPD@8 @244
EndEnableCovertMode_R3@8 @245
EndEnableDeepSleep_R3@8 @246
EndEnableManufacturerLockout_R3@8 @247
EndEnableProtectedSession_R3@8 @248
EndEnableResponderMode_R3@8 @249
EndEpdOnOff@8 @250
EndInitiateFirmwareUpdate_R3@8 @251
EndIssueEPD@8 @252
EndMfrLogin_R2@8 @253
EndReadAccessPermissionsForLevel_R3@20 @254
EndReadAlarmConfiguration@20 @255
EndReadAlarmConfigurationLock_R3@20 @256
EndReadAlarmConfiguration_R3@20 @257
EndReadAlarmThresholds@12 @258
EndReadBacklightBrightness_R3@12 @259
EndReadBacklightEnable_R3@12 @260
EndReadBacklightPeriod_R3@12 @261
EndReadBaselineCounts@24 @262
EndReadBatteryCriticalTiming_R3@16 @263
EndReadBatteryLowThreshold@16 @264
EndReadBatteryTestInterval@12 @265
EndReadBatteryTypeFitted_R3@12 @266
EndReadBatteryTypeOverride_R3@12 @267
EndReadCalDueDate@12 @268
EndReadCalDueDate_R3@12 @269
EndReadCalReference_R3@12 @270
EndReadCalibrationData_R2@48 @271
EndReadCalibrationFacility_R3@12 @272
EndReadCapabilities@12 @273
EndReadChirpEnable_R3@12 @274
EndReadChirpSensitivity@12 @275
EndReadCounts@28 @276
EndReadCurrentAccessLevel@12 @277
EndReadDeadTimeFactors_R3@20 @278
EndReadDebugRegister_R3@16 @279
EndReadDetectorTestLimits_R3@20 @280
EndReadDetectorThresholdLimits_R3@20 @281
EndReadDetectorThresholds@20 @282
EndReadDetectorThresholds_R3@20 @283
EndReadDisplayCapability_R3@24 @284
EndReadDisplayEnablePermissions_R3@24 @285
EndReadDisplayEnables_R3@20 @286
EndReadDisplayOptions@12 @287
EndReadDisplayOptionsLock_R3@12 @288
EndReadDisplayTimeout@12 @289
EndReadDoseProfileByIndex_R3@24 @290
EndReadDoseProfileByTime@16 @291
EndReadDoseProfileConfiguration_R3@12 @292
EndReadDoseProfileInterval@12 @293
EndReadDoseSaveInterval_R3@12 @294
EndReadDoses@24 @295
EndReadEEProm@24 @296
EndReadEpdIdentities@36 @297
EndReadEpdPartNumber_R3@12 @298
EndReadEpdRevision_R3@12 @299
EndReadEpdSerialNum@12 @300
EndReadEpdType@12 @301
EndReadEventLogLevel_R3@12 @302
EndReadEventsByIndex@16 @303
EndReadFactoryCalDate@12 @304
EndReadFemSerialNum_R3@12 @305
EndReadFirmwarePartNumber_R3@12 @306
EndReadFirmwareVersion@12 @307
EndReadFlashTestCounts_R3@24 @308
EndReadFpgaVersion_R3@16 @309
EndReadGains@20 @310
EndReadGains_R3@20 @311
EndReadGraphicData_R3@12 @312
EndReadGraphicSize_R3@12 @313
EndReadLastCalibrationProcess_R3@12 @314
EndReadMarkNumber@12 @315
EndReadMeasurandIds_R3@20 @316
EndReadModelName_R3@12 @317
EndReadOffModeBatteryTestInterval_R3@12 @318
EndReadOffModeDisplay_R3@16 @319
EndReadPcbPartNumber_R3@12 @320
EndReadPcbRevision_R3@12 @321
EndReadPcbSerialNum_R3@12 @322
EndReadPeakRates@20 @323
EndReadPulseModeEnable_R3@12 @324
EndReadPulseModeIndustrial_R3@12 @325
EndReadPulseModeThreshold_R3@12 @326
EndReadPulsedModeOverrangeThreshold_R3@12 @327
EndReadQualityData@12 @328
EndReadQuickAccessDisplays_R3@20 @329
EndReadRTC@12 @330
EndReadRadioFirmwareVersion_R3@12 @331
EndReadRateOffPercentage@20 @332
EndReadRates@24 @333
EndReadResponderTriggerUtc_R3@12 @334
EndReadReturnForReadTime@12 @335
EndReadRunTime_R3@12 @336
EndReadScratchpad@24 @337
EndReadScratchpadSize@12 @338
EndReadSelfTestInterval@12 @339
EndReadSensitivities@20 @340
EndReadSensitivities_R3@20 @341
EndReadSnapshotAlarmThresholds_R3@12 @342
EndReadSnapshotCounters_R3@12 @343
EndReadSnapshotMeasurements_R3@12 @344
EndReadSnapshotSummary_R3@12 @345
EndReadStatus@12 @346
EndReadStayTime_R3@12 @347
EndReadSwitchOnFromButton_R3@12 @348
EndReadTaskDatabaseId_R3@12 @349
EndReadTaskId_R3@12 @350
EndReadTelemetryAdvConfig_R3@12 @351
EndReadTelemetryAdvContent_R3@16 @352
EndReadTelemetryCxnConfig_R3@12 @353
EndReadTelemetryEnable_R3@16 @354
EndReadTelemetryMode_R2@12 @355
EndReadTelemetryReportInterval_R3@12 @356
EndReadTelemetryTxPower_R3@16 @357
EndReadTotalDoses@24 @358
EndReadTriggeredDoses_R3@24 @359
EndReadVoltages@20 @360
EndReadWearerDatabaseId_R3@12 @361
EndReadWearerId@12 @362
EndReadZoneAccessPermitted@12 @363
EndReadZoneControlMap@12 @364
EndSetBaselineCounters@8 @365
EndStartDetectorTest@8 @366
EndTriggerBacklight_R3@8 @367
EndTriggerResponderMode_R3@8 @368
EndValidateEpdOwnerKey_R3@12 @369
EndWriteAccessKey@8 @370
EndWriteAccessLevel@8 @371
EndWriteAccessPermissionsForLevel_R3@8 @372
EndWriteAlarmConfigurationLock_R3@8 @373
EndWriteAlarmConfiguration_R3@8 @374
EndWriteAlarmThresholds@8 @375
EndWriteBacklightBrightness_R3@8 @376
EndWriteBacklightEnable_R3@8 @377
EndWriteBacklightPeriod_R3@8 @378
EndWriteBatteryCriticalTiming_R3@8 @379
EndWriteBatteryLowThreshold@8 @380
EndWriteBatteryTestInterval@8 @381
EndWriteBatteryTypeOverride_R3@8 @382
EndWriteCalDueDate@8 @383
EndWriteCalDueDate_R3@8 @384
EndWriteCalReference_R3@8 @385
EndWriteCalibrationFacility_R3@8 @386
EndWriteCapabilities_R3@8 @387
EndWriteChirpEnable_R3@8 @388
EndWriteChirpSensitivity@8 @389
EndWriteClearDoseOnSwitchOn@8 @390
EndWriteDeadTimeFactors_R3@8 @391
EndWriteDebugRegister_R3@8 @392
EndWriteDetectorTestLimits_R3@8 @393
EndWriteDetectorThresholds_R2@8 @394
EndWriteDetectorThresholds_R3@8 @395
EndWriteDisplayEnablePermissions_R3@8 @396
EndWriteDisplayEnables_R3@8 @397
EndWriteDisplayOptions@8 @398
EndWriteDisplayOptionsLock_R3@8 @399
EndWriteDisplayTimeout@8 @400
EndWriteDoseProfileDoseIncrement_R3@8 @401
EndWriteDoseProfileInterval@8 @402
EndWriteDoseProfileMeasurands_R3@8 @403
EndWriteDoseSaveInterval_R3@8 @404
EndWriteDoseWritableFlag@8 @405
EndWriteDoses@8 @406
EndWriteEEProm@8 @407
EndWriteEpdPartNumber_R3@8 @408
EndWriteEpdRevision_R3@8 @409
EndWriteEpdSerialNumber@8 @410
EndWriteEventLogLevel_R3@8 @411
EndWriteFactoryCalDate@8 @412
EndWriteFemSerialNumber_R3@8 @413
EndWriteGainableFlag_R3@8 @414
EndWriteGains_R3@8 @415
EndWriteGoldenFlag_R3@8 @416
EndWriteGraphicBitmap_R3@8 @417
EndWriteLastCalibrationProcess_R3@8 @418
EndWriteMarkNumber_R3@8 @419
EndWriteModelName_R3@8 @420
EndWriteNotCalibratedFlag_R3@8 @421
EndWriteOffModeBatteryTestInterval_R3@8 @422
EndWriteOffModeDisplay_R3@8 @423
EndWritePcbPartNumber_R3@8 @424
EndWritePcbRevision_R3@8 @425
EndWritePcbSerialNumber_R3@8 @426
EndWritePulseModeEnable_R3@8 @427
EndWritePulseModeIndustrial_R3@8 @428
EndWritePulseModeThreshold_R3@8 @429
EndWritePulsedModeOverrangeThreshold_R3@8 @430
EndWriteQuickAccessDisplays_R3@8 @431
EndWriteRTC_R3@8 @432
EndWriteRateOffPercentage@8 @433
EndWriteReturnForReadTime@8 @434
EndWriteScratchpad@8 @435
EndWriteSelfTestInterval@8 @436
EndWriteSensitivities_R2@8 @437
EndWriteSensitivities_R3@8 @438
EndWriteStayTime_R3@8 @439
EndWriteSwitchOnFromButton_R3@8 @440
EndWriteTaskDatabaseId_R3@8 @441
EndWriteTaskId_R3@8 @442
EndWriteTelemetryAdvConfig_R3@8 @443
EndWriteTelemetryAdvContent_R3@8 @444
EndWriteTelemetryCxnConfig_R3@8 @445
EndWriteTelemetryEnable_R3@8 @446
EndWriteTelemetryMode_R2@8 @447
EndWriteTelemetryReportInterval_R3@8 @448
EndWriteTelemetryTxPower_R3@8 @449
EndWriteTotalDoses@8 @450
EndWriteTriggeredDoses_R3@8 @451
EndWriteWearerDatabaseId_R3@8 @452
EndWriteWearerId@8 @453
EndWriteZoneControlMap@8 @454
GetDiscoveredEpds@16 @455
GetDiscoveryTimeout@8 @456
GetDiscoveryTimeslots@8 @457
GetDllLogLevel@8 @458
GetErrorCode@0 @459
GetMultipleDiscoveryMode@8 @460
GetResponseTimeout@8 @461
GetRetryCount@8 @462
OpenReader@8 @463
SetConnectCallback@8 @464
SetDisconnectCallback@8 @465
SetDiscoveryCacheTimeout@8 @466
SetDiscoveryTimeslots@8 @467
SetDllLogLevel@8 @468
SetMultipleDiscoveryMode@8 @469
SetRemovedCallback@8 @470
SetResponseTimeout@8 @471
SetRetryCount@8 @472
StartDiscovery@8 @473
StopDiscovery@4 @474

Binary file not shown.

Binary file not shown.

297177
MK3/x.txt

File diff suppressed because it is too large Load diff

View file

@ -11,16 +11,14 @@ namespace TestEPD3Dll
{
static void Main(string[] args)
{
DateTime start = new DateTime(1601, 1, 1);
DateTime rpdStart = new DateTime(1970, 1, 1);
TimeSpan ts = rpdStart - start;
double l = ts.TotalSeconds;
MK3.Epd2 x = new MK3.Epd2(4);
x.Connect(false);
var rv = x.GetStatus();
var rv = x.SetTime();
rv = x.GetStatus();
x.ReadAlarmTresholds();
rv = x.GetDoses();
//x.SetDeIssued();
x.WriteCalibration();
}
}

Binary file not shown.