eDosStation/EpdBaseClr/EpdBaseClr.h

371 lines
7.6 KiB
C
Raw Normal View History

2019-02-01 17:35:18 +01:00
#pragma once
2021-05-28 17:06:41 +02:00
#pragma unmanaged
2019-02-01 17:35:18 +01:00
#include "..\EpdBase\EpdBase.h"
#pragma comment(lib,"dll2/Reader2.lib")
2021-05-28 17:06:41 +02:00
#undef EPDDLL_API
#pragma unmanaged
#include "..\EpdBase3\Epd3Base.h"
2023-10-24 07:10:30 +02:00
#pragma comment(lib,"dll2/Reader32.lib")
2021-05-28 17:06:41 +02:00
#pragma managed
2019-02-01 17:35:18 +01:00
using namespace System;
namespace EpdBaseClr {
2021-05-26 16:20:40 +02:00
const char* cEpdError = "Setreader Error";
ref class Epd2;
2024-09-04 13:05:16 +02:00
public ref class cStepValues
{
public:
Int32 func;
Int32 commitrv;
Int32 endrv;
cStepValues();
~ cStepValues();
private:
};
cStepValues:: cStepValues()
{
func = -1; commitrv = -1; endrv = -1;
}
cStepValues::~ cStepValues()
{
}
2021-05-26 16:20:40 +02:00
public ref class EpdEventArgs : EventArgs
{
public:
int deviceID;
bool isIssued, isBG, isMK3;
2024-05-22 13:31:10 +02:00
2021-05-26 16:20:40 +02:00
EpdEventArgs(int epdID, bool epdIssued, bool isBG, bool isMK3) : EventArgs()
{
this->deviceID = epdID;
this->isIssued = epdIssued;
this->isBG = isBG;
this->isMK3 = isMK3;
}
};
public ref struct EpdException : System::Exception
{
public:
int errorCode;
EpdException(int r) : System::Exception(gcnew String(cEpdError))
{
this->errorCode = r;
}
};
public ref class EpdErrorEventArgs : EventArgs
{
public:
int returnValue;
2024-05-22 13:31:10 +02:00
int ErrorRV; int ErrorStep;
2021-05-26 16:20:40 +02:00
EpdErrorEventArgs(int ReturnValue) : EventArgs()
{
2024-05-22 13:31:10 +02:00
ErrorRV= ErrorStep = 0;
this->returnValue = ReturnValue;
}
EpdErrorEventArgs(int ReturnValue, int errorRV, int errorStep) : EventArgs()
{
this->ErrorRV = errorRV;
this->ErrorStep = errorStep;
2021-05-26 16:20:40 +02:00
this->returnValue = ReturnValue;
}
2024-05-22 13:31:10 +02:00
2021-05-27 16:13:53 +02:00
};
public ref class EpdTOEventArgs : EventArgs
{
public:
int tries;
bool connecttimeout;
EpdTOEventArgs(int _tries, bool _connecttimeout) : EventArgs()
{
this->tries=_tries;
this->connecttimeout = _connecttimeout;
}
2021-05-26 16:20:40 +02:00
};
/*public ref class sEpdBase
2019-02-04 11:48:08 +01:00
{
public :
DateTime^ RealTime;
unsigned int CurrentDeviceID;
2021-05-26 16:20:40 +02:00
};*/
2019-02-01 17:35:18 +01:00
public ref class Epd2
{
2021-06-02 13:54:22 +02:00
/*private:
DateTime^ Jan2000;*/
2024-09-04 13:05:16 +02:00
const wchar_t* tHp07 = L"HP07";
const wchar_t* tHp10 = L"HP10";
2021-06-03 08:37:02 +02:00
const wchar_t* tHp07N = L"HPN";
const wchar_t* tHp10G = L"HP10G";
2021-05-28 17:06:41 +02:00
2021-05-26 16:20:40 +02:00
public:
delegate void dEpdRead(Epd2^ Sender, EpdEventArgs^ e);
2021-05-27 16:13:53 +02:00
delegate void dEpdTO(Epd2^ Sender, EpdTOEventArgs^ e);
2021-05-26 16:20:40 +02:00
delegate void dEpdError(Epd2^ Sender, EpdErrorEventArgs^ e);
dEpdRead^ _EpdRead;
dEpdTO^ _EpdTO;
dEpdError^ _EpdError;
2024-09-04 13:05:16 +02:00
2021-05-26 16:20:40 +02:00
event dEpdRead^ EpdRead
{
void add(dEpdRead^ handler)
{
_EpdRead += handler;
}
void remove(dEpdRead^ handler)
{
_EpdRead -= handler;
}
}
event dEpdError^ EpdError
{
void add(dEpdError^ handler)
{
_EpdError += handler;
}
void remove(dEpdError^ handler)
{
_EpdError -= handler;
}
}
event dEpdTO^ EpdTO
{
void add(dEpdTO^ handler)
{
_EpdTO += handler;
}
void remove(dEpdTO^ handler)
{
_EpdTO -= handler;
}
}
2024-05-29 16:08:18 +02:00
//private:
//bool hasAlarm = false;
2019-02-01 17:35:18 +01:00
public:
2024-09-04 13:05:16 +02:00
2022-04-08 15:41:46 +02:00
bool onlyMK2;
2019-02-01 17:35:18 +01:00
EpdBase::Epd2U *epd;
2021-05-28 17:06:41 +02:00
Epd3Base::Epd3U* epd3;
2021-06-03 08:37:02 +02:00
String^ Hp07Name;
String^ Hp10Name;
bool isTitleNG;
2024-09-04 13:05:16 +02:00
2019-02-01 17:35:18 +01:00
DateTime^ RealTime;
String^ WearerName;
String^ WearerID;
2021-05-31 15:20:16 +02:00
//bool Issued;
2019-02-01 17:35:18 +01:00
bool isOn;
2021-06-02 13:54:22 +02:00
bool isBG, isNG, VersionOK;
2021-05-26 16:20:40 +02:00
bool isMK3;
2024-05-29 16:08:18 +02:00
2019-02-01 17:35:18 +01:00
int InitRV;
int DiscRV;
int StatusRV;
2020-02-05 14:21:53 +01:00
int GetStatusError;
int GetDosesError;
int ReadTresholdsError;
int PrepareForIssueError;
int SetIssuedError;
int ConnectError;
2019-02-01 17:35:18 +01:00
int ReadDosesRV;
2019-02-19 15:08:06 +01:00
int DeviceCount = 0;
2024-05-22 13:31:10 +02:00
int ErrorStep=0;
int ErrorRV = 0;
2019-02-01 17:35:18 +01:00
double Hp07;
double Hp10;
double Hp07Peak;
double Hp10Peak;
2019-02-12 07:33:18 +01:00
System::Nullable<System::DateTime> Hp10PeakTime;
System::Nullable<System::DateTime> Hp07PeakTime;
2019-02-11 11:34:52 +01:00
double Hp07Total;
double Hp10Total;
2019-02-01 17:35:18 +01:00
double alarmHP07;
double alarmHP10;
2019-02-04 11:48:08 +01:00
double Hp10THDose1;
double Hp10THDose2;
double Hp07THDose;
double Hp10Rate1On;
double Hp10Rate2On;
double Hp07RateOn;
double Hp10Rate1Off;
double Hp10Rate2Off;
double Hp07RateOff;
2021-06-03 08:37:02 +02:00
double NGgain;
2019-02-04 11:48:08 +01:00
int K1;
int K2;
int K3;
int K4;
int K5;
int K6;
int SG;
int BC;
int FB;
int HG;
2019-02-11 11:34:52 +01:00
int QualityData;
2019-02-04 11:48:08 +01:00
2021-04-22 16:52:44 +02:00
unsigned int D1, D2, D3, D4, CountsClock, CountsClockBase;
2019-02-04 11:48:08 +01:00
int epdType;
int alarmStatus ;
int otherAlarms ;
int errorStatus ;
int operatingStatus ;
unsigned int EpdID ;
2024-05-22 13:31:10 +02:00
int HardVersion, HardVersionMinor;
2019-02-04 11:48:08 +01:00
int SoftVersion ;
int FunctionFlags ;
2019-02-12 16:01:47 +01:00
unsigned short BatADC;
unsigned short SupplyADC;
2020-02-18 14:06:52 +01:00
//OperatingStatus
BYTE DetectorsOn = 0;
2021-05-31 15:20:16 +02:00
bool EPDIssued = 0;
2020-02-18 14:06:52 +01:00
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;
2022-04-12 14:28:14 +02:00
//New fields
bool eDosDose07Warning =false;
bool eDosDose07Alarm = false;
bool eDosDose10Warning = false;
bool eDosDose10Alarm = false;
bool eDosRate07Warning = false;
bool eDosRate07Alarm = false;
bool eDosRate10Warning= false;
bool eDosRate10Alarm = false;
bool eDosBatteryWarning= false;
2022-04-26 08:43:13 +02:00
bool eDoshasAlarm = false;
bool eDosHasFault = false;
2019-02-12 16:01:47 +01:00
2022-04-20 16:56:49 +02:00
Epd2(int port, bool OnlyMK2);
2019-02-04 11:48:08 +01:00
~Epd2();
!Epd2();
2024-09-04 13:05:16 +02:00
//int StepReturnValues[50][3];
//int StepReturnMax;
//array<cStepValues^> StepReturnValues;
System::Collections::Generic::List<cStepValues^>^ StepReturnValues;
2021-06-02 13:54:22 +02:00
int SetFeedbackSound(byte sound, UINT16 sound3);
private:
2021-05-12 12:35:50 +02:00
int Connect(bool reinit, int EPDTimeout);
2019-02-04 11:48:08 +01:00
int Close();
2021-05-28 17:06:41 +02:00
int DecodeStatus(Epd3Base::Epd3U* epd);
int DecodeStatus(EpdBase::Epd2U* epd);
2019-02-01 17:35:18 +01:00
int GetStatus();
int GetDoses();
2021-05-28 17:06:41 +02:00
int GetDoses(EpdBase::Epd2U* epd);
2021-06-01 16:35:24 +02:00
int AfterGetDoses(Epd3Base::Epd3U* epd);
2021-05-28 17:06:41 +02:00
int GetDoses(Epd3Base::Epd3U* epd);
2022-03-17 08:57:22 +01:00
int ClearAlarms();
2024-08-28 13:05:03 +02:00
//int SetIssued();
2021-06-02 13:54:22 +02:00
int BeforeSetIssued(Epd3Base::Epd3U* epd);
2024-08-28 13:05:03 +02:00
//int SetIssued(Epd3Base::Epd3U* epd);
2021-06-02 13:54:22 +02:00
int BeforeSetIssued(EpdBase::Epd2U* epd);
2024-08-28 13:05:03 +02:00
//int SetIssued(EpdBase::Epd2U* epd);
2022-09-06 15:44:32 +02:00
2019-02-12 16:01:47 +01:00
int WriteCalibration();
2021-05-28 17:06:41 +02:00
int WriteCalibration(EpdBase::Epd2U* epd);
int WriteCalibration(Epd3Base::Epd3U* epd);
2019-02-04 11:48:08 +01:00
int ReadTresholds();
2021-06-01 16:35:24 +02:00
int AfterReadTresholds(EpdBase::Epd2U* epd);
2021-05-28 17:06:41 +02:00
int ReadTresholds(EpdBase::Epd2U* epd);
2021-06-01 16:35:24 +02:00
int AfterReadTresholds(Epd3Base::Epd3U* epd);
2021-05-28 17:06:41 +02:00
int ReadTresholds(Epd3Base::Epd3U* epd);
2019-02-12 16:01:47 +01:00
int ReadExtraStatus();
2021-05-28 17:06:41 +02:00
int ReadExtraStatus(EpdBase::Epd2U* epd);
int ReadExtraStatus(Epd3Base::Epd3U* epd);
2021-06-01 16:35:24 +02:00
int AfterGetDoses(EpdBase::Epd2U* epd);
2021-05-26 16:20:40 +02:00
int ConnectAndStatus();
System::Threading::CancellationTokenSource^ tokenSource;
int tokenSourceTimeout;
int readRetries;
System::Threading::Tasks::Task^ waitTask;
2024-08-28 13:05:03 +02:00
//int SetDeIssued();
2021-06-02 13:54:22 +02:00
public:
2024-05-22 13:31:10 +02:00
2022-04-20 16:56:49 +02:00
System::Threading::Tasks::Task^ Wait(int timeout, int Retries);
2021-05-26 16:20:40 +02:00
void WaitEnd();
2021-06-01 16:35:24 +02:00
int GetAll(bool close);
2024-05-22 13:31:10 +02:00
int GetAllDeissue(bool reconnect);
2024-09-04 13:05:16 +02:00
int IssueAndCheck(float gain, float ChirpRate, bool WriteConfig);
int GetSteps();
2024-09-05 16:10:29 +02:00
bool HasStepError();
2021-06-01 16:35:24 +02:00
2021-05-27 16:13:53 +02:00
private:
2021-05-28 17:06:41 +02:00
int AfterGetStatus(EpdBase::Epd2U* epd);
int AfterGetStatus(Epd3Base::Epd3U* epd);
2021-05-27 16:13:53 +02:00
int AfterGetStatus();
2022-08-30 09:10:33 +02:00
2021-05-28 17:06:41 +02:00
int SwitchCon();
void InitData();
2022-04-08 15:41:46 +02:00
2021-05-27 16:13:53 +02:00
void WaitEpd();
2022-09-06 15:44:32 +02:00
2024-08-28 13:05:03 +02:00
//int PrepareForIssue();
2019-02-01 17:35:18 +01:00
};
}