#ifndef __ACREL_DJSF1352RN_H__
#define __ACREL_DJSF1352RN_H__
#include "com_ttySx.h"
#include "modbus_RTU.h"


typedef struct DCMeter
{
    com_ttySx_t tty;

    uint16_t salve;
    float current_V[2];
    float current_I[2];
    float current_P[2];
    float current_E[2];

    pthread_mutex_t mutex;
}DCMeter_t;

int ccu_DCMeter_init(DCMeter_t* dev, const char* devname);

float ccu_DCMeterA_readV(DCMeter_t* dev);
float ccu_DCMeterB_readV(DCMeter_t* dev);

float ccu_DCMeterA_readI(DCMeter_t* dev);
float ccu_DCMeterB_readI(DCMeter_t* dev);

float ccu_DCMeterA_readP(DCMeter_t* dev);
float ccu_DCMeterB_readP(DCMeter_t* dev);

float ccu_DCMeterA_readE(DCMeter_t* dev);
float ccu_DCMeterB_readE(DCMeter_t* dev);

void ccu_DCMeterA_check(DCMeter_t* dev, float* VMeter, float* IMeter, float* PMeter, float* EMeter);
void ccu_DCMeterB_check(DCMeter_t* dev, float* VMeter, float* IMeter, float* PMeter, float* EMeter);

void ccu_DCMeter_exit(DCMeter_t* dev);

#endif//__ACREL_DJSF1352RN_H__
