still  some problems
This commit is contained in:
Luc 2021-05-28 17:06:41 +02:00
parent 196a988c30
commit 2ee01955b1
44 changed files with 17077 additions and 143 deletions

View file

@ -1,11 +1,11 @@
#include "stdafx.h"
#pragma unmanaged
#include "EpdBase.h"
#include "TimeFunctions.h"
#define DiscoveryTimeslotPeriod 500
#define DiscoveryExpirationPeriod 6000
#define RxRetryCount 5
#define TxRetryCount 5
#pragma unmanaged
EpdBase::Epd2U::Epd2U(int comport)
{
@ -50,10 +50,16 @@ DWORD EpdBase::Epd2U::StartCom()
CommsInitialized = InitRv;
return ErrorReason;
}
void EpdBase::Epd2U::EndCom()
{
if (port > 0 && CommsInitialized==1) DeinitComms(port);
CommsInitialized = 0;
}
EpdBase::Epd2U::~Epd2U()
{
if (port>0) DeinitComms(port);
CommsInitialized = 0;
EndCom();
}
int EpdBase::Epd2U::StartDiscover( int EpdTimeout)
{
@ -92,7 +98,7 @@ int EpdBase::Epd2U::StartDiscover( int EpdTimeout)
}
return DiscRV;
}
void EpdBase::Epd2U::Open(DWORD DeviceID)
int EpdBase::Epd2U::Open(DWORD DeviceID)
{
CurrentDeviceID = DeviceID;
if (port > 0) {
@ -104,6 +110,7 @@ void EpdBase::Epd2U::Open(DWORD DeviceID)
}
}
else { OpenRV = ConRV = 1; }
return OpenRV;
}
void EpdBase::Epd2U::Close()
{
@ -341,7 +348,7 @@ WORD EpdBase::Epd2U::ReadTresHolds()
&HG);
CommitRV = Commit();
if (CommitRV == 0) Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
return CommitRV;
if (CommitRV == 1) return 0; else return 123;
}
WORD EpdBase::Epd2U::ReadDoses()
{
@ -398,14 +405,16 @@ WORD EpdBase::Epd2U::ReadDoses()
}
WORD EpdBase::Epd2U::PrepareForIssue()
{
if (port == 0) return 1;
int rv = 0;
if (port == 0) return 0;
CommitRV = WriteConfig();
if (CommitRV) CommitRV = Commit();
if (CommitRV) CommitRV = ClearDose();
if (CommitRV) CommitRV = ClearTotalDose();
if (CommitRV) CommitRV = ClearPeakRates();
if (CommitRV) CommitRV = Commit();
return CommitRV;
if (CommitRV) rv = 0; else rv = 1;
return rv;
}
WORD EpdBase::Epd2U::DeIssue()
{
@ -436,10 +445,16 @@ WORD EpdBase::Epd2U::DeIssue()
Close();
return CommitRV;
}
/// <summary>
///
/// </summary>
/// <returns>O = OK</returns>
WORD EpdBase::Epd2U::Issue()
{
WORD rv;
IssueEpdRV = WriteAlarmDoseThresholdsRV = WriteAlarmRateThresholdsRV = WriteWearerNameRV = OnRV = CommitRV = 0;
if (port == 0) return 1;
if (port == 0) return 0;
WORD OKRV = SetFailFlag(); // all actions have been completed
if (OKRV) OKRV = Commit();
@ -454,6 +469,7 @@ WORD EpdBase::Epd2U::Issue()
if (OKRV == 0)
{
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
rv = 1;
}
ClearFailFlag(); // all actions have been completed
Commit();
@ -472,11 +488,8 @@ WORD EpdBase::Epd2U::Issue()
Error = GetErrorDetails(&ErrorSource, &ErrorReason, &ErrorData);
EndSession(0x5E, 40);
}
Close();
//DeinitComms(port);
return OKRV;
return rv;
}
/// <summary>

View file

@ -1,7 +1,8 @@
#pragma once
#include "TimeFunctions.h"
#include "dll2/reader2.h"
#pragma unmanaged
#include <windows.h>
#include "reader2.h"
#pragma unmanaged
namespace EpdBase
{
class Epd2U
@ -201,11 +202,11 @@ namespace EpdBase
BYTE byStatus4;
int maxDiscoverTime = 10000;
int ConnectTries = 0;
LARGE_INTEGER WaitDiscovery;
int ConnectTries;
BYTE ConnectTimerFired;
int StartDiscover(int EpdTimeout);
void Open(DWORD DeviceID);
int Open(DWORD DeviceID);
void Close();
void DecodeFunctionFlags();
@ -215,6 +216,7 @@ namespace EpdBase
Epd2U(int comport);
WORD WriteConfig();
DWORD StartCom();
void EndCom();
WORD ReadStatus();
WORD EPDReadExtraStatus();
WORD EPDReadConfig();

View file

@ -129,6 +129,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="EpdBase.h" />
<ClInclude Include="reader2.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="TimeFunctions.h" />

View file

@ -27,6 +27,9 @@
<ClInclude Include="TimeFunctions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="reader2.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="EpdBase.cpp">

View file

@ -49,3 +49,33 @@ void TimeFunctions::UnixTimeToFileTime(time_t t, LPFILETIME pft)
FileTimeToSystemTime(&ft, pst);
}
void TimeFunctions::EpdTimeToFileTime(INT32 t, LPFILETIME pft, bool isMK2) //MK3
{
LONGLONG offset;
if (isMK2) offset = 116444736000000000; else offset = 125911584000000000;;
LONGLONG ll;
ll = Int32x32To64(t, 10000000) + offset; //1601-1-1 -> 2000
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
}
void TimeFunctions::FileTimeToEpdTime(FILETIME pft, INT32* t, bool isMK2)
{
LONGLONG offset;
if (isMK2) offset = 116444736000000000; else offset = 125911584000000000;
LONGLONG ll = ((((LONGLONG)pft.dwHighDateTime << 32) + pft.dwLowDateTime) - offset) / 10000000;
*t = (DWORD)ll;
}
UINT32 TimeFunctions::NowToEpdTime(bool isMK2)
{
LONGLONG offset;
if (isMK2) offset = 116444736000000000; else offset = 125911584000000000;
SYSTEMTIME t;
GetSystemTime(&t);
FILETIME ft;
SystemTimeToFileTime((const SYSTEMTIME*)&t, &ft);
LONGLONG ll = ((((LONGLONG)ft.dwHighDateTime << 32U) + ft.dwLowDateTime) - offset) / 10000000;
return (DWORD)ll;
}

View file

@ -1,15 +1,16 @@
#pragma once
#include <windows.h>
#include <time.h>
class TimeFunctions
{
public:
TimeFunctions();
static void EpdTimeToFileTime(INT32 t, LPFILETIME pft, bool isMK2);
void FileTimeToEpdTime(FILETIME pft, INT32* t, bool isMK2);
static UINT32 NowToEpdTime(bool isMK2);
static void UnixTimeToFileTime(time_t t, LPFILETIME pft);
static void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst);
};
UINT32 FileTime_to_POSIX(FILETIME ft);
UINT32 UnixTimeNow();

BIN
EpdBase/dll2/reader2.lib Normal file

Binary file not shown.

1374
EpdBase/reader2.h Normal file

File diff suppressed because it is too large Load diff

11678
EpdBase/x.txt Normal file

File diff suppressed because it is too large Load diff

45
EpdBase3/CommonEpdTypes.h Normal file
View file

@ -0,0 +1,45 @@
#ifndef common_epd_types_h
#define common_epd_types_h
enum class EpdGeneration
{
None,
Mk2,
Mk3
};
enum class EpdTypes : uint8_t
{
Mk2BetaGamma = 0,
Mk2Neutron = 3,
Mk3BetaGamma = 4,
Mk3Neutron = 7,
Mk2Gamma = 16,
Mk3Gamma = 20
};
#pragma pack (push)
#pragma pack (1)
struct DiscoveryId
{
uint32_t Id;
EpdGeneration Gen;
uint32_t MaxBaud;
bool operator==(const DiscoveryId &other) const
{
return (Id == other.Id) && (Gen == other.Gen);
}
bool operator !=(const DiscoveryId &other) const
{
return !(*this == other);
}
} ;
typedef struct
{
uint16_t Address;
uint8_t Length;
} MemoryBlockDetails;
typedef struct
{
MemoryBlockDetails BlockDetail;
uint8_t Data[UINT8_MAX];
} MemoryData;
#pragma pack (pop)
#endif

75
EpdBase3/Epd2.h Normal file
View file

