kopia lustrzana https://github.com/weetmuts/wmbusmeters
Add RemainingBattery vif.
rodzic
6a331b1ce4
commit
cb1f628560
|
@ -58,6 +58,7 @@
|
|||
X(Current,0x7D50,0x7D5F, Quantity::Current, Unit::Ampere) \
|
||||
X(ResetCounter,0x7D60,0x7D60, Quantity::Counter, Unit::COUNTER) \
|
||||
X(CumulationCounter,0x7D61,0x7D61, Quantity::Counter, Unit::COUNTER) \
|
||||
X(RemainingBattery,0x7D74,0x7D74, Quantity::Time, Unit::Day) \
|
||||
X(AnyVolumeVIF,0x00,0x00, Quantity::Volume, Unit::Unknown) \
|
||||
X(AnyEnergyVIF,0x00,0x00, Quantity::Energy, Unit::Unknown) \
|
||||
X(AnyPowerVIF,0x00,0x00, Quantity::Power, Unit::Unknown) \
|
||||
|
|
|
@ -803,7 +803,7 @@ void MeterCommonImplementation::addLinkMode(LinkMode lm)
|
|||
link_modes_.addLinkMode(lm);
|
||||
}
|
||||
|
||||
void MeterCommonImplementation::addMfctTPlStatusBits(Translate::Lookup lookup)
|
||||
void MeterCommonImplementation::addMfctTPLStatusBits(Translate::Lookup lookup)
|
||||
{
|
||||
mfct_tpl_status_bits_ = lookup;
|
||||
}
|
||||
|
@ -906,13 +906,14 @@ void MeterCommonImplementation::addNumericFieldWithExtractor(string vname,
|
|||
PrintProperties print_properties,
|
||||
Quantity vquantity,
|
||||
VifScaling vif_scaling,
|
||||
FieldMatcher matcher)
|
||||
FieldMatcher matcher,
|
||||
Unit use_unit)
|
||||
{
|
||||
field_infos_.push_back(
|
||||
FieldInfo(field_infos_.size(),
|
||||
vname,
|
||||
vquantity,
|
||||
defaultUnitForQuantity(vquantity),
|
||||
use_unit == Unit::Unknown ? defaultUnitForQuantity(vquantity) : use_unit,
|
||||
vif_scaling,
|
||||
matcher,
|
||||
help,
|
||||
|
|
|
@ -94,7 +94,7 @@ protected:
|
|||
std::vector<std::string> &meterExtraConstantFields();
|
||||
void setMeterType(MeterType mt);
|
||||
void addLinkMode(LinkMode lm);
|
||||
void addMfctTPlStatusBits(Translate::Lookup lookup);
|
||||
void addMfctTPLStatusBits(Translate::Lookup lookup);
|
||||
|
||||
// Print with the default unit for this quantity.
|
||||
void addPrint(string vname, Quantity vquantity,
|
||||
|
@ -140,7 +140,8 @@ protected:
|
|||
PrintProperties print_properties, // Should this be printed by default in fields,json and hr.
|
||||
Quantity vquantity, // Value belongs to this quantity, this quantity determines the default unit.
|
||||
VifScaling vif_scaling, // How should any Vif value be scaled.
|
||||
FieldMatcher matcher);
|
||||
FieldMatcher matcher,
|
||||
Unit use_unit = Unit::Unknown); // If specified use this unit instead.
|
||||
|
||||
void addNumericField(
|
||||
string vname, // Name of value without unit, eg total
|
||||
|
|
|
@ -37,6 +37,8 @@ using namespace std;
|
|||
X(Year, Hour, {vto=vfrom*24.0*365;}) \
|
||||
X(Hour, Day, {vto=vfrom/24.0;}) \
|
||||
X(Day, Hour, {vto=vfrom*24.0;}) \
|
||||
X(Day, Year, {vto=vfrom/365;}) \
|
||||
X(Year, Day, {vto=vfrom*365;}) \
|
||||
X(KWH, GJ, {vto=vfrom*0.0036;}) \
|
||||
X(KWH, MJ, {vto=vfrom*0.0036*1000.0;}) \
|
||||
X(GJ, KWH,{vto=vfrom/0.0036;}) \
|
||||
|
|
|
@ -2822,6 +2822,9 @@ double vifScale(int vif)
|
|||
case 0x7d5e:
|
||||
case 0x7d5f: { double exp = (vif & 0xf)-12; return pow(10.0, -exp); }
|
||||
|
||||
// for remaining battery wmbusmeters returns number of days.
|
||||
case 0x7d74: { return 1.0; }
|
||||
|
||||
/*
|
||||
case 0x78: // Fabrication no
|
||||
case 0x79: // Enhanced identification
|
||||
|
@ -3613,6 +3616,11 @@ string vif_7D_SecondExtensionType(uchar dif, uchar vif, uchar vife)
|
|||
if ((vife & 0x7f) >= 0x71) {
|
||||
return "Reserved";
|
||||
}
|
||||
|
||||
if ((vife & 0x7f) == 0x74) {
|
||||
return "Remaining battery in days";
|
||||
}
|
||||
|
||||
return "?";
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue