kopia lustrzana https://github.com/weetmuts/wmbusmeters
Make sure field matching is performed on the dv entries in an order where the offsets are increasing.
rodzic
930e39b5be
commit
30b33c9ede
|
@ -2,5 +2,8 @@
|
|||
# Since the simulation will not remove the crcs unless they all check out, this will result in a broken telegram.
|
||||
telegram=|3444EE4D813929271608|811D|7A51000000|046D1912A62B036E000000|5170426CE1F1436E00000002FF2C00000259D6D0D4090265FC0902FD66A00044|
|
||||
|
||||
|
||||
# After offset 112 this telegram looks broken. Duplicate total energy entries and broken dif inside.
|
||||
telegram=|a944c5149564252200047a10009025a8431d8Bee683c2471d99f2B943e739f39aff1a257d056cBB97d6Ba1ce2a85c01455Bef04a0BB199582803174de070957378350c6419c5Bf499Bf8e089390B4aB4f610c0BB334ad2B810994Be18fcf0d8B12a3BBB3e8cBe90009df3d7cfc8B62d89923e1a0d207BBdd4B453491a00d3942fe1B8d0d03492ad8cce69c8968B157d6f25ad1a541aafB0787aae06d6c9Bf903f903fd0c05010002fd0B|
|
||||
|
||||
# And this telegram as well. Duplicate total energy entries! No broken dif though.
|
||||
telegram=|a944c5149564252200047a5d009025aa5d3614331a4e5c3316ae3f016Bea63B1999e17029355a4ae0f498f936e876c1ad9B4a973642c10c384f6f74c7de852f811ffB8acBB36245015726d1a75a6ad2d94ff8e19a093f6e4e010178B41e26468ca8d560B5c571ff8e047ec7d1f3a72B06B63cdcB2B86ff1df9f6de62831d19B109c13438e7851aB5890d540c06de90628B4e8388381B6e0fc96d36d577e462036203fd0c05010002fd0B|
|
||||
|
|
|
@ -1775,10 +1775,18 @@ void MeterCommonImplementation::processFieldExtractors(Telegram *t)
|
|||
{
|
||||
map<FieldInfo*,DVEntry*> found;
|
||||
|
||||
// Iterate through the data content (dv_entries) in the telegram.
|
||||
vector<DVEntry*> sorted_entries;
|
||||
|
||||
for (auto &p : t->dv_entries)
|
||||
{
|
||||
DVEntry *dve = &p.second.second;
|
||||
sorted_entries.push_back(&p.second.second);
|
||||
}
|
||||
sort(sorted_entries.begin(), sorted_entries.end(),
|
||||
[](const DVEntry* a, const DVEntry *b) -> bool { return a->offset < b->offset; });
|
||||
|
||||
// Iterate through the data content (dv_entries) in the telegram.
|
||||
for (DVEntry *dve : sorted_entries)
|
||||
{
|
||||
// We have telegram content, a dif-vif-value entry.
|
||||
// Now check for a field info that wants to handle this telegram content entry.
|
||||
for (FieldInfo &fi : field_infos_)
|
||||
|
@ -1800,11 +1808,12 @@ void MeterCommonImplementation::processFieldExtractors(Telegram *t)
|
|||
else
|
||||
{
|
||||
// We have field that wants to handle this entry!
|
||||
debug("(meters) using field info %s(%s)[%d] to extract %s\n",
|
||||
debug("(meters) using field info %s(%s)[%d] to extract %s at offset %d\n",
|
||||
fi.vname().c_str(),
|
||||
toString(fi.xuantity()),
|
||||
fi.index(),
|
||||
dve->dif_vif_key.str().c_str());
|
||||
dve->dif_vif_key.str().c_str(),
|
||||
dve->offset);
|
||||
|
||||
dve->addFieldInfo(&fi);
|
||||
fi.performExtraction(this, t, dve);
|
||||
|
|
|
@ -14,6 +14,10 @@ cat > $TEST/test_expected.txt <<EOF
|
|||
(dvparser) warning: unexpected end of data
|
||||
(dvparser) found new format "046D0406041301FD17426C4406840106840206840306840406840506840606840706840806840906C1337F47A64E0C062364" with hash b934, remembering!
|
||||
(meter) while processing field extractors ignoring dventry 0C06 at offset 129 matching since field total was already matched against dventry 0406 at offset 25 !
|
||||
(dvparser) found new format "046D0406041301FD17426C4406840106840206840306840406840506840606840706840806840906585D65E6958F6B5E93DBA60CD99D06EB27D97106000000840F060003620501" with hash 6c76, remembering!
|
||||
(meter) while processing field extractors ignoring dventry 0000 at offset 146 matching since field total was already matched against dventry 0406 at offset 25 !
|
||||
(meter) while processing field extractors ignoring dventry 0600 at offset 151 matching since field total was already matched against dventry 0406 at offset 25 !
|
||||
(meter) while processing field extractors ignoring dventry 0501 at offset 166 matching since field total was already matched against dventry 0406 at offset 25 !
|
||||
EOF
|
||||
|
||||
$PROG --format=fields --selectfields=id,current_consumption_hca,device_date_time --debug simulations/simulation_broken.txt \
|
||||
|
|
Ładowanie…
Reference in New Issue