Program Listing for File EnergyMeter3Module.hpp

Return to documentation for file (doc/include/EnergyMeter3Module.hpp)

#ifndef ENERGYMETER3_MODULE_HPP_
#define ENERGYMETER3_MODULE_HPP_

#include "EnergyMeter3Module.h"
#include "EnergyMeterParameters.hpp"
#include "Module.hpp"

// Forward declaration
class EnergyMeterFunctions;

class EnergyMeter3Module : public Module {
    friend class EnergyMeter3ModuleNapi;

    ModuleType em3_type_;

protected:
    EnergyMeterFunctions* energy_meter;
    EmodRet initFunctions();
    EnergyMeter3ModuleCookedCallback_Type cooked_callback_func_;
    void* callback_ctx_;
    static void cookedCallback(const uint8_t* data, const uint16_t data_len, const uint8_t id_function, void* ctx);

public:
    EnergyMeter3Module();
    ~EnergyMeter3Module();

    EmodRet init(const ModuleType em3_type = ModuleType::typeEM3, const EnergyMeter3ModuleCallback_Type callback_func = nullptr,
                 void* const callback_context = nullptr, const uint8_t variant = 1);
    EmodRet init(const ModuleType em3_type, const EnergyMeter3ModuleCookedCallback_Type callback_func, void* const callback_context, const uint8_t variant);

    EmodRet init(const uint8_t variant);

    EmodRet configCurrentFullScale(const float full_current_L1, const float full_current_L2, const float full_current_L3);

    EmodRet configVoltageFullScale(const float full_voltage_L1, const float full_voltage_L2, const float full_voltage_L3);

    EmodRet configSecondaryVoltageFullScale(const float full_voltage_L1, const float full_voltage_L2, const float full_voltage_L3);

    EmodRet configCurrentDirection(const bool current_direction_L1, const bool current_direction_L2, const bool current_direction_L3);

    EmodRet configWorkMode(const uint16_t mode);

    EmodRet configMeteringStandard(const uint16_t standard);

    EmodRet resetAllEnergyMeter(void);

    EmodRet getCurrentFullScale(float* full_current_L1, float* full_current_L2, float* full_current_L3);

    EmodRet getVoltageFullScale(float* full_voltage_L1, float* full_voltage_L2, float* full_voltage_L3);

    EmodRet getSecondaryVoltageFullScale(float* full_voltage_L1, float* full_voltage_L2, float* full_voltage_L3);

    EmodRet getCurrentDirection(bool* current_direction_L1, bool* current_direction_L2, bool* current_direction_L3);

    EmodRet getWorkMode(uint16_t* mode);

    EmodRet getMeteringStandard(uint16_t* standard);

    EmodRet getPowerParameters(const int32_t phase, PhasePowerParameters* parameters);

    EmodRet getEnergyParameters(const int32_t phase, EnergyParameters* parameters);

    [[deprecated]] EmodRet getPowerParameters_L1(PhasePowerParameters* parameters);

    [[deprecated]] EmodRet getPowerParameters_L2(PhasePowerParameters* parameters);

    [[deprecated]] EmodRet getPowerParameters_L3(PhasePowerParameters* parameters);

    EmodRet getPowerParameters_L123Combined(CombinedPowerParameters* parameters);

    [[deprecated]] EmodRet getEnergyParameters_L1(EnergyParameters* parameters);

    [[deprecated]] EmodRet getEnergyParameters_L2(EnergyParameters* parameters);

    [[deprecated]] EmodRet getEnergyParameters_L3(EnergyParameters* parameters);

    EmodRet getEnergyParameters_L123Combined(EnergyParameters* parameters);

    // Callback methods

    EmodRet configEventAtTimeInterval(const uint32_t time_interval);

    EmodRet resetEventConfig(void);
};

#endif  // ENERGYMETER3_MODULE_HPP_