Skip to content

Commit ea5d40f

Browse files
author
TinyOh
committed
fix(api): version check pass while device name out of check table.
1 parent d261bad commit ea5d40f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/mynteye/api/version_checker.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const char* WARN_DESCRIPTION_F =
3434
const char* WARN_DESCRIPTION_S =
3535
"We suggest that you should update the SDK";
3636
const char* PASS_DESCRIPTION = "pass";
37+
const char* PASS_OUTOF_TABLE_WARNING = "You're using a custom mynteye device";
3738

3839
/** firmware/sdk version matched table */
3940
/**----device type-----sdk version---firmware version-----pass tag-----*/
@@ -112,11 +113,27 @@ STATUS_UNIT checkUnit(const std::string& sdkv,
112113
return ST_NOT_PASS;
113114
}
114115

116+
bool checkIfDeviceInTable(const std::string& devn) {
117+
for (size_t i =0;
118+
i < sizeof(FSVM_TABLE)/sizeof(firmware_version_match_table_unit);
119+
i++) {
120+
if (FSVM_TABLE[i].device_type == devn) {
121+
return true;
122+
}
123+
}
124+
return false;
125+
}
126+
115127
bool checkFirmwareVersion(const std::shared_ptr<API> api) {
116128
auto sdkv = api->GetSDKVersion();
117129
auto devn = api->GetInfo(Info::DEVICE_NAME);
118130
auto firmv = api->GetInfo(Info::FIRMWARE_VERSION);
119131

132+
if (!checkIfDeviceInTable(devn)) {
133+
LOG(WARNING) << PASS_OUTOF_TABLE_WARNING;
134+
return true;
135+
}
136+
120137
for (size_t i =0;
121138
i < sizeof(FSVM_TABLE)/sizeof(firmware_version_match_table_unit);
122139
i++) {

0 commit comments

Comments
 (0)