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