Add Keysight branding where applicable

Because there is now more than one "product name" per device
type, we have a concept of a "generic product name" which
singularly maps onto a device type.

This change comes with a few small breaking changes within
the C++ API:

DeviceType::GetDeviceTypeString has been renamed to
DeviceType::GetGenericProductName to denote that
the returned value is not device specific and
device->getProductName() is preferable.

The member function DeviceType::toString has been renamed
to DeviceType::getGenericProductName for the same reason.

The DeviceType std::ostream& operator<< has been removed
to avoid accidental use of the generic product name.
This commit is contained in:
Paul Hollinsky
2021-04-12 19:01:43 -04:00
parent d79f735df8
commit e29d63b08c
12 changed files with 186 additions and 12 deletions
@@ -16,6 +16,13 @@ public:
static constexpr DeviceType::Enum DEVICE_TYPE = DeviceType::VCAN4_4;
static constexpr const char* SERIAL_START = "V4";
enum class SKU {
Standard,
AP0400A_D26, // HDB26, USB A, and Keysight Branding
AP0400A_DB9, // 4xDB9, USB A, and Keysight Branding
AP0400A_OBD, // OBD, USB A, and Keysight Branding
};
static std::vector<std::shared_ptr<Device>> Find() {
std::vector<std::shared_ptr<Device>> found;
@@ -37,6 +44,32 @@ public:
return supportedNetworks;
}
SKU getSKU() const {
switch(getSerial().back()) {
case 'A':
return SKU::AP0400A_D26;
case 'B':
return SKU::AP0400A_DB9;
case 'C':
return SKU::AP0400A_OBD;
default:
return SKU::Standard;
}
}
std::string getProductName() const override {
switch(getSKU()) {
case SKU::Standard: break;
case SKU::AP0400A_D26:
return "Keysight AP0400A-D26";
case SKU::AP0400A_DB9:
return "Keysight AP0400A-DB9";
case SKU::AP0400A_OBD:
return "Keysight AP0400A-OBD";
}
return Device::getProductName();
}
protected:
virtual void setupSupportedRXNetworks(std::vector<Network>& rxNetworks) override {
for(auto& netid : GetSupportedNetworks())