fix(*): isp version use type+version tostring().
This commit is contained in:
parent
cd313f2eb0
commit
1df9a28756
|
@ -103,7 +103,7 @@ class MYNTEYE_API Version {
|
|||
return (from <= *this) && (*this <= until);
|
||||
}
|
||||
|
||||
std::string to_string() const;
|
||||
virtual std::string to_string() const;
|
||||
|
||||
static std::vector<std::string> split(const std::string &s);
|
||||
static value_t parse_part(const std::string &name, size_t part);
|
||||
|
@ -112,6 +112,20 @@ class MYNTEYE_API Version {
|
|||
MYNTEYE_PROPERTY(value_t, minor)
|
||||
};
|
||||
|
||||
/**
|
||||
* ISPVersion version.
|
||||
*/
|
||||
class MYNTEYE_API ISPVersion : public Version {
|
||||
public:
|
||||
ISPVersion() = default;
|
||||
ISPVersion(value_t major, value_t minor)
|
||||
: Version(major, minor) {}
|
||||
explicit ISPVersion(const std::string &name, value_t flag = 0)
|
||||
: Version(parse_part(name, 0), parse_part(name, 1)) {}
|
||||
|
||||
std::string to_string() const override;
|
||||
};
|
||||
|
||||
/**
|
||||
* Hardware version.
|
||||
*/
|
||||
|
@ -163,7 +177,7 @@ struct MYNTEYE_API DeviceInfo {
|
|||
Type imu_type;
|
||||
std::uint16_t nominal_baseline;
|
||||
Version auxiliary_chip_version;
|
||||
Version isp_version;
|
||||
ISPVersion isp_version;
|
||||
};
|
||||
|
||||
#undef MYNTEYE_PROPERTY
|
||||
|
|
|
@ -116,7 +116,7 @@ std::size_t DeviceInfoParser::GetFromData(
|
|||
info->isp_version.set_minor(data[i + 1]);
|
||||
i += 2;
|
||||
// firmware_version, 2
|
||||
info->firmware_version.set_major(data[i]);
|
||||
info->firmware_version.set_major(data[i + 1] ? data[i] : 0);
|
||||
info->firmware_version.set_minor(data[i + 1]);
|
||||
i += 2;
|
||||
// hardware_version, 3
|
||||
|
@ -158,8 +158,8 @@ std::size_t DeviceInfoParser::GetFromData(
|
|||
info->auxiliary_chip_version.set_minor(data[i + 1]);
|
||||
i += 2;
|
||||
// isp_version, 2
|
||||
info->isp_version.set_major(data[i]);
|
||||
info->isp_version.set_minor(data[i + 1]);
|
||||
info->isp_version.set_major(0);
|
||||
info->isp_version.set_minor(data[i]);
|
||||
i += 2;
|
||||
} else {
|
||||
info->auxiliary_chip_version.set_major(0);
|
||||
|
|
|
@ -59,4 +59,21 @@ Type::value_t Type::parse_part(
|
|||
return std::stoi(name.substr(pos, count), 0, 16);
|
||||
}
|
||||
|
||||
std::string ISPVersion::to_string() const {
|
||||
std::stringstream s;
|
||||
if (major() == 0x01) {
|
||||
s << "S2000-";
|
||||
} else if (major() == 0x02) {
|
||||
s << "S2110-";
|
||||
} else if (major() == 0x03) {
|
||||
s << "S210A-";
|
||||
} else if (major() == 0x04) {
|
||||
s << "S2X0C-";
|
||||
} else if (major() == 0x05) {
|
||||
s << "S200B-";
|
||||
}
|
||||
s << static_cast<int>(minor());
|
||||
return s.str();
|
||||
}
|
||||
|
||||
MYNTEYE_END_NAMESPACE
|
||||
|
|
Loading…
Reference in New Issue
Block a user