Improve analyze with forced driver.

pull/505/head
Fredrik Öhrström 2022-03-27 14:43:10 +02:00
rodzic 790f78a2bf
commit 368230c929
2 zmienionych plików z 43 dodań i 14 usunięć

Wyświetl plik

@ -372,7 +372,7 @@ public:
AboutTelegram &about,
vector<uchar> &input_frame,
bool simulated,
string only)
string force)
{
vector<MeterDriver> old_drivers;
#define X(mname,linkmode,info,type,cname) old_drivers.push_back(MeterDriver::type);
@ -385,9 +385,13 @@ LIST_OF_METERS
if (odr == MeterDriver::AUTO) continue;
if (odr == MeterDriver::UNKNOWN) continue;
string driver_name = toString(odr);
if (only != "" && driver_name != only) continue;
if (force != "")
{
if (driver_name != force) continue;
return driver_name;
}
if (only == "" &&
if (force == "" &&
!isMeterDriverReasonableForMedia(odr, "", t.dll_type) &&
!isMeterDriverReasonableForMedia(odr, "", t.tpl_type))
{
@ -421,13 +425,13 @@ LIST_OF_METERS
int l = 0;
int u = 0;
t.analyzeParse(OutputFormat::NONE, &l, &u);
if (analyze_verbose_ && only == "") printf("(verbose) old %02d/%02d %s\n", u, l, driver_name.c_str());
if (analyze_verbose_ && force == "") printf("(verbose) old %02d/%02d %s\n", u, l, driver_name.c_str());
if (u > *best_understood)
{
*best_understood = u;
*best_length = l;
best_driver = driver_name;
if (analyze_verbose_ && only == "") printf("(verbose) old best so far: %s %02d/%02d\n", best_driver.c_str(), u, l);
if (analyze_verbose_ && force == "") printf("(verbose) old best so far: %s %02d/%02d\n", best_driver.c_str(), u, l);
}
}
}
@ -448,7 +452,11 @@ LIST_OF_METERS
for (DriverInfo ndr : all_registered_drivers_list_)
{
string driver_name = toString(ndr);
if (only != "" && driver_name != only) continue;
if (only != "")
{
if (driver_name != only) continue;
return driver_name;
}
if (only == "" &&
!isMeterDriverReasonableForMedia(MeterDriver::AUTO, driver_name, t.dll_type) &&

Wyświetl plik

@ -33,7 +33,7 @@ TESTRESULT="ERROR"
cat > $TEST/test_expected.txt <<EOF
Auto driver : multical21
Best driver : 00/00
Using driver : 00/00
Using driver : multical21(driver should be upgraded) 00/00
000 : 2a length (42 bytes)
001 : 44 dll-c (from meter SND_NR)
002 : 2d2c dll-mfct (KAM)
@ -48,9 +48,19 @@ Using driver : 00/00
{
"media":"cold water",
"meter":"unknown",
"meter":"multical21",
"name":"",
"id":"76348799",
"total_m3":0,
"target_m3":0,
"max_flow_m3h":0,
"flow_temperature_c":127,
"external_temperature_c":127,
"current_status":"",
"time_dry":"",
"time_reversed":"",
"time_leaking":"",
"time_bursting":"",
"timestamp":"1111-11-11T11:11:11Z"
}
EOF
@ -69,7 +79,7 @@ TESTRESULT="ERROR"
cat > $TEST/test_expected.txt <<EOF
Auto driver : multical21
Best driver : 00/00
Using driver : 00/00
Using driver : multical21(driver should be upgraded) 00/00
000 : 23 length (35 bytes)
001 : 44 dll-c (from meter SND_NR)
002 : 2d2c dll-mfct (KAM)
@ -84,9 +94,19 @@ Using driver : 00/00
{
"media":"cold water",
"meter":"unknown",
"meter":"multical21",
"name":"",
"id":"76348799",
"total_m3":0,
"target_m3":0,
"max_flow_m3h":0,
"flow_temperature_c":127,
"external_temperature_c":127,
"current_status":"",
"time_dry":"",
"time_reversed":"",
"time_leaking":"",
"time_bursting":"",
"timestamp":"1111-11-11T11:11:11Z"
}
EOF
@ -105,7 +125,7 @@ TESTRESULT="ERROR"
cat > $TEST/test_expected.txt <<EOF
Auto driver : multical21
Best driver : multical21(driver should be upgraded) 12/12
Using driver : multical21(driver should be upgraded) 12/12
Using driver : multical21(driver should be upgraded) 00/00
000 : 2a length (42 bytes)
001 : 44 dll-c (from meter SND_NR)
002 : 2d2c dll-mfct (KAM)
@ -168,7 +188,7 @@ TESTRESULT="ERROR"
cat > $TEST/test_expected.txt <<EOF
Auto driver : multical21
Best driver : multical21(driver should be upgraded) 12/12
Using driver : multical21(driver should be upgraded) 12/12
Using driver : multical21(driver should be upgraded) 00/00
000 : 23 length (35 bytes)
001 : 44 dll-c (from meter SND_NR)
002 : 2d2c dll-mfct (KAM)
@ -222,7 +242,7 @@ TESTRESULT="ERROR"
cat > $TEST/test_expected.txt <<EOF
Auto driver : supercom587
Best driver : 00/00
Using driver : 00/00
Using driver : supercom587 00/00
000 : ae length (174 bytes)
001 : 44 dll-c (from meter SND_NR)
002 : ee4d dll-mfct (SON)
@ -237,9 +257,10 @@ Using driver : 00/00
{
"media":"water",
"meter":"unknown",
"meter":"supercom587",
"name":"",
"id":"77777777",
"total_m3":0,
"timestamp":"1111-11-11T11:11:11Z"
}
EOF