diff --git a/EpdBase3/Epd3.h b/EpdBase3/Epd3.h index 62ba1b1..84aba27 100644 --- a/EpdBase3/Epd3.h +++ b/EpdBase3/Epd3.h @@ -1,435 +1,461 @@ -#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 -#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); -} +#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 +#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(CommsHandle hComms, uint8_t onState, CompletionCallback callback); + int32_t EPDDLL_API EndEnableProtectedSession(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); + + //enkel 3.1 + CompletionToken EPDDLL_API BeginTestLed_R3(CommsHandle hComms, float seconds, CompletionCallback callback); + int32_t EPDDLL_API EmdTestLed_R3(CommsHandle hComms, CompletionToken token); + + CompletionToken EPDDLL_API BeginTestVibe_R3(CommsHandle hComms, float seconds, CompletionCallback callback); + int32_t EPDDLL_API EndTestVibe_R3(CommsHandle hComms, CompletionToken token); + + enum AlarmPatterns + { + PatNone = 0, + PatContinuousSingle = 1, + PatContinuousDualSlow = 2, + PatContinuousDualFast = 3, + PatIntermittentSingleSlow = 4, + PatIntermittentSingleFast = 5, + PatIntermittentDoubleSlow = 6, + PatIntermittentDoubleFast = 7, + PatIndustryDose = 14, + PatIndustryRate = 15 + }; + CompletionToken EPDDLL_API BeginTestSound_R3(CommsHandle hComms, AlarmPatterns pattern, BYTE volume, BYTE tone, float seconds, CompletionCallback callback); + int32_t EPDDLL_API EndTestSound_R3(CommsHandle hComms, CompletionToken token); + + + +} #endif \ No newline at end of file diff --git a/EpdBase3/Epd3Base.cpp b/EpdBase3/Epd3Base.cpp index 4d68d8c..e063062 100644 --- a/EpdBase3/Epd3Base.cpp +++ b/EpdBase3/Epd3Base.cpp @@ -5,6 +5,7 @@ #include "TimeFunctions.h" #pragma unmanaged #define noDeissueWithClear +#define ProtectSession //-102 = permission Epd3Base::Epd3U* current; @@ -13,17 +14,20 @@ Epd3Base::Epd3U* current; void Epd3Base::Epd3U::ResetStepReturnValues() { CurrentStep = -1; - for (int i = MaxSteps - 1; i >= 0; --i) for (int j = 0; j < 3; j++) StepReturnValues[i][j] = 0; + HasStepError = 0; + for (int i = MaxSteps - 1; i >= 0; --i) for (int j = 0; j < 4; j++) StepReturnValues[i][j] = 0; } -void Epd3Base::Epd3U::SetFunctionReturnValue(enum eFunctions f) +void Epd3Base::Epd3U::SetFunctionReturnValue(enum eFunctions f, BYTE CanIgnore) { if (CurrentStep < -1) CurrentStep = -1; if (CurrentStep < MaxSteps - 1) { ++CurrentStep; + if (CurrentStep == 0) HasStepError = 0; StepReturnValues[CurrentStep][0] = f; StepReturnValues[CurrentStep][1] = -1; StepReturnValues[CurrentStep][2] = -1; + StepReturnValues[CurrentStep][3] = CanIgnore; } } @@ -32,12 +36,21 @@ void Epd3Base::Epd3U::SetCommitReturnValue(int32_t rv) if (CurrentStep>=0 && CurrentStep= 0 && CurrentStep < MaxSteps) StepReturnValues[CurrentStep][2] = rv; + if (rv != 0) { + HasStepError = 1; + if (StepReturnValues[CurrentStep][3]) rv = 0; //if canIngore set rv ok + Error = GetErrorCode(); + } + return rv; } + + + int32_t Epd3Base::Epd3U::CommitAndSetRV() { int32_t r = Commit3(epdComsHandle); @@ -50,7 +63,7 @@ int32_t Epd3Base::Epd3U::CommitAndEnd2RV(int32_t (WINAPI *endFunction2)(CommsHa int32_t r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = (*endFunction2)(epdComsHandle, token); - SetEndReturnValue(r); + r= SetEndReturnValue(r); return r; } @@ -146,7 +159,7 @@ Epd3Base::Epd3U::Epd3U(int _comport) Epd3Base::Epd3U::~Epd3U() { - EndCom(); + EndCom(isConnected); if (hCompletion != 0) { CloseHandle(hCompletion); hCompletion = 0; } //if (hWaitTimer != 0) { CloseHandle(hWaitTimer); hWaitTimer = 0; } } @@ -192,7 +205,6 @@ DWORD Epd3Base::Epd3U::StartCom() } } else { - Dll3RV = r_FunctionFail; } } @@ -204,19 +216,18 @@ error: return Dll3RV; } -void Epd3Base::Epd3U::EndCom() +void Epd3Base::Epd3U::EndCom(bool doDiscon) { int rv; if (CommsInitialized == 1 || CurrentDeviceID != 0) { if (CommsInitialized == 1) { if (epdComsHandle != nullptr) { - DisCon(0); - Sleep(1000); + if (doDiscon) { DisCon(0); } //Dll3RV = CloseReader(epdComsHandle); // not necessary if followed by DestroyReaderInterface //if (Dll3RV) { // rv = 1; //} - SetFunctionReturnValue(eFunctions::fDestroyReaderInterface); + SetFunctionReturnValue(eFunctions::fDestroyReaderInterface,0); Dll3RV = DestroyReaderInterface(epdComsHandle); SetCommitReturnValue(0); SetEndReturnValue(Dll3RV); @@ -311,11 +322,11 @@ int Epd3Base::Epd3U::DisCon(UINT16 alarm) step = 1; Dll3RV = SetDisconnectCallback(epdComsHandle, disconnectcallback); if (alarm) { - SetFunctionReturnValue(fDisconnectAndNotify); - Dll3RV = DisconnectAndNotify(epdComsHandle, EndSessionControl, 12); + SetFunctionReturnValue(fDisconnectAndNotify,0); + Dll3RV = DisconnectAndNotify(epdComsHandle, alarm, 12); //1.2 secon SetCommitReturnValue(0); SetEndReturnValue(Dll3RV); } else { - SetFunctionReturnValue(fDisconnect); + SetFunctionReturnValue(fDisconnect,0); Dll3RV = Disconnect(epdComsHandle); SetCommitReturnValue(0); SetEndReturnValue(Dll3RV); } @@ -325,7 +336,8 @@ int Epd3Base::Epd3U::DisCon(UINT16 alarm) step = 2; Dll3RV = WaitForSingleObject(hCompletion, 3000); switch (Dll3RV) { - case WAIT_OBJECT_0: rv = 0; break; + case WAIT_OBJECT_0: + rv = 0; break; case WAIT_TIMEOUT: rv = 0; current->CurrentDeviceID = 0; @@ -439,10 +451,10 @@ int Epd3Base::Epd3U::SetTime() //Only R3 int r = 0; if (Epd.Gen == EpdGeneration::Mk3) { - SetFunctionReturnValue(WriteRTC_R3); + SetFunctionReturnValue(WriteRTC_R3,1); utc = TimeFunctions::NowToEpdTime(Epd.Gen == EpdGeneration::Mk2); token = BeginWriteRTC_R3(epdComsHandle, utc, nullptr); - CommitAndEnd2RV(EndWriteRTC_R3, token); + r = CommitAndEnd2RV(EndWriteRTC_R3, token); /*r = CommitSetRV(); if (!r) r = EndWriteRTC_R3(epdComsHandle, token); SetEndReturnValue(r);*/ @@ -486,16 +498,13 @@ int Epd3Base::Epd3U::ReadStatus() step = 1; - SetFunctionReturnValue(eFunctions::ReadStatus); + SetFunctionReturnValue(eFunctions::ReadStatus,0); token = BeginReadStatus(epdComsHandle, nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndReadStatus(epdComsHandle, token, &epd3status); - SetEndReturnValue(r); - if (r != 0) { - Error = GetErrorCode(); - goto error; - } + r = SetEndReturnValue(r); + if (r != 0) goto error; IssueCount = epd3status.IssueCount; OperatingStatus = epd3status.OperatingStatus; @@ -509,15 +518,13 @@ int Epd3Base::Epd3U::ReadStatus() VersionNumber_t VersionNumber; step = 2; - SetFunctionReturnValue(ReadEpdIdentities); + SetFunctionReturnValue(ReadEpdIdentities,0); token = BeginReadEpdIdentities(epdComsHandle, nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndReadEpdIdentities(epdComsHandle, token, &EpdID32, (EpdTypes*)&EpdType, &capabilities, &MarkNumber, &VersionNumber, NULL, 0); - SetEndReturnValue(r); - if (r != 0) { - Error = GetErrorCode(); - goto error; - } + r = SetEndReturnValue(r); + if (r != 0) goto error; + EpdID = EpdID32; isBG = (EpdType == EpdTypes::Mk2BetaGamma || EpdType == EpdTypes::Mk3BetaGamma); @@ -530,17 +537,14 @@ int Epd3Base::Epd3U::ReadStatus() DecodeStatus(); //Alarm status... step = 3; - SetFunctionReturnValue(ReadCounts); + SetFunctionReturnValue(ReadCounts,0); token = BeginReadCounts(epdComsHandle, nullptr, 0, nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndReadCounts(epdComsHandle, token, Counts, MaxCounts, &countsRead, &utc, &seconds); - SetEndReturnValue(r); + r= SetEndReturnValue(r); // - 101 = InvalidParam // - 104 = FunctionFail, - if (r != 0 && r != -104) { - Error = GetErrorCode(); - goto error; - } + if (r) goto error; // (r != 0 && r != -104) { Error = GetErrorCode(); goto error; } decodeCounters(countsRead); //HG,SG .. //Wearer @@ -548,29 +552,25 @@ int Epd3Base::Epd3U::ReadStatus() if (EPDIssued) { IdString_t mk3WearerID; //Mk2 EPDs only support Name and Primary ID - SetFunctionReturnValue(ReadWearerId); + SetFunctionReturnValue(ReadWearerId,0); token = BeginReadWearerId(epdComsHandle, static_cast(WearerIdType::WearerId_Name), nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndReadWearerId(epdComsHandle, token, &mk3WearerID); - SetEndReturnValue(r); - if (r != 0) { - Error = GetErrorCode(); - goto error; - } + r = SetEndReturnValue(r); + if (r != 0) goto error; + if (mk3WearerID.Length > WearerNameLength) mk3WearerID.Length = WearerNameLength; memcpy(WearerName, mk3WearerID.Utf8String, mk3WearerID.Length); WearerName[mk3WearerID.Length] = 0; step = 5; - SetFunctionReturnValue(ReadWearerId); + SetFunctionReturnValue(ReadWearerId,0); token = BeginReadWearerId(epdComsHandle, static_cast(WearerIdType::WearerId_Primary), nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndReadWearerId(epdComsHandle, token, &mk3WearerID); - SetEndReturnValue(r); - if (r != 0) { - Error = GetErrorCode(); - goto error; - } + r = SetEndReturnValue(r); + if (r != 0) goto error; + if (mk3WearerID.Length > WearerIDLength) mk3WearerID.Length = WearerIDLength; memcpy(this->WearerID, mk3WearerID.Utf8String, mk3WearerID.Length); WearerName[mk3WearerID.Length] = 0; @@ -583,11 +583,11 @@ int Epd3Base::Epd3U::ReadStatus() //MK2 .. some utc... but no real time clock step = 6; if (utc == 0) { - SetFunctionReturnValue(ReadRTC); + SetFunctionReturnValue(ReadRTC,0); token = BeginReadRTC(epdComsHandle, nullptr); r = CommitAndSetRV(); if (!r) r = EndReadRTC(epdComsHandle, token, &utc); //EpdClock for MK2 - SetEndReturnValue(r); + r= SetEndReturnValue(r); if (r) goto error; EpdClock = utc; utc = TimeFunctions::NowToEpdTime(true); @@ -621,14 +621,15 @@ int Epd3Base::Epd3U::ConnectAndStatus(int tokenSourceTimeout) ResetStepReturnValues(); if (CommsInitialized == 0) StartCom(); if (CommsInitialized) { - SetFunctionReturnValue(fStartDiscover); + SetFunctionReturnValue(fStartDiscover,0); dllStatus = StartDiscover(tokenSourceTimeout); + SetCommitReturnValue(0); + if (dllStatus==1) SetEndReturnValue(0); else SetEndReturnValue(dllStatus); if (dllStatus != 1) rv = 1; //Connect error else if (DeviceCount < 1) rv = 2; //TO else if (isMK3 && ReadStatus() != 0) rv = 1; //Read Error else rv = 0; - SetCommitReturnValue(0); SetEndReturnValue(rv); } else rv = 1; return rv; @@ -843,14 +844,13 @@ void Epd3Base::Epd3U::decodedTresholds(int numdTresholds) WORD Epd3Base::Epd3U::ReadCal() { int r = 0; - SetFunctionReturnValue(ReadSensitivities); + SetFunctionReturnValue(ReadSensitivities,0); token = BeginReadSensitivities(epdComsHandle, nullptr, 0, nullptr); r = CommitAndSetRV(); //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndReadSensitivities(epdComsHandle, token, sensitivities, MaxSensitivities, &numSensitivities); - SetEndReturnValue(r); - if (r != 0) - goto error; + r = SetEndReturnValue(r); + if (r != 0) goto error; decodeSensitivities(numSensitivities); return r; error: @@ -902,12 +902,12 @@ WORD Epd3Base::Epd3U::ReadSensitivitiesAndTresholds() HG = HGthresh; } else { - SetFunctionReturnValue(ReadDetectorThresholds); + SetFunctionReturnValue(ReadDetectorThresholds,0); token = BeginReadDetectorThresholds_R3(epdComsHandle, nullptr, 0, nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndReadDetectorThresholds_R3(epdComsHandle, token, dTresholds, MaxTresholds, &numTresholds); - SetEndReturnValue(r); + r = SetEndReturnValue(r); if (r != 0) goto error; decodedTresholds(numTresholds); // HG, SG, BC, FB, BC, FB @@ -940,33 +940,33 @@ WORD Epd3Base::Epd3U::ReadDoses() numDoses = 0; utc = 0; - SetFunctionReturnValue(eFunctions::fReadDoses); + SetFunctionReturnValue(eFunctions::fReadDoses,0); token = BeginReadDoses(epdComsHandle, nullptr, 0, nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndReadDoses(epdComsHandle, token, doses, MaxDoses, &numDoses, &utc); - SetEndReturnValue(r); + r = SetEndReturnValue(r); if (r != 0) goto error; decodeDoses(numDoses); - SetFunctionReturnValue(eFunctions::ReadTotalDoses); + SetFunctionReturnValue(eFunctions::ReadTotalDoses,0); token = BeginReadTotalDoses(epdComsHandle, nullptr, 0, nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndReadTotalDoses(epdComsHandle, token, totdoses, MaxDoses, &numtotDoses, &utc); - SetEndReturnValue(r); + r = SetEndReturnValue(r); if (r != 0) goto error; decodetotDoses(numtotDoses); - SetFunctionReturnValue(eFunctions::ReadQualityData); + SetFunctionReturnValue(eFunctions::ReadQualityData,0); token = BeginReadQualityData(epdComsHandle, nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndReadQualityData(epdComsHandle, token, &quality); - SetEndReturnValue(r); + r = SetEndReturnValue(r); if (r != 0) goto error; @@ -974,12 +974,12 @@ WORD Epd3Base::Epd3U::ReadDoses() Resets = quality.PowerCycles; - SetFunctionReturnValue(eFunctions::ReadPeakRates); + SetFunctionReturnValue(eFunctions::ReadPeakRates,0); token = BeginReadPeakRates(epdComsHandle, nullptr, 0, nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndReadPeakRates(epdComsHandle, token, peakRates, MaxPeakRates, &numRates); - SetEndReturnValue(r); + r= SetEndReturnValue(r); if (r != 0) goto error; @@ -1004,32 +1004,26 @@ int Epd3Base::Epd3U::ClearDoses() { int r = 1; - SetFunctionReturnValue(eFunctions::ClearTotalDose); + SetFunctionReturnValue(eFunctions::ClearTotalDose,0); token = BeginClearTotalDose(epdComsHandle, nullptr); - r = Commit3(epdComsHandle); - SetCommitReturnValue(r); - if (!r) r = EndClearTotalDose(epdComsHandle, token); - SetEndReturnValue(r); + r = CommitAndEnd2RV(EndClearTotalDose, token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndClearTotalDose(epdComsHandle, token); SetEndReturnValue(r); if (r != 0 && r != r_InvalidOp) goto error; - SetFunctionReturnValue(eFunctions::ClearDose); + SetFunctionReturnValue(eFunctions::ClearDose,0); token = BeginClearDose(epdComsHandle, nullptr); - r = Commit3(epdComsHandle); - SetCommitReturnValue(r); - if (!r) r = EndClearDose(epdComsHandle, token); - SetEndReturnValue(r); + r = CommitAndEnd2RV(EndClearDose, token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndClearDose(epdComsHandle, token); SetEndReturnValue(r); if (r != 0 && r != r_InvalidOp) goto error; - SetFunctionReturnValue(eFunctions::ClearPeakRates); + SetFunctionReturnValue(eFunctions::ClearPeakRates,0); token = BeginClearPeakRates(epdComsHandle, nullptr); - r = Commit3(epdComsHandle); - SetCommitReturnValue(r); - if (!r) r = EndClearPeakRates(epdComsHandle, token); - SetEndReturnValue(r); + r = CommitAndEnd2RV(EndClearPeakRates,token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndClearPeakRates(epdComsHandle, token); SetEndReturnValue(r); if (r != 0 && r != r_InvalidOp) goto error; @@ -1045,22 +1039,17 @@ int Epd3Base::Epd3U::ClearAlarms() { int r = 0; - - SetFunctionReturnValue(eFunctions::ClearFaultStatus); + SetFunctionReturnValue(eFunctions::ClearFaultStatus,0); token = BeginClearFaultStatus(epdComsHandle, nullptr); - r = Commit3(epdComsHandle); - SetCommitReturnValue(r); - if (!r) r = EndClearFaultStatus(epdComsHandle, token); - SetEndReturnValue(r); + r = CommitAndEnd2RV(EndClearFaultStatus, token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndClearFaultStatus(epdComsHandle, token); SetEndReturnValue(r); if (r != 0 && r != -105) goto error; - SetFunctionReturnValue(eFunctions::ClearLatchedAlarms); + SetFunctionReturnValue(eFunctions::ClearLatchedAlarms,0); token = BeginClearLatchedAlarms(epdComsHandle, nullptr); - r = Commit3(epdComsHandle); - SetCommitReturnValue(r); - if (!r) r = EndClearLatchedAlarms(epdComsHandle, token); - SetEndReturnValue(r); + r = CommitAndEnd2RV(EndClearLatchedAlarms, token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndClearLatchedAlarms(epdComsHandle, token); SetEndReturnValue(r); if (r != 0 && r != -105) goto error; @@ -1088,15 +1077,11 @@ WORD Epd3Base::Epd3U::PrepareForIssue() if (rv != 0) goto error;*/ - SetFunctionReturnValue(eFunctions::ClearLatchedAlarms); + /* gebeurt bij clearalrms + SetFunctionReturnValue(eFunctions::ClearLatchedAlarms,0); token = BeginEpdOnOff(epdComsHandle, 1, nullptr); - rv = Commit3(epdComsHandle); - SetCommitReturnValue(rv); - if (!rv) rv = EndEpdOnOff(epdComsHandle, token); - SetEndReturnValue(rv); - if (rv != 0) - rv = 0; - + rv = CommitAndEnd2RV(EndEpdOnOff, token); + */ step = 2; if (WriteConfig32) { rv = WriteConfig(); @@ -1117,7 +1102,8 @@ WORD Epd3Base::Epd3U::PrepareForIssue() rv = ClearAlarms(); if (rv != 0) goto error; - Sleep(2000); + + Sleep(2100); return rv; @@ -1130,12 +1116,10 @@ error: WORD Epd3Base::Epd3U::ReadAlarmConfig() { //Alleen MK3 ? leeg bij MK2 - SetFunctionReturnValue(eFunctions::ReadAlarmConfiguration); + SetFunctionReturnValue(eFunctions::ReadAlarmConfiguration,0); token = BeginReadAlarmConfiguration(epdComsHandle, nullptr, 0, nullptr); - int32_t r = Commit3(epdComsHandle); - SetCommitReturnValue(r); - r = EndReadAlarmConfiguration(epdComsHandle, token, alarmConfig, MaxAlarmConfig, &numAlarm); - SetEndReturnValue(r); + int32_t r = Commit3(epdComsHandle); SetCommitReturnValue(r); + if (!r) { r = EndReadAlarmConfiguration(epdComsHandle, token, alarmConfig, MaxAlarmConfig, &numAlarm); SetEndReturnValue(r); } return numAlarm; } @@ -1149,22 +1133,20 @@ WORD Epd3Base::Epd3U::ReadAlarmTresholds() { if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10N; else measID = (uint8_t)MeasurementId::Meas_Hp07; hp07tresholds.MeasId = measID; - SetFunctionReturnValue(eFunctions::ReadAlarmThresholds); + SetFunctionReturnValue(eFunctions::ReadAlarmThresholds,0); token = BeginReadAlarmThresholds(epdComsHandle, (uint8_t)hp07tresholds.MeasId, nullptr, 0, nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); - r = EndReadAlarmThresholds(epdComsHandle, token, &hp07tresholds); - SetEndReturnValue(r); + if (!r) { r = EndReadAlarmThresholds(epdComsHandle, token, &hp07tresholds); r = SetEndReturnValue(r); } decodeTreshold(&hp07tresholds); if (isNeutron) measID = (uint8_t)MeasurementId::Meas_Hp10G; else measID = (uint8_t)MeasurementId::Meas_Hp10; hp10tresholds.MeasId = measID; - SetFunctionReturnValue(eFunctions::ReadAlarmThresholds); + SetFunctionReturnValue(eFunctions::ReadAlarmThresholds,0); token = BeginReadAlarmThresholds(epdComsHandle, (uint8_t)hp10tresholds.MeasId, nullptr, 0, nullptr); r = Commit3(epdComsHandle); SetCommitReturnValue(r); - r = EndReadAlarmThresholds(epdComsHandle, token, &hp10tresholds); - SetEndReturnValue(r); + if (!r) { r = EndReadAlarmThresholds(epdComsHandle, token, &hp10tresholds); r= SetEndReturnValue(r); } decodeTreshold(&hp10tresholds); return r; @@ -1181,7 +1163,7 @@ WORD Epd3Base::Epd3U::WriteAlarmTresholds() { hp10tresholds.MeasId = measID; encodeTreshold(&hp10tresholds); - SetFunctionReturnValue(eFunctions::WriteAlarmThresholds); + SetFunctionReturnValue(eFunctions::WriteAlarmThresholds,0); token = BeginWriteAlarmThresholds(epdComsHandle, (uint8_t)hp10tresholds.MeasId, (uint8_t)hp10tresholds.NumberThresholds, hp10tresholds.Thresholds, nullptr); r = CommitAndEnd2RV(EndWriteAlarmThresholds, token); //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (r != 0) goto error; r = EndWriteAlarmThresholds(epdComsHandle, token); SetEndReturnValue(r); @@ -1192,13 +1174,13 @@ WORD Epd3Base::Epd3U::WriteAlarmTresholds() { hp07tresholds.MeasId = measID; encodeTreshold(&hp07tresholds); hp07tresholds.NumberThresholds = 4; - SetFunctionReturnValue(eFunctions::WriteAlarmThresholds); + SetFunctionReturnValue(eFunctions::WriteAlarmThresholds,0); token = BeginWriteAlarmThresholds(epdComsHandle, (uint8_t)hp07tresholds.MeasId, (uint8_t)hp07tresholds.NumberThresholds, hp07tresholds.Thresholds, nullptr); r = CommitAndEnd2RV(EndWriteAlarmThresholds, token); //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (r != 0) goto error; r = EndWriteAlarmThresholds(epdComsHandle, token); SetEndReturnValue(r); if (r != 0) goto error; - SetFunctionReturnValue(eFunctions::WriteRateOffPercentage); + SetFunctionReturnValue(eFunctions::WriteRateOffPercentage,0); token = BeginWriteRateOffPercentage(epdComsHandle, RatePct, 2, nullptr); r = CommitAndEnd2RV(EndWriteRateOffPercentage, token); //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (r != 0) goto error; r = EndWriteRateOffPercentage(epdComsHandle, token); SetEndReturnValue(r); @@ -1232,20 +1214,21 @@ WORD Epd3Base::Epd3U::DeIssue() Sleep(2000); #endif - SetFunctionReturnValue(eFunctions::DeissueEPD); + SetFunctionReturnValue(eFunctions::DeissueEPD,0); token = BeginDeissueEPD(epdComsHandle, nullptr); r = CommitAndEnd2RV(EndDeissueEPD,token); //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndDeissueEPD(epdComsHandle, token); SetEndReturnValue(r); Sleep(2000); } - SetFunctionReturnValue(eFunctions::EpdOnOff); + SetFunctionReturnValue(eFunctions::EpdOnOff,0); token = BeginEpdOnOff(epdComsHandle, 0, nullptr); r = CommitAndEnd2RV(EndEpdOnOff, token); //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndEpdOnOff(epdComsHandle, token); SetEndReturnValue(r); Sleep(100); - EndCom(); + EndCom(true); + if (r) goto error; return r; @@ -1259,7 +1242,7 @@ WORD Epd3Base::Epd3U::WriteWearer() { int32_t r = 0; int step = 0; - SetFunctionReturnValue(eFunctions::SetBaselineCounters); + SetFunctionReturnValue(eFunctions::SetBaselineCounters,0); token = BeginSetBaselineCounters(epdComsHandle, nullptr); r = CommitAndEnd2RV(EndSetBaselineCounters, token); //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndSetBaselineCounters(epdComsHandle, token); SetEndReturnValue(r); @@ -1273,7 +1256,7 @@ WORD Epd3Base::Epd3U::WriteWearer() { mk3WearerID.Length = 23; memcpy(mk3WearerID.Utf8String, WearerName, 23); - SetFunctionReturnValue(eFunctions::WriteWearerId); + SetFunctionReturnValue(eFunctions::WriteWearerId,0); token = BeginWriteWearerId(epdComsHandle, mk3WearerID, nullptr); r = CommitAndEnd2RV(EndWriteWearerId, token); //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteWearerId(epdComsHandle, token); SetEndReturnValue(r); @@ -1284,7 +1267,7 @@ WORD Epd3Base::Epd3U::WriteWearer() { mk3WearerID.Length = 13; memcpy(mk3WearerID.Utf8String, WearerID, 13); - SetFunctionReturnValue(eFunctions::WriteWearerId); + SetFunctionReturnValue(eFunctions::WriteWearerId,0); token = BeginWriteWearerId(epdComsHandle, mk3WearerID, nullptr); r = CommitAndEnd2RV(EndWriteWearerId, token); //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteWearerId(epdComsHandle, token); SetEndReturnValue(r); @@ -1317,21 +1300,32 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru if (r) goto error; } -#if ProtectSession - if (isMK3) { - Control = EndSessionControl; - token = BeginEnableProtectedSession_R3(epdComsHandle, 1, nullptr); - r = CommitAndEnd2RV(EndEnableProtectedSession_R3, token); - //r = Commit3(epdComsHandle); r = EndEnableProtectedSession_R3(epdComsHandle, token); - if (r != 0) - goto error; - } -#endif + step = 1; if (!isConnected) r = ReOpenDev(); if (r) goto error; + + step = 4; + //EPDIssued + //if (!DetectorsOn) { + SetFunctionReturnValue(eFunctions::EpdOnOff, 0); + token = BeginEpdOnOff(epdComsHandle, 1, nullptr); + r = CommitAndEnd2RV(EndEpdOnOff, token); + +#ifdef ProtectSession + if (isMK3) { + Control = 1; // EndSessionControl; + //SetFunctionReturnValue(EnableProtectedSession, 1); + //token = BeginEnableProtectedSession(epdComsHandle, 1, nullptr); + //r = CommitAndEnd2RV(EndEnableProtectedSession, token); + //if (r != 0) goto error; + } +#else + Control = 0; +#endif + step = 2; r = WriteAlarmTresholds(); if (r != 0) @@ -1342,49 +1336,32 @@ WORD Epd3Base::Epd3U::Issue(bool PrepareDone) //normaal is preparedone=tru if (r != 0) goto error; - - step = 4; - //EPDIssued - //if (!DetectorsOn) { - SetFunctionReturnValue(eFunctions::EpdOnOff); - token = BeginEpdOnOff(epdComsHandle, 1, nullptr); - r = CommitAndEnd2RV(EndEpdOnOff, token); - //r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndEpdOnOff(epdComsHandle, token); SetEndReturnValue(r); - // OKRV = EpdOn(); OKRV = Commit3(); - if (r != 0) - r = 0; - //} - - //step = 5; - //ReOpenDev(); - tries = 1; - SetFunctionReturnValue(eFunctions::EpdOnOff); + SetFunctionReturnValue(eFunctions::IssueEPD,0); token = BeginIssueEPD(epdComsHandle, nullptr); r = CommitAndEnd2RV(EndIssueEPD, token); - //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndIssueEPD(epdComsHandle, token); SetEndReturnValue(r); + if (r != 0) { tries++; if (r == r_ErrorNotConnected) ReOpenDev(); Sleep(500); - SetFunctionReturnValue(eFunctions::EpdOnOff); + SetFunctionReturnValue(eFunctions::IssueEPD,0); token = BeginIssueEPD(epdComsHandle, nullptr); r = CommitAndEnd2RV(EndIssueEPD, token); - //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndIssueEPD(epdComsHandle, token); SetEndReturnValue(r); } if (r) goto error; + step = 6; if (isMK3) { + r = DisCon(Control); //stops protected session if control is EndSessionCOntrol - if (r) - goto error; } step = 7; - EndCom(); + EndCom(false); return r; @@ -1406,11 +1383,11 @@ WORD Epd3Base::Epd3U::EPDReadExtraStatus() &byStatus4); if (CommitRV == 1) CommitRV = Commit3();*/ - SetFunctionReturnValue(eFunctions::ReadBaselineCounts); + SetFunctionReturnValue(eFunctions::ReadBaselineCounts,0); token = BeginReadBaselineCounts(epdComsHandle, nullptr); r = CommitAndSetRV();// Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndReadBaselineCounts(epdComsHandle, token, Counts, 10, &utc, &countsRead); - SetEndReturnValue(r); + r = SetEndReturnValue(r); if (!r) decodeBaseCounters(countsRead); //if (CommitRV == 1) CommitRV = ReadCounts(&D1, &D2, &D3, &D4, &CountsClock); //if (CommitRV == 1) CommitRV = Commit3(); @@ -1434,21 +1411,17 @@ WORD Epd3Base::Epd3U::WriteCal() { Password = 9; - SetFunctionReturnValue(eFunctions::MfrLogin_R2); + SetFunctionReturnValue(eFunctions::MfrLogin_R2,0); token = BeginMfrLogin_R2(epdComsHandle, Password, nullptr); - uint32_t r = Commit3(epdComsHandle); SetCommitReturnValue(r); - if (r != 0) - goto error; - r = EndMfrLogin_R2(epdComsHandle, token); SetEndReturnValue(r); + uint32_t r = CommitAndEnd2RV(EndMfrLogin_R2,token); + //Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r ) r = EndMfrLogin_R2(epdComsHandle, token); SetEndReturnValue(r); if (r != 0) goto error; - SetFunctionReturnValue(eFunctions::WriteSensitivities_R2); + SetFunctionReturnValue(eFunctions::WriteSensitivities_R2,0); 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); SetCommitReturnValue(r); - if (r != 0) - goto error; - r = EndWriteSensitivities_R2(epdComsHandle, token); SetEndReturnValue(r); + r = CommitAndEnd2RV(EndWriteSensitivities_R2, token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteSensitivities_R2(epdComsHandle, token); SetEndReturnValue(r); if (r != 0) goto error; } @@ -1463,7 +1436,7 @@ int Epd3Base::Epd3U::GetAll(bool Closeconnection) rv = ReadDoses(); step=2; if (!rv) rv = ReadAlarmTresholds(); - if (Closeconnection) EndCom(); + if (Closeconnection) EndCom(isConnected ); return rv; } @@ -1532,8 +1505,13 @@ int Epd3Base::Epd3U::IssueAndCheck(float gain, float ChirpRate) step = 3; rv = SetChirp(ChirpRate); + if (rv == r_ErrorNotConnected) + { + rv = ReOpenDev(); + rv = SetChirp(ChirpRate); + } if (rv) goto error; - Sleep(1000); + step = 5; rv = Issue(true); // data already loaded @@ -1552,11 +1530,11 @@ int Epd3Base::Epd3U::WriteConfig(void) int32_t r = 0; ECLen = 32; - SetFunctionReturnValue(eFunctions::WriteAccessLevel); + // Become admin + SetFunctionReturnValue(eFunctions::WriteAccessLevel,0); token = BeginWriteAccessLevel(epdComsHandle, AccessLevel_t::Admin, EC, ECLen, nullptr); - r = Commit3(epdComsHandle); SetCommitReturnValue(r); - r = EndWriteAccessLevel(epdComsHandle, token); - SetEndReturnValue(r); + r = CommitAndEnd2RV(EndWriteAccessLevel,token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteAccessLevel(epdComsHandle, token); SetEndReturnValue(r); if (!r) { displayIds = new QuickAccessDisplay_t[6]{ @@ -1569,39 +1547,39 @@ int Epd3Base::Epd3U::WriteConfig(void) }; numDisplays = 6; - SetFunctionReturnValue(eFunctions::WriteQuickAccessDisplays_R3); + SetFunctionReturnValue(eFunctions::WriteQuickAccessDisplays_R3,1); token = BeginWriteQuickAccessDisplays_R3(epdComsHandle, displayIds, numDisplays, nullptr); - r = Commit3(epdComsHandle); SetCommitReturnValue(r); - r = EndWriteQuickAccessDisplays_R3(epdComsHandle, token); SetEndReturnValue(r); + r = CommitAndEnd2RV(EndWriteQuickAccessDisplays_R3, token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteQuickAccessDisplays_R3(epdComsHandle, token); SetEndReturnValue(r); } if (!r) { //Unmanaged%20HtmlFiles/_display_ids.html numItems = 9; enables = new DisplayAttributeMap_t[9]{ - { 0,0x97FF,0xFFFF }, - { 1,0x97FF,0xFFE1 }, - { 2,0x97FF,0xFE07 }, - { 3,0x97FF,0xFE07 }, - { 4,0x97FF,0xFE01 }, - { 5,0x97FF,0xFF0B }, - { 6,0x97FF,0xFFF9 }, - { 7,0x97FF,0xFFD3 }, - { 8,0x97FF,0xFFFF } + { 0,0xDFFF,0xFFFF }, + { 1,0xDFFF,0xFF07 }, + { 2,0xDFFF,0xFFFF }, + { 3,0xDFFF,0xFFFF }, + { 4,0xDFFF,0xFE01 }, + { 5,0xDFFF,0xFFFF }, + { 6,0xDFFF,0xFFFF }, + { 7,0xDFFF,0xFFFB }, + { 8,0xDFFF,0xFFFF } }; // 0x1 Operation Menu Back /0x2 On / Off 0x4 Clear Dose 0x8 Toggle Telemtry 0x10 Responder Trigger // 1 0 0 0 0 - SetFunctionReturnValue(eFunctions::WriteDisplayEnables_R3); + SetFunctionReturnValue(eFunctions::WriteDisplayEnables_R3,1); token = BeginWriteDisplayEnables_R3(epdComsHandle, enables, numItems, nullptr); - r = Commit3(epdComsHandle); SetCommitReturnValue(r); - r = EndWriteDisplayEnables_R3(epdComsHandle, token); SetEndReturnValue(r); + r = CommitAndEnd2RV(EndWriteDisplayEnables_R3, token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteDisplayEnables_R3(epdComsHandle, token); SetEndReturnValue(r); } if (!r) { uint8_t numMenus = 9; uint16_t permissions[9] = { 0x0000 , 0x0016 , - 0x0010 , + 0x0000 , 0x0000 , 0x0000 , 0x0000 , @@ -1610,42 +1588,44 @@ int Epd3Base::Epd3U::WriteConfig(void) 0x0000 }; - SetFunctionReturnValue(eFunctions::WriteDisplayEnablePermissions_R3); + SetFunctionReturnValue(eFunctions::WriteDisplayEnablePermissions_R3,1); token = BeginWriteDisplayEnablePermissions_R3(epdComsHandle, AccessLevel_t::Admin, permissions, numDisplays, nullptr); - r = Commit3(epdComsHandle); SetCommitReturnValue(r); - r = EndWriteDisplayEnablePermissions_R3(epdComsHandle, token); SetEndReturnValue(r); + r = CommitAndEnd2RV(EndWriteDisplayEnablePermissions_R3, token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); + //r = EndWriteDisplayEnablePermissions_R3(epdComsHandle, token); SetEndReturnValue(r); + //r = 0; //override } if (!r) { //AlarmConfiguration uint8_t alarmConfigLen = 14; alarmConfigIds = new AlarmConfig_t[14]{ - { (AlarmIds)6,0,0x0000,0x1884,61 }, - { (AlarmIds)8,0,0x0000,0x9884,61 }, - { (AlarmIds)5,0,0x0000,0x9CA4,61 }, - { (AlarmIds)4,0,0x0000,0x9CA7,61 }, - { (AlarmIds)9,0,0x0000,0x9CA5,61 }, + { (AlarmIds)6,0,0x0000,0x1884,60 }, + { (AlarmIds)8,0,0x0000,0x9884,60 }, + { (AlarmIds)5,0,0x0000,0x9CA4,60 }, + { (AlarmIds)4,0,0x0000,0x9CC7,60 }, + { (AlarmIds)9,0,0x0000,0x9CA5,60 }, { (AlarmIds)7,0,0x0000,0x1884,60 }, - { (AlarmIds)0,0,0x0000,0x9CA1,60 }, - { (AlarmIds)1,0,0x0000,0x18A4,60 }, - { (AlarmIds)2,0,0x0000,0x9CA7,60 }, - { (AlarmIds)3,0,0x0000,0x18A5,60 }, - { (AlarmIds)0,1,0x0000,0x9CA1,60 }, - { (AlarmIds)1,1,0x0000,0x18A4,60 }, - { (AlarmIds)2,1,0x0000,0x9CA7,60 }, - { (AlarmIds)3,1,0x0000,0x18A5,60 }, + { (AlarmIds)0,0,0x0000,0x9CC1,60 }, + { (AlarmIds)1,0,0x0000,0x1884,60 }, + { (AlarmIds)2,0,0x0000,0x9CC7,60 }, + { (AlarmIds)3,0,0x0000,0x1885,60 }, + { (AlarmIds)0,1,0x0000,0x9CC1,60 }, + { (AlarmIds)1,1,0x0000,0x1884,60 }, + { (AlarmIds)2,1,0x0000,0x9CC7,60 }, + { (AlarmIds)3,1,0x0000,0x1885,60 } }; - SetFunctionReturnValue(eFunctions::WriteAlarmConfiguration_R3); + SetFunctionReturnValue(eFunctions::WriteAlarmConfiguration_R3,1); token = BeginWriteAlarmConfiguration_R3(epdComsHandle, alarmConfigIds, alarmConfigLen, nullptr); - r = Commit3(epdComsHandle); SetCommitReturnValue(r); - r = EndWriteAlarmConfiguration_R3(epdComsHandle, token); SetEndReturnValue(r); + r = CommitAndEnd2RV(EndWriteAlarmConfiguration_R3, token); + //r = Commit3(epdComsHandle); SetCommitReturnValue(r); r = EndWriteAlarmConfiguration_R3(epdComsHandle, token); SetEndReturnValue(r); } //OffModeDisplay if (!r) { dutyCycle = (OffModeDutyCycle)0; offModeDispId = (OffModeDisplayId_t)1; - SetFunctionReturnValue(eFunctions::WriteOffModeDisplay_R3); + SetFunctionReturnValue(eFunctions::WriteOffModeDisplay_R3,1); token = BeginWriteOffModeDisplay_R3(epdComsHandle, dutyCycle, offModeDispId, nullptr); r = CommitAndEnd2RV(EndWriteOffModeDisplay_R3, token); /*r = Commit3(epdComsHandle); SetCommitReturnValue(r); @@ -1654,7 +1634,7 @@ int Epd3Base::Epd3U::WriteConfig(void) //SwitchOnFromButton if (!r) { uint8_t OnOfenabled = 0; - SetFunctionReturnValue(eFunctions::WriteSwitchOnFromButton_R3); + SetFunctionReturnValue(eFunctions::WriteSwitchOnFromButton_R3,0); token = BeginWriteSwitchOnFromButton_R3(epdComsHandle, OnOfenabled, nullptr); r = CommitAndEnd2RV(EndWriteSwitchOnFromButton_R3, token); /*r = Commit3(epdComsHandle); SetCommitReturnValue(r); @@ -1670,16 +1650,15 @@ int Epd3Base::Epd3U::SetChirp(float Sensitivity) if (Sensitivity > 0.001F) { enable = 1; - SetFunctionReturnValue(eFunctions::WriteChirpSensitivity); + SetFunctionReturnValue(eFunctions::WriteChirpSensitivity,0); token = BeginWriteChirpSensitivity(epdComsHandle, Sensitivity, nullptr); r = CommitAndEnd2RV(EndWriteChirpSensitivity , token); - /*r = Commit3(epdComsHandle); SetCommitReturnValue(r); - if (!r) r = EndWriteChirpSensitivity(epdComsHandle, token); SetEndReturnValue(r);*/ + /*r = Commit3(epdComsHandle); SetCommitReturnValue(r); if (!r) r = EndWriteChirpSensitivity(epdComsHandle, token); SetEndReturnValue(r);*/ } if (r) goto error; if (!r) { - SetFunctionReturnValue(eFunctions::WriteChirpEnable_R3); + SetFunctionReturnValue(eFunctions::WriteChirpEnable_R3,0); token = BeginWriteChirpEnable_R3(epdComsHandle, enable, nullptr); r = CommitAndEnd2RV(EndWriteChirpEnable_R3, token); /*r = Commit3(epdComsHandle); SetCommitReturnValue(r); diff --git a/EpdBase3/Epd3Base.h b/EpdBase3/Epd3Base.h index f9a4c5c..6054e18 100644 --- a/EpdBase3/Epd3Base.h +++ b/EpdBase3/Epd3Base.h @@ -27,6 +27,7 @@ namespace Epd3Base { , fDestroyReaderInterface , fDisconnect , fDisconnectAndNotify , fStartDiscover + , IssueEPD, EnableProtectedSession }; class Epd3U { @@ -41,8 +42,9 @@ namespace Epd3Base { const WORD MaxDevices = 10; WORD DeviceCount = 0; DWORD DeviceIDs[10]; - int32_t StepReturnValues[MaxSteps][3]; + int32_t StepReturnValues[MaxSteps][4]; int CurrentStep; + BYTE HasStepError = 0; WORD WriteConfig32 = 1; @@ -71,9 +73,8 @@ namespace Epd3Base { Epd3U(int _comport); ~Epd3U(); DWORD StartCom(); - void EndCom(void); + void EndCom(bool doDiscon); int StartDiscover(int tokentimeout); - //OperatingStatus @@ -287,9 +288,10 @@ namespace Epd3Base { void decodePeakRates(int count); public: - void SetFunctionReturnValue(eFunctions f); + void SetFunctionReturnValue(eFunctions f, BYTE CanIgnore); void SetCommitReturnValue(int rv); - void SetEndReturnValue(int rv); + uint32_t SetEndReturnValue(int rv); + int32_t CommitAndSetRV(); int32_t CommitAndEnd2RV(int32_t (WINAPI *endFunction2)(CommsHandle hComms, CompletionToken token), CompletionToken token); int GetAll(bool Closeconnection); diff --git a/EpdBaseClr/EpdBaseClr.cpp b/EpdBaseClr/EpdBaseClr.cpp index c825b87..66de5c9 100644 --- a/EpdBaseClr/EpdBaseClr.cpp +++ b/EpdBaseClr/EpdBaseClr.cpp @@ -2,6 +2,10 @@ #include "EpdBaseClr.h" #pragma managed +bool EpdBaseClr::Epd2::HasStepError() +{ + return (bool)epd3->HasStepError; +} int EpdBaseClr::Epd2::GetSteps() { int nsteps = (int)epd3->CurrentStep + 1; @@ -47,7 +51,7 @@ EpdBaseClr::Epd2::~Epd2() epd = nullptr; } if (epd3 != nullptr) { - epd3->EndCom(); + epd3->EndCom(true); delete epd3; epd3 = nullptr; } @@ -96,7 +100,7 @@ int EpdBaseClr::Epd2::Close() { EpdID= 0; if (epd != nullptr) epd->EndCom(); - if (epd3 != nullptr) epd3->EndCom(); + if (epd3 != nullptr) epd3->EndCom(true); return 0; } int EpdBaseClr::Epd2::DecodeStatus(Epd3Base::Epd3U* epd) @@ -827,7 +831,7 @@ int EpdBaseClr::Epd2::SwitchCon() } else { if (epd->CommsInitialized == 0) { - epd3->EndCom(); + epd3->EndCom(epd3->isConnected); Sleep(500); rv = epd->StartCom(); //0=ok if (!rv) rv = epd->Open(EpdID); diff --git a/EpdBaseClr/EpdBaseClr.h b/EpdBaseClr/EpdBaseClr.h index cbfff4d..043e80d 100644 --- a/EpdBaseClr/EpdBaseClr.h +++ b/EpdBaseClr/EpdBaseClr.h @@ -353,6 +353,7 @@ namespace EpdBaseClr { int IssueAndCheck(float gain, float ChirpRate, bool WriteConfig); int GetSteps(); + bool HasStepError(); private: int AfterGetStatus(EpdBase::Epd2U* epd); diff --git a/TestEPD3Dll/Program.cs b/TestEPD3Dll/Program.cs index b914c5a..dec6c47 100644 --- a/TestEPD3Dll/Program.cs +++ b/TestEPD3Dll/Program.cs @@ -19,7 +19,7 @@ namespace TestEPD3Dll #pragma warning disable CS0168 // The variable 'rv' is declared but never used int rv; #pragma warning restore CS0168 // The variable 'rv' is declared but never used - MK3.Epd2 x = new MK3.Epd2(7); + MK3.Epd2 x = new MK3.Epd2(3); x.Connect(false); x.ECIn = System.Security.Cryptography.SHA256.Create().ComputeHash(System.Text.Encoding.UTF8.GetBytes("Administrator")); diff --git a/eDosStation/DecodeResults.cs b/eDosStation/DecodeResults.cs index bad417e..25067ce 100644 --- a/eDosStation/DecodeResults.cs +++ b/eDosStation/DecodeResults.cs @@ -44,7 +44,7 @@ namespace eDosStation "WriteChirpEnable_R3","WriteRTC_R3","ReadStatus","ReadEpdIdentities","ReadCounts","ReadWearerId","ReadRTC" ,"DestroyReaderInterface" //0=ok ,"Disconnect" , "DisconnectAndNotify" //0=ok - ,"StartDiscover" + ,"StartDiscover","IssueEPD","EnableProtectedSession_R3" }; private static string GetName(int func) diff --git a/eDosStation/EntryBadge.xaml b/eDosStation/EntryBadge.xaml index 3189dc0..0dd90de 100644 --- a/eDosStation/EntryBadge.xaml +++ b/eDosStation/EntryBadge.xaml @@ -14,6 +14,13 @@ +