package meterControl

import "time"

type IMeterControl interface {
	IReadMeter
	IWriteMeter
}
type IReadMeter interface {
	// 获取电表上年份
	ReadYear(commUid string, addr byte) (int, error)
	ReadMonth(commUid string, addr byte) (int, error)
	ReadDay(commUid string, addr byte) (int, error)
	ReadHour(commUid string, addr byte) (int, error)
	ReadMinute(commUid string, addr byte) (int, error)
	ReadSecond(commUid string, addr byte) (int, error)
	ReadTime(commUid string, addr byte) (time.Time, error)
	// ReadVoltage  读取电压  []float64 总电压,1相,2相,3相....
	ReadVoltage(commUid string, addr byte) (totalVoltage, aVoltage, bVoltage, cVoltage float64, err error)
	// ReadElectricCurrent  读取电流  []float64 总电流,1相,2相,3相....
	ReadElectricCurrent(commUid string, addr byte) (totalElectricCurrent, aElectricCurrent, bElectricCurrent, cElectricCurrent float64, err error)
	// ReadPower  读取功率  []float64 总功率,1相,2相,3相....
	ReadPower(commUid string, addr byte) (totalPower, aPower, bPower, cPower float64, err error)
	// ReadTotalPower 读取当前总功率
	ReadTotalPower(commUid string, addr byte) (totalPower float64, err error)
	// ReadEnergy  读取功率  []float64 总电能,1相,2相,3相....
	ReadEnergy(commUid string, addr byte) (totalEnergy, aEnergy, bEnergy, cEnergy float64, err error)
	// ReadPowerFactor 读取功率因数  []float64 总功率因数,1相,2相,3相....
	ReadPowerFactor(commUid string, addr byte) (totalPf, aPf, bPf, cPf float64, err error)
	// ReadMsgAddr 读取通信地址
	ReadMsgAddr(commUid string, addr byte) (byte, error)
	// ReadMainAddr 读取主控地址
	ReadMainAddr(commUid string, addr byte) (byte, error)
	// ReadDailyFreezingTime 读取日冻结时间
	ReadDailyFreezingTime(commUid string, addr byte) (string, error)
	// ReadMonthlyFreezingTime 读取月冻结时间
	ReadMonthlyFreezingTime(commUid string, addr byte) (day, hour string, err error)
}
type IWriteMeter interface {
	// 获取电表上年份
	WriteYear(commUid string, addr byte, year int) error
	WriteMonth(commUid string, addr byte, month int) error
	WriteDay(commUid string, addr byte, day int) error
	WriteHour(commUid string, addr byte, hour int) error
	WriteMinute(commUid string, addr byte, minute int) error
	WriteSecond(commUid string, addr byte, second int) error
	WriteTime(commUid string, addr byte, t time.Time) error
	WriteMsgAddr(commUid string, addr byte, newAddr byte) error
}