@ -0,0 +1,75 @@
#ifndef epd2_h
#define epd2_h
/******************************************************************************
*
* Module Name : Reader3.DLL
*
* File Name : Epd3.h
*
* File Description : Public API For EPD MK3 Communication
*
* Authors: : T Banahan
*
******************************************************************************
*
* This is an unpublished work, the copyright of which vests in Thermo
* Fisher Scientific. All rights reserved.
*
* The information contained herein is the property of Thermo Fisher
* Scientific and is supplied without liability for errors or ommissions
* and no part may be reproduced, used or disclosed except as authorised
* by contract or other written permission. The copyright and the foregoing
* restriction on reproduction, use and disclosure extends to all the media
* in which this information may be embodied.
*
******************************************************************************/
#ifndef WINAPI
#define WINAPI __stdcall
#endif
#ifdef READER3_EXPORTS
#define EPDDLL_API __declspec(dllexport) WINAPI
#else
#define EPDDLL_API __declspec(dllimport) WINAPI
#endif
#include <stdint.h>
extern "C"
{
/********************************************************************************************************************************************
*
* Telemetry
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadTelemetryMode_R2(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadTelemetryMode_R2(CommsHandle hComms, CompletionToken token, uint8_t *mode);
CompletionToken EPDDLL_API BeginWriteTelemetryMode_R2(CommsHandle hComms, uint8_t mode, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTelemetryMode_R2(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
*
* Calibration data
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadCalibrationData_R2(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadCalibrationData_R2(CommsHandle hComms, CompletionToken token,
uint16_t * HGSens10, uint16_t * SGSens10, uint16_t * HGSens07, uint16_t * SGSens07,
uint16_t * FBSens07, uint16_t * BCSens07,
uint16_t * SGthresh, uint16_t * BCthresh,
uint16_t * FBthresh, uint16_t * HGthresh);
CompletionToken EPDDLL_API BeginWriteDetectorThresholds_R2(CommsHandle hComms, CompletionCallback callback,
uint16_t SGthresh, uint16_t BCthresh,
uint16_t FBthresh, uint16_t HGthresh);
int32_t EPDDLL_API EndWriteDetectorThresholds_R2(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteSensitivities_R2(CommsHandle hComms, CompletionCallback callback,
uint16_t HGSens10, uint16_t SGSens10, uint16_t HGSens07, uint16_t SGSens07,
uint16_t FBSens07, uint16_t BCSens07);
int32_t EPDDLL_API EndWriteSensitivities_R2(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
*
* Manufacturer Login
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginMfrLogin_R2(CommsHandle hComms, uint32_t password, CompletionCallback callback);
int32_t EPDDLL_API EndMfrLogin_R2(CommsHandle hComms, CompletionToken token);
}
#endif

435
EpdBase3/Epd3.h Normal file
View file

@ -0,0 +1,435 @@
#ifndef epd3_h
#define epd3_h
/******************************************************************************
*
* Module Name : Reader3.DLL
*
* File Name : Epd3.h
*
* File Description : Public API For EPD MK3 Communication
*
* Authors: : P Beeson
*
******************************************************************************
*
* This is an unpublished work, the copyright of which vests in Thermo
* Fisher Scientific. All rights reserved.
*
* The information contained herein is the property of Thermo Fisher
* Scientific and is supplied without liability for errors or ommissions
* and no part may be reproduced, used or disclosed except as authorised
* by contract or other written permission. The copyright and the foregoing
* restriction on reproduction, use and disclosure extends to all the media
* in which this information may be embodied.
*
******************************************************************************/
#ifndef WINAPI
#define WINAPI __stdcall
#endif
#ifdef READER3_EXPORTS
#define EPDDLL_API __declspec(dllexport) WINAPI
#else
#define EPDDLL_API __declspec(dllimport) WINAPI
#endif
#include <stdint.h>
#include "Mk3Types.h"
extern "C"
{
/********************************************************************************************************************************************
*
* MK3 Specific Event Log
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteEventLogLevel_R3(CommsHandle hComms, uint8_t level, CompletionCallback callback = nullptr);
int32_t EPDDLL_API EndWriteEventLogLevel_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadEventLogLevel_R3(CommsHandle hComms, CompletionCallback callback = nullptr);
int32_t EPDDLL_API EndReadEventLogLevel_R3(CommsHandle hComms, CompletionToken token, uint8_t* level);
/********************************************************************************************************************************************
* MK3 Specific Counts Acquisition
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadFlashTestCounts_R3(CommsHandle hComms, uint8_t counterIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadFlashTestCounts_R3(CommsHandle hComms, CompletionToken token, Counter_t counts[], uint8_t length, uint8_t * numCounts, uint32_t * utc);
/********************************************************************************************************************************************
*
* Triggered Dose
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadTriggeredDoses_R3(CommsHandle hComms, uint8_t ids[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadTriggeredDoses_R3(CommsHandle hComms, CompletionToken token, MeasValue_t doses[], uint8_t length, uint8_t * numDoses, uint32_t * utc);
CompletionToken EPDDLL_API BeginWriteTriggeredDoses_R3(CommsHandle hComms, MeasValue_t doses[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTriggeredDoses_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
*
* Real Time Clock
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteRTC_R3(CommsHandle hComms, uint32_t rtc, CompletionCallback callback = nullptr);
int32_t EPDDLL_API EndWriteRTC_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
*
* MK3 Specific Calibration
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadDetectorThresholds_R3(CommsHandle hComms, uint8_t counterIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadDetectorThresholds_R3(CommsHandle hComms, CompletionToken token, DetectorThreshold_t thresholds[], uint8_t length, uint8_t * numThresholds);
CompletionToken EPDDLL_API BeginWriteDetectorThresholds_R3(CommsHandle hComms, DetectorThreshold_t thresholds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDetectorThresholds_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadSensitivities_R3(CommsHandle hComms, uint8_t sensIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadSensitivities_R3(CommsHandle hComms, CompletionToken token, CalSensitivity_t sensitivities[], uint8_t length, uint8_t * numSensitivities);
CompletionToken EPDDLL_API BeginWriteSensitivities_R3(CommsHandle hComms, CalSensitivity_t sensitivities[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteSensitivities_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadGains_R3(CommsHandle hComms, uint8_t sensIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadGains_R3(CommsHandle hComms, CompletionToken token, CalGain_t gains[], uint8_t length, uint8_t * numGains);
CompletionToken EPDDLL_API BeginWriteGains_R3(CommsHandle hComms, CalGain_t gains[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteGains_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteNotCalibratedFlag_R3(CommsHandle hComms, uint8_t notCalibrated, CompletionCallback callback);
int32_t EPDDLL_API EndWriteNotCalibratedFlag_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteGainableFlag_R3(CommsHandle hComms, uint8_t gainable, CompletionCallback callback);
int32_t EPDDLL_API EndWriteGainableFlag_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteLastCalibrationProcess_R3(CommsHandle hComms, CalProcess_t process, CompletionCallback callback);
int32_t EPDDLL_API EndWriteLastCalibrationProcess_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadLastCalibrationProcess_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadLastCalibrationProcess_R3(CommsHandle hComms, CompletionToken token, CalProcess_t * process);
CompletionToken EPDDLL_API BeginWriteCalibrationFacility_R3(CommsHandle hComms, CalFacility_t facility, CompletionCallback callback);
int32_t EPDDLL_API EndWriteCalibrationFacility_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadCalibrationFacility_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadCalibrationFacility_R3(CommsHandle hComms, CompletionToken token, CalFacility_t * facility);
CompletionToken EPDDLL_API BeginWriteCalReference_R3(CommsHandle hComms, uint32_t calRef, CompletionCallback callback);
int32_t EPDDLL_API EndWriteCalReference_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadCalReference_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadCalReference_R3(CommsHandle hComms, CompletionToken token, uint32_t * calRef);
CompletionToken EPDDLL_API BeginWriteCalDueDate_R3(CommsHandle hComms, uint32_t utc, CompletionCallback callback);
int32_t EPDDLL_API EndWriteCalDueDate_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadCalDueDate_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadCalDueDate_R3(CommsHandle hComms, CompletionToken token, uint32_t* utc);
CompletionToken EPDDLL_API BeginWriteGoldenFlag_R3(CommsHandle hComms, uint8_t onState, CompletionCallback callback);
int32_t EPDDLL_API EndWriteGoldenFlag_R3(CommsHandle hComms, CompletionToken token);
// ***** MK3 Specific Detector Threshold Limits
CompletionToken EPDDLL_API BeginReadDetectorThresholdLimits_R3(CommsHandle hComms, uint8_t counterIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadDetectorThresholdLimits_R3(CommsHandle hComms, CompletionToken token, DetectorThresholdLimit_t limits[], uint8_t length, uint8_t * numLimits);
// * MK3 Specific Dead Time Factors
CompletionToken EPDDLL_API BeginReadDeadTimeFactors_R3(CommsHandle hComms, uint8_t counterIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadDeadTimeFactors_R3(CommsHandle hComms, CompletionToken token, DeadTimeCoefficient_t thresholds[], uint8_t length, uint8_t * numFactors);
CompletionToken EPDDLL_API BeginWriteDeadTimeFactors_R3(CommsHandle hComms, DeadTimeCoefficient_t factors[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDeadTimeFactors_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* End of Calibration methods
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteDoseSaveInterval_R3(CommsHandle hComms, uint8_t intervalMins, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDoseSaveInterval_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadDoseSaveInterval_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadDoseSaveInterval_R3(CommsHandle hComms, CompletionToken token, uint8_t *intervalMins);
CompletionToken EPDDLL_API BeginClearEEPROM_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndClearEEPROM_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* MK3 Specific Identities
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadPcbSerialNum_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadPcbSerialNum_R3(CommsHandle hComms, CompletionToken token, uint32_t* pcbSerialNum);
CompletionToken EPDDLL_API BeginWritePcbSerialNumber_R3(CommsHandle hComms, uint32_t serNum, CompletionCallback callback);
int32_t EPDDLL_API EndWritePcbSerialNumber_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadFemSerialNum_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadFemSerialNum_R3(CommsHandle hComms, CompletionToken token, uint32_t* serialNum);
CompletionToken EPDDLL_API BeginWriteFemSerialNumber_R3(CommsHandle hComms, uint32_t serNum, CompletionCallback callback);
int32_t EPDDLL_API EndWriteFemSerialNumber_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadEpdPartNumber_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadEpdPartNumber_R3(CommsHandle hComms, CompletionToken token, PartNumber_t partNum);
CompletionToken EPDDLL_API BeginWriteEpdPartNumber_R3(CommsHandle hComms, PartNumber_t partNum, CompletionCallback callback);
int32_t EPDDLL_API EndWriteEpdPartNumber_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadModelName_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadModelName_R3(CommsHandle hComms, CompletionToken token, ModelName_t * name);
CompletionToken EPDDLL_API BeginWriteModelName_R3(CommsHandle hComms, ModelName_t name, CompletionCallback callback);
int32_t EPDDLL_API EndWriteModelName_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteCapabilities_R3(CommsHandle hComms, uint32_t capabilities, CompletionCallback callback);
int32_t EPDDLL_API EndWriteCapabilities_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteMarkNumber_R3(CommsHandle hComms, MarkNumber_t markNumber, CompletionCallback callback);
int32_t EPDDLL_API EndWriteMarkNumber_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadFirmwarePartNumber_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadFirmwarePartNumber_R3(CommsHandle hComms, CompletionToken token, FirmwarePartNumber_t partNum);
CompletionToken EPDDLL_API BeginReadFpgaVersion_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadFpgaVersion_R3(CommsHandle hComms, CompletionToken token, uint8_t *major, uint8_t *minor);
CompletionToken EPDDLL_API BeginWritePcbRevision_R3(CommsHandle hComms, uint16_t rev, CompletionCallback callback);
int32_t EPDDLL_API EndWritePcbRevision_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadPcbRevision_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadPcbRevision_R3(CommsHandle hComms, CompletionToken token, uint16_t* rev);
CompletionToken EPDDLL_API BeginReadPcbPartNumber_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadPcbPartNumber_R3(CommsHandle hComms, CompletionToken token, PcbPartNumber_t partNum);
CompletionToken EPDDLL_API BeginWritePcbPartNumber_R3(CommsHandle hComms, PcbPartNumber_t partNum, CompletionCallback callback);
int32_t EPDDLL_API EndWritePcbPartNumber_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteEpdRevision_R3(CommsHandle hComms, uint16_t rev, CompletionCallback callback);
int32_t EPDDLL_API EndWriteEpdRevision_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadEpdRevision_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadEpdRevision_R3(CommsHandle hComms, CompletionToken token, uint16_t* rev);
CompletionToken EPDDLL_API BeginReadRadioFirmwareVersion_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadRadioFirmwareVersion_R3(CommsHandle hComms, CompletionToken token, VersionNumber_t * version);
/********************************************************************************************************************************************
* MK3 Detector Test Limits
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadDetectorTestLimits_R3(CommsHandle hComms, uint8_t counterIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadDetectorTestLimits_R3(CommsHandle hComms, CompletionToken token, DetectorTestLimit_t limits[], uint8_t length, uint8_t * numLimits);
CompletionToken EPDDLL_API BeginWriteDetectorTestLimits_R3(CommsHandle hComms, DetectorTestLimit_t limits[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDetectorTestLimits_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* Pulse Mode
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWritePulseModeEnable_R3(CommsHandle hComms, uint8_t enable, CompletionCallback callback);
int32_t EPDDLL_API EndWritePulseModeEnable_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadPulseModeEnable_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadPulseModeEnable_R3(CommsHandle hComms, CompletionToken token, uint8_t * enabled);
CompletionToken EPDDLL_API BeginWritePulseModeIndustrial_R3(CommsHandle hComms, uint8_t industrial, CompletionCallback callback);
int32_t EPDDLL_API EndWritePulseModeIndustrial_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadPulseModeIndustrial_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadPulseModeIndustrial_R3(CommsHandle hComms, CompletionToken token, uint8_t * enabled);
CompletionToken EPDDLL_API BeginWritePulseModeThreshold_R3(CommsHandle hComms, uint8_t counts, CompletionCallback callback);
int32_t EPDDLL_API EndWritePulseModeThreshold_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadPulseModeThreshold_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadPulseModeThreshold_R3(CommsHandle hComms, CompletionToken token, uint8_t * counts);
CompletionToken EPDDLL_API BeginReadPulsedModeOverrangeThreshold_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadPulsedModeOverrangeThreshold_R3(CommsHandle hComms, CompletionToken token, float* threshold);
CompletionToken EPDDLL_API BeginWritePulsedModeOverrangeThreshold_R3(CommsHandle hComms, float threshold, CompletionCallback callback);
int32_t EPDDLL_API EndWritePulsedModeOverrangeThreshold_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadChirpEnable_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadChirpEnable_R3(CommsHandle hComms, CompletionToken token, uint8_t * enabled);
CompletionToken EPDDLL_API BeginWriteChirpEnable_R3(CommsHandle hComms, uint8_t enable, CompletionCallback callback);
int32_t EPDDLL_API EndWriteChirpEnable_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* MK3 Specific Wearer Identity
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadWearerDatabaseId_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadWearerDatabaseId_R3(CommsHandle hComms, CompletionToken token, DatabaseId_t * dbid);
CompletionToken EPDDLL_API BeginWriteWearerDatabaseId_R3(CommsHandle hComms, DatabaseId_t dbid, CompletionCallback callback);
int32_t EPDDLL_API EndWriteWearerDatabaseId_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadTaskId_R3(CommsHandle hComms, uint16_t type, CompletionCallback callback);
int32_t EPDDLL_API EndReadTaskId_R3(CommsHandle hComms, CompletionToken token, IdString_t * taskId);
CompletionToken EPDDLL_API BeginWriteTaskId_R3(CommsHandle hComms, IdString_t taskId, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTaskId_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadTaskDatabaseId_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadTaskDatabaseId_R3(CommsHandle hComms, CompletionToken token, DatabaseId_t * dbid);
CompletionToken EPDDLL_API BeginWriteTaskDatabaseId_R3(CommsHandle hComms, DatabaseId_t dbid, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTaskDatabaseId_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginClearWearerOrTaskId_R3(CommsHandle hComms, WearerAndTaskIdType_t ids[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndClearWearerOrTaskId_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* MK3 Graphics
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadGraphicSize_R3(CommsHandle hComms, uint16_t graphicId, CompletionCallback callback);
int32_t EPDDLL_API EndReadGraphicSize_R3(CommsHandle hComms, CompletionToken token, GraphicSize_t * size);
CompletionToken EPDDLL_API BeginClearGraphic_R3(CommsHandle hComms, uint16_t graphicId, CompletionCallback callback);
int32_t EPDDLL_API EndClearGraphic_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadGraphicData_R3(CommsHandle hComms, uint16_t graphicId, CompletionCallback callback);
int32_t EPDDLL_API EndReadGraphicData_R3(CommsHandle hComms, CompletionToken token, GraphicBitmap_t * data);
CompletionToken EPDDLL_API BeginWriteGraphicBitmap_R3(CommsHandle hComms, GraphicBitmap_t data, CompletionCallback callback);
int32_t EPDDLL_API EndWriteGraphicBitmap_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* MK3 Snapshot Summary
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadSnapshotSummary_R3(CommsHandle hComms, uint8_t snapshotNum, CompletionCallback callback);
int32_t EPDDLL_API EndReadSnapshotSummary_R3(CommsHandle hComms, CompletionToken token, Mk3SnapshotSummary_t * data);
CompletionToken EPDDLL_API BeginReadSnapshotMeasurements_R3(CommsHandle hComms, uint8_t snapshotNum, CompletionCallback callback);
int32_t EPDDLL_API EndReadSnapshotMeasurements_R3(CommsHandle hComms, CompletionToken token, Mk3SnapshotMeasurements_t * data);
CompletionToken EPDDLL_API BeginReadSnapshotCounters_R3(CommsHandle hComms, uint8_t snapshotNum, CompletionCallback callback);
int32_t EPDDLL_API EndReadSnapshotCounters_R3(CommsHandle hComms, CompletionToken token, Mk3SnapshotCounters_t * data);
CompletionToken EPDDLL_API BeginReadSnapshotAlarmThresholds_R3(CommsHandle hComms, uint8_t snapshotNum, CompletionCallback callback);
int32_t EPDDLL_API EndReadSnapshotAlarmThresholds_R3(CommsHandle hComms, CompletionToken token, Mk3SnapshotAlarmThresholds_t * data);
/********************************************************************************************************************************************
* MK3 Specific Dose Profile
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteDoseProfileDoseIncrement_R3(CommsHandle hComms, float doseIncrement, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDoseProfileDoseIncrement_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteDoseProfileMeasurands_R3(CommsHandle hComms, uint8_t ids[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDoseProfileMeasurands_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadDoseProfileByIndex_R3(CommsHandle hComms, uint16_t start, uint16_t numRequested, CompletionCallback callback);
int32_t EPDDLL_API EndReadDoseProfileByIndex_R3(CommsHandle hComms, CompletionToken token, uint16_t * startIndex, DoseProfileRecord_t profile[], uint16_t length, uint16_t *count);
CompletionToken EPDDLL_API BeginReadDoseProfileConfiguration_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadDoseProfileConfiguration_R3(CommsHandle hComms, CompletionToken token, DoseProfileConfig_t * config);
CompletionToken EPDDLL_API BeginClearDoseProfile_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndClearDoseProfile_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* Other MK3 Specific Functions
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginEnableDeepSleep_R3(CommsHandle hComms, uint8_t onState, CompletionCallback callback);
int32_t EPDDLL_API EndEnableDeepSleep_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginEnableCovertMode_R3(CommsHandle hComms, uint8_t onState, CompletionCallback callback);
int32_t EPDDLL_API EndEnableCovertMode_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginEnableManufacturerLockout_R3(CommsHandle hComms, uint8_t onState, CompletionCallback callback);
int32_t EPDDLL_API EndEnableManufacturerLockout_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginEnableProtectedSession_R3(CommsHandle hComms, uint8_t onState, CompletionCallback callback);
int32_t EPDDLL_API EndEnableProtectedSession_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginEnableResponderMode_R3(CommsHandle hComms, uint8_t onState, CompletionCallback callback);
int32_t EPDDLL_API EndEnableResponderMode_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginTriggerResponderMode_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndTriggerResponderMode_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadResponderTriggerUtc_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadResponderTriggerUtc_R3(CommsHandle hComms, CompletionToken token, uint32_t *utc);
CompletionToken EPDDLL_API BeginReadRunTime_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadRunTime_R3(CommsHandle hComms, CompletionToken token, uint32_t *seconds);
CompletionToken EPDDLL_API BeginWriteStayTime_R3(CommsHandle hComms, uint16_t minutes, CompletionCallback callback);
int32_t EPDDLL_API EndWriteStayTime_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadStayTime_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadStayTime_R3(CommsHandle hComms, CompletionToken token, uint16_t* minutes);
CompletionToken EPDDLL_API BeginWriteOffModeBatteryTestInterval_R3(CommsHandle hComms, uint16_t minutes, CompletionCallback callback);
int32_t EPDDLL_API EndWriteOffModeBatteryTestInterval_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadOffModeBatteryTestInterval_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadOffModeBatteryTestInterval_R3(CommsHandle hComms, CompletionToken token, uint16_t* minutes);
CompletionToken EPDDLL_API BeginWriteBatteryCriticalTiming_R3(CommsHandle hComms, uint16_t minutesToCritical, uint16_t minutesToShutdown, CompletionCallback callback);
int32_t EPDDLL_API EndWriteBatteryCriticalTiming_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadBatteryCriticalTiming_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadBatteryCriticalTiming_R3(CommsHandle hComms, CompletionToken token, uint16_t *minutesToCritical, uint16_t *minutesToShutdown);
CompletionToken EPDDLL_API BeginWriteBatteryTypeOverride_R3(CommsHandle hComms, int8_t batteryType, CompletionCallback callback);
int32_t EPDDLL_API EndWriteBatteryTypeOverride_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadBatteryTypeOverride_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadBatteryTypeOverride_R3(CommsHandle hComms, CompletionToken token, int8_t *batteryType);
CompletionToken EPDDLL_API BeginReadBatteryTypeFitted_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadBatteryTypeFitted_R3(CommsHandle hComms, CompletionToken token, int8_t *batteryType);
/********************************************************************************************************************************************
* MK3 Specific Access Level Functions
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadAccessPermissionsForLevel_R3(CommsHandle hComms, AccessLevel_t level, CompletionCallback callback);
int32_t EPDDLL_API EndReadAccessPermissionsForLevel_R3(CommsHandle hComms, uint16_t commandIds[], uint16_t length, uint16_t *numIds, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteAccessPermissionsForLevel_R3(CommsHandle hComms, AccessLevel_t level, uint16_t commandIds[], uint16_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteAccessPermissionsForLevel_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
*
* Displays
*
********************************************************************************************************************************************/
/********************************************************************************************************************************************
*
* Display Quick Access List
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadQuickAccessDisplays_R3(CommsHandle hComms, uint8_t locationIndexes[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadQuickAccessDisplays_R3(CommsHandle hComms, CompletionToken token, QuickAccessDisplay_t displayIds[], uint8_t length, uint8_t * numDisplays);
CompletionToken EPDDLL_API BeginWriteQuickAccessDisplays_R3(CommsHandle hComms, QuickAccessDisplay_t displayIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteQuickAccessDisplays_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
*
* Display Enables
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadDisplayEnables_R3(CommsHandle hComms, uint8_t menuIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadDisplayEnables_R3(CommsHandle hComms, CompletionToken token, DisplayAttributeMap_t enables[], uint8_t length, uint8_t * numItems);
CompletionToken EPDDLL_API BeginWriteDisplayEnables_R3(CommsHandle hComms, DisplayAttributeMap_t enables[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDisplayEnables_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadDisplayEnablePermissions_R3(CommsHandle hComms, AccessLevel_t level, CompletionCallback callback);
int32_t EPDDLL_API EndReadDisplayEnablePermissions_R3(CommsHandle hComms, CompletionToken token, AccessLevel_t * level, uint16_t permissions[], uint8_t length, uint8_t * numMenus);
CompletionToken EPDDLL_API BeginWriteDisplayEnablePermissions_R3(CommsHandle hComms, AccessLevel_t level, uint16_t enables[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDisplayEnablePermissions_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
*
* Display Capabilities
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadDisplayCapability_R3(CommsHandle hComms, DisplayCapability_t capability, CompletionCallback callback);
int32_t EPDDLL_API EndReadDisplayCapability_R3(CommsHandle hComms, CompletionToken token, DisplayCapability_t* capabilityRequested, DisplayAttributeMap_t displayMaps[], uint8_t length, uint8_t * numItems);
/********************************************************************************************************************************************
*
* Off Mode Display
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteOffModeDisplay_R3(CommsHandle hComms, OffModeDutyCycle dutyCycle, OffModeDisplayId_t offModeDispId, CompletionCallback callback);
int32_t EPDDLL_API EndWriteOffModeDisplay_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadOffModeDisplay_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadOffModeDisplay_R3(CommsHandle hComms, CompletionToken token, OffModeDutyCycle * dutyCycle, OffModeDisplayId_t * offModeDispId);
/********************************************************************************************************************************************
*
* Backlight
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteBacklightEnable_R3(CommsHandle hComms, uint8_t enable, CompletionCallback callback);
int32_t EPDDLL_API EndWriteBacklightEnable_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadBacklightEnable_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadBacklightEnable_R3(CommsHandle hComms, CompletionToken token, uint8_t * enabled);
CompletionToken EPDDLL_API BeginTriggerBacklight_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndTriggerBacklight_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteSwitchOnFromButton_R3(CommsHandle hComms, uint8_t enable, CompletionCallback callback);
int32_t EPDDLL_API EndWriteSwitchOnFromButton_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadSwitchOnFromButton_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadSwitchOnFromButton_R3(CommsHandle hComms, CompletionToken token, uint8_t * enabled);
CompletionToken EPDDLL_API BeginWriteBacklightPeriod_R3(CommsHandle hComms, uint8_t seconds, CompletionCallback callback);
int32_t EPDDLL_API EndWriteBacklightPeriod_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadBacklightPeriod_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadBacklightPeriod_R3(CommsHandle hComms, CompletionToken token, uint8_t * seconds);
CompletionToken EPDDLL_API BeginWriteBacklightBrightness_R3(CommsHandle hComms, uint8_t level, CompletionCallback callback);
int32_t EPDDLL_API EndWriteBacklightBrightness_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadBacklightBrightness_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadBacklightBrightness_R3(CommsHandle hComms, CompletionToken token, uint8_t* level);
/********************************************************************************************************************************************
*
* Display Options
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteDisplayOptionsLock_R3(CommsHandle hComms, uint8_t value, uint8_t mask, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDisplayOptionsLock_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadDisplayOptionsLock_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadDisplayOptionsLock_R3(CommsHandle hComms, CompletionToken token, uint8_t * value);
// end of display group
/********************************************************************************************************************************************
*
* Alarm Configuration
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteAlarmConfiguration_R3(CommsHandle hComms, AlarmConfig_t alarmConfigs[], uint16_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteAlarmConfiguration_R3(CommsHandle hComms, CompletionToken token);
__declspec(deprecated("BeginReadAlarmConfiguration_R3 is now deprecated. Use BeginReadAlarmConfiguration instead"))
CompletionToken EPDDLL_API BeginReadAlarmConfiguration_R3(CommsHandle hComms, AlarmConfigId alarmConfigIds[], uint16_t length, CompletionCallback callback);
__declspec(deprecated("EndReadAlarmConfiguration_R3 is now deprecated. Use EndReadAlarmConfiguration instead"))
int32_t EPDDLL_API EndReadAlarmConfiguration_R3(CommsHandle hComms, CompletionToken token, AlarmConfig_t alarmConfigs[], uint16_t length, uint16_t * numConfigs);
CompletionToken EPDDLL_API BeginWriteAlarmConfigurationLock_R3(CommsHandle hComms, AlarmConfig_t alarmConfigLocks[], uint16_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteAlarmConfigurationLock_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadAlarmConfigurationLock_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadAlarmConfigurationLock_R3(CommsHandle hComms, CompletionToken token, AlarmConfig_t alarmConfigLocks[], uint16_t length, uint16_t * numConfigs);
CompletionToken EPDDLL_API BeginReadMeasurandIds_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadMeasurandIds_R3(CommsHandle hComms, CompletionToken token, MeasurementId ids[], uint8_t length, uint8_t * numIds);
/********************************************************************************************************************************************
*
* Telemetry
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadTelemetryEnable_R3(CommsHandle hComms, uint8_t mode, CompletionCallback callback);
int32_t EPDDLL_API EndReadTelemetryEnable_R3(CommsHandle hComms, uint8_t *mode, uint8_t *enabled, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteTelemetryEnable_R3(CommsHandle hComms, uint8_t mode, uint8_t enabled, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTelemetryEnable_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadTelemetryTxPower_R3(CommsHandle hComms, uint8_t mode, CompletionCallback callback);
int32_t EPDDLL_API EndReadTelemetryTxPower_R3(CommsHandle hComms, uint8_t *mode, int8_t *dBm, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteTelemetryTxPower_R3(CommsHandle hComms, uint8_t mode, int8_t dBm, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTelemetryTxPower_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadTelemetryAdvContent_R3(CommsHandle hComms, uint8_t mode, CompletionCallback callback);
int32_t EPDDLL_API EndReadTelemetryAdvContent_R3(CommsHandle hComms, uint8_t *mode, uint8_t *advFlags, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteTelemetryAdvContent_R3(CommsHandle hComms, uint8_t mode, uint8_t advFlags, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTelemetryAdvContent_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadTelemetryAdvConfig_R3(CommsHandle hComms, uint8_t mode, CompletionCallback callback);
int32_t EPDDLL_API EndReadTelemetryAdvConfig_R3(CommsHandle hComms, TeleAdvConfig_t *config, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteTelemetryAdvConfig_R3(CommsHandle hComms, TeleAdvConfig_t *config, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTelemetryAdvConfig_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadTelemetryCxnConfig_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadTelemetryCxnConfig_R3(CommsHandle hComms, TeleCxnConfig_t *config, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteTelemetryCxnConfig_R3(CommsHandle hComms, TeleCxnConfig_t *config, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTelemetryCxnConfig_R3(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadTelemetryReportInterval_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadTelemetryReportInterval_R3(CommsHandle hComms, uint8_t *interval, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteTelemetryReportInterval_R3(CommsHandle hComms, uint8_t interval, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTelemetryReportInterval_R3(CommsHandle hComms, CompletionToken token);
/*Debug Registers*/
CompletionToken EPDDLL_API BeginReadDebugRegister_R3(CommsHandle hComms, uint8_t registerId, CompletionCallback callback);
int32_t EPDDLL_API EndReadDebugRegister_R3(CommsHandle hComms, uint8_t *registerId, uint32_t *value, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteDebugRegister_R3(CommsHandle hComms, uint8_t registerId, uint32_t value, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDebugRegister_R3(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
*
* MK3 Specific Zone Control
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginValidateEpdOwnerKey_R3(CommsHandle hComms, uint8_t encData[], CompletionCallback callback);
int32_t EPDDLL_API EndValidateEpdOwnerKey_R3(CommsHandle hComms, uint8_t *decData, CompletionToken token);
/********************************************************************************************************************************************
*
* MK3 Firmware Update
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginInitiateFirmwareUpdate_R3(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndInitiateFirmwareUpdate_R3(CommsHandle hComms, CompletionToken token);
}
#endif

909
EpdBase3/Epd3Base.cpp Normal file
View file

@ -0,0 +1,909 @@
#include "pch.h"
#pragma unmanaged
#include "Epd3Base.h"
#include "TimeFunctions.h"
#pragma unmanaged
Epd3Base::Epd3U* current;
void WINAPI completion(CommsHandle hComms, CompletionToken token)
{
SetEvent(current->hCompletion);
}
void WINAPI discovery(CommsHandle hComms, DiscoveryId const discovered[], int32_t count)
{
if (count > 0)
{
current->CurrentDeviceID = discovered[0].Id;
current->DeviceCount = count;
memcpy(&current->Epd, &discovered[0], sizeof(DiscoveryId));
SetEvent(current->hCompletion);
}
}
Epd3Base::Epd3U::Epd3U(int _comport)
{
port = _comport;
comPort[3] = 48 + _comport;
CommsInitialized = 0;
epdComsHandle = INVALID_HANDLE_VALUE;
Error = 123;
current = this;
if (_comport == 0) return;
if (hCompletion == 0) hCompletion = CreateEvent(NULL, TRUE, FALSE, NULL);
if (hWaitTimer == 0) hWaitTimer = CreateEvent(NULL, TRUE, FALSE, NULL);
}
Epd3Base::Epd3U::~Epd3U()
{
EndCom();
if (hCompletion != 0) { CloseHandle(hCompletion); hCompletion = 0; }
}
DWORD Epd3Base::Epd3U::StartCom()
{
ErrorReason = 0;
int mx = 10;
epdComsHandle = INVALID_HANDLE_VALUE;
if (port == 0) {
CommsInitialized = 1;
return 1;
}
if (CommsInitialized == 0) {
epdComsHandle = CreateReaderInterface();
Dll3RV = OpenReader(epdComsHandle, comPort);
if (Dll3RV == 0)
{
Dll3RV = SetMultipleDiscoveryMode(epdComsHandle, false);
CommsInitialized = 1;
}
}
return Dll3RV;
}
void Epd3Base::Epd3U::EndCom()
{
if (CommsInitialized == 1) {
if (epdComsHandle != INVALID_HANDLE_VALUE) {
CloseReader(epdComsHandle);
DestroyReaderInterface(epdComsHandle);
}
}
CommsInitialized = 0;
epdComsHandle = INVALID_HANDLE_VALUE;
}
/// <summary>
///
/// </summary>
/// <param name="tokentimeout"></param>
/// <returns>rv=1 bij timeout <>1 voor error</returns>
int Epd3Base::Epd3U::StartDiscover(int tokentimeout)
{
int32_t rv=1;
Error = 0;
if (port == 0) {
DeviceCount = 1;
DeviceIDs[0] = 768;
return 0;
}
Dll3RV = SetDiscoveryCacheTimeout(epdComsHandle, tokentimeout);
//Dll3RV = Commit3(epdComsHandle);
DeviceCount = 0; ConnectTries = 1;
ResetEvent(hCompletion);
ConnectTimerFired = 0;
current = this;
Dll3RV = StartDiscovery(epdComsHandle, discovery);
if (Dll3RV == 0) {
Dll3RV = WaitForSingleObject(hCompletion, tokentimeout);
if (Dll3RV == WAIT_OBJECT_0) rv = 1;
else if (Dll3RV == WAIT_TIMEOUT) {
rv = 1; ConnectTimerFired = 1;
} else rv = 2;
}
if ( DeviceCount > 0) {
Dll3RV = Connect3(epdComsHandle, Epd, true);
if (Dll3RV != 0) rv = 2;
}
return rv;
}
int Epd3Base::Epd3U::OpenDev(DiscoveryId DeviceID)
{
CurrentDeviceID = DeviceID.Id;
if (epdComsHandle != INVALID_HANDLE_VALUE)
{
Dll3RV = Connect3(epdComsHandle, DeviceID, true);
}
else { Dll3RV = 0; }
return Dll3RV;
}
void Epd3Base::Epd3U::CloseDev(bool CloseAll)
{
if (epdComsHandle != INVALID_HANDLE_VALUE) {
Disconnect(epdComsHandle);
if (CloseAll) {
CloseReader(epdComsHandle);
DestroyReaderInterface(epdComsHandle);
epdComsHandle = INVALID_HANDLE_VALUE;
}
}
}
BYTE checkStatus(OpStatusFlags status, OpStatusFlags flag)
{
if (((uint32_t)status & (uint32_t)flag) == (uint32_t)flag) return 1; else return 0;
}
BYTE checkStatus(FaultStatusFlags status, FaultStatusFlags flag)
{
if (((uint32_t)status & (uint32_t)flag) == (uint32_t)flag) return 1; else return 0;
}
BYTE checkStatus(AlarmStatusFlags status, AlarmStatusFlags flag)
{
uint32_t ustatus = (uint32_t)status;
uint32_t uflag = (uint32_t)flag;
if ((ustatus & uflag) == uflag) return 1; else return 0;
}
BYTE checkStatus(DoseAlarmFlags status, DoseAlarmFlags flag)
{
if (((uint32_t)status & (uint32_t)flag) == (uint32_t)flag) return 1; else return 0;
}
void Epd3Base::Epd3U::DecodeStatus()
{
DetectorsOn = checkStatus(epd3status.OperatingStatus, OpStatusFlags::EpdOn);
EPDIssued = checkStatus(epd3status.OperatingStatus, OpStatusFlags::EpdIssued);
EPDLocked = checkStatus(epd3status.OperatingStatus, OpStatusFlags::GainAdjustable);
EPDTesting = checkStatus(epd3status.OperatingStatus, OpStatusFlags::DetectorTestRequested);
EPDFaulty = checkStatus(epd3status.FaultStatus, FaultStatusFlags::EpdFaulty);
EPDNewFault = checkStatus(epd3status.FaultStatus, FaultStatusFlags::EpdFaulty);
EPDComFault = checkStatus(epd3status.FaultStatus, FaultStatusFlags::EarlyCommsTermination);
EPDCalFault = checkStatus(epd3status.FaultStatus, FaultStatusFlags::NotCalibrated);
EPDDetFault = checkStatus(epd3status.FaultStatus, FaultStatusFlags::DetectorTestFail);
EPDEprFault = checkStatus(epd3status.FaultStatus, FaultStatusFlags::EepromFailure);
EPDTrhFault = checkStatus(epd3status.FaultStatus, FaultStatusFlags::BadThreshold);
for (int ix = 0; ix < 4; ix++)
{
DoseAlarmFlags status = epd3status.DoseAlarms[ix].Status;
switch ((MeasurementId)epd3status.DoseAlarms[ix].Id)
{
case MeasurementId::Meas_Hp07:
case MeasurementId::Meas_Hp10N:
AlarmDoseHP07N = checkStatus(status, DoseAlarmFlags::DoseAlarm);
AlarmRateHP07N = checkStatus(status, DoseAlarmFlags::RateAlarm);
break;
case MeasurementId::Meas_Hp10:
case MeasurementId::Meas_Hp10G:
AlarmDoseHP101G = checkStatus(status, DoseAlarmFlags::DoseAlarm);
AlarmDoseHP102G = AlarmDoseHP101G;
AlarmRateHP101G = checkStatus(status, DoseAlarmFlags::RateAlarm);
AlarmRateHP102G = AlarmRateHP101G;
break;
}
}
OtherAlarmReturn = checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::ReturnForRead);
OtherAlarmBatLow = checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::LowBattery);
OtherAlarmCarrier = checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::TelemetryAlert);
OtherAlarmBatVolt = checkStatus(epd3status.AlarmStatus, AlarmStatusFlags::LowBattery);
}
void Epd3Base::Epd3U::SetTime() //Only R3
{
if (Epd.Gen == EpdGeneration::Mk3) {
utc = TimeFunctions::NowToEpdTime(Epd.Gen == EpdGeneration::Mk2);
token = BeginWriteRTC_R3(epdComsHandle, utc, nullptr);
uint32_t r = Commit3(epdComsHandle);
Dll3RV = EndWriteRTC_R3(epdComsHandle, token);
}
}
int Epd3Base::Epd3U::ReadStatus()
{
int32_t r; //0=ok
Error = 0;
if (port == 0) {
EpdID = 4567;
EpdType = EpdTypes::Mk2BetaGamma;
isBG = 1;
isMK3 = false;
FunctionFlags = 0x000;
Epd.Gen = EpdGeneration::None;
Epd.MaxBaud = 0;
Epd.Id = EpdID;
return 0;
}
isMK3 = Epd.Gen == EpdGeneration::Mk3;
OperatingStatus = (OpStatusFlags)0U;
AlarmStatus = (AlarmStatusFlags)0U;
ErrorStatus = (FaultStatusFlags)0;
IssueCount = OtherAlarms = EEPROMBadSectors = 0;
RealTime = EpdClock = OffTime = EpdID = 0;
ErrorSource = ErrorReason = ErrorData = 0;
HardVersion = SoftVersion = FunctionFlags = 0;
SetResponseTimeout(epdComsHandle, 2000);
token = BeginReadStatus(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndReadStatus(epdComsHandle, token, &epd3status);
if (r != 0) {
Error = GetErrorCode(); return r;
}
IssueCount = epd3status.IssueCount;
OperatingStatus = epd3status.OperatingStatus;
AlarmStatus = epd3status.AlarmStatus;
ErrorStatus = epd3status.FaultStatus;
OtherAlarms = epd3status.OtherBits;
uint32_t EpdID32;
uint32_t capabilities;
MarkNumber_t MarkNumber;
VersionNumber_t VersionNumber;
token = BeginReadEpdIdentities(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndReadEpdIdentities(epdComsHandle, token, &EpdID32, (EpdTypes*)&EpdType, &capabilities, &MarkNumber, &VersionNumber, NULL, 0);
if (r != 0) {
Error = GetErrorCode(); return r;
}
EpdID = EpdID32;
isBG = (EpdType == EpdTypes::Mk2BetaGamma || EpdType == EpdTypes::Mk3BetaGamma);
DecodeStatus();
memset(WearerID, 0, WearerIDLength + 1);
memset(WearerName, 0, WearerNameLength + 1);
//Counts
uint8_t length = 0;
countsRead = 0; utc = 0; seconds = 0;
token = BeginReadCounts(epdComsHandle, nullptr, 0, nullptr);
r = Commit3(epdComsHandle);
r = EndReadCounts(epdComsHandle, token, Counts, MaxCounts, &countsRead, &utc, &seconds);
// - 101 = InvalidParam
// - 104 = FunctionFail,
if (r != 0 && r != -104) {
Error = GetErrorCode(); return r;
}
decodeCounters(countsRead); //HG,SG ..
//Wearer
if (EPDIssued) {
IdString_t mk3WearerID;
//Mk2 EPDs only support Name and Primary ID
token = BeginReadWearerId(epdComsHandle, static_cast<uint16_t>(WearerIdType::WearerId_Name), nullptr);
r = Commit3(epdComsHandle);
r = EndReadWearerId(epdComsHandle, token, &mk3WearerID);
if (r != 0) {
Error = GetErrorCode(); return r;
}
if (mk3WearerID.Length > WearerNameLength) mk3WearerID.Length = WearerNameLength;
memcpy(WearerName, mk3WearerID.Utf8String, mk3WearerID.Length); WearerName[mk3WearerID.Length] = 0;
token = BeginReadWearerId(epdComsHandle, static_cast<uint16_t>(WearerIdType::WearerId_Primary), nullptr);
r = Commit3(epdComsHandle);
r = EndReadWearerId(epdComsHandle, token, &mk3WearerID);
if (r != 0) {
Error = GetErrorCode(); return r;
}
if (mk3WearerID.Length > WearerIDLength) mk3WearerID.Length = WearerIDLength;
memcpy(this->WearerID, mk3WearerID.Utf8String, mk3WearerID.Length); WearerName[mk3WearerID.Length] = 0;
for (int i = 0; i < mk3WearerID.Length; i++)
if (WearerID[i] == 0xb) WearerID[i] = '0'; else WearerID[i] |= 0x30;
}
//Times
//1601-01-01T00:00:00Z.
//MK2 .. some utc... but no real time clock
if (utc == 0) {
token = BeginReadRTC(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndReadRTC(epdComsHandle, token, &utc); //EpdClock for MK2
EpdClock = utc;
utc = TimeFunctions::NowToEpdTime(true);
}
else {
EpdClock = utc;
}
FILETIME fUTC;
TimeFunctions::EpdTimeToFileTime(utc, &fUTC, Epd.Gen == EpdGeneration::Mk2);
FileTimeToSystemTime(&fUTC, &tRealTime);
return r;
}
/// <summary>
/// discover, connect and read status
/// </summary>
/// <param name="tokenSourceTimeout"></param>
/// <returns>0=success 1=connect error, 2 = no devices, 3= error reading status</returns>
int Epd3Base::Epd3U::ConnectAndStatus(int tokenSourceTimeout)
{
WORD dllStatus;
int rv = 1;
if (CommsInitialized == 0) StartCom();
dllStatus = StartDiscover(tokenSourceTimeout);
if (dllStatus != 1) rv = 1; //Connect error
else if (DeviceCount < 1) rv = 2; //TO
else if (ReadStatus() != 0) rv = 1; //Read Error
else rv = 0;
return rv;
}
void Epd3Base::Epd3U::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; //Neutr=FN
case SensitivityId::Sg1Sens07G: K4 = sensitivities[ix].value; break; //Neutr=AN
case SensitivityId::Fb1Sens07B: K5 = sensitivities[ix].value; break;
case SensitivityId::Sg2Sens07B: K6 = sensitivities[ix].value; break;
default: break;
}
}
}
void Epd3Base::Epd3U::decodetotDoses(int count)
{
//doses
Hp10Total = Hp07Total = 0;
for (int ix = 0; ix < count; ix++)
{
switch ((MeasurementId)doses[ix].id) {
case MeasurementId::Meas_Hp07: Hp07Total = doses[ix].value; break;
case MeasurementId::Meas_Hp10: Hp10Total = doses[ix].value; break;
case MeasurementId::Meas_Hp10N: Hp07Total = doses[ix].value; break;
case MeasurementId::Meas_Hp10G: Hp10Total = doses[ix].value; break;
}
}
}
void Epd3Base::Epd3U::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 Epd3Base::Epd3U::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 Epd3Base::Epd3U::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 Epd3Base::Epd3U::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 Epd3Base::Epd3U::decodeTreshold(Mk3AlarmThresholds_t* th)
{
float* pThDose = nullptr, * pThRate = nullptr, * pTHDoseWarning = nullptr, * pTHRateWarning = nullptr;
switch ((MeasurementId)th->MeasId)
{
case MeasurementId::Meas_Hp07:
case MeasurementId::Meas_Hp10N:
Hp07THDose = 0; Hp07RateOn = 0; Hp07RateOff = 0;
pThDose = &Hp07THDose;
pThRate = &Hp07RateOn;
pTHDoseWarning = pTHRateWarning = nullptr;
break;
case MeasurementId::Meas_Hp10:
Hp10THDose1 = 0; Hp10THDose2 = 0;
Hp10Rate1On = Hp10Rate2On = Hp10Rate1Off = Hp10Rate2Off = 0;
pThDose = &Hp10THDose2;
pThRate = &Hp10Rate2On;
pTHDoseWarning = &Hp10THDose1;
pTHRateWarning = &Hp10Rate1Off;
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: 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_RateWarning: if (pTHRateWarning != nullptr) *pTHRateWarning = th->Thresholds[ix].Value; break;
}
}
}
void Epd3Base::Epd3U::encodeTreshold(Mk3AlarmThresholds_t* th)
{
//th.MeasId
float* pThDose, * pThRate, * pTHDoseWarning, * pTHRateWarning;
th->NumberThresholds = 4;
switch ((MeasurementId)th->MeasId) {
case MeasurementId::Meas_Hp07:
case MeasurementId::Meas_Hp10N:
pThDose = &Hp07THDose;
pTHDoseWarning = &Hp07THDose;
pThRate = &Hp07RateOn;
pTHRateWarning = &Hp07RateOff;
RatePct[0].MeasId = th->MeasId;
RatePct[0].Value = 85; // (int)(Hp07RateOff * 100.0 / Hp07RateOn);
break;
case MeasurementId::Meas_Hp10:
case MeasurementId::Meas_Hp10G:
pThDose = &Hp10THDose2;
pThRate = &Hp10Rate2On;
pTHDoseWarning = &Hp10THDose1;
pTHRateWarning = &Hp10Rate1On;
RatePct[1].MeasId = th->MeasId;
RatePct[1].Value = 85; // (int)(Hp10Rate2Off * 100.0 / Hp10Rate2On);
break;
default:
pThDose = &Hp07THDose;
pTHDoseWarning = &Hp07THDose;
pThRate = &Hp07RateOn;
pTHRateWarning = &Hp07RateOff;
}
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 = *pTHDoseWarning;
th->Thresholds[3].Id = (uint16_t)ThresholdId::Thres_RateWarning;
th->Thresholds[3].Value = *pTHRateWarning;
}
void Epd3Base::Epd3U::decodedTresholds(int numdTresholds)
{
for (int ix = 0; ix < numdTresholds; ix++) {
switch ((CounterType)dTresholds[ix].type) {
case CounterType::Counter_Hg1: HG = dTresholds[ix].value; break;
case CounterType::Counter_Sg1: SG = dTresholds[ix].value; break;
case CounterType::Counter_Sg2: BC = dTresholds[ix].value; break;
case CounterType::Counter_Fb1: FB = dTresholds[ix].value; break;
case CounterType::Counter_An1: BC = dTresholds[ix].value; break; //AN-> BC
case CounterType::Counter_Fn2: FB = dTresholds[ix].value; break; //FN->FB
}
}
}
/// <summary>
///
/// </summary>
/// <returns>0 OK</returns>
WORD Epd3Base::Epd3U::ReadSensitivitiesAndTresholds()
{
int32_t r = 0;
if (Epd.Gen == EpdGeneration::Mk2) {
uint16_t HGSens10;
uint16_t SGSens10;
uint16_t HGSens07;
uint16_t SGSens07;
uint16_t FBSens07;
uint16_t BCSens07;
uint16_t SGthresh;
uint16_t BCthresh;
uint16_t FBthresh;
uint16_t HGthresh;
//ResetEvent(Ev1);
//token = BeginReadDoses(epdComsHandle, new uint8_t[]{ 0, 1 }, 2 , completion);
token = BeginReadCalibrationData_R2(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
//r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadCalibrationData_R2(epdComsHandle, token,
&HGSens10,
&SGSens10,
&HGSens07,
&SGSens07,
&FBSens07,
&BCSens07,
&SGthresh,
&BCthresh,
&FBthresh,
&HGthresh
);
K1 = HGSens10;
K2 = SGSens10;
K3 = HGSens07;
K4 = SGSens07;
K5 = FBSens07;
K6 = BCSens07;
SG = SGthresh;
BC = BCthresh;
FB = FBthresh;
HG = HGthresh;
}
else {
token = BeginReadDetectorThresholds_R3(epdComsHandle, nullptr, 0, nullptr);
r = Commit3(epdComsHandle);
r = EndReadDetectorThresholds_R3(epdComsHandle, token, dTresholds, MaxTresholds, &numTresholds);
decodedTresholds(numTresholds);
token = BeginReadSensitivities(epdComsHandle, nullptr, 0, nullptr);
r = Commit3(epdComsHandle);
r = EndReadSensitivities(epdComsHandle, token, sensitivities, MaxSensitivities, &numSensitivities);
decodeSensitivities(numSensitivities);
}
return r;
}
/// <summary>
///
/// </summary>
/// <returns>0 OK</returns>
WORD Epd3Base::Epd3U::ReadDoses()
{
int32_t r = 1;
if (port == 0) {
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;
return 0;
}
numDoses = 0; utc = 0;
SetResponseTimeout(epdComsHandle, 2000);
//ResetEvent(Ev1);
token = BeginReadDoses(epdComsHandle, nullptr, 0, nullptr);
r = Commit3(epdComsHandle);
//r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadDoses(epdComsHandle, token, doses, MaxDoses, &numDoses, &utc);
decodeDoses(numDoses);
//ResetEvent(Ev1);
token = BeginReadTotalDoses(epdComsHandle, nullptr, 0, nullptr);
r = Commit3(epdComsHandle);
//r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadTotalDoses(epdComsHandle, token, totdoses, MaxDoses, &numtotDoses, &utc);
decodetotDoses(numtotDoses);
token = BeginReadQualityData(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndReadQualityData(epdComsHandle, token, &quality);
Knocks = quality.Knocks;
Resets = quality.PowerCycles;
token = BeginReadPeakRates(epdComsHandle, nullptr, 0, nullptr);
r = Commit3(epdComsHandle);
r = EndReadPeakRates(epdComsHandle, token, peakRates, MaxPeakRates, &numRates);
decodePeakRates(numRates);
ReadSensitivitiesAndTresholds();
return r;
}
void Epd3Base::Epd3U::ClearDoses()
{
int32_t r = 1;
token = BeginClearDose(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndClearDose(epdComsHandle, token);
if (r != 0)
goto error;
token = BeginClearTotalDose(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndClearTotalDose(epdComsHandle, token);
if (r != 0)
goto error;
token = BeginClearPeakRates(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndClearPeakRates(epdComsHandle, token);
if (r != 0)
goto error;
error: return;
}
void Epd3Base::Epd3U::ClearAlarms()
{
token = BeginClearFaultStatus(epdComsHandle, nullptr);
int32_t r = Commit3(epdComsHandle);
r = EndClearFaultStatus(epdComsHandle, token);
token = BeginClearLatchedAlarms(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndClearLatchedAlarms(epdComsHandle, token);
token = BeginClearAllStatus(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndClearAllStatus(epdComsHandle, token);
}
WORD Epd3Base::Epd3U::PrepareForIssue()
{
if (port == 0) return 0;
//CommitRV = WriteConfig();
ClearDoses();
ClearAlarms();
return 0;
}
WORD Epd3Base::Epd3U::ReadAlarmConfig() {
//Alleen MK3 ? leeg bij MK2
token = BeginReadAlarmConfiguration(epdComsHandle, nullptr, 0, nullptr);
int32_t r = Commit3(epdComsHandle);
r = EndReadAlarmConfiguration(epdComsHandle, token, alarmConfig, MaxAlarmConfig, &numAlarm);
return numAlarm;
}
WORD Epd3Base::Epd3U::ReadAlarmTresholds() {
//Alleen MK3 ? leeg bij MK2
bool isNeutron = (EpdType == EpdTypes::Mk2Neutron || EpdType == EpdTypes::Mk3Neutron);
uint8_t measID;
uint32_t r;
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10N; else measID = (uint8_t)MeasurementId::Meas_Hp07;
SetResponseTimeout(epdComsHandle, 2000);
//ResetEvent(Ev1);
hp07tresholds.MeasId = measID;
token = BeginReadAlarmThresholds(epdComsHandle, (uint8_t)hp07tresholds.MeasId, nullptr, 0, nullptr);
r = Commit3(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;
hp10tresholds.MeasId = 0;
//ResetEvent(Ev1);
token = BeginReadAlarmThresholds(epdComsHandle, (uint8_t)hp10tresholds.MeasId, nullptr, 0, nullptr);
r = Commit3(epdComsHandle);
//r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndReadAlarmThresholds(epdComsHandle, token, &hp10tresholds);
decodeTreshold(&hp10tresholds);
return r;
}
WORD Epd3Base::Epd3U::WriteAlarmTresholds() {
//Alleen MK3 ? leeg bij MK2
uint32_t r;
bool isNeutron = (EpdType == EpdTypes::Mk2Neutron || EpdType == EpdTypes::Mk3Neutron);
uint8_t measID;
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10G; else measID = (uint8_t)MeasurementId::Meas_Hp10;
hp10tresholds.MeasId = measID;
encodeTreshold(&hp10tresholds);
token = BeginWriteAlarmThresholds(epdComsHandle, (uint8_t)hp10tresholds.MeasId, (uint8_t)hp10tresholds.NumberThresholds, hp10tresholds.Thresholds, nullptr);
r = Commit3(epdComsHandle);
if (r != 0)
goto error;
r = EndWriteAlarmThresholds(epdComsHandle, token);
if (r != 0)
goto error;
if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10N; else measID = (uint8_t)MeasurementId::Meas_Hp07;
hp07tresholds.MeasId = measID;
encodeTreshold(&hp07tresholds);
hp07tresholds.NumberThresholds = 2;
token = BeginWriteAlarmThresholds(epdComsHandle, (uint8_t)hp07tresholds.MeasId, (uint8_t)hp07tresholds.NumberThresholds, hp07tresholds.Thresholds, nullptr);
r = Commit3(epdComsHandle);
if (r != 0)
goto error;
r = EndWriteAlarmThresholds(epdComsHandle, token);
if (r != 0)
goto error;
token = BeginWriteRateOffPercentage(epdComsHandle, RatePct, 2, nullptr);
r = Commit3(epdComsHandle);
if (r != 0)
goto error;
r = EndWriteRateOffPercentage(epdComsHandle, token);
if (r != 0)
goto error;
error:
return r;
}
WORD Epd3Base::Epd3U::DeIssue()
{
int32_t r = 1;
if (!EPDIssued) return 0;
if (port == 0) return 0;
ClearDoses();
ClearAlarms();
token = BeginDeissueEPD(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndDeissueEPD(epdComsHandle, token);
if (r != 0)
goto error;
token = BeginEpdOnOff(epdComsHandle, 0, nullptr);
r = Commit3(epdComsHandle);
r = EndEpdOnOff(epdComsHandle, token);
if (r != 0)
goto error;
EndCom();
error:
return r;
}
WORD Epd3Base::Epd3U::WriteWearer() {
token = BeginSetBaselineCounters(epdComsHandle, nullptr);
int32_t r = Commit3(epdComsHandle);
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);
token = BeginWriteWearerId(epdComsHandle, mk3WearerID, nullptr);
r = Commit3(epdComsHandle);
r = EndWriteWearerId(epdComsHandle, token);
mk3WearerID.IdType = (uint16_t)WearerIdType::WearerId_Primary;
mk3WearerID.Length = 13;
memcpy(mk3WearerID.Utf8String, WearerID, 13);
token = BeginWriteWearerId(epdComsHandle, mk3WearerID, nullptr);
r = Commit3(epdComsHandle);
r = EndWriteWearerId(epdComsHandle, token);
return 0;
}
/// <summary>
///
/// </summary>
/// <returns>0 Success</returns>
WORD Epd3Base::Epd3U::Issue()
{
uint32_t r=0;
if (port == 0) return r;
r = WriteAlarmTresholds();
if (r != 0)
goto error;
r = WriteWearer();
if (r != 0)
goto error;
/*r = WriteCal();
if (r != 0)
goto error;*/
//EPDIssued
if (!DetectorsOn) {
token = BeginEpdOnOff(epdComsHandle, 1, nullptr);
r = Commit3(epdComsHandle);
r = EndEpdOnOff(epdComsHandle, token);
// OKRV = EpdOn(); OKRV = Commit3();
//Sleep(1500);
}
token = BeginIssueEPD(epdComsHandle, nullptr);
r = Commit3(epdComsHandle);
r = EndIssueEPD(epdComsHandle, token);
if (r != 0)
goto error;
EndCom();
error:
return r;
}
WORD Epd3Base::Epd3U::EPDReadExtraStatus()
{
if (port == 0) return 1;
//byBatADC = bySupplyADC = 0;
/*CommitRV = ReadA2ConfigStatus(
&byBatADC,
&bySupplyADC,
&byStatus3,
&byStatus4);
if (CommitRV == 1) CommitRV = Commit3();*/
token = BeginReadBaselineCounts(epdComsHandle, nullptr);
uint32_t r = Commit3(epdComsHandle);
r = EndReadBaselineCounts(epdComsHandle, token, Counts, 10, &utc, &countsRead);
decodeBaseCounters(countsRead);
//if (CommitRV == 1) CommitRV = ReadCounts(&D1, &D2, &D3, &D4, &CountsClock);
//if (CommitRV == 1) CommitRV = Commit3();
//if (CommitRV == 1) CommitRV = ReadBaseCounts(&BaseD1, &BaseD2, &BaseD3, &BaseD4, &BaseCountsClock);
//if (CommitRV == 1) CommitRV = Commit3();
return r;
}
WORD Epd3Base::Epd3U::WriteCal()
{
uint32_t r = 0;
if (port == 0) return 0;
if (K6 > 2000)
{
r = 0;
return 0;
}
if (EpdType == EpdTypes::Mk2Neutron)
{
Password = 9;
token = BeginMfrLogin_R2(epdComsHandle, Password, nullptr);
uint32_t r = Commit3(epdComsHandle);
if (r != 0)
goto error;
r = EndMfrLogin_R2(epdComsHandle, token);
if (r != 0)
goto error;
token = BeginWriteSensitivities_R2(epdComsHandle, nullptr, (uint16_t)K1, (uint16_t)K2, (uint16_t)K3, (uint16_t)K4, (uint16_t)K5, (uint16_t)K6);
r = Commit3(epdComsHandle);
if (r != 0)
goto error;
if (r != 0)
goto error;
r = EndWriteSensitivities_R2(epdComsHandle, token);
if (r != 0)
goto error;
}
return r;
error:
return r;
}

265
EpdBase3/Epd3Base.h Normal file
View file

@ -0,0 +1,265 @@
#pragma once
#pragma unmanaged
#include <windows.h>
#pragma unmanaged
#include "EpdCommon.h"
#include "Epd3.h"
#include "Epd2.h"
#pragma unmanaged
#define MaxPeakRates 10
#define MaxSensitivities 10
#define MaxDoses 4
#define MaxCounts 6
#define MaxAlarmConfig 10
#define MaxTresholds 10
namespace Epd3Base {
class Epd3U
{
public:
char comPort[5] = { "COM4" };
CommsHandle epdComsHandle;
uint32_t CurrentDeviceID;
EpdGeneration EpdGen;
DiscoveryId Epd;
CompletionToken token;
WORD port = 3;
const WORD MaxDevices = 10;
WORD DeviceCount = 0;
DWORD DeviceIDs[10];
WORD Error = 0;
WORD ErrorSource;
WORD ErrorReason;
WORD ErrorData;
int32_t Dll3RV;
public:
HANDLE hWaitTimer = 0;
HANDLE hCompletion = 0;
private:
WORD CommsInitialized = 0;
public:
Epd3U(int _comport);
~Epd3U();
DWORD StartCom();
void EndCom();
int StartDiscover(int tokentimeout);
//OperatingStatus
BYTE DetectorsOn = 0;
BYTE EPDIssued = 0;
BYTE EPDLocked = 0;
BYTE EPDTesting = 0;
BYTE EPDProcSec = 0;
BYTE EPDFaulty = 0;
//ERrrostatus
BYTE EPDNewFault = 0;
BYTE EPDComFault = 0;
BYTE EPDCalFault = 0;
BYTE EPDDetFault = 0;
BYTE EPDEprFault = 0;
BYTE EPDTrhFault = 0;
BYTE EPDOthFault = 0;
//AlarmStatus
BYTE AlarmDoseHP101G = 0;
BYTE AlarmDoseHP102G = 0;
BYTE AlarmDoseHP07N = 0;
BYTE AlarmRateHP101G = 0;
BYTE AlarmRateHP102G = 0;
BYTE AlarmRateHP07N = 0;
//OtherAlarm
BYTE OtherAlarmRateHp101G = 0;
BYTE OtherAlarmRateHp102G = 0;
BYTE OtherAlarmRateHp07N = 0;
BYTE OtherAlarmReturn = 0;
BYTE OtherAlarmBatLow = 0;
BYTE OtherAlarmCarrier = 0;
BYTE OtherAlarmBatVolt = 0;
DWORD Password = 9;
//Identification
DWORD EpdID = 0;
WORD HardVersion;
WORD SoftVersion;
WORD FunctionFlags;
DWORD EpdClock;
DWORD RealTime;
WORD IssueCount;
DWORD OffTime;
WORD OtherAlarms;
WORD EEPROMBadSectors;
EpdTypes EpdType = EpdTypes::Mk2Gamma;
bool isBG = false;
bool isMK3 = false;
SYSTEMTIME tRealTime;
//Wearer
#define WearerIDLength 12
BYTE WearerID[(WearerIDLength)+1];
#define WearerNameLength 22
BYTE WearerName[WearerNameLength + 1];
// Dose
float Hp10Dose;
float Hp07Dose;
float Hp10Total;
float Hp07Total;
WORD Knocks;
WORD Resets;
WORD QualityData;
//Peaks
float Hp10Peak;
float Hp07Peak;
DWORD Hp10Time;
DWORD Hp07Time;
//AlarmDoseTreshold
float Hp10THDose1;
float Hp10THDose2;
float Hp07THDose;
float Hp10Rate1On;
float Hp10Rate2On;
float Hp07RateOn;
float Hp10Rate1Off;
float Hp10Rate2Off;
float Hp07RateOff;
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;
DWORD D3;
DWORD D4;
DWORD CountsClock;
DWORD BaseD1;
DWORD BaseD2;
DWORD BaseD3;
DWORD BaseD4;
DWORD BaseCountsClock;
BYTE ConnectTimerFired;
int ConnectTries;
OpStatusFlags OperatingStatus;
FaultStatusFlags ErrorStatus;
AlarmStatusFlags AlarmStatus;
StatusData_t epd3status;
uint8_t counterIds[MaxCounts]; //max 6 for mk3
uint8_t counterIdLen;
MeasurementId mIDs[MAX_MEASUREMENTS];
uint8_t nmIDs = 0;
MeasValue_t doses[MaxDoses];
MeasValue_t totdoses[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, numtotDoses, numRates, numSensitivities, numTresholds;
uint16_t numAlarm;
uint32_t utc;
Mk3QualityData_t quality;
Mk3AlarmThresholds_t hp07tresholds;
Mk3RatePercentage_t RatePct[2];
Mk3AlarmThresholds_t hp10tresholds;
DetectorThreshold_t dTresholds[MaxTresholds];
//Functions
int OpenDev(DiscoveryId DeviceID);
void CloseDev(bool CloseAll);
void DecodeStatus();
void SetTime();
int ReadStatus();
void decodeCounters(int count);
void decodeBaseCounters(int count);
void decodeTreshold(Mk3AlarmThresholds_t* th);
void encodeTreshold(Mk3AlarmThresholds_t* th);
void decodedTresholds(int numdTresholds);
WORD ReadSensitivitiesAndTresholds();
WORD ReadDoses();
void ClearDoses();
void ClearAlarms();
WORD PrepareForIssue();
WORD ReadAlarmConfig();
int ConnectAndStatus(int tokenSourceTimeout);
void decodeSensitivities(int count);
void decodetotDoses(int count);
void decodeDoses(int count);
void decodePeakRates(int count);
WORD ReadAlarmTresholds();
WORD WriteAlarmTresholds();
WORD DeIssue();
WORD WriteWearer();
WORD Issue();
WORD EPDReadExtraStatus();
WORD WriteCal();
};
}

10
EpdBase3/EpdBase3.cpp Normal file
View file

@ -0,0 +1,10 @@
// EpdBase3.cpp : Defines the functions for the static library.
//
#include "pch.h"
#include "framework.h"
// TODO: This is an example of a library function
void fnEpdBase3()
{
}

178
EpdBase3/EpdBase3.vcxproj Normal file
View file

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{e6bb4f4e-4774-4fe3-b341-7f4c24dc61e7}</ProjectGuid>
<RootNamespace>EpdBase3</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>Epd3Base</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="CommonEpdTypes.h" />
<ClInclude Include="Epd2.h" />
<ClInclude Include="Epd3.h" />
<ClInclude Include="Epd3Base.h" />
<ClInclude Include="EpdCommon.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="Mk3Types.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="TimeFunctions.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Epd3Base.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="TimeFunctions.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="CommonEpdTypes.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Epd2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Epd3.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Epd3Base.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Mk3Types.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EpdCommon.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="TimeFunctions.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Epd3Base.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="TimeFunctions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

321
EpdBase3/EpdCommon.h Normal file
View file

@ -0,0 +1,321 @@
#ifndef epd_common_h
#define epd_common_h
#ifndef WINAPI
#define WINAPI __stdcall
#endif
#ifdef READER3_EXPORTS
#define EPDDLL_API __declspec(dllexport) WINAPI
#else
#define EPDDLL_API __declspec(dllimport) WINAPI
#endif
#include <stdint.h>
#include "Mk3Types.h"
// Grouping for Doxygen comments and function descriptions
// Documentation for method return codes
extern "C"
{
const int r_OK = 0;
const int r_UnknownError = -1;
const int r_InvalidCommsHandle = -2;
const int r_InvalidPortName = -3;
const int r_PortAlreadyOpen = -4;
const int r_PortClosed = -5;
const int r_OperationFailed = -6;
const int r_InvalidState = -7;
const int r_InvalidCompletionToken = -8;
const int r_OperationTimeout = -9;
const int r_UnknownCmd = -100;
const int r_InvalidParam = -101;
const int r_InsufficientPriv = -102;
const int r_UnsupportedOp = -103;
const int r_FunctionFail = -104;
const int r_InvalidOp = -105;
const int r_IncompleteCommand = -106;
const int r_ResponseTooBig = -107; //response exceeded single frame length
const int r_ErrorBadStoredData = -108;
const int r_InvalidResponseDataLength = -109;
const int r_PayloadTooBig = -110;
const int r_ParseFailure = -111;
const int r_EEPROMWriteFailure = -112;
const int r_Busy = -113;
//These are Mk2 errors
const int r_EEPROMReadFailure = -121;
const int r_WearerNameMismatch = -122;
const int r_DataTooLongForBuffer = -123;
// Error codes generated within DLL
const int r_ErrorUnexpectedResponse = -200;
const int r_ErrorNotProcessed = -201; //command not processed due to previous failure
const int r_ErrorNotConnected = -202;
const int r_ErrorUserCancelled = -203;
typedef void* CommsHandle;
typedef void* CompletionToken;
typedef void(WINAPI *DiscoveryCallback)(CommsHandle hComms, DiscoveryId const discovered[], int32_t count);
typedef void(WINAPI *CompletionCallback)(CommsHandle hComms, CompletionToken token);
typedef void(WINAPI *ConnectCallback)(CommsHandle hComms, DiscoveryId id);
typedef void(WINAPI *DisconnectCallback)(CommsHandle hComms, DiscoveryId id);
typedef void(WINAPI *RemovedCallback)(CommsHandle hComms, DiscoveryId id);
/********************************************************************************************************************************************
*
* Interface Setup & Tear down
*
********************************************************************************************************************************************/
CommsHandle EPDDLL_API CreateReaderInterface();
int32_t EPDDLL_API DestroyReaderInterface(CommsHandle hComms);
int32_t EPDDLL_API OpenReader(CommsHandle hComms, char* portName);
int32_t EPDDLL_API CloseReader(CommsHandle hComms);
/********************************************************************************************************************************************
*
* Interface configuration
*
********************************************************************************************************************************************/
int32_t EPDDLL_API SetDllLogLevel(CommsHandle hComms, uint32_t level);
int32_t EPDDLL_API GetDllLogLevel(CommsHandle hComms, uint32_t* level);
int32_t EPDDLL_API SetResponseTimeout(CommsHandle hComms, uint32_t ms);
int32_t EPDDLL_API GetResponseTimeout(CommsHandle hComms, uint32_t* ms);
int32_t EPDDLL_API SetRetryCount(CommsHandle hComms, uint32_t retries);
int32_t EPDDLL_API GetRetryCount(CommsHandle hComms, uint32_t* retries);
int32_t EPDDLL_API SetMultipleDiscoveryMode(CommsHandle hComms, bool state);
int32_t EPDDLL_API GetMultipleDiscoveryMode(CommsHandle hComms, bool *state);
int32_t EPDDLL_API SetDiscoveryTimeslots(CommsHandle hComms, uint32_t slots);
int32_t EPDDLL_API GetDiscoveryTimeslots(CommsHandle hComms, uint32_t *slots);
int32_t EPDDLL_API SetDiscoveryCacheTimeout(CommsHandle hComms, uint32_t ms);
int32_t EPDDLL_API GetDiscoveryTimeout(CommsHandle hComms, uint32_t *ms);
/********************************************************************************************************************************************
*
* General Stack Operation, Discovery, Connection Management etc
*
********************************************************************************************************************************************/
int32_t EPDDLL_API Commit3(CommsHandle hComms);
int32_t EPDDLL_API CommitAndWait(CommsHandle hComms);
int32_t EPDDLL_API Cancel(CommsHandle hComms);
int32_t EPDDLL_API StartDiscovery(CommsHandle hComms, DiscoveryCallback callback);
int32_t EPDDLL_API StopDiscovery(CommsHandle hComms);
int32_t EPDDLL_API GetDiscoveredEpds(CommsHandle hComms, DiscoveryId discovered[], uint32_t size, uint32_t* count);
int32_t EPDDLL_API Connect3(CommsHandle hComms, DiscoveryId epd, bool wait = false);
int32_t EPDDLL_API Disconnect(CommsHandle hComms);
int32_t EPDDLL_API DisconnectAndNotify(CommsHandle hComms, uint16_t alarmConfig, uint16_t duration);
int32_t EPDDLL_API SetConnectCallback(CommsHandle hComms, ConnectCallback callback);
int32_t EPDDLL_API SetDisconnectCallback(CommsHandle hComms, DisconnectCallback callback);
int32_t EPDDLL_API AwaitRemoval(CommsHandle hComms, DiscoveryId epd, bool wait=false);
int32_t EPDDLL_API SetRemovedCallback(CommsHandle hComms, RemovedCallback callback);
int32_t EPDDLL_API GetErrorCode();
/********************************************************************************************************************************************
* Real Time Clock
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadRTC(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadRTC(CommsHandle hComms, CompletionToken token, uint32_t* rtc);
/********************************************************************************************************************************************
* Common Counts Acquisition
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadCounts(CommsHandle hComms, uint8_t counterIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadCounts(CommsHandle hComms, CompletionToken token, Counter_t counts[], uint8_t length, uint8_t * numCounts, uint32_t * utc, uint32_t * secondsSinceBaseline);
CompletionToken EPDDLL_API BeginReadBaselineCounts(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadBaselineCounts(CommsHandle hComms, CompletionToken token, Counter_t counts[], uint8_t length, uint32_t * timestamp, uint8_t * numCounts);
CompletionToken EPDDLL_API BeginSetBaselineCounters(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndSetBaselineCounters(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginStartDetectorTest(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndStartDetectorTest(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadSelfTestInterval(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadSelfTestInterval(CommsHandle hComms, CompletionToken token, uint16_t * minutes);
CompletionToken EPDDLL_API BeginWriteSelfTestInterval(CommsHandle hComms, uint16_t minutes, CompletionCallback callback);
int32_t EPDDLL_API EndWriteSelfTestInterval(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteChirpSensitivity(CommsHandle hComms, float sensitivity, CompletionCallback callback);
int32_t EPDDLL_API EndWriteChirpSensitivity(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadChirpSensitivity(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadChirpSensitivity(CommsHandle hComms, CompletionToken token, float * sensitivity);
/********************************************************************************************************************************************
*
* Common Calibration
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteFactoryCalDate(CommsHandle hComms, uint32_t utc, CompletionCallback callback);
int32_t EPDDLL_API EndWriteFactoryCalDate(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadFactoryCalDate(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadFactoryCalDate(CommsHandle hComms, CompletionToken token, uint32_t* utc);
CompletionToken EPDDLL_API BeginWriteCalDueDate(CommsHandle hComms, uint32_t utc, CompletionCallback callback);
int32_t EPDDLL_API EndWriteCalDueDate(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadCalDueDate(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadCalDueDate(CommsHandle hComms, CompletionToken token, uint32_t* utc);
CompletionToken EPDDLL_API BeginReadSensitivities(CommsHandle hComms, uint8_t sensIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadSensitivities(CommsHandle hComms, CompletionToken token, CalSensitivity_t sensitivities[], uint8_t length, uint8_t * numSensitivities);
CompletionToken EPDDLL_API BeginReadDetectorThresholds(CommsHandle hComms, uint8_t counterIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadDetectorThresholds(CommsHandle hComms, CompletionToken token, DetectorThreshold_t thresholds[], uint8_t length, uint8_t * numThresholds);
CompletionToken EPDDLL_API BeginReadGains(CommsHandle hComms, uint8_t sensIds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadGains(CommsHandle hComms, CompletionToken token, CalGain_t gains[], uint8_t length, uint8_t * numGains);
/********************************************************************************************************************************************
*
* Common Dose Measurements
*
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadDoses(CommsHandle hComms, uint8_t ids[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadDoses(CommsHandle hComms, CompletionToken token, MeasValue_t doses[], uint8_t length, uint8_t * numDoses, uint32_t * utc);
CompletionToken EPDDLL_API BeginReadTotalDoses(CommsHandle hComms, uint8_t ids[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadTotalDoses(CommsHandle hComms, CompletionToken token, MeasValue_t doses[], uint8_t length, uint8_t * numDoses, uint32_t * utc);
CompletionToken EPDDLL_API BeginClearDose(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndClearDose(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginClearTotalDose(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndClearTotalDose(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginClearPeakRates(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndClearPeakRates(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteDoses(CommsHandle hComms, MeasValue_t doses[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDoses(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteTotalDoses(CommsHandle hComms, MeasValue_t doses[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteTotalDoses(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadRates(CommsHandle hComms, uint8_t ids[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadRates(CommsHandle hComms, CompletionToken token, MeasValue_t rates[], uint8_t length, uint8_t * numRates, uint32_t * utc);
CompletionToken EPDDLL_API BeginReadPeakRates(CommsHandle hComms, uint8_t ids[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadPeakRates(CommsHandle hComms, CompletionToken token, PeakRate_t rates[], uint8_t length, uint8_t * numRates);
CompletionToken EPDDLL_API BeginReadQualityData(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadQualityData(CommsHandle hComms, CompletionToken token, Mk3QualityData_t * quality);
/********************************************************************************************************************************************
* Common Alarm Thresholds
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadAlarmThresholds(CommsHandle hComms, uint8_t measurandId, uint8_t thresholdIds[], uint8_t numThresholds, CompletionCallback callback);
int32_t EPDDLL_API EndReadAlarmThresholds(CommsHandle hComms, CompletionToken token, Mk3AlarmThresholds_t * thresholds);
CompletionToken EPDDLL_API BeginWriteAlarmThresholds(CommsHandle hComms, uint8_t measurandId, uint8_t numThresholds, Mk3AlarmThreshold_t thresholds[], CompletionCallback callback);
int32_t EPDDLL_API EndWriteAlarmThresholds(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadRateOffPercentage(CommsHandle hComms, uint8_t measurandIds[], uint8_t numThresholds, CompletionCallback callback);
int32_t EPDDLL_API EndReadRateOffPercentage(CommsHandle hComms, CompletionToken token, Mk3RatePercentage_t offThresholds[], uint8_t length, uint8_t * numThresholds);
CompletionToken EPDDLL_API BeginWriteRateOffPercentage(CommsHandle hComms, Mk3RatePercentage_t thresholds[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteRateOffPercentage(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* Common General Management
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginEpdOnOff(CommsHandle hComms, uint8_t onState, CompletionCallback callback);
int32_t EPDDLL_API EndEpdOnOff(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* Common EPD Status
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadStatus(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadStatus(CommsHandle hComms, CompletionToken token, StatusData_t * status);
CompletionToken EPDDLL_API BeginClearFaultStatus(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndClearFaultStatus(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginClearLatchedAlarms(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndClearLatchedAlarms(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginClearAllStatus(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndClearAllStatus(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* Common Wearer Identity
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadWearerId(CommsHandle hComms, uint16_t type, CompletionCallback callback);
int32_t EPDDLL_API EndReadWearerId(CommsHandle hComms, CompletionToken token, IdString_t * wearerId);
CompletionToken EPDDLL_API BeginWriteWearerId(CommsHandle hComms, IdString_t wearerId, CompletionCallback callback);
int32_t EPDDLL_API EndWriteWearerId(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* Common Issue & Return
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginIssueEPD(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndIssueEPD(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginDeissueEPD(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndDeissueEPD(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* Common Identities
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadEpdIdentities(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadEpdIdentities(CommsHandle hComms, CompletionToken token, uint32_t * epdId, EpdTypes * epdType, uint32_t * capabilities,
MarkNumber_t * markNumber, VersionNumber_t * firmwareVersion, char* vcsRevBuf, uint32_t buflen);
CompletionToken EPDDLL_API BeginWriteEpdSerialNumber(CommsHandle hComms, uint32_t epdId, CompletionCallback callback);
int32_t EPDDLL_API EndWriteEpdSerialNumber(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadEpdSerialNum(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadEpdSerialNum(CommsHandle hComms, CompletionToken token, uint32_t* epdSerialNum);
CompletionToken EPDDLL_API BeginReadCapabilities(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadCapabilities(CommsHandle hComms, CompletionToken token, uint32_t* capabilities);
CompletionToken EPDDLL_API BeginReadMarkNumber(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadMarkNumber(CommsHandle hComms, CompletionToken token, MarkNumber_t * markNumber);
CompletionToken EPDDLL_API BeginReadEpdType(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadEpdType(CommsHandle hComms, CompletionToken token, EpdTypes * epdType);
CompletionToken EPDDLL_API BeginReadFirmwareVersion(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadFirmwareVersion(CommsHandle hComms, CompletionToken token, VersionNumber_t * version);
/********************************************************************************************************************************************
* Common General Configuration
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteDoseWritableFlag(CommsHandle hComms, uint8_t enabled, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDoseWritableFlag(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteClearDoseOnSwitchOn(CommsHandle hComms, uint8_t enable, CompletionCallback callback);
int32_t EPDDLL_API EndWriteClearDoseOnSwitchOn(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginWriteReturnForReadTime(CommsHandle hComms, uint32_t utc, CompletionCallback callback);
int32_t EPDDLL_API EndWriteReturnForReadTime(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadReturnForReadTime(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadReturnForReadTime(CommsHandle hComms, CompletionToken token, uint32_t* utc);
CompletionToken EPDDLL_API BeginReadAlarmConfiguration(CommsHandle hComms, AlarmConfigId alarmConfigIds[], uint16_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadAlarmConfiguration(CommsHandle hComms, CompletionToken token, AlarmConfig_t alarmConfigs[], uint16_t length, uint16_t * numConfigs);
/********************************************************************************************************************************************
* Common Dose Profile
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteDoseProfileInterval(CommsHandle hComms, uint16_t interval, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDoseProfileInterval(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadDoseProfileInterval(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadDoseProfileInterval(CommsHandle hComms, CompletionToken token, uint16_t * interval);
CompletionToken EPDDLL_API BeginReadDoseProfileByTime(CommsHandle hComms, uint32_t startTime, uint32_t endTime, CompletionCallback callback);
int32_t EPDDLL_API EndReadDoseProfileByTime(CommsHandle hComms, CompletionToken token, DoseProfileRecord_t * profile[], uint16_t *count);
void EPDDLL_API CleanUpReadDoseProfile(DoseProfileRecord_t * profile);
/********************************************************************************************************************************************
* Common Event Log
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadEventsByIndex(CommsHandle hComms, uint8_t start, uint8_t requested, CompletionCallback callback = nullptr);
int32_t EPDDLL_API EndReadEventsByIndex(CommsHandle hComms, CompletionToken token, EventLog * logs[], uint8_t *count);
void EPDDLL_API CleanUpReadEventLog(EventLog * logs);
/********************************************************************************************************************************************
* Common Scratchpad
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadScratchPad(CommsHandle hComms, uint16_t startAddress, uint16_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadScratchpad(CommsHandle hComms, CompletionToken token, uint16_t *address, uint8_t buffer[], uint16_t length, uint16_t* read);
CompletionToken EPDDLL_API BeginWriteScratchPad(CommsHandle hComms, uint16_t startAddress, uint8_t buffer[], uint16_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteScratchpad(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadScratchpadSize(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadScratchpadSize(CommsHandle hComms, CompletionToken token, uint16_t* size);
CompletionToken EPDDLL_API BeginClearScratchPad(CommsHandle hComms, uint8_t fillChar, CompletionCallback callback);
int32_t EPDDLL_API EndClearScratchpad(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* Common EEProm
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginReadEEProm(CommsHandle hComms, uint16_t startAddress, uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndReadEEProm(CommsHandle hComms, CompletionToken token, uint16_t *address, uint8_t buffer[], uint8_t length, uint8_t* read);
CompletionToken EPDDLL_API BeginWriteEEProm(CommsHandle hComms, uint16_t startAddress, uint8_t buffer[], uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteEEProm(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* Common Access level
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteAccessLevel(CommsHandle hComms, AccessLevel_t level, EncryptionKey key, uint8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteAccessLevel(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadCurrentAccessLevel(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadCurrentAccessLevel(CommsHandle hComms, CompletionToken token, AccessLevel_t * level);
CompletionToken EPDDLL_API BeginWriteAccessKey(CommsHandle hComms, AccessLevel_t level, EncryptionKey key, int8_t length, CompletionCallback callback);
int32_t EPDDLL_API EndWriteAccessKey(CommsHandle hComms, CompletionToken token);
/********************************************************************************************************************************************
* Common Battery Management
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteBatteryTestInterval(CommsHandle hComms, uint16_t minutes, CompletionCallback callback);
int32_t EPDDLL_API EndWriteBatteryTestInterval(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadBatteryTestInterval(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadBatteryTestInterval(CommsHandle hComms, CompletionToken token, uint16_t* minutes);
CompletionToken EPDDLL_API BeginWriteBatteryLowThreshold(CommsHandle hComms, int8_t batteryType, uint16_t mV, CompletionCallback callback);
int32_t EPDDLL_API EndWriteBatteryLowThreshold(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadBatteryLowThreshold(CommsHandle hComms, int8_t batteryType, CompletionCallback callback);
int32_t EPDDLL_API EndReadBatteryLowThreshold(CommsHandle hComms, CompletionToken token, int8_t* batteryType, uint16_t* mV );
CompletionToken EPDDLL_API BeginReadVoltages(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadVoltages(CommsHandle hComms, CompletionToken token, uint16_t* vbat0, uint16_t* vbat1, uint16_t* vcpu);
/********************************************************************************************************************************************
* Common User Inteface
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteDisplayOptions(CommsHandle hComms, uint8_t value, uint8_t mask, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDisplayOptions(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadDisplayOptions(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadDisplayOptions(CommsHandle hComms, CompletionToken token, uint8_t * value);
CompletionToken EPDDLL_API BeginWriteDisplayTimeout(CommsHandle hComms, uint8_t seconds, CompletionCallback callback);
int32_t EPDDLL_API EndWriteDisplayTimeout(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadDisplayTimeout(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadDisplayTimeout(CommsHandle hComms, CompletionToken token, uint8_t* seconds);
/********************************************************************************************************************************************
* Common Zone Control
********************************************************************************************************************************************/
CompletionToken EPDDLL_API BeginWriteZoneControlMap(CommsHandle hComms, uint8_t map[], uint8_t mask[], CompletionCallback callback);
int32_t EPDDLL_API EndWriteZoneControlMap(CommsHandle hComms, CompletionToken token);
CompletionToken EPDDLL_API BeginReadZoneControlMap(CommsHandle hComms, CompletionCallback callback);
int32_t EPDDLL_API EndReadZoneControlMap(CommsHandle hComms, CompletionToken token, uint8_t map[]);
CompletionToken EPDDLL_API BeginReadZoneAccessPermitted(CommsHandle hComms, uint8_t zone, CompletionCallback callback);
int32_t EPDDLL_API EndReadZoneAccessPermitted(CommsHandle hComms, CompletionToken token, bool *permitted);
}
#endif

581
EpdBase3/Mk3Types.h Normal file
View file

@ -0,0 +1,581 @@
#ifndef Mk3Types_h
#define Mk3Types_h
#include <stdint.h>
#include "CommonEpdTypes.h"
#include <vector>
#define MAX_COUNTERS 6
// Mk3 Measurands
#define MK3_MEAS_HP10 0
#define MK3_MEAS_HP07 1
#define MK3_MEAS_HP10G 2
#define MK3_MEAS_HP10N 3
enum class CounterType : uint16_t
{
Counter_Hg1 = 0, // MK2 HG
Counter_Hg2 = 1,
Counter_Sg1 = 2, // Mk2 SG
Counter_Sg2 = 3, // Mk2 BC
Counter_Sg3 = 4,
Counter_Fb1 = 5, // Mk2 FB
Counter_Fb2 = 6,
Counter_An1 = 7,
Counter_Fn2 = 8
};
#define MAX_DET_THRESHOLDS MAX_COUNTERS
#pragma pack (push)
#pragma pack (1)
typedef struct
{
uint16_t eventId;
uint16_t info;
uint32_t timestamp;
}EventLog;
typedef struct
{
uint16_t type;
uint32_t value;
}Counter_t;
typedef struct
{
uint16_t type;
uint16_t value;
}DetectorThreshold_t;
typedef struct
{
CounterType id;
uint16_t scaledDeadTime;
uint16_t scaledCoefficient;
}DeadTimeCoefficient_t;
typedef struct
{
CounterType id;
uint8_t value;
}DetectorTestLimit_t;
typedef struct
{
uint16_t type;
uint16_t va;
uint16_t vb;
}DetectorThresholdLimit_t;
enum class OffModeDutyCycle :uint8_t
{
Off = 0,
On = 1,
Pct50 = 2,
Pct33 = 3,
Pct25 = 4,
Pct10 = 5,
NoChange = 255
};
enum class SensitivityId
{
//Hp10 Gamma contributors
Hg1Sens10G = 0, // Mk2 HGSens10 (K1)
Hg2Sens10G = 1,
Sg1Sens10G = 2, // Mk2 SGSens10 (K2)
Sg2Sens10G = 3,
Sg3Sens10G = 4,
//Hp10 Neutron contributors
//Hp07 Gamma contributors
Hg1Sens07G = 5, // Mk2 HGSens07 (K3)
Hg2Sens07G = 6,
Sg1Sens07G = 7, // Mk2 SGSens07 (K4)
Sg2Sens07G = 8,
Sg3Sens07G = 9,
//Hp07 Beta contributors
Fb1Sens07B = 10, // Mk2 FBSens07 (K5)
Fb2Sens07B = 11,
Sg2Sens07B = 12, // Mk2 BCSens07 (K6)
Sg3Sens07B = 13,
MaxSensitivity
};
#define MAX_SENSITIVITIES ((uint16_t)SensitivityId::MaxSensitivity)
#define LAST_SENSITIVITY (((uint16_t)SensitivityId::MaxSensitivity) - 1)
enum class MeasurementId : uint16_t
{
Meas_Hp10,
Meas_Hp07,
Meas_Hp10G,
Meas_Hp10N
};
#define MAX_MEASUREMENTS 4
enum class ThresholdId
{
Thres_DoseAlarm = 0,
Thres_DoseWarning = 1,
Thres_RateAlarm = 2,
Thres_RateWarning = 3
};
#define MAX_ALM_THRESHOLDS 4
enum class WearerIdType
{
WearerId_Name,
WearerId_Primary,
WearerId_Id2,
WearerId_Id3
};
#define MAX_WEARER_ID_TYPES 4
enum class TaskIdType
{
Task_Name,
Task_Primary
};
#define MAX_TASK_ID_TYPES 2
enum class WearerAndTaskIdType_t : uint16_t
{
WearerId_Name,
WearerId_Primary,
WearerId_Id2,
WearerId_Id3,
TaskName,
TaskID,
WearerDBID,
TaskDBID
};
#define MAX_WEARER_TASK_ID_TYPES 8
typedef struct
{
uint8_t RecordType;
uint8_t Measurand;
int32_t TimeStamp;
uint32_t Value;
}DoseProfileRecord_t;
typedef struct
{
float DoseIncrement;
uint16_t Interval;
uint16_t NumberOfMeasurands;
MeasurementId Enables[MAX_MEASUREMENTS];
}DoseProfileConfig_t;
typedef struct
{
uint16_t id;
float value;
}CalSensitivity_t;
typedef struct
{
uint16_t id;
float value;
}CalGain_t;
typedef struct
{
uint16_t id;
float value;
}MeasValue_t;
typedef struct
{
uint16_t id;
float value;
uint32_t timestamp;
}PeakRate_t;
typedef struct
{
uint32_t Utc;
uint16_t NumberOfMeasurands;
MeasValue_t Measurements[MAX_MEASUREMENTS];
}MeasurandDoseOrRate_t;
typedef struct
{
uint8_t Major;
uint8_t Minor;
uint8_t Patch;
uint16_t Build;
}VersionNumber_t;
typedef struct MarkNumberTag
{
uint8_t Major;
uint8_t Minor;
uint8_t Revision;
uint8_t Build;
} MarkNumber_t;
#define PART_NUM_LENGTH 10
typedef uint8_t PartNumber_t[PART_NUM_LENGTH];
#define PCB_PART_NUM_LENGTH 14
typedef uint8_t PcbPartNumber_t[PCB_PART_NUM_LENGTH];
#define FIRMWARE_PART_NUM_LENGTH 16
typedef uint8_t FirmwarePartNumber_t[FIRMWARE_PART_NUM_LENGTH];
#define MODEL_NAME_LENGTH 32
typedef struct ModelNameTag
{
uint8_t Name[MODEL_NAME_LENGTH];
} ModelName_t;
#define CAL_PROCESS_LENGTH 12
typedef struct CalProcessTag
{
uint8_t Process[CAL_PROCESS_LENGTH];
} CalProcess_t;
#define CAL_FACILITY_LENGTH 8
typedef struct CalFacilityTag
{
uint8_t Name[CAL_FACILITY_LENGTH];
} CalFacility_t;
#define MAX_ID_STRING_LENGTH 64
typedef struct IdStringTag
{
uint16_t IdType;
uint16_t Length;
uint8_t Utf8String[MAX_ID_STRING_LENGTH];
} IdString_t;
#define DB_ID_LENGTH 16
typedef struct DbIdTag
{
uint8_t Id[DB_ID_LENGTH];
} DatabaseId_t;
#define MAX_GRAPHIC_WIDTH 112
#define MAX_GRAPHIC_HEIGHT 24
#define MAX_GRAPHIC_PIXELS (MAX_GRAPHIC_WIDTH * MAX_GRAPHIC_HEIGHT)
#define MAX_GRAPHIC_ID 1
#define MAX_GRAPHIC_BYTES ((MAX_GRAPHIC_PIXELS)/8)
typedef struct GraphicSizeTag
{
uint16_t Id;
uint16_t Height;
uint16_t Width;
} GraphicSize_t;
typedef struct
{
GraphicSize_t Meta;
uint16_t DataLength;
uint8_t Data[MAX_GRAPHIC_BYTES];
} GraphicBitmap_t;
enum class OpStatusFlags : uint32_t {
EpdOn = 0x0001,
EpdIssued = 0x0002,
DetectorTestRequested = 0x0004,
DetectorTestPassed = 0x0008,
TelemetryOn = 0x0010,
TelemetryConnected = 0x0020,
CalibrationDue = 0x0040,
CalibrationInProgress = 0x0080,
GainAdjustable = 0x0100,
GainAdjusted = 0x0200,
ReducedRateOverrange = 0x0400,
DoseWriteEnabled = 0x0800,
ClearOnOnEnabled = 0x1000,
Golden = 0x2000,
ProtectedSession = 0x4000,
//NotYetDefined = 0x8000,
ResponderEnabled = 0x00010000,
ResponderTriggered = 0x00020000,
AlkalineFitted = 0x00040000,
DeepSleep = 0x00080000,
CovertMode = 0x00100000,
PulsedModeEnabled = 0x00200000,
PulsedModeActive = 0x00400000,
PulsedModeIndustrial=0x00800000,
};
enum class FaultStatusFlags : uint32_t {
NotInitialized = 0x0001,
BadThreshold = 0x0002,
BadSensitivities = 0x0004,
DetectorTestFail = 0x0008,
NotCalibrated = 0x0010,
EepromFailure = 0x0020,
ErrorLogged = 0x0040,
EpdFaulty = 0x0080,
TimeInvalid = 0x0100,
EarlyCommsTermination = 0x0200,
SounderFailure = 0x0400,
ResetWhileIssued = 0x0800,
};
enum class AlarmStatusFlags : uint32_t {
DoseWarning = 0x00000001,
DoseAlarm = 0x00000002,
DoseOverrange = 0x00000004,
TotalDoseOverrange = 0x00000008,
RateWarning = 0x00000010,
RateAlarm = 0x00000020,
RateOverrange = 0x00000040,
PulseOverrange = 0x00000080,
LatchedRateWarning = 0x00000100,
LatchedRateAlarm = 0x00000200,
LatchedRateOverrange = 0x00000400,
LatchedPulseOverrange = 0x00000800,
StayTimeExceeded = 0x00010000,
ReturnForRead = 0x00020000,
AbuseAlarm = 0x00040000,
LowBattery = 0x00080000,
TelemetryAlert = 0x00100000
};
enum class DoseAlarmFlags : uint32_t {
DoseWarning = 0x0001,
DoseAlarm = 0x0002,
DoseOverrange = 0x0004,
TotalDoseOverrange = 0x0008,
RateWarning = 0x0010,
RateAlarm = 0x0020,
RateOverrange = 0x0040,
LatchedRateWarning = 0x0100,
LatchedRateAlarm = 0x0200,
LatchedRateOverrange = 0x0400
};
enum class Mk2StatusFlags : uint32_t {
ADSIssued = 0x0001,
OneSecCountsProcessing = 0x0002,
RadioBatteryLow = 0x0004
};
typedef struct
{
uint16_t Id;
DoseAlarmFlags Status;
}Mk3DoseStatus_t;
typedef struct
{
OpStatusFlags OperatingStatus;
FaultStatusFlags FaultStatus;
AlarmStatusFlags AlarmStatus;
uint16_t IssueCount;
uint16_t FaultCode;
uint32_t OtherBits;
uint16_t NumberDoseAlarmWords;
Mk3DoseStatus_t DoseAlarms[MAX_MEASUREMENTS];
}StatusData_t;
enum class QualityFlags
{
DoseOverrange = 0x0001,
RateOverrange = 0x0002,
AbuseWarning = 0x0004,
CrcFailure = 0x0008,
CounterOverrange = 0x0010,
DetectorFail = 0x0040
};
typedef struct
{
uint16_t PowerCycles;
uint16_t Knocks;
QualityFlags Flags;
}Mk3QualityData_t;
typedef struct
{
uint16_t Id;
float Value;
}Mk3AlarmThreshold_t;
typedef struct
{
uint16_t MeasId;
uint16_t NumberThresholds;
Mk3AlarmThreshold_t Thresholds[MAX_ALM_THRESHOLDS];
}Mk3AlarmThresholds_t;
typedef struct
{
uint16_t MeasId;
std::vector<ThresholdId> Thresholds;
}Mk3AlarmThresholdsRequest_t;
typedef struct
{
uint16_t MeasId;
uint16_t Value;
}Mk3RatePercentage_t;
typedef struct
{
uint16_t MeasId;
uint16_t AlarmFlags;
float Dose;
}Mk3SnapshotDoseAndFlags_t;
typedef struct
{
uint16_t SnapshotNumber;
uint16_t IssueCount;
uint32_t StartTime;
uint32_t EndTime;
DatabaseId_t WearerDbId;
DatabaseId_t TaskDbId;
uint32_t OperatingStatus;
uint32_t FaultStatus;
uint32_t AlarmStatus;
uint16_t NumberOfMeasurands;
Mk3SnapshotDoseAndFlags_t DoseAndFlags[MAX_MEASUREMENTS];
}Mk3SnapshotSummary_t;
typedef struct
{
uint16_t MeasId;
uint16_t AlarmFlags;
float Dose;
float TriggeredDose;
float TotalDose;
float PeakRate;
uint32_t PeakRateTime;
}Mk3SnapshotMeasurement_t;
typedef struct
{
uint16_t SnapshotNumber;
uint16_t NumberOfMeasurands;
Mk3SnapshotMeasurement_t DoseAndFlags[MAX_MEASUREMENTS];
}Mk3SnapshotMeasurements_t;
typedef struct
{
uint16_t CounterId;
uint32_t StartCount;
uint32_t EndCount;
}Mk3SnapshotCount_t;
typedef struct
{
uint16_t SnapshotNumber;
uint16_t NumberOfCounters;
uint32_t StartTime;
uint32_t EndTime;
Mk3SnapshotCount_t Counters[MAX_COUNTERS];
}Mk3SnapshotCounters_t;
typedef struct
{
float DoseWarning;
float DoseAlarm;
float RateWarning;
float RateAlarm;
uint16_t MeasId;
}Mk3SnapshotAlarmThreshold_t;
typedef struct
{
uint16_t SnapshotNumber;
uint16_t NumberOfMeasurands;
Mk3SnapshotAlarmThreshold_t Thresholds[MAX_MEASUREMENTS];
}Mk3SnapshotAlarmThresholds_t;
// ****************
// Access Level
//
#define COMMAND_ID_MAP_SIZE 64
#define ENCRYPT_IV_SIZE 16
#define ENCRYPT_KEY_SIZE 32
#define ENCRYPT_CIPHER_SIZE 16
typedef uint8_t EncryptionKey[ENCRYPT_KEY_SIZE];
typedef uint8_t EncryptionText[ENCRYPT_CIPHER_SIZE];
typedef uint8_t PlainText[ENCRYPT_CIPHER_SIZE];
enum class AccessLevel_t : uint8_t
{
Open = 0,
Admin = 1,
Regulator = 2,
Manufacturer = 3
};
typedef struct SetAccessLevelRqTag
{
bool Granted;
EncryptionText Code;
EncryptionKey Key;
AccessLevel_t Level;
} SetAccessLevelRq_t;
typedef struct SetAccessPasswordRqTag
{
EncryptionKey Key;
AccessLevel_t Level;
} SetAccessPasswordRq_t;
typedef struct CommandIdPermissionsTag
{
AccessLevel_t Level;
uint8_t CommandIdPermissions[COMMAND_ID_MAP_SIZE];
}CommandIdPermissions_t;
// ****************
// UI Config
//
#define MAX_QUICK_ACCESS_DISPLAYS 6 /*5 + default display*/
typedef struct QuickAccessDisplayTag
{
uint8_t Position;
uint8_t DisplayId;
}QuickAccessDisplay_t;
typedef struct DisplayEnablesTag
{
uint8_t MenuId;
uint16_t EnableMask;
uint16_t Enables;
}DisplayAttributeMap_t;
#define MAX_MENUS 15
typedef struct DisplayEnablePrivilegesTag
{
AccessLevel_t Level;
uint8_t NumMenus;
uint16_t Privileges[MAX_MENUS];
} DisplayEnablePrivileges_t;
enum class DisplayCapability_t :uint8_t
{
DefaultDisplay = 1,
QuickDisplay = 2,
};
enum class OffModeDisplayId_t : uint8_t
{
Undefined = 0,
OffText = 1,
CalDueDate = 2,
UserBitmap = 3,
Manufacturer_PartnerLogo = 4,
CustomerLogo = 5,
ModelVersion=6
};
enum class AlarmIds : uint16_t
{
DoseAlarm = 0,
DoseWarning = 1,
RateWarning = 2,
RateAlarm = 3,
DoseOrRateOverRange = 4,
FailureAlarm = 5,
AbuseAlarm = 6,
BatteryLow = 7,
ReturnForRead = 8
};
#define MAX_OTHER_ALARMS 5
typedef struct AlarmConfigTag
{
AlarmIds AlarmId;
uint16_t MeasurandId;
uint16_t AlarmConfigMask;
uint16_t AlarmConfigBits;
uint16_t Duration;
}AlarmConfig_t;
typedef struct AlarmConfigIdTag
{
AlarmIds AlarmId;
uint16_t MeasurandId;
}AlarmConfigId;
// ****************
// Telemetry
//
typedef struct TeleAdvConfigTag
{
uint8_t operatingMode;
uint16_t undirectedInterval;
uint16_t directedInterval;
uint16_t directedTimeout;
}TeleAdvConfig_t;
typedef struct TeleCxnConfigTag
{
uint16_t minInterval;
uint16_t maxInterval;
uint16_t slaveLatency;
uint16_t supervisoryTimeout;
}TeleCxnConfig_t;
// ****************
// Debug Registers
//
typedef struct DebugRegisterValueTag
{
uint8_t registerId;
uint32_t value;
}DebugRegisterValue_t;
// ****************
// Battery Low Thesholds
//
typedef struct BatteryLowThresholdTag
{
uint8_t batteryType;
uint16_t mv;
}BatteryLowThreshold_t;
// ****************
// Battery Critical Timing
//
typedef struct BatteryCriticalTimingTag
{
uint16_t timeToCritical;
uint16_t timeToShutdown;
}BatteryCriticalTiming_t;
// ****************
// Battery Critical Timing
//
typedef struct MeasuredVoltagesTag
{
uint16_t vbat0;
uint16_t vbat1;
uint16_t vcpu;
}MeasuredVoltages_t;
#pragma pack (pop)
#endif

BIN
EpdBase3/Reader3.dll Normal file

Binary file not shown.

View file

@ -0,0 +1,79 @@
#include "pch.h"
#include "TimeFunctions.h"
#pragma unmanaged
TimeFunctions::TimeFunctions()
{
}
UINT32 FileTime_to_POSIX(FILETIME ft)
{
// takes the last modified date
LARGE_INTEGER date, adjust;
date.HighPart = ft.dwHighDateTime;
date.LowPart = ft.dwLowDateTime;
// 100-nanoseconds = milliseconds * 10000
adjust.QuadPart = 11644473600000 * 10000;
// removes the diff between 1970 and 1601
date.QuadPart -= adjust.QuadPart;
// converts back from 100-nanoseconds to seconds
return (UINT32)(date.QuadPart / 10000000);
}
UINT32 UnixTimeNow() {
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
return FileTime_to_POSIX(ft);
}
void TimeFunctions::UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
// Note that LONGLONG is a 64-bit value
LONGLONG ll;
ll = Int32x32To64(t, 10000000) + 116444736000000000;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
}
void TimeFunctions::UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst)
{
FILETIME ft;
UnixTimeToFileTime(t, &ft);
FileTimeToSystemTime(&ft, pst);
}
void TimeFunctions::EpdTimeToFileTime(INT32 t, LPFILETIME pft, bool isMK2) //MK3
{
LONGLONG offset;
if (isMK2) offset = 116444736000000000; else offset = 125911584000000000;;
LONGLONG ll;
ll = Int32x32To64(t, 10000000) + offset; //1601-1-1 -> 2000
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
}
void TimeFunctions::FileTimeToEpdTime(FILETIME pft, INT32* t, bool isMK2)
{
LONGLONG offset;
if (isMK2) offset = 116444736000000000; else offset = 125911584000000000;
LONGLONG ll = ((((LONGLONG)pft.dwHighDateTime << 32) + pft.dwLowDateTime) - offset) / 10000000;
*t = (DWORD)ll;
}
UINT32 TimeFunctions::NowToEpdTime(bool isMK2)
{
LONGLONG offset;
if (isMK2) offset = 116444736000000000; else offset = 125911584000000000;
SYSTEMTIME t;
GetSystemTime(&t);
FILETIME ft;
SystemTimeToFileTime((const SYSTEMTIME*)&t, &ft);
LONGLONG ll = ((((LONGLONG)ft.dwHighDateTime << 32U) + ft.dwLowDateTime) - offset) / 10000000;
return (DWORD)ll;
}

17
EpdBase3/TimeFunctions.h Normal file
View file

@ -0,0 +1,17 @@
#pragma once
#include <windows.h>
#include <time.h>
class TimeFunctions
{
public:
TimeFunctions();
static void EpdTimeToFileTime(INT32 t, LPFILETIME pft, bool isMK2);
void FileTimeToEpdTime(FILETIME pft, INT32* t, bool isMK2);
static UINT32 NowToEpdTime(bool isMK2);
static void UnixTimeToFileTime(time_t t, LPFILETIME pft);
static void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst);
};
UINT32 FileTime_to_POSIX(FILETIME ft);
UINT32 UnixTimeNow();

3
EpdBase3/framework.h Normal file
View file

@ -0,0 +1,3 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers

5
EpdBase3/pch.cpp Normal file
View file

@ -0,0 +1,5 @@
// pch.cpp: source file corresponding to the pre-compiled header
#include "pch.h"
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.

13
EpdBase3/pch.h Normal file
View file

@ -0,0 +1,13 @@
// pch.h: This is a precompiled header file.
// Files listed below are compiled only once, improving build performance for future builds.
// This also affects IntelliSense performance, including code completion and many code browsing features.
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
// Do not add files here that you will be updating frequently as this negates the performance advantage.
#ifndef PCH_H
#define PCH_H
// add headers that you want to pre-compile here
#include "framework.h"
#endif //PCH_H

476
EpdBase3/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
Commit3@4=Commit@4 @227
Connect3@20=Connect3@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

BIN
EpdBase3/reader3.exp Normal file

Binary file not shown.

BIN
EpdBase3/reader3.lib Normal file

Binary file not shown.

View file

@ -1,35 +1,40 @@
#include "stdafx.h"
#include "EpdBaseClr.h"
#pragma managed
EpdBaseClr::Epd2::Epd2(int port)
{
//HANDLE hMod = LoadLibrary(L"Reader2.dll");
EpdID = 0;
Jan2000 = gcnew DateTime(2000, 1, 1);
isMK3 = Issued = isBG = 0;
epd = new EpdBase::Epd2U(port);
epd3 = new Epd3Base::Epd3U(port);
this->InitRV = epd->InitRv;
epd->StartCom();
//epd->StartCom();
}
EpdBaseClr::Epd2::~Epd2()
{
if (epd != nullptr) {
delete epd; epd = nullptr;
epd->EndCom();
delete epd;
epd = nullptr;
}
if (epd3 != nullptr) {
epd3->EndCom();
delete epd3;
epd3 = nullptr;
}
this->!Epd2();
}
EpdBaseClr::Epd2::!Epd2()
{
}
int EpdBaseClr::Epd2::SetFeedbackSound(byte sound)
{
epd->EndSessionControl = sound;
return 0;
}
/// <summary>
/// find Epd
/// </summary>
@ -60,15 +65,16 @@ int EpdBaseClr::Epd2::Connect(bool reinit, int EPDTimeout)
}
return rv;
}
int EpdBaseClr::Epd2::Close()
{
EpdID= 0;
if (epd!=nullptr) epd->Close();
if (epd !=nullptr)
epd->EndCom();
if (epd3 != nullptr)
epd3->EndCom();
return 0;
}
int EpdBaseClr::Epd2::DecodeStatus()
int EpdBaseClr::Epd2::DecodeStatus(Epd3Base::Epd3U* epd)
{
epd->DecodeStatus();
//OperatingStatus
@ -104,7 +110,42 @@ int EpdBaseClr::Epd2::DecodeStatus()
return 1;
}
int EpdBaseClr::Epd2::DecodeStatus(EpdBase::Epd2U* epd)
{
epd->DecodeStatus();
//OperatingStatus
DetectorsOn = epd->DetectorsOn;
EPDIssued = epd->EPDIssued;
EPDLocked = epd->EPDLocked;
EPDTesting = epd->EPDTesting;
EPDProcSec = epd->EPDProcSec;
EPDFaulty = epd->EPDFaulty;
EPDNewFault = epd->EPDNewFault;
EPDComFault = epd->EPDComFault;
EPDCalFault = epd->EPDCalFault;
EPDDetFault = epd->EPDDetFault;
EPDEprFault = epd->EPDEprFault;
EPDTrhFault = epd->EPDTrhFault;
EPDOthFault = epd->EPDOthFault;
AlarmDoseHP101G = epd->AlarmDoseHP101G;
AlarmDoseHP102G = epd->AlarmDoseHP102G;
AlarmDoseHP07N = epd->AlarmDoseHP07N;
AlarmRateHP101G = epd->AlarmRateHP101G;
AlarmRateHP102G = epd->AlarmRateHP102G;
AlarmRateHP07N = epd->AlarmRateHP07N;
OtherAlarmRateHp101G = epd->OtherAlarmRateHp101G;
OtherAlarmRateHp102G = epd->OtherAlarmRateHp102G;
OtherAlarmRateHp07N = epd->OtherAlarmRateHp07N;
OtherAlarmReturn = epd->OtherAlarmReturn;
OtherAlarmBatLow = epd->OtherAlarmBatLow;
OtherAlarmCarrier = epd->OtherAlarmCarrier;
OtherAlarmBatVolt = epd->OtherAlarmBatVolt;
return 1;
}
/// <summary>
///
/// </summary>
@ -114,12 +155,12 @@ int EpdBaseClr::Epd2::GetStatus()
int rv = 1;
StatusRV = epd->ReadStatus();
if (StatusRV != 1) GetStatusError = epd->Error; else GetStatusError= rv = 0;
AfterGetStatus();
AfterGetStatus(epd);
return rv;
}
int EpdBaseClr::Epd2::AfterGetStatus()
int EpdBaseClr::Epd2::AfterGetStatus(EpdBase::Epd2U *epd)
{
isMK3 = false;
Issued = epd->EPDIssued;
WearerID = gcnew String((char*)epd->WearerID);
WearerName = gcnew String((char*)epd->WearerName);
@ -135,16 +176,59 @@ int EpdBaseClr::Epd2::AfterGetStatus()
SoftVersion = epd->SoftVersion;
FunctionFlags = epd->FunctionFlags;
CountsClock = epd->EpdClock;
DecodeStatus();
DecodeStatus(epd);
return 0;
}
int EpdBaseClr::Epd2::AfterGetStatus(Epd3Base::Epd3U* epd)
{
Issued = epd->EPDIssued;
WearerID = gcnew String((char*)epd->WearerID);
WearerName = gcnew String((char*)epd->WearerName);
isOn = (epd->DetectorsOn != 0);
epdType = (int)epd->EpdType;
isBG = (epd->EpdType == EpdTypes::Mk2BetaGamma || epd->EpdType == EpdTypes::Mk3BetaGamma); //MK2 BG=0 or MK3 BG=4 3=MK2 Neuruon 7=MK3 neutron
isMK3 = epd->isMK3;
alarmStatus = (int)epd->AlarmStatus;
otherAlarms = (int)epd->OtherAlarms;
errorStatus = (int)epd->ErrorStatus;
operatingStatus = (int)epd->OperatingStatus;
EpdID = epd->EpdID;
HardVersion = epd->HardVersion;
SoftVersion = epd->SoftVersion;
FunctionFlags = epd->FunctionFlags;
CountsClock = epd->EpdClock;
DecodeStatus( epd);
return 0;
}
int EpdBaseClr::Epd2::AfterGetStatus()
{
int rv = 0;
if (isMK3) rv=AfterGetStatus(epd3);
else rv=AfterGetStatus(epd);
return rv;
}
/// <summary>
///
/// </summary>
/// <returns>0 OK</returns>
int EpdBaseClr::Epd2::GetDoses()
{
int rv = 0;
if (isMK3)
rv = GetDoses(epd3);
else
rv = GetDoses(epd);
return rv;
}
int EpdBaseClr::Epd2::GetDoses(EpdBase::Epd2U* epd)
{
int rv = 1;
Hp10 = Hp07 = 0.0;
ReadDosesRV = epd->ReadDoses();
if (ReadDosesRV == 1) {
rv = 0;
GetDosesError = 0;
Hp10 = (double)epd->Hp10Dose / 64.0;
Hp07 = (double)epd->Hp07Dose / 64.0;
@ -155,6 +239,7 @@ int EpdBaseClr::Epd2::GetDoses()
Hp10Total = epd->Hp10Total / 64.0;
}
else {
rv = 1;
GetDosesError = epd->Error;
}
@ -182,36 +267,114 @@ int EpdBaseClr::Epd2::GetDoses()
BC = epd->SG;
FB = epd->FB;
HG = epd->HG;
return ReadDosesRV;
return rv;
}
int EpdBaseClr::Epd2::SetDeIssued()
/// <summary>
///
/// </summary>
/// <param name="epd"></param>
/// <returns>0 OK</returns>
int EpdBaseClr::Epd2::GetDoses(Epd3Base::Epd3U* epd)
{
return epd->DeIssue();
}
int rv = 1;
Hp10 = Hp07 = 0.0;
int ReadDosesRV = epd->ReadDoses();
int EpdBaseClr::Epd2::PrepareForIssue()
{
PrepareForIssueError = 0;
int rv= epd->PrepareForIssue();
if (rv != 1) PrepareForIssueError = epd->Error;
if (ReadDosesRV == 0) {
rv = 0;
GetDosesError = 0;
Hp10 = (double)epd->Hp10Dose;
Hp07 = (double)epd->Hp07Dose;
Hp07Peak = (double)epd->Hp07Peak;
Hp10Peak = (double)epd->Hp10Peak;
Hp07Total = epd->Hp07Total;
Hp10Total = epd->Hp10Total;
}
else {
rv = 1;
GetDosesError = epd->Error;
}
if (epd->Hp10Time > 0) {
//seconds since 2000 ?
//double x = (epd->EpdClock - epd->Hp10Time) * -1.0;
Hp10PeakTime = Jan2000->AddSeconds(epd->Hp10Time);
}
else
Hp10PeakTime = System::Nullable<System::DateTime>();;
if (epd->Hp07Time > 0) {
//double x = (epd->EpdClock - epd->Hp07Time) * -1.0;
Hp07PeakTime = Jan2000->AddSeconds(epd->Hp07Time);
}
else
Hp07PeakTime = System::Nullable<System::DateTime>();
QualityData = epd->QualityData;
K1 = epd->K1;
K2 = epd->K2;
K3 = epd->K3;
K4 = epd->K4;
K5 = epd->K5;
K6 = epd->K6;
SG = epd->SG;
BC = epd->SG;
FB = epd->FB;
HG = epd->HG;
return rv;
}
/// <summary>
///
/// </summary>
/// <returns>0 OK</returns>
int EpdBaseClr::Epd2::SetDeIssued()
{
int rv = 0;
if (isMK3) rv = epd3->DeIssue();
else rv= epd->DeIssue();
return rv;
}
int EpdBaseClr::Epd2::PrepareForIssue()
{
int rv = 0;
PrepareForIssueError = 0;
if (isMK3) rv= epd3->PrepareForIssue();
else rv= epd->PrepareForIssue();
if (rv != 0) PrepareForIssueError = epd->Error;
return rv;
}
/// <summary>
///
/// </summary>
/// <returns>0 OK</returns>
int EpdBaseClr::Epd2::SetIssued()
{
SetIssuedError = 0;
epd->Hp07THDose = (DWORD)(Hp07THDose*64.0);
epd->Hp10THDose1 = (DWORD)(Hp10THDose1*64.0);
epd->Hp10THDose2 = (DWORD)(Hp10THDose2*64.0);
int rv = 0;
if (isMK3) rv=SetIssued(epd3);
else rv=SetIssued(epd);
return rv;
}
epd->Hp10Rate1On = (DWORD)(Hp10Rate1On);
epd->Hp10Rate2On = (DWORD)(Hp10Rate2On);
epd->Hp07RateOn = (DWORD)(Hp07RateOn);
epd->Hp10Rate1Off = (DWORD)(Hp10Rate1Off);
epd->Hp10Rate2Off = (DWORD)(Hp10Rate2Off);
epd->Hp07RateOff = (DWORD)(Hp07RateOff);
/// <summary>
///
/// </summary>
/// <param name="epd"></param>
/// <returns>0 success</returns>
int EpdBaseClr::Epd2::SetIssued(Epd3Base::Epd3U* epd)
{
int rv = 0;
SetIssuedError = 0;
epd->Hp07THDose = Hp07THDose;
epd->Hp10THDose1 = Hp10THDose1;
epd->Hp10THDose2 = Hp10THDose2;
epd->Hp10Rate1On = Hp10Rate1On;
epd->Hp10Rate2On = Hp10Rate2On;
epd->Hp07RateOn = Hp07RateOn;
epd->Hp10Rate1Off = Hp10Rate1Off;
epd->Hp10Rate2Off = Hp10Rate2Off;
epd->Hp07RateOff = Hp07RateOff;
memset(epd->WearerID, ' ', WearerIDLength); epd->WearerID[WearerIDLength] = 0;
char* str1 = (char*)(void *)Runtime::InteropServices::Marshal::StringToHGlobalAnsi(WearerID);
@ -227,12 +390,51 @@ int EpdBaseClr::Epd2::SetIssued()
_memccpy(epd->WearerName, str2, l, WearerNameLength);
Runtime::InteropServices::Marshal::FreeHGlobal((IntPtr)str2);
int rv = epd->Issue();
if (rv != 1) SetIssuedError = epd->Error;
rv = epd->Issue();
if (rv != 0) SetIssuedError = epd->Error;
return rv;
}
int EpdBaseClr::Epd2::SetIssued(EpdBase::Epd2U* epd)
{
int rv = 0;
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);
rv = epd->Issue();
if (rv != 0) SetIssuedError = epd->Error;
return rv;
}
int EpdBaseClr::Epd2::WriteCalibration()
{
int rv = 0;
if (isMK3) rv = WriteCalibration(epd3);
else rv = WriteCalibration(epd);
return rv;
}
int EpdBaseClr::Epd2::WriteCalibration(EpdBase::Epd2U* epd)
{
epd->K1 = K1;
epd->K2 = K2;
@ -253,10 +455,48 @@ int EpdBaseClr::Epd2::WriteCalibration()
}
int EpdBaseClr::Epd2::WriteCalibration(Epd3Base::Epd3U* epd)
{
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;
}
/// <summary>
///
/// </summary>
/// <returns>0=success</returns>
int EpdBaseClr::Epd2::ReadTresholds()
{
int rv = 0;
if (isMK3)
rv = ReadTresholds(epd3);
else
rv = ReadTresholds(epd);
return rv;
}
/// <summary>
///
/// </summary>
/// <param name="epd"></param>
/// <returns>0 = Success</returns>
int EpdBaseClr::Epd2::ReadTresholds(EpdBase::Epd2U* epd)
{
ReadTresholdsError = 0;
int rv= epd->ReadTresHolds();
int rv = epd->ReadTresHolds();
if (rv != 0) ReadTresholdsError = epd->Error;
Hp10THDose1 = (double)epd->Hp10THDose1 / 64.0;
@ -266,6 +506,46 @@ int EpdBaseClr::Epd2::ReadTresholds()
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;
}
/// <summary>
///
/// </summary>
/// <param name="epd"></param>
/// <returns>0 Success</returns>
int EpdBaseClr::Epd2::ReadTresholds(Epd3Base::Epd3U* epd)
{
int rv = 0;
ReadTresholdsError = 0;
rv= epd->ReadAlarmTresholds();
rv = epd->ReadSensitivitiesAndTresholds();
if (rv != 0) ReadTresholdsError = epd->Error;
Hp10THDose1 = (double)epd->Hp10THDose1 ;
Hp10THDose2 = (double)epd->Hp10THDose2 ;
Hp07THDose = (double)epd->Hp07THDose ;
Hp10Total = (double)epd->Hp10Total ;
Hp07Total = (double)epd->Hp07Total ;
Hp10Rate1On = (double)epd->Hp10Rate1On;
Hp10Rate2On = (double)epd->Hp10Rate2On ;
Hp07RateOn = (double)epd->Hp07RateOn ;
@ -286,8 +566,14 @@ int EpdBaseClr::Epd2::ReadTresholds()
return rv;
}
int EpdBaseClr::Epd2::ReadExtraStatus()
{
int rv = 0;
if (isMK3) rv = ReadExtraStatus(epd3);
else rv = ReadExtraStatus(epd);
return rv;
}
int EpdBaseClr::Epd2::ReadExtraStatus(EpdBase::Epd2U* epd)
{
int rv = epd->EPDReadExtraStatus();
BatADC = epd->byBatADC;
@ -302,7 +588,40 @@ int EpdBaseClr::Epd2::ReadExtraStatus()
return rv;
}
int EpdBaseClr::Epd2::ReadExtraStatus(Epd3Base::Epd3U* epd)
{
int rv = epd->EPDReadExtraStatus();
BatADC = 0; //epd->byBatADC;
SupplyADC = 0; // 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 EpdBaseClr::Epd2::SwitchCon()
{
int rv = 0;
if (isMK3) {
if (epd3->epdComsHandle == INVALID_HANDLE_VALUE) {
epd->EndCom(); rv=epd3->StartCom();
}
}
else {
if (epd->CommsInitialized == 0) {
epd3->EndCom();
rv = epd->StartCom();
rv = epd->Open(EpdID);
rv = epd->ReadStatus();
if (rv == 1) rv = 0; else rv = 1;
}
}
return rv;
}
void EpdBaseClr::Epd2::InitData()
{
ConnectError = 0;
@ -324,7 +643,6 @@ void EpdBaseClr::Epd2::InitData()
FunctionFlags = 0;
CountsClock = 0;
}
/// <summary>
/// connect to Epd and read status
/// </summary>
@ -333,42 +651,44 @@ int EpdBaseClr::Epd2::ConnectAndStatus()
{
int rv = 1;
InitData();
rv = epd->ConnectAndStatus(tokenSourceTimeout);
epd->EndCom();
rv = epd3->ConnectAndStatus(tokenSourceTimeout);
if (rv==0) {
DeviceCount = epd->DeviceCount;
EpdID = epd->DeviceIDs[0]; rv = 0;
AfterGetStatus();
DeviceCount = epd3->DeviceCount;
EpdID = epd->EpdID;
rv = 0;
AfterGetStatus(epd3);
epd->EpdID = epd3->EpdID;
rv = SwitchCon();
}
else ConnectError = epd->Error;
else
ConnectError = epd->Error;
return rv;
}
void EpdBaseClr::Epd2::WaitEpd()
{
int rv = 0; //start
System::Threading::CancellationToken^ token = tokenSource->Token;
rv = ConnectAndStatus();
if (token->IsCancellationRequested && rv != 2) {
/*if (token->IsCancellationRequested && rv != 2) {
rv = 2;
}
}*/
if (rv == 0) {
if (_EpdRead != nullptr) _EpdRead(this, gcnew EpdEventArgs(EpdID, Issued, isBG, isMK3));
}
else if (rv == 2 && _EpdTO != nullptr) {
_EpdTO(this, gcnew EpdTOEventArgs(epd->ConnectTries, epd->ConnectTimerFired));
_EpdTO(this, gcnew EpdTOEventArgs(epd3->ConnectTries, epd3->ConnectTimerFired));
}
else if (rv > 0 && _EpdError != nullptr) {
_EpdError(this, gcnew EpdErrorEventArgs(rv));
}
return;
}
System::Threading::Tasks::Task^ EpdBaseClr::Epd2::Wait(int timeout, int Retries)
{
if (waitTask == nullptr)
{
tokenSourceTimeout = timeout;
epd->maxDiscoverTime = timeout;
tokenSource = gcnew System::Threading::CancellationTokenSource(tokenSourceTimeout + 500);
readRetries = Retries;
waitTask = System::Threading::Tasks::Task::Run(gcnew Action(this, &Epd2::WaitEpd)); // System::Threading::Tasks::Task::Factory->cre(gcnew Action(this, &CCard::WaitBadge), tokenSource->Token);
@ -382,8 +702,8 @@ void EpdBaseClr::Epd2::WaitEnd()
{
if (waitTask != nullptr)
{
if (epd->hWaitTimer!= nullptr)
SetEvent(epd->hWaitTimer);
if (epd3->hWaitTimer!= nullptr)
SetEvent(epd3->hWaitTimer);
waitTask->Wait(750);
if (waitTask->Status == System::Threading::Tasks::TaskStatus::Running) {
tokenSource->Cancel();

View file

@ -1,6 +1,12 @@
#pragma once
#pragma unmanaged
#include "..\EpdBase\EpdBase.h"
#pragma comment(lib,"dll2/Reader2.lib")
#undef EPDDLL_API
#pragma unmanaged
#include "..\EpdBase3\Epd3Base.h"
#pragma comment(lib,"dll2/Reader3.lib")
#pragma managed
using namespace System;
namespace EpdBaseClr {
@ -67,6 +73,9 @@ namespace EpdBaseClr {
public ref class Epd2
{
private:
DateTime^ Jan2000;
public:
delegate void dEpdRead(Epd2^ Sender, EpdEventArgs^ e);
delegate void dEpdTO(Epd2^ Sender, EpdTOEventArgs^ e);
@ -116,6 +125,7 @@ namespace EpdBaseClr {
public:
EpdBase::Epd2U *epd;
Epd3Base::Epd3U* epd3;
//sEpdBase^ b;
DateTime^ RealTime;
String^ WearerName;
@ -235,16 +245,30 @@ namespace EpdBaseClr {
int Connect(bool reinit, int EPDTimeout);
int Close();
int DecodeStatus(Epd3Base::Epd3U* epd);
int DecodeStatus(EpdBase::Epd2U* epd);
int GetStatus();
int GetDoses();
int GetDoses(EpdBase::Epd2U* epd);
int GetDoses(Epd3Base::Epd3U* epd);
int SetDeIssued();
int SetIssued();
int SetIssued(Epd3Base::Epd3U* epd);
int SetIssued(EpdBase::Epd2U* epd);
int PrepareForIssue();
int WriteCalibration();
int WriteCalibration(EpdBase::Epd2U* epd);
int WriteCalibration(Epd3Base::Epd3U* epd);
int ReadTresholds();
int ReadTresholds(EpdBase::Epd2U* epd);
int ReadTresholds(Epd3Base::Epd3U* epd);
int ReadExtraStatus();
int ReadExtraStatus(EpdBase::Epd2U* epd);
int ReadExtraStatus(Epd3Base::Epd3U* epd);
int ConnectAndStatus();
System::Threading::CancellationTokenSource^ tokenSource;
@ -255,12 +279,12 @@ namespace EpdBaseClr {
void WaitEnd();
private:
void InitData();
int AfterGetStatus(EpdBase::Epd2U* epd);
int AfterGetStatus(Epd3Base::Epd3U* epd);
int AfterGetStatus();
int DecodeStatus();
int SwitchCon();
void InitData();
void WaitEpd();
};
}

View file

@ -94,7 +94,7 @@
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalDependencies />
<AdditionalDependencies>$(ProjectDir)..\EpdBase\dll2\Reader2.lib;%(AdditionalDependencies)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<PreventDllBinding>false</PreventDllBinding>
</Link>
@ -160,6 +160,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EpdBase3\EpdBase3.vcxproj">
<Project>{e6bb4f4e-4774-4fe3-b341-7f4c24dc61e7}</Project>
</ProjectReference>
<ProjectReference Include="..\EpdBase\EpdBase.vcxproj">
<Project>{3114a047-7562-42fe-94de-2418ef19ad9a}</Project>
</ProjectReference>

BIN
EpdBaseClr/Reader3.dll Normal file

Binary file not shown.

BIN
EpdBaseClr/dll2/Reader3.dll Normal file

Binary file not shown.

BIN
EpdBaseClr/dll2/reader3.lib Normal file

Binary file not shown.

View file

@ -396,6 +396,7 @@ WORD MK3::Epd2U::ReadStatus()
return r;
}
void MK3::Epd2U::decodeSensitivities(int count) {
K1 = K2 = K3 = K4 = K4 = K6 = 0.0F;
@ -412,8 +413,6 @@ void MK3::Epd2U::decodeSensitivities(int count) {
}
}
}
void MK3::Epd2U::decodetotDoses(int count)
{
//doses
@ -489,7 +488,6 @@ void MK3::Epd2U::decodeBaseCounters(int count)
}
}
void MK3::Epd2U::decodeTreshold(Mk3AlarmThresholds_t* th)
{
float* pThDose = nullptr, * pThRate = nullptr, * pTHDoseWarning = nullptr, * pTHRateWarning = nullptr;
@ -578,7 +576,6 @@ void MK3::Epd2U::decodedTresholds(int numdTresholds)
}
}
}
WORD MK3::Epd2U::ReadSensitivitiesAndTresholds()
{
int32_t r = 0;
@ -639,7 +636,6 @@ WORD MK3::Epd2U::ReadSensitivitiesAndTresholds()
}
return 0;
}
WORD MK3::Epd2U::ReadDoses()
{
int32_t r = 1;
@ -890,7 +886,7 @@ WORD MK3::Epd2U::WriteAlarmTresholds() {
WORD MK3::Epd2U::DeIssue()
{
int32_t r = 1;
if (!EPDIssued) return 0;
// if (!EPDIssued) return 0;
ClearDoseRV = ClearTotalDoseRV = ClearPeakRatesRV = DeIssueEpdRV = 0;
if (port == 0) return 1;
@ -902,8 +898,7 @@ WORD MK3::Epd2U::DeIssue()
r = Commit(epdComsHandle);
r = WaitForSingleObject(Ev1, 10000); // no time-out interval
r = EndDeissueEPD(epdComsHandle, token);
if (r != 0)
goto error;
//if (r != 0) goto error;
ResetEvent(Ev1);
token = BeginEpdOnOff(epdComsHandle,0, completion);
@ -1023,7 +1018,6 @@ WORD MK3::Epd2U::Issue()
error:
return r;
}
WORD MK3::Epd2U::EPDReadExtraStatus()
{
if (port == 0) return 1;
@ -1047,7 +1041,6 @@ WORD MK3::Epd2U::EPDReadExtraStatus()
//if (CommitRV == 1) CommitRV = Commit();
return CommitRV;
}
WORD MK3::Epd2U::WriteCal()
{
uint32_t r = 0;

View file

@ -25,6 +25,7 @@ namespace TestEPD3Dll
x.ReadAlarmTresholds();
rv = x.GetDoses();
x.SetDeIssued();
//x.WriteCalibration();
x.Hp07THDose = 1;
x.Hp10THDose1 = 2;

View file

@ -27,6 +27,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MK3", "MK3\MK3.vcxproj", "{
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestEPD3Dll", "TestEPD3Dll\TestEPD3Dll.csproj", "{37EE9D5D-1204-4B3F-879D-AAF5A9181085}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Epd3Base", "EpdBase3\EpdBase3.vcxproj", "{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -229,6 +231,20 @@ Global
{37EE9D5D-1204-4B3F-879D-AAF5A9181085}.Release|x64.Build.0 = Release|Any CPU
{37EE9D5D-1204-4B3F-879D-AAF5A9181085}.Release|x86.ActiveCfg = Release|Any CPU
{37EE9D5D-1204-4B3F-879D-AAF5A9181085}.Release|x86.Build.0 = Release|Any CPU
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Debug|Any CPU.ActiveCfg = Debug|Win32
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Debug|ARM.ActiveCfg = Debug|Win32
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Debug|ARM64.ActiveCfg = Debug|Win32
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Debug|x64.ActiveCfg = Debug|x64
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Debug|x64.Build.0 = Debug|x64
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Debug|x86.ActiveCfg = Debug|Win32
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Debug|x86.Build.0 = Debug|Win32
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Release|Any CPU.ActiveCfg = Release|Win32
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Release|ARM.ActiveCfg = Release|Win32
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Release|ARM64.ActiveCfg = Release|Win32
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Release|x64.ActiveCfg = Release|x64
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Release|x64.Build.0 = Release|x64
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Release|x86.ActiveCfg = Release|Win32
{E6BB4F4E-4774-4FE3-B341-7F4C24DC61E7}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -162,7 +162,7 @@ namespace eDosStation
return false;
}
rva = ep.ReadTresholds();
if (rva != 1)
if (rva != 0)
{
MessageBox.Show($"ReadTresholds error {ep.ReadTresholdsError}");
}
@ -241,7 +241,7 @@ namespace eDosStation
StationVisitID = (int?)dataInterface.VisitInitCommand.Parameters["EPDVisitID"].Value;
co.Close();
int rv = ep.PrepareForIssue();
if (rv != 1)
if (rv != 0)
{
MessageBox.Show($"PrepareForIssue error {ep.PrepareForIssueError}");
}
@ -298,9 +298,9 @@ namespace eDosStation
#endif
rv = ep.SetIssued();
if (rv != 1)
if (rv != 0)
{
MessageBox.Show($"SetIssued error {ep.SetIssuedError}");
MessageBox.Show($"SetIssued error {rv}");
}
dispatcherTimer.Start(); //restart timer
panelDone.Visibility = Visibility.Visible;

View file

@ -119,7 +119,7 @@ namespace eDosStation
ok.IsSelected = true;
}
int rv = ep.ReadExtraStatus(); //D1 BaseD1 ...
if (rv != 1)
if (rv != 0)
{
MessageBox.Show($"ReadExtraStatus {rv}");
}
@ -127,10 +127,10 @@ namespace eDosStation
Wearer.Text = $"{ep.WearerName}";
EpdVisit.Text = $"{ep.WearerID}";
rv = ep.GetDoses();
if (rv != 1)
if (rv != 0)
{
rv = ep.GetDoses(); //try again
if (rv != 1)
if (rv != 0)
MessageBox.Show($"GetDoses {rv} er:{ep.GetDosesError}");
}
@ -140,7 +140,7 @@ namespace eDosStation
{
bool isBG = ep.isBG;
rv = ep.SetDeIssued(); //includes close
if (rv != 1)
if (rv != 0)
{
MessageBox.Show($"DeIssueerror {rv}");
}

BIN
eDosStation/Reader3.dll Normal file

Binary file not shown.

View file

@ -25,6 +25,7 @@
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@ -33,26 +34,33 @@
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="PersID :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="0" Grid.Column="1" Name ="Wearer" Text="..."/>
<TextBlock Grid.Row="0" Grid.Column="0" Text="EPD ID :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="0" Grid.Column="1" Name ="epdid" Text="..."/>
<TextBlock Grid.Row="0" Grid.Column="2" Text ="Visit#" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="0" Grid.Column="3" Name ="EpdVisit" Text="..." Padding="20,0,20,0" />
<Line Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Stroke="Black" Width="10" />
<TextBlock Grid.Row="0" Grid.Column="2" Text="Type:" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="0" Grid.Column="3" Name ="epdtype" Text="..."/>
<TextBlock Grid.Row="2" Grid.Column="0" Text="Issued :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="2" Grid.Column="1" Text="..." Name ="isIssued" Padding="20,0,20,0" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="PersID :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="1" Grid.Column="1" Name ="Wearer" Text="..."/>
<TextBlock Grid.Row="1" Grid.Column="2" Text ="Visit#" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="1" Grid.Column="3" Name ="EpdVisit" Text="..." Padding="20,0,20,0" />
<Line Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4" Stroke="Black" Width="10" />
<TextBlock Grid.Row="3" Grid.Column="0" Text="Alarm :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="..." Name ="hasAlarm" Padding="20,0,20,0"/>
<StackPanel Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" Name="sAlarm" Margin="50,0,20,0"/>
<TextBlock Grid.Row="3" Grid.Column="0" Text="Issued :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="3" Grid.Column="1" Text="..." Name ="isIssued" Padding="20,0,20,0" />
<TextBlock Grid.Row="4" Grid.Column="0" Text="Doses :" Padding="20,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Right" />
<StackPanel Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Vertical" Margin="5,10,0,20">
<TextBlock Grid.Row="4" Grid.Column="0" Text="Alarm :" Padding="20,0,20,0" HorizontalAlignment="Right"/>
<TextBlock Grid.Row="4" Grid.Column="1" Text="..." Name ="hasAlarm" Padding="20,0,20,0"/>
<StackPanel Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" Name="sAlarm" Margin="50,0,20,0"/>
<TextBlock Grid.Row="5" Grid.Column="0" Text="Doses :" Padding="20,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Right" />
<StackPanel Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Vertical" Margin="5,10,0,20">
<StackPanel Orientation="Horizontal">
<TextBlock Name="HpDose07l" Width="200"/>
<TextBlock Name="HpDose07" />
@ -63,8 +71,8 @@
</StackPanel>
</StackPanel>
<TextBlock Grid.Row="5" Grid.Column="0" Text="Dose Tresholds :" Padding="20,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<StackPanel Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Vertical" Margin="0,20,0,20" >
<TextBlock Grid.Row="6" Grid.Column="0" Text="Dose Tresholds :" Padding="20,0,20,0" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<StackPanel Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Vertical" Margin="0,20,0,20" >
<StackPanel Orientation="Horizontal">
<TextBlock Name="HP07AlarmDosel" Width="200" />
<TextBlock Name="HP07AlarmDose" />
@ -79,12 +87,12 @@
</StackPanel>
</StackPanel>
<Grid Grid.Row="6" Grid.ColumnSpan="4" >
<Grid Grid.Row="7" Grid.ColumnSpan="4" >
<telerik:RadProgressBar Name="Progress" Style="{StaticResource styleTTOProgessBar}" />
<TextBlock Name="ProgressText" Text="100" Foreground="White" FontSize="20" HorizontalAlignment="Center" />
</Grid>
<StackPanel Grid.Row="7" Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" >
<StackPanel Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="4" HorizontalAlignment="Center" VerticalAlignment="Center" >
<telerik:RadButton Content="Close" Style="{StaticResource OkCancelButton}" Margin="0,20,0,20" Click="RadButton_Click" />
</StackPanel>
</Grid>

View file

@ -1,16 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace eDosStation
@ -91,6 +81,11 @@ namespace eDosStation
} else
hasAlarm.Text = "no";
epdid.Text = ep.EpdID.ToString();
var stype = new StringBuilder();
if (ep.isMK3) stype.Append("MK3 "); else stype.Append("MK2 ");
if (ep.isBG) stype.Append(" BG"); else stype.Append(" NG");
epdtype.Text = stype.ToString();
Decoder.AlarmToTextBox(sAlarm, ep);
@ -101,7 +96,7 @@ namespace eDosStation
HpDose07.Text = $"{ep.Hp07:0.00} µSv";
HpDose10.Text = $"{ep.Hp10:0.00} µSv";
ep.ReadTresholds();
int rv = ep.ReadTresholds(); //0=success
HP10AlarmDose1l.Text = "Alarm HP10(1)";
HP10AlarmDose2l.Text = "Alarm HP10(2)";
HP07AlarmDosel.Text = "Alarm HP07";

View file

@ -282,6 +282,9 @@
<Resource Include="Images\EPD-N2.png" />
</ItemGroup>
<ItemGroup>
<Content Include="Reader3.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Resource Include="Images\EPD-MK3.png" />
<Resource Include="Images\logo500.png" />
<Resource Include="Images\logoh120.png" />

BIN
eDosStation/reader3.lib Normal file

Binary file not shown.