Program Listing for File DInput5Relay2Module.hpp
↰ Return to documentation for file (doc/include/DInput5Relay2Module.hpp
)
/****************************************************************************
* @defgroup PackageName Modules
* @file DInput5Relay2Module.hpp
* @brief
* @author info@pickdata.net
***************************************************************************/
#ifndef DINPUT5RELAY2_MODULE_HPP_
#define DINPUT5RELAY2_MODULE_HPP_
#include "DInput5Relay2Module.h"
#include "Module.hpp"
// Forward declaration
class RelayFunctions;
class DigitalInputFunctions;
class DInput5Relay2Module : public Module {
friend class DInput5Relay2Napi;
protected:
RelayFunctions* relays;
DigitalInputFunctions* digitalInputs;
EmodRet initFunctions();
// Needed for bindings
uint8_t getFunctsOffsetIdDI();
uint8_t getInputFunctsOffsetIdDI();
public:
// Constants
static constexpr uint16_t kDigitalInput1 = DInput5Relay2Module_INPUT01;
static constexpr uint16_t kDigitalInput2 = DInput5Relay2Module_INPUT02;
static constexpr uint16_t kDigitalInput3 = DInput5Relay2Module_INPUT03;
static constexpr uint16_t kDigitalInput4 = DInput5Relay2Module_INPUT04;
static constexpr uint16_t kDigitalInput5 = DInput5Relay2Module_INPUT05;
static constexpr uint16_t kDigitalInputAll = DInput5Relay2Module_ALL_INPUT;
static constexpr uint8_t kRelay1 = DInput5Relay2Module_RELAY1;
static constexpr uint8_t kRelay2 = DInput5Relay2Module_RELAY2;
static constexpr uint8_t kRelayAll = DInput5Relay2Module_ALL_RELAY;
static constexpr uint8_t kNumberOfDigitalInputs = DInput5Relay2Module_NUMBER_OF_DI_INPUTS;
static constexpr uint8_t kNumberOfRelays = DInput5Relay2Module_NUMBER_OF_RELAYS;
static constexpr uint32_t kPretriggeredTimeMode = DInput5Relay2Module_MODE_PRETRIGGER_TIME;
static constexpr uint32_t kPulseCounterMode = DInput5Relay2Module_MODE_PULSE_COUNTER;
static constexpr uint32_t kWidthCounterMode = DInput5Relay2Module_MODE_WIDTH_COUNTER;
static constexpr uint8_t kIdFunctionInputs = DInput5Relay2Module_idFunctionINPUTS;
static constexpr uint8_t kIdFunctionCounter1 = DInput5Relay2Module_idFunctionCOUNTER01;
static constexpr uint8_t kIdFunctionCounter2 = DInput5Relay2Module_idFunctionCOUNTER02;
static constexpr uint8_t kIdFunctionCounter3 = DInput5Relay2Module_idFunctionCOUNTER03;
static constexpr uint8_t kIdFunctionCounter4 = DInput5Relay2Module_idFunctionCOUNTER04;
static constexpr uint8_t kIdFunctionCounter5 = DInput5Relay2Module_idFunctionCOUNTER05;
// Constructor, destructor and init methods
DInput5Relay2Module();
~DInput5Relay2Module();
EmodRet init(const DInput5Relay2ModuleCallback_Type callback_func = nullptr, void* const callback_context = nullptr, const uint8_t variant = 1);
EmodRet init(const uint8_t variant);
// DI methods
EmodRet getStatus(const uint16_t input_mask, uint8_t* status, bool* new_data = nullptr);
EmodRet getAllStatus(uint8_t status[kNumberOfDigitalInputs], bool* new_data = nullptr);
EmodRet setPulseFilterTime(const uint16_t input_mask, const uint32_t ms_time);
EmodRet setAllPulseFilterTime(const uint32_t ms_time);
EmodRet getPulseFilterTime(const uint16_t input_mask, uint32_t* ms_time);
EmodRet getAllPulseFilterTime(uint32_t ms_times[kNumberOfDigitalInputs]);
EmodRet getPulseCount(const uint16_t input_mask, uint32_t* count);
EmodRet getAllPulseCount(uint32_t counts[kNumberOfDigitalInputs]);
EmodRet resetPulseCount(const uint16_t input_mask);
EmodRet resetAllPulseCount();
EmodRet getPulseWidth(const uint16_t input_mask, uint32_t* width);
EmodRet getAllPulseWidth(uint32_t widths[kNumberOfDigitalInputs]);
// Relays methods
EmodRet configPulseWidth(const uint8_t relay_mask, const uint32_t width_ms);
EmodRet configAllPulseWidth(const uint32_t width_ms);
EmodRet activate(const uint8_t relay_mask);
EmodRet deactivate(const uint8_t relay_mask);
EmodRet activateAll(void);
EmodRet deactivateAll(void);
EmodRet getRelayStatus(const uint8_t relay_mask, uint8_t* status);
EmodRet getAllRelayStatus(uint8_t* status);
// Callback methods
EmodRet configEventAtTimeInterval(const uint32_t time_interval);
EmodRet switchToMode(const uint16_t input_mask, const uint32_t mode);
EmodRet configEventOnNewData(void);
EmodRet configEventOnValueChange(const uint32_t threshold, const uint32_t event_mask = kDigitalInputAll);
EmodRet resetEventConfig(void);
};
#endif // DINPUT5RELAY2_MODULE_HPP_