kopia lustrzana https://github.com/weetmuts/wmbusmeters
Refactor.
rodzic
7e11dc8174
commit
f058fb2501
|
@ -53,7 +53,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
|
|
||||||
MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption",
|
"total_energy_consumption",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -68,7 +68,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
SET_FUNC(total_energy_consumption_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_consumption_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_consumption_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_consumption_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"current_power_consumption",
|
"current_power_consumption",
|
||||||
Quantity::Power,
|
Quantity::Power,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -83,7 +83,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
SET_FUNC(current_power_consumption_kw_, Unit::KW),
|
SET_FUNC(current_power_consumption_kw_, Unit::KW),
|
||||||
GET_FUNC(current_power_consumption_kw_, Unit::KW));
|
GET_FUNC(current_power_consumption_kw_, Unit::KW));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_production",
|
"total_energy_production",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
DifVifKey("0E833C"),
|
DifVifKey("0E833C"),
|
||||||
|
@ -98,7 +98,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
SET_FUNC(total_energy_production_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_production_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_production_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_production_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"current_power_production",
|
"current_power_production",
|
||||||
Quantity::Power,
|
Quantity::Power,
|
||||||
DifVifKey("0BAB3C"),
|
DifVifKey("0BAB3C"),
|
||||||
|
@ -113,7 +113,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
SET_FUNC(current_power_production_kw_, Unit::KW),
|
SET_FUNC(current_power_production_kw_, Unit::KW),
|
||||||
GET_FUNC(current_power_production_kw_, Unit::KW));
|
GET_FUNC(current_power_production_kw_, Unit::KW));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"voltage_at_phase_1",
|
"voltage_at_phase_1",
|
||||||
Quantity::Voltage,
|
Quantity::Voltage,
|
||||||
DifVifKey("0AFDC9FC01"),
|
DifVifKey("0AFDC9FC01"),
|
||||||
|
@ -128,7 +128,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
SET_FUNC(phase_1_v_, Unit::Volt),
|
SET_FUNC(phase_1_v_, Unit::Volt),
|
||||||
GET_FUNC(phase_1_v_, Unit::Volt));
|
GET_FUNC(phase_1_v_, Unit::Volt));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"voltage_at_phase_2",
|
"voltage_at_phase_2",
|
||||||
Quantity::Voltage,
|
Quantity::Voltage,
|
||||||
DifVifKey("0AFDC9FC02"),
|
DifVifKey("0AFDC9FC02"),
|
||||||
|
@ -143,7 +143,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
SET_FUNC(phase_2_v_, Unit::Volt),
|
SET_FUNC(phase_2_v_, Unit::Volt),
|
||||||
GET_FUNC(phase_2_v_, Unit::Volt));
|
GET_FUNC(phase_2_v_, Unit::Volt));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"voltage_at_phase_3",
|
"voltage_at_phase_3",
|
||||||
Quantity::Voltage,
|
Quantity::Voltage,
|
||||||
DifVifKey("0AFDC9FC03"),
|
DifVifKey("0AFDC9FC03"),
|
||||||
|
@ -172,7 +172,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
SET_STRING_FUNC(device_date_time_),
|
SET_STRING_FUNC(device_date_time_),
|
||||||
GET_STRING_FUNC(device_date_time_));
|
GET_STRING_FUNC(device_date_time_));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption_tariff_1",
|
"total_energy_consumption_tariff_1",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
DifVifKey("8E1003"),
|
DifVifKey("8E1003"),
|
||||||
|
@ -187,7 +187,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
SET_FUNC(total_energy_consumption_tariff_1_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_consumption_tariff_1_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_consumption_tariff_1_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_consumption_tariff_1_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption_tariff_2",
|
"total_energy_consumption_tariff_2",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
DifVifKey("8E2003"),
|
DifVifKey("8E2003"),
|
||||||
|
@ -203,7 +203,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
GET_FUNC(total_energy_consumption_tariff_2_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_consumption_tariff_2_kwh_, Unit::KWH));
|
||||||
|
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption_tariff_3",
|
"total_energy_consumption_tariff_3",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
DifVifKey("8E3003"),
|
DifVifKey("8E3003"),
|
||||||
|
@ -218,7 +218,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
SET_FUNC(total_energy_consumption_tariff_3_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_consumption_tariff_3_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_consumption_tariff_3_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_consumption_tariff_3_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_production_tariff_1",
|
"total_energy_production_tariff_1",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
DifVifKey("8E10833C"),
|
DifVifKey("8E10833C"),
|
||||||
|
@ -234,7 +234,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
GET_FUNC(total_energy_production_tariff_1_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_production_tariff_1_kwh_, Unit::KWH));
|
||||||
|
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_production_tariff_2",
|
"total_energy_production_tariff_2",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
DifVifKey("8E20833C"),
|
DifVifKey("8E20833C"),
|
||||||
|
@ -250,7 +250,7 @@ MeterAmiplus::MeterAmiplus(MeterInfo &mi, DriverInfo &di) : MeterCommonImplement
|
||||||
GET_FUNC(total_energy_production_tariff_2_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_production_tariff_2_kwh_, Unit::KWH));
|
||||||
|
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_production_tariff_3",
|
"total_energy_production_tariff_3",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
DifVifKey("8E30833C"),
|
DifVifKey("8E30833C"),
|
||||||
|
|
|
@ -42,7 +42,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
|
|
||||||
MeterApator08::MeterApator08(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
MeterApator08::MeterApator08(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addField(
|
addNumericField(
|
||||||
"total",
|
"total",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT,
|
PrintProperty::JSON | PrintProperty::FIELD | PrintProperty::IMPORTANT,
|
||||||
|
|
|
@ -40,7 +40,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
|
|
||||||
MeterAventiesHCA::MeterAventiesHCA(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
MeterAventiesHCA::MeterAventiesHCA(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"current_consumption",
|
"current_consumption",
|
||||||
Quantity::HCA,
|
Quantity::HCA,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -55,7 +55,7 @@ MeterAventiesHCA::MeterAventiesHCA(MeterInfo &mi, DriverInfo &di) : MeterCommonI
|
||||||
SET_FUNC(current_consumption_hca_, Unit::HCA),
|
SET_FUNC(current_consumption_hca_, Unit::HCA),
|
||||||
GET_FUNC(current_consumption_hca_, Unit::HCA));
|
GET_FUNC(current_consumption_hca_, Unit::HCA));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"consumption_at_set_date",
|
"consumption_at_set_date",
|
||||||
Quantity::HCA,
|
Quantity::HCA,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -76,7 +76,7 @@ MeterAventiesHCA::MeterAventiesHCA(MeterInfo &mi, DriverInfo &di) : MeterCommonI
|
||||||
strprintf(key, "consumption_at_set_date_%d", i);
|
strprintf(key, "consumption_at_set_date_%d", i);
|
||||||
strprintf(info, "Heat cost allocation at the %d billing period date.", i);
|
strprintf(info, "Heat cost allocation at the %d billing period date.", i);
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
key,
|
key,
|
||||||
Quantity::HCA,
|
Quantity::HCA,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -43,7 +43,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
MeterAventiesWM::MeterAventiesWM(MeterInfo &mi, DriverInfo &di) :
|
MeterAventiesWM::MeterAventiesWM(MeterInfo &mi, DriverInfo &di) :
|
||||||
MeterCommonImplementation(mi, di)
|
MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total",
|
"total",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -63,7 +63,7 @@ MeterAventiesWM::MeterAventiesWM(MeterInfo &mi, DriverInfo &di) :
|
||||||
string msg, info;
|
string msg, info;
|
||||||
strprintf(msg, "consumption_at_set_date_%d", i);
|
strprintf(msg, "consumption_at_set_date_%d", i);
|
||||||
strprintf(info, "Water consumption at the %d billing period date.", i);
|
strprintf(info, "Water consumption at the %d billing period date.", i);
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
msg,
|
msg,
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -70,7 +70,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
{
|
{
|
||||||
// Fields common for T1A1, T1A2, T1B...........
|
// Fields common for T1A1, T1A2, T1B...........
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption",
|
"total_energy_consumption",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
FIND_FIELD(MeasurementType::Instantaneous, VIFRange::EnergyWh),
|
FIND_FIELD(MeasurementType::Instantaneous, VIFRange::EnergyWh),
|
||||||
|
@ -79,7 +79,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
SET_FUNC(total_energy_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_volume",
|
"total_volume",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
FIND_FIELD(MeasurementType::Instantaneous, VIFRange::Volume),
|
FIND_FIELD(MeasurementType::Instantaneous, VIFRange::Volume),
|
||||||
|
@ -152,7 +152,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
|
|
||||||
for (int i=0; i<14; ++i)
|
for (int i=0; i<14; ++i)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
tostrprintf("prev_%d_month", i+1),
|
tostrprintf("prev_%d_month", i+1),
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
FIND_FIELD_S(MeasurementType::Instantaneous, VIFRange::EnergyWh, StorageNr(32+i)),
|
FIND_FIELD_S(MeasurementType::Instantaneous, VIFRange::EnergyWh, StorageNr(32+i)),
|
||||||
|
@ -166,7 +166,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
|
|
||||||
for (int i=0; i<14; ++i)
|
for (int i=0; i<14; ++i)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
tostrprintf("prev_%d_month", i+1),
|
tostrprintf("prev_%d_month", i+1),
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
FIND_FIELD_S(MeasurementType::Instantaneous, VIFRange::Volume, StorageNr(32+i)),
|
FIND_FIELD_S(MeasurementType::Instantaneous, VIFRange::Volume, StorageNr(32+i)),
|
||||||
|
@ -178,7 +178,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
|
|
||||||
// Telegram type T1B ///////////////////////////////////////////////////////
|
// Telegram type T1B ///////////////////////////////////////////////////////
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"due_energy_consumption",
|
"due_energy_consumption",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
FIND_FIELD_S(MeasurementType::Instantaneous, VIFRange::EnergyWh, StorageNr(8)),
|
FIND_FIELD_S(MeasurementType::Instantaneous, VIFRange::EnergyWh, StorageNr(8)),
|
||||||
|
@ -196,7 +196,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
SET_STRING_FUNC(due_date_),
|
SET_STRING_FUNC(due_date_),
|
||||||
GET_STRING_FUNC(due_date_));
|
GET_STRING_FUNC(due_date_));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"volume_flow",
|
"volume_flow",
|
||||||
Quantity::Flow,
|
Quantity::Flow,
|
||||||
FIND_FIELD(MeasurementType::Instantaneous, VIFRange::VolumeFlow),
|
FIND_FIELD(MeasurementType::Instantaneous, VIFRange::VolumeFlow),
|
||||||
|
@ -205,7 +205,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
SET_FUNC(volume_flow_m3h_, Unit::M3H),
|
SET_FUNC(volume_flow_m3h_, Unit::M3H),
|
||||||
GET_FUNC(volume_flow_m3h_, Unit::M3H));
|
GET_FUNC(volume_flow_m3h_, Unit::M3H));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"power",
|
"power",
|
||||||
Quantity::Power,
|
Quantity::Power,
|
||||||
FIND_FIELD(MeasurementType::Instantaneous, VIFRange::PowerW),
|
FIND_FIELD(MeasurementType::Instantaneous, VIFRange::PowerW),
|
||||||
|
@ -214,7 +214,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
SET_FUNC(power_kw_, Unit::KW),
|
SET_FUNC(power_kw_, Unit::KW),
|
||||||
GET_FUNC(power_kw_, Unit::KW));
|
GET_FUNC(power_kw_, Unit::KW));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption_last_month",
|
"total_energy_consumption_last_month",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
FIND_FIELD_S(MeasurementType::Instantaneous, VIFRange::EnergyWh, StorageNr(32)),
|
FIND_FIELD_S(MeasurementType::Instantaneous, VIFRange::EnergyWh, StorageNr(32)),
|
||||||
|
@ -232,7 +232,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
SET_STRING_FUNC(last_month_date_),
|
SET_STRING_FUNC(last_month_date_),
|
||||||
GET_STRING_FUNC(last_month_date_));
|
GET_STRING_FUNC(last_month_date_));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"max_power_last_month",
|
"max_power_last_month",
|
||||||
Quantity::Power,
|
Quantity::Power,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -247,7 +247,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
SET_FUNC(max_power_last_month_kw_, Unit::KW),
|
SET_FUNC(max_power_last_month_kw_, Unit::KW),
|
||||||
GET_FUNC(max_power_last_month_kw_, Unit::KW));
|
GET_FUNC(max_power_last_month_kw_, Unit::KW));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"flow_temperature",
|
"flow_temperature",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -262,7 +262,7 @@ MeterC5isf::MeterC5isf(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
SET_FUNC(flow_temperature_c_, Unit::C),
|
SET_FUNC(flow_temperature_c_, Unit::C),
|
||||||
GET_FUNC(flow_temperature_c_, Unit::C));
|
GET_FUNC(flow_temperature_c_, Unit::C));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"return_temperature",
|
"return_temperature",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -53,7 +53,7 @@ MeterIperl::MeterIperl(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
// version 0x68
|
// version 0x68
|
||||||
// version 0x7c Sensus 640
|
// version 0x7c Sensus 640
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total",
|
"total",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -68,7 +68,7 @@ MeterIperl::MeterIperl(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
SET_FUNC(total_water_consumption_m3_, Unit::M3),
|
SET_FUNC(total_water_consumption_m3_, Unit::M3),
|
||||||
GET_FUNC(total_water_consumption_m3_, Unit::M3));
|
GET_FUNC(total_water_consumption_m3_, Unit::M3));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"max_flow",
|
"max_flow",
|
||||||
Quantity::Flow,
|
Quantity::Flow,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -52,7 +52,7 @@ MeterItron::MeterItron(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
|
|
||||||
addLinkMode(LinkMode::T1);
|
addLinkMode(LinkMode::T1);
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total",
|
"total",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -81,7 +81,7 @@ MeterItron::MeterItron(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementatio
|
||||||
SET_STRING_FUNC(meter_date_),
|
SET_STRING_FUNC(meter_date_),
|
||||||
GET_STRING_FUNC(meter_date_));
|
GET_STRING_FUNC(meter_date_));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"target",
|
"target",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -51,7 +51,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
MeterLSE_07_17::MeterLSE_07_17(MeterInfo &mi, DriverInfo &di) :
|
MeterLSE_07_17::MeterLSE_07_17(MeterInfo &mi, DriverInfo &di) :
|
||||||
MeterCommonImplementation(mi, di)
|
MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total",
|
"total",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -66,7 +66,7 @@ MeterLSE_07_17::MeterLSE_07_17(MeterInfo &mi, DriverInfo &di) :
|
||||||
SET_FUNC(total_water_consumption_m3_, Unit::M3),
|
SET_FUNC(total_water_consumption_m3_, Unit::M3),
|
||||||
GET_FUNC(total_water_consumption_m3_, Unit::M3));
|
GET_FUNC(total_water_consumption_m3_, Unit::M3));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"due_date",
|
"due_date",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -47,7 +47,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
|
|
||||||
MeterMicroClima::MeterMicroClima(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
MeterMicroClima::MeterMicroClima(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption",
|
"total_energy_consumption",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -62,7 +62,7 @@ MeterMicroClima::MeterMicroClima(MeterInfo &mi, DriverInfo &di) : MeterCommonImp
|
||||||
SET_FUNC(total_energy_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption_tariff1",
|
"total_energy_consumption_tariff1",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -77,7 +77,7 @@ MeterMicroClima::MeterMicroClima(MeterInfo &mi, DriverInfo &di) : MeterCommonImp
|
||||||
SET_FUNC(total_energy_tariff1_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_tariff1_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_tariff1_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_tariff1_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_volume",
|
"total_volume",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -92,7 +92,7 @@ MeterMicroClima::MeterMicroClima(MeterInfo &mi, DriverInfo &di) : MeterCommonImp
|
||||||
SET_FUNC(total_volume_m3_, Unit::M3),
|
SET_FUNC(total_volume_m3_, Unit::M3),
|
||||||
GET_FUNC(total_volume_m3_, Unit::M3));
|
GET_FUNC(total_volume_m3_, Unit::M3));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_volume_tariff2",
|
"total_volume_tariff2",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -107,7 +107,7 @@ MeterMicroClima::MeterMicroClima(MeterInfo &mi, DriverInfo &di) : MeterCommonImp
|
||||||
SET_FUNC(total_volume_tariff2_m3_, Unit::M3),
|
SET_FUNC(total_volume_tariff2_m3_, Unit::M3),
|
||||||
GET_FUNC(total_volume_tariff2_m3_, Unit::M3));
|
GET_FUNC(total_volume_tariff2_m3_, Unit::M3));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"volume_flow",
|
"volume_flow",
|
||||||
Quantity::Flow,
|
Quantity::Flow,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -122,7 +122,7 @@ MeterMicroClima::MeterMicroClima(MeterInfo &mi, DriverInfo &di) : MeterCommonImp
|
||||||
SET_FUNC(volume_flow_m3h_, Unit::M3H),
|
SET_FUNC(volume_flow_m3h_, Unit::M3H),
|
||||||
GET_FUNC(volume_flow_m3h_, Unit::M3H));
|
GET_FUNC(volume_flow_m3h_, Unit::M3H));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"power",
|
"power",
|
||||||
Quantity::Power,
|
Quantity::Power,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -137,7 +137,7 @@ MeterMicroClima::MeterMicroClima(MeterInfo &mi, DriverInfo &di) : MeterCommonImp
|
||||||
SET_FUNC(power_kw_, Unit::KW),
|
SET_FUNC(power_kw_, Unit::KW),
|
||||||
GET_FUNC(power_kw_, Unit::KW));
|
GET_FUNC(power_kw_, Unit::KW));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"flow_temperature",
|
"flow_temperature",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -152,7 +152,7 @@ MeterMicroClima::MeterMicroClima(MeterInfo &mi, DriverInfo &di) : MeterCommonImp
|
||||||
SET_FUNC(flow_temperature_c_, Unit::C),
|
SET_FUNC(flow_temperature_c_, Unit::C),
|
||||||
GET_FUNC(flow_temperature_c_, Unit::C));
|
GET_FUNC(flow_temperature_c_, Unit::C));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"return_temperature",
|
"return_temperature",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -167,7 +167,7 @@ MeterMicroClima::MeterMicroClima(MeterInfo &mi, DriverInfo &di) : MeterCommonImp
|
||||||
SET_FUNC(return_temperature_c_, Unit::C),
|
SET_FUNC(return_temperature_c_, Unit::C),
|
||||||
GET_FUNC(return_temperature_c_, Unit::C));
|
GET_FUNC(return_temperature_c_, Unit::C));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"temperature_difference",
|
"temperature_difference",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -43,7 +43,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
|
|
||||||
MeterMinomess::MeterMinomess(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
MeterMinomess::MeterMinomess(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total",
|
"total",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -75,7 +75,7 @@ MeterMinomess::MeterMinomess(MeterInfo &mi, DriverInfo &di) : MeterCommonImpleme
|
||||||
SET_STRING_FUNC(meter_date_),
|
SET_STRING_FUNC(meter_date_),
|
||||||
GET_STRING_FUNC(meter_date_));
|
GET_STRING_FUNC(meter_date_));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"target",
|
"target",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -45,7 +45,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
MeterPIIGTH::MeterPIIGTH(MeterInfo &mi, DriverInfo &di) :
|
MeterPIIGTH::MeterPIIGTH(MeterInfo &mi, DriverInfo &di) :
|
||||||
MeterCommonImplementation(mi, di)
|
MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"temperature",
|
"temperature",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -60,7 +60,7 @@ MeterPIIGTH::MeterPIIGTH(MeterInfo &mi, DriverInfo &di) :
|
||||||
SET_FUNC(temperature_c_, Unit::C),
|
SET_FUNC(temperature_c_, Unit::C),
|
||||||
GET_FUNC(temperature_c_, Unit::C));
|
GET_FUNC(temperature_c_, Unit::C));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"average_temperature_1h",
|
"average_temperature_1h",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -75,7 +75,7 @@ MeterPIIGTH::MeterPIIGTH(MeterInfo &mi, DriverInfo &di) :
|
||||||
SET_FUNC(average_temperature_1h_c_, Unit::C),
|
SET_FUNC(average_temperature_1h_c_, Unit::C),
|
||||||
GET_FUNC(average_temperature_1h_c_, Unit::C));
|
GET_FUNC(average_temperature_1h_c_, Unit::C));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"average_temperature_24h",
|
"average_temperature_24h",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -91,7 +91,7 @@ MeterPIIGTH::MeterPIIGTH(MeterInfo &mi, DriverInfo &di) :
|
||||||
GET_FUNC(average_temperature_24h_c_, Unit::C));
|
GET_FUNC(average_temperature_24h_c_, Unit::C));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"relative_humidity",
|
"relative_humidity",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
DifVifKey("02FB1A"),
|
DifVifKey("02FB1A"),
|
||||||
|
|
|
@ -52,7 +52,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
MeterQWater::MeterQWater(MeterInfo &mi, DriverInfo &di) :
|
MeterQWater::MeterQWater(MeterInfo &mi, DriverInfo &di) :
|
||||||
MeterCommonImplementation(mi, di)
|
MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total",
|
"total",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -67,7 +67,7 @@ MeterQWater::MeterQWater(MeterInfo &mi, DriverInfo &di) :
|
||||||
SET_FUNC(total_water_consumption_m3_, Unit::M3),
|
SET_FUNC(total_water_consumption_m3_, Unit::M3),
|
||||||
GET_FUNC(total_water_consumption_m3_, Unit::M3));
|
GET_FUNC(total_water_consumption_m3_, Unit::M3));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"due_date",
|
"due_date",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -96,7 +96,7 @@ MeterQWater::MeterQWater(MeterInfo &mi, DriverInfo &di) :
|
||||||
SET_STRING_FUNC(due_date_),
|
SET_STRING_FUNC(due_date_),
|
||||||
GET_STRING_FUNC(due_date_));
|
GET_STRING_FUNC(due_date_));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"due_date_17",
|
"due_date_17",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -46,7 +46,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
|
|
||||||
MeterSharky::MeterSharky(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
MeterSharky::MeterSharky(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption",
|
"total_energy_consumption",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -61,7 +61,7 @@ MeterSharky::MeterSharky(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementat
|
||||||
SET_FUNC(total_energy_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption_tariff1",
|
"total_energy_consumption_tariff1",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -76,7 +76,7 @@ MeterSharky::MeterSharky(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementat
|
||||||
SET_FUNC(total_energy_tariff1_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_tariff1_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_tariff1_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_tariff1_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_volume",
|
"total_volume",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -91,7 +91,7 @@ MeterSharky::MeterSharky(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementat
|
||||||
SET_FUNC(total_volume_m3_, Unit::M3),
|
SET_FUNC(total_volume_m3_, Unit::M3),
|
||||||
GET_FUNC(total_volume_m3_, Unit::M3));
|
GET_FUNC(total_volume_m3_, Unit::M3));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_volume_tariff2",
|
"total_volume_tariff2",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -106,7 +106,7 @@ MeterSharky::MeterSharky(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementat
|
||||||
SET_FUNC(total_volume_tariff2_m3_, Unit::M3),
|
SET_FUNC(total_volume_tariff2_m3_, Unit::M3),
|
||||||
GET_FUNC(total_volume_tariff2_m3_, Unit::M3));
|
GET_FUNC(total_volume_tariff2_m3_, Unit::M3));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"volume_flow",
|
"volume_flow",
|
||||||
Quantity::Flow,
|
Quantity::Flow,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -121,7 +121,7 @@ MeterSharky::MeterSharky(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementat
|
||||||
SET_FUNC(volume_flow_m3h_, Unit::M3H),
|
SET_FUNC(volume_flow_m3h_, Unit::M3H),
|
||||||
GET_FUNC(volume_flow_m3h_, Unit::M3H));
|
GET_FUNC(volume_flow_m3h_, Unit::M3H));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"power",
|
"power",
|
||||||
Quantity::Power,
|
Quantity::Power,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -136,7 +136,7 @@ MeterSharky::MeterSharky(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementat
|
||||||
SET_FUNC(power_kw_, Unit::KW),
|
SET_FUNC(power_kw_, Unit::KW),
|
||||||
GET_FUNC(power_kw_, Unit::KW));
|
GET_FUNC(power_kw_, Unit::KW));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"flow_temperature",
|
"flow_temperature",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -151,7 +151,7 @@ MeterSharky::MeterSharky(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementat
|
||||||
SET_FUNC(flow_temperature_c_, Unit::C),
|
SET_FUNC(flow_temperature_c_, Unit::C),
|
||||||
GET_FUNC(flow_temperature_c_, Unit::C));
|
GET_FUNC(flow_temperature_c_, Unit::C));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"return_temperature",
|
"return_temperature",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -166,7 +166,7 @@ MeterSharky::MeterSharky(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementat
|
||||||
SET_FUNC(return_temperature_c_, Unit::C),
|
SET_FUNC(return_temperature_c_, Unit::C),
|
||||||
GET_FUNC(return_temperature_c_, Unit::C));
|
GET_FUNC(return_temperature_c_, Unit::C));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"temperature_difference",
|
"temperature_difference",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -47,7 +47,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
|
|
||||||
MeterSharky774::MeterSharky774(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
MeterSharky774::MeterSharky774(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption",
|
"total_energy_consumption",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -62,7 +62,7 @@ MeterSharky774::MeterSharky774(MeterInfo &mi, DriverInfo &di) : MeterCommonImpl
|
||||||
SET_FUNC(total_energy_consumption_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_consumption_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_consumption_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_consumption_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_volume",
|
"total_volume",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -77,7 +77,7 @@ MeterSharky774::MeterSharky774(MeterInfo &mi, DriverInfo &di) : MeterCommonImpl
|
||||||
SET_FUNC(total_volume_m3_, Unit::M3),
|
SET_FUNC(total_volume_m3_, Unit::M3),
|
||||||
GET_FUNC(total_volume_m3_, Unit::M3));
|
GET_FUNC(total_volume_m3_, Unit::M3));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"volume_flow",
|
"volume_flow",
|
||||||
Quantity::Flow,
|
Quantity::Flow,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -92,7 +92,7 @@ MeterSharky774::MeterSharky774(MeterInfo &mi, DriverInfo &di) : MeterCommonImpl
|
||||||
SET_FUNC(volume_flow_m3h_, Unit::M3H),
|
SET_FUNC(volume_flow_m3h_, Unit::M3H),
|
||||||
GET_FUNC(volume_flow_m3h_, Unit::M3H));
|
GET_FUNC(volume_flow_m3h_, Unit::M3H));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"power",
|
"power",
|
||||||
Quantity::Power,
|
Quantity::Power,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -107,7 +107,7 @@ MeterSharky774::MeterSharky774(MeterInfo &mi, DriverInfo &di) : MeterCommonImpl
|
||||||
SET_FUNC(power_kw_, Unit::KW),
|
SET_FUNC(power_kw_, Unit::KW),
|
||||||
GET_FUNC(power_kw_, Unit::KW));
|
GET_FUNC(power_kw_, Unit::KW));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"flow_temperature",
|
"flow_temperature",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -122,7 +122,7 @@ MeterSharky774::MeterSharky774(MeterInfo &mi, DriverInfo &di) : MeterCommonImpl
|
||||||
SET_FUNC(flow_temperature_c_, Unit::C),
|
SET_FUNC(flow_temperature_c_, Unit::C),
|
||||||
GET_FUNC(flow_temperature_c_, Unit::C));
|
GET_FUNC(flow_temperature_c_, Unit::C));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"return_temperature",
|
"return_temperature",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -137,14 +137,14 @@ MeterSharky774::MeterSharky774(MeterInfo &mi, DriverInfo &di) : MeterCommonImpl
|
||||||
SET_FUNC(return_temperature_c_, Unit::C),
|
SET_FUNC(return_temperature_c_, Unit::C),
|
||||||
GET_FUNC(return_temperature_c_, Unit::C));
|
GET_FUNC(return_temperature_c_, Unit::C));
|
||||||
|
|
||||||
addField("temperature_difference",
|
addNumericField("temperature_difference",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
PrintProperty::JSON | PrintProperty::FIELD,
|
PrintProperty::JSON | PrintProperty::FIELD,
|
||||||
"The temperature difference.",
|
"The temperature difference.",
|
||||||
[](Unit u, double v) {},
|
[](Unit u, double v) {},
|
||||||
[this](Unit u) { return flow_temperature_c_ - return_temperature_c_; });
|
[this](Unit u) { return flow_temperature_c_ - return_temperature_c_; });
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"operating_time",
|
"operating_time",
|
||||||
Quantity::Time,
|
Quantity::Time,
|
||||||
DifVifKey("0AA618"),
|
DifVifKey("0AA618"),
|
||||||
|
@ -159,7 +159,7 @@ MeterSharky774::MeterSharky774(MeterInfo &mi, DriverInfo &di) : MeterCommonImpl
|
||||||
SET_FUNC(operating_time_h_, Unit::Hour),
|
SET_FUNC(operating_time_h_, Unit::Hour),
|
||||||
GET_FUNC(operating_time_h_, Unit::Hour));
|
GET_FUNC(operating_time_h_, Unit::Hour));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"energy_at_set_date",
|
"energy_at_set_date",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -41,7 +41,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
|
|
||||||
MeterSupercom587::MeterSupercom587(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
MeterSupercom587::MeterSupercom587(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total",
|
"total",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -43,7 +43,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
|
|
||||||
MeterUltraHeat::MeterUltraHeat(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
MeterUltraHeat::MeterUltraHeat(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"heat",
|
"heat",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -58,7 +58,7 @@ MeterUltraHeat::MeterUltraHeat(MeterInfo &mi, DriverInfo &di) : MeterCommonImple
|
||||||
SET_FUNC(heat_mj_, Unit::MJ),
|
SET_FUNC(heat_mj_, Unit::MJ),
|
||||||
GET_FUNC(heat_mj_, Unit::MJ));
|
GET_FUNC(heat_mj_, Unit::MJ));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"volume",
|
"volume",
|
||||||
Quantity::Volume,
|
Quantity::Volume,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -73,7 +73,7 @@ MeterUltraHeat::MeterUltraHeat(MeterInfo &mi, DriverInfo &di) : MeterCommonImple
|
||||||
SET_FUNC(volume_m3_, Unit::M3),
|
SET_FUNC(volume_m3_, Unit::M3),
|
||||||
GET_FUNC(volume_m3_, Unit::M3));
|
GET_FUNC(volume_m3_, Unit::M3));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"power",
|
"power",
|
||||||
Quantity::Power,
|
Quantity::Power,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -88,7 +88,7 @@ MeterUltraHeat::MeterUltraHeat(MeterInfo &mi, DriverInfo &di) : MeterCommonImple
|
||||||
SET_FUNC(power_kw_, Unit::KW),
|
SET_FUNC(power_kw_, Unit::KW),
|
||||||
GET_FUNC(power_kw_, Unit::KW));
|
GET_FUNC(power_kw_, Unit::KW));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"flow",
|
"flow",
|
||||||
Quantity::Flow,
|
Quantity::Flow,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -103,7 +103,7 @@ MeterUltraHeat::MeterUltraHeat(MeterInfo &mi, DriverInfo &di) : MeterCommonImple
|
||||||
SET_FUNC(flow_m3h_, Unit::M3H),
|
SET_FUNC(flow_m3h_, Unit::M3H),
|
||||||
GET_FUNC(flow_m3h_, Unit::M3H));
|
GET_FUNC(flow_m3h_, Unit::M3H));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"flow",
|
"flow",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -118,7 +118,7 @@ MeterUltraHeat::MeterUltraHeat(MeterInfo &mi, DriverInfo &di) : MeterCommonImple
|
||||||
SET_FUNC(flow_c_, Unit::C),
|
SET_FUNC(flow_c_, Unit::C),
|
||||||
GET_FUNC(flow_c_, Unit::C));
|
GET_FUNC(flow_c_, Unit::C));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"return",
|
"return",
|
||||||
Quantity::Temperature,
|
Quantity::Temperature,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
|
@ -42,7 +42,7 @@ static bool ok = registerDriver([](DriverInfo&di)
|
||||||
|
|
||||||
MeterVario451Mid::MeterVario451Mid(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
MeterVario451Mid::MeterVario451Mid(MeterInfo &mi, DriverInfo &di) : MeterCommonImplementation(mi, di)
|
||||||
{
|
{
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"total_energy_consumption",
|
"total_energy_consumption",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -57,7 +57,7 @@ MeterVario451Mid::MeterVario451Mid(MeterInfo &mi, DriverInfo &di) : MeterCommon
|
||||||
SET_FUNC(total_energy_consumption_kwh_, Unit::KWH),
|
SET_FUNC(total_energy_consumption_kwh_, Unit::KWH),
|
||||||
GET_FUNC(total_energy_consumption_kwh_, Unit::KWH));
|
GET_FUNC(total_energy_consumption_kwh_, Unit::KWH));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"energy_at_old_date",
|
"energy_at_old_date",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
@ -86,7 +86,7 @@ MeterVario451Mid::MeterVario451Mid(MeterInfo &mi, DriverInfo &di) : MeterCommon
|
||||||
SET_STRING_FUNC(old_date_txt_),
|
SET_STRING_FUNC(old_date_txt_),
|
||||||
GET_STRING_FUNC(old_date_txt_));
|
GET_STRING_FUNC(old_date_txt_));
|
||||||
|
|
||||||
addFieldWithExtractor(
|
addNumericFieldWithExtractor(
|
||||||
"energy_at_set_date",
|
"energy_at_set_date",
|
||||||
Quantity::Energy,
|
Quantity::Energy,
|
||||||
NoDifVifKey,
|
NoDifVifKey,
|
||||||
|
|
266
src/meters.cc
266
src/meters.cc
|
@ -793,8 +793,6 @@ void MeterCommonImplementation::addPrint(string vname, Quantity vquantity,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NoLookup
|
NoLookup
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -823,8 +821,6 @@ void MeterCommonImplementation::addPrint(string vname, Quantity vquantity, Unit
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NoLookup
|
NoLookup
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -851,13 +847,11 @@ void MeterCommonImplementation::addPrint(string vname, Quantity vquantity,
|
||||||
getValueFunc,
|
getValueFunc,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NoLookup
|
NoLookup
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeterCommonImplementation::addFieldWithExtractor(
|
void MeterCommonImplementation::addNumericFieldWithExtractor(
|
||||||
string vname,
|
string vname,
|
||||||
Quantity vquantity,
|
Quantity vquantity,
|
||||||
DifVifKey dif_vif_key,
|
DifVifKey dif_vif_key,
|
||||||
|
@ -876,51 +870,6 @@ void MeterCommonImplementation::addFieldWithExtractor(
|
||||||
string field_name = vname+"_"+default_unit;
|
string field_name = vname+"_"+default_unit;
|
||||||
fields_.push_back(field_name);
|
fields_.push_back(field_name);
|
||||||
|
|
||||||
// Compose the extract function.
|
|
||||||
function<bool(FieldInfo *p,Meter *m, Telegram *t)> extract =
|
|
||||||
[](FieldInfo *fi, Meter *m, Telegram *t)
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
string key = fi->difVifKey().str();
|
|
||||||
int offset {};
|
|
||||||
if (key == "")
|
|
||||||
{
|
|
||||||
// Search for key.
|
|
||||||
bool ok = findKeyWithNr(fi->measurementType(),
|
|
||||||
fi->vifRange(),
|
|
||||||
fi->storageNr().intValue(),
|
|
||||||
fi->tariffNr().intValue(),
|
|
||||||
fi->indexNr().intValue(),
|
|
||||||
&key,
|
|
||||||
&t->values);
|
|
||||||
if (!ok) return false;
|
|
||||||
}
|
|
||||||
double extracted_double_value = NAN;
|
|
||||||
if (extractDVdouble(&t->values,
|
|
||||||
key,
|
|
||||||
&offset,
|
|
||||||
&extracted_double_value,
|
|
||||||
fi->vifScaling() == VifScaling::Auto ||
|
|
||||||
fi->vifScaling() == VifScaling::AutoSigned,
|
|
||||||
fi->vifScaling() == VifScaling::NoneSigned ||
|
|
||||||
fi->vifScaling() == VifScaling::AutoSigned))
|
|
||||||
{
|
|
||||||
Unit decoded_unit = fi->defaultUnit();
|
|
||||||
if (fi->vifRange() != VIFRange::Any &&
|
|
||||||
fi->vifRange() != VIFRange::AnyVolumeVIF &&
|
|
||||||
fi->vifRange() != VIFRange::AnyEnergyVIF &&
|
|
||||||
fi->vifRange() != VIFRange::AnyPowerVIF &&
|
|
||||||
fi->vifRange() != VIFRange::None)
|
|
||||||
{
|
|
||||||
decoded_unit = toDefaultUnit(fi->vifRange());
|
|
||||||
}
|
|
||||||
fi->setValueDouble(decoded_unit, extracted_double_value);
|
|
||||||
t->addMoreExplanation(offset, fi->renderJson(&m->conversions()));
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
return found;
|
|
||||||
};
|
|
||||||
|
|
||||||
prints_.push_back(
|
prints_.push_back(
|
||||||
FieldInfo(vname,
|
FieldInfo(vname,
|
||||||
vquantity,
|
vquantity,
|
||||||
|
@ -939,13 +888,11 @@ void MeterCommonImplementation::addFieldWithExtractor(
|
||||||
NULL,
|
NULL,
|
||||||
setValueFunc,
|
setValueFunc,
|
||||||
NULL,
|
NULL,
|
||||||
extract,
|
|
||||||
NULL,
|
|
||||||
NoLookup
|
NoLookup
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeterCommonImplementation::addField(
|
void MeterCommonImplementation::addNumericField(
|
||||||
string vname,
|
string vname,
|
||||||
Quantity vquantity,
|
Quantity vquantity,
|
||||||
PrintProperties print_properties,
|
PrintProperties print_properties,
|
||||||
|
@ -975,8 +922,6 @@ void MeterCommonImplementation::addField(
|
||||||
NULL,
|
NULL,
|
||||||
setValueFunc,
|
setValueFunc,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NoLookup
|
NoLookup
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -999,62 +944,6 @@ void MeterCommonImplementation::addStringFieldWithExtractor(
|
||||||
string field_name = vname+"_"+default_unit;
|
string field_name = vname+"_"+default_unit;
|
||||||
fields_.push_back(field_name);
|
fields_.push_back(field_name);
|
||||||
|
|
||||||
// Compose the extract function.
|
|
||||||
function<bool(FieldInfo *p,Meter *m, Telegram *t)> extract =
|
|
||||||
[](FieldInfo *fi, Meter *m, Telegram *t)
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
string key = fi->difVifKey().str();
|
|
||||||
int offset {};
|
|
||||||
if (key == "")
|
|
||||||
{
|
|
||||||
// Search for key.
|
|
||||||
bool ok = findKeyWithNr(fi->measurementType(),
|
|
||||||
fi->vifRange(),
|
|
||||||
fi->storageNr().intValue(),
|
|
||||||
fi->tariffNr().intValue(),
|
|
||||||
fi->indexNr().intValue(),
|
|
||||||
&key,
|
|
||||||
&t->values);
|
|
||||||
if (!ok) return false;
|
|
||||||
}
|
|
||||||
if (fi->vifRange() == VIFRange::DateTime)
|
|
||||||
{
|
|
||||||
struct tm datetime;
|
|
||||||
extractDVdate(&t->values, key, &offset, &datetime);
|
|
||||||
string extracted_device_date_time = strdatetime(&datetime);
|
|
||||||
fi->setValueString(extracted_device_date_time);
|
|
||||||
t->addMoreExplanation(offset, fi->renderJsonText());
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
else if (fi->vifRange() == VIFRange::Date)
|
|
||||||
{
|
|
||||||
struct tm date;
|
|
||||||
extractDVdate(&t->values, key, &offset, &date);
|
|
||||||
string extracted_device_date = strdate(&date);
|
|
||||||
fi->setValueString(extracted_device_date);
|
|
||||||
t->addMoreExplanation(offset, fi->renderJsonText());
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
else if (fi->vifRange() == VIFRange::EnhancedIdentification ||
|
|
||||||
fi->vifRange() == VIFRange::FabricationNo)
|
|
||||||
{
|
|
||||||
string extracted_id;
|
|
||||||
extractDVReadableString(&t->values, key, &offset, &extracted_id);
|
|
||||||
fi->setValueString(extracted_id);
|
|
||||||
t->addMoreExplanation(offset, fi->renderJsonText());
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
error("Internal error: Cannot extract text string from vif %s in %s:%d\n",
|
|
||||||
toString(fi->vifRange()),
|
|
||||||
__FILE__, __LINE__);
|
|
||||||
|
|
||||||
}
|
|
||||||
return found;
|
|
||||||
};
|
|
||||||
|
|
||||||
prints_.push_back(
|
prints_.push_back(
|
||||||
FieldInfo(vname,
|
FieldInfo(vname,
|
||||||
vquantity,
|
vquantity,
|
||||||
|
@ -1073,8 +962,6 @@ void MeterCommonImplementation::addStringFieldWithExtractor(
|
||||||
getValueFunc,
|
getValueFunc,
|
||||||
NULL,
|
NULL,
|
||||||
setValueFunc,
|
setValueFunc,
|
||||||
NULL,
|
|
||||||
extract,
|
|
||||||
NoLookup
|
NoLookup
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -1098,36 +985,6 @@ void MeterCommonImplementation::addStringFieldWithExtractorAndLookup(
|
||||||
string field_name = vname+"_"+default_unit;
|
string field_name = vname+"_"+default_unit;
|
||||||
fields_.push_back(field_name);
|
fields_.push_back(field_name);
|
||||||
|
|
||||||
// Compose the extract function.
|
|
||||||
function<bool(FieldInfo *p,Meter *m, Telegram *t)> extract =
|
|
||||||
[](FieldInfo *fi, Meter *m, Telegram *t)
|
|
||||||
{
|
|
||||||
bool found = false;
|
|
||||||
string key = fi->difVifKey().str();
|
|
||||||
int offset {};
|
|
||||||
if (key == "")
|
|
||||||
{
|
|
||||||
// Search for key.
|
|
||||||
bool ok = findKeyWithNr(fi->measurementType(),
|
|
||||||
fi->vifRange(),
|
|
||||||
fi->storageNr().intValue(),
|
|
||||||
fi->tariffNr().intValue(),
|
|
||||||
fi->indexNr().intValue(),
|
|
||||||
&key,
|
|
||||||
&t->values);
|
|
||||||
if (!ok) return false;
|
|
||||||
}
|
|
||||||
uint64_t extracted_bits {};
|
|
||||||
if (extractDVlong(&t->values, key, &offset, &extracted_bits))
|
|
||||||
{
|
|
||||||
string translated_bits = fi->lookup().translate(extracted_bits);
|
|
||||||
fi->setValueString(translated_bits);
|
|
||||||
t->addMoreExplanation(offset, fi->renderJsonText());
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
return found;
|
|
||||||
};
|
|
||||||
|
|
||||||
prints_.push_back(
|
prints_.push_back(
|
||||||
FieldInfo(vname,
|
FieldInfo(vname,
|
||||||
vquantity,
|
vquantity,
|
||||||
|
@ -1146,8 +1003,6 @@ void MeterCommonImplementation::addStringFieldWithExtractorAndLookup(
|
||||||
getValueFunc,
|
getValueFunc,
|
||||||
NULL,
|
NULL,
|
||||||
setValueFunc,
|
setValueFunc,
|
||||||
NULL,
|
|
||||||
extract,
|
|
||||||
lookup
|
lookup
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -2168,14 +2023,13 @@ bool isValidKey(string& key, MeterDriver mt)
|
||||||
|
|
||||||
void FieldInfo::performExtraction(Meter *m, Telegram *t)
|
void FieldInfo::performExtraction(Meter *m, Telegram *t)
|
||||||
{
|
{
|
||||||
if (extract_double_)
|
if (xuantity_ == Quantity::Text)
|
||||||
{
|
{
|
||||||
extract_double_(this, m, t);
|
extractString(m, t);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (extract_string_)
|
|
||||||
{
|
{
|
||||||
extract_string_(this, m, t);
|
extractNumeric(m, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2187,3 +2041,111 @@ DriverName MeterInfo::driverName()
|
||||||
}
|
}
|
||||||
return driver_name;
|
return driver_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FieldInfo::extractNumeric(Meter *m, Telegram *t)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
string key = difVifKey().str();
|
||||||
|
int offset {};
|
||||||
|
if (key == "")
|
||||||
|
{
|
||||||
|
// Search for key.
|
||||||
|
bool ok = findKeyWithNr(measurementType(),
|
||||||
|
vifRange(),
|
||||||
|
storageNr().intValue(),
|
||||||
|
tariffNr().intValue(),
|
||||||
|
indexNr().intValue(),
|
||||||
|
&key,
|
||||||
|
&t->values);
|
||||||
|
if (!ok) return false;
|
||||||
|
}
|
||||||
|
double extracted_double_value = NAN;
|
||||||
|
if (extractDVdouble(&t->values,
|
||||||
|
key,
|
||||||
|
&offset,
|
||||||
|
&extracted_double_value,
|
||||||
|
vifScaling() == VifScaling::Auto ||
|
||||||
|
vifScaling() == VifScaling::AutoSigned,
|
||||||
|
vifScaling() == VifScaling::NoneSigned ||
|
||||||
|
vifScaling() == VifScaling::AutoSigned))
|
||||||
|
{
|
||||||
|
Unit decoded_unit = defaultUnit();
|
||||||
|
if (vifRange() != VIFRange::Any &&
|
||||||
|
vifRange() != VIFRange::AnyVolumeVIF &&
|
||||||
|
vifRange() != VIFRange::AnyEnergyVIF &&
|
||||||
|
vifRange() != VIFRange::AnyPowerVIF &&
|
||||||
|
vifRange() != VIFRange::None)
|
||||||
|
{
|
||||||
|
decoded_unit = toDefaultUnit(vifRange());
|
||||||
|
}
|
||||||
|
setValueDouble(decoded_unit, extracted_double_value);
|
||||||
|
t->addMoreExplanation(offset, renderJson(&m->conversions()));
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FieldInfo::extractString(Meter *m, Telegram *t)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
string key = difVifKey().str();
|
||||||
|
int offset {};
|
||||||
|
if (key == "")
|
||||||
|
{
|
||||||
|
// Search for key.
|
||||||
|
bool ok = findKeyWithNr(measurementType(),
|
||||||
|
vifRange(),
|
||||||
|
storageNr().intValue(),
|
||||||
|
tariffNr().intValue(),
|
||||||
|
indexNr().intValue(),
|
||||||
|
&key,
|
||||||
|
&t->values);
|
||||||
|
if (!ok) return false;
|
||||||
|
}
|
||||||
|
uint64_t extracted_bits {};
|
||||||
|
if (lookup_.hasLookups())
|
||||||
|
{
|
||||||
|
if (extractDVlong(&t->values, key, &offset, &extracted_bits))
|
||||||
|
{
|
||||||
|
string translated_bits = lookup().translate(extracted_bits);
|
||||||
|
setValueString(translated_bits);
|
||||||
|
t->addMoreExplanation(offset, renderJsonText());
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (vifRange() == VIFRange::DateTime)
|
||||||
|
{
|
||||||
|
struct tm datetime;
|
||||||
|
extractDVdate(&t->values, key, &offset, &datetime);
|
||||||
|
string extracted_device_date_time = strdatetime(&datetime);
|
||||||
|
setValueString(extracted_device_date_time);
|
||||||
|
t->addMoreExplanation(offset, renderJsonText());
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
else if (vifRange() == VIFRange::Date)
|
||||||
|
{
|
||||||
|
struct tm date;
|
||||||
|
extractDVdate(&t->values, key, &offset, &date);
|
||||||
|
string extracted_device_date = strdate(&date);
|
||||||
|
setValueString(extracted_device_date);
|
||||||
|
t->addMoreExplanation(offset, renderJsonText());
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
else if (vifRange() == VIFRange::EnhancedIdentification ||
|
||||||
|
vifRange() == VIFRange::FabricationNo)
|
||||||
|
{
|
||||||
|
string extracted_id;
|
||||||
|
extractDVReadableString(&t->values, key, &offset, &extracted_id);
|
||||||
|
setValueString(extracted_id);
|
||||||
|
t->addMoreExplanation(offset, renderJsonText());
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error("Internal error: Cannot extract text string from vif %s in %s:%d\n",
|
||||||
|
toString(vifRange()),
|
||||||
|
__FILE__, __LINE__);
|
||||||
|
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
|
@ -326,8 +326,6 @@ struct FieldInfo
|
||||||
function<string()> get_value_string,
|
function<string()> get_value_string,
|
||||||
function<void(Unit,double)> set_value_double,
|
function<void(Unit,double)> set_value_double,
|
||||||
function<void(string)> set_value_string,
|
function<void(string)> set_value_string,
|
||||||
function<bool(FieldInfo*, Meter *mi, Telegram *t)> extract_double,
|
|
||||||
function<bool(FieldInfo*, Meter *mi, Telegram *t)> extract_string,
|
|
||||||
Translate::Lookup lookup
|
Translate::Lookup lookup
|
||||||
) :
|
) :
|
||||||
vname_(vname),
|
vname_(vname),
|
||||||
|
@ -347,8 +345,6 @@ struct FieldInfo
|
||||||
get_value_string_(get_value_string),
|
get_value_string_(get_value_string),
|
||||||
set_value_double_(set_value_double),
|
set_value_double_(set_value_double),
|
||||||
set_value_string_(set_value_string),
|
set_value_string_(set_value_string),
|
||||||
extract_double_(extract_double),
|
|
||||||
extract_string_(extract_string),
|
|
||||||
lookup_(lookup)
|
lookup_(lookup)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -374,6 +370,8 @@ struct FieldInfo
|
||||||
void setValueDouble(Unit u, double d) { if (set_value_double_) set_value_double_(u, d); }
|
void setValueDouble(Unit u, double d) { if (set_value_double_) set_value_double_(u, d); }
|
||||||
void setValueString(string s) { if (set_value_string_) set_value_string_(s); }
|
void setValueString(string s) { if (set_value_string_) set_value_string_(s); }
|
||||||
|
|
||||||
|
bool extractNumeric(Meter *m, Telegram *t);
|
||||||
|
bool extractString(Meter *m, Telegram *t);
|
||||||
void performExtraction(Meter *m, Telegram *t);
|
void performExtraction(Meter *m, Telegram *t);
|
||||||
|
|
||||||
string renderJsonOnlyDefaultUnit();
|
string renderJsonOnlyDefaultUnit();
|
||||||
|
@ -402,8 +400,6 @@ private:
|
||||||
function<string()> get_value_string_; // Callback to fetch the value from the meter.
|
function<string()> get_value_string_; // Callback to fetch the value from the meter.
|
||||||
function<void(Unit,double)> set_value_double_; // Call back to set the value in the c++ object
|
function<void(Unit,double)> set_value_double_; // Call back to set the value in the c++ object
|
||||||
function<void(string)> set_value_string_; // Call back to set the value string in the c++ object
|
function<void(string)> set_value_string_; // Call back to set the value string in the c++ object
|
||||||
function<bool(FieldInfo*, Meter *mi, Telegram *t)> extract_double_; // Extract field from telegram and insert into meter.
|
|
||||||
function<bool(FieldInfo*, Meter *mi, Telegram *t)> extract_string_; // Extract field from telegram and insert into meter.
|
|
||||||
Translate::Lookup lookup_;
|
Translate::Lookup lookup_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ protected:
|
||||||
#define FIND_SFIELD_STI(TYPE,INFO,STORAGE,TARIFF,INDEX) NoDifVifKey,TYPE,INFO,STORAGE,TARIFF,INDEX
|
#define FIND_SFIELD_STI(TYPE,INFO,STORAGE,TARIFF,INDEX) NoDifVifKey,TYPE,INFO,STORAGE,TARIFF,INDEX
|
||||||
|
|
||||||
|
|
||||||
void addFieldWithExtractor(
|
void addNumericFieldWithExtractor(
|
||||||
string vname, // Name of value without unit, eg total
|
string vname, // Name of value without unit, eg total
|
||||||
Quantity vquantity, // Value belongs to this quantity.
|
Quantity vquantity, // Value belongs to this quantity.
|
||||||
DifVifKey dif_vif_key, // You can hardocde a dif vif header here or use NoDifVifKey
|
DifVifKey dif_vif_key, // You can hardocde a dif vif header here or use NoDifVifKey
|
||||||
|
@ -110,7 +110,7 @@ protected:
|
||||||
function<void(Unit,double)> setValueFunc, // Use the SET macro above.
|
function<void(Unit,double)> setValueFunc, // Use the SET macro above.
|
||||||
function<double(Unit)> getValueFunc); // Use the GET macro above.
|
function<double(Unit)> getValueFunc); // Use the GET macro above.
|
||||||
|
|
||||||
void addField(
|
void addNumericField(
|
||||||
string vname, // Name of value without unit, eg total
|
string vname, // Name of value without unit, eg total
|
||||||
Quantity vquantity, // Value belongs to this quantity.
|
Quantity vquantity, // Value belongs to this quantity.
|
||||||
PrintProperties print_properties, // Should this be printed by default in fields,json and hr.
|
PrintProperties print_properties, // Should this be printed by default in fields,json and hr.
|
||||||
|
|
Ładowanie…
Reference in New Issue