Clean up DeviceType
parent
8060b07eee
commit
a5b79167b9
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef __NETWORKID_H_
|
#ifndef __DEVICETYPE_H_
|
||||||
#define __NETWORKID_H_
|
#define __DEVICETYPE_H_
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
@ -9,71 +9,139 @@ namespace icsneo {
|
||||||
class DeviceType {
|
class DeviceType {
|
||||||
public:
|
public:
|
||||||
// This enum used to be a bitfield, but has since become an enum as we have more than 32 devices
|
// This enum used to be a bitfield, but has since become an enum as we have more than 32 devices
|
||||||
enum : uint32_t {
|
enum Enum : uint32_t {
|
||||||
UNKNOWN = (0x00000000),
|
Unknown = (0x00000000),
|
||||||
BLUE = (0x00000001),
|
BLUE = (0x00000001),
|
||||||
ECU_AVB = (0x00000002),
|
ECU_AVB = (0x00000002),
|
||||||
RADSUPERMOON = (0x00000003),
|
RADSupermoon = (0x00000003),
|
||||||
DW_VCAN = (0x00000004),
|
DW_VCAN = (0x00000004),
|
||||||
RADMOON2 = (0x00000005),
|
RADMoon2 = (0x00000005),
|
||||||
RADGIGALOG = (0x00000006),
|
RADGigalog = (0x00000006),
|
||||||
VCAN41 = (0x00000007),
|
VCAN4_1 = (0x00000007),
|
||||||
FIRE = (0x00000008),
|
FIRE = (0x00000008),
|
||||||
RADPLUTO = (0x00000009),
|
RADPluto = (0x00000009),
|
||||||
VCAN42_EL = (0x0000000a),
|
VCAN4_2EL = (0x0000000a),
|
||||||
RADIO_CANHUB = (0x0000000b),
|
RADIO_CANHUB = (0x0000000b),
|
||||||
VCAN3 = (0x00000010),
|
VCAN3 = (0x00000010),
|
||||||
RED = (0x00000040),
|
RED = (0x00000040),
|
||||||
ECU = (0x00000080),
|
ECU = (0x00000080),
|
||||||
IEVB = (0x00000100),
|
IEVB = (0x00000100),
|
||||||
PENDANT = (0x00000200),
|
Pendant = (0x00000200),
|
||||||
OBD2_PRO = (0x00000400),
|
OBD2_PRO = (0x00000400),
|
||||||
ECUCHIP_UART = (0x00000800),
|
ECUChip_UART = (0x00000800),
|
||||||
PLASMA = (0x00001000),
|
PLASMA = (0x00001000),
|
||||||
DONT_REUSE0 = (0x00002000), // Previously FIRE_VNET
|
DONT_REUSE0 = (0x00002000), // Previously FIRE_VNET
|
||||||
NEOANALOG = (0x00004000),
|
NEOAnalog = (0x00004000),
|
||||||
CT_OBD = (0x00008000),
|
CT_OBD = (0x00008000),
|
||||||
DONT_REUSE1 = (0x00010000), // Previously PLASMA_1_12
|
DONT_REUSE1 = (0x00010000), // Previously PLASMA_1_12
|
||||||
DONT_REUSE2 = (0x00020000), // Previously PLASMA_1_13
|
DONT_REUSE2 = (0x00020000), // Previously PLASMA_1_13
|
||||||
ION = (0x00040000),
|
ION = (0x00040000),
|
||||||
RADSTAR = (0x00080000),
|
RADStar = (0x00080000),
|
||||||
DONT_REUSE3 = (0x00100000), // Previously ION3
|
DONT_REUSE3 = (0x00100000), // Previously ION3
|
||||||
VCAN44 = (0x00200000),
|
VCAN4_4 = (0x00200000),
|
||||||
VCAN42 = (0x00400000),
|
VCAN4_2 = (0x00400000),
|
||||||
CMPROBE = (0x00800000),
|
CMProbe = (0x00800000),
|
||||||
EEVB = (0x01000000),
|
EEVB = (0x01000000),
|
||||||
VCANRF = (0x02000000),
|
VCANrf = (0x02000000),
|
||||||
FIRE2 = (0x04000000),
|
FIRE2 = (0x04000000),
|
||||||
FLEX = (0x08000000),
|
Flex = (0x08000000),
|
||||||
RADGALAXY = (0x10000000),
|
RADGalaxy = (0x10000000),
|
||||||
RADSTAR2 = (0x20000000),
|
RADStar2 = (0x20000000),
|
||||||
VIVIDCAN = (0x40000000),
|
VividCAN = (0x40000000),
|
||||||
OBD2_SIM = (0x80000000)
|
OBD2_SIM = (0x80000000)
|
||||||
};
|
};
|
||||||
// static const char* GetNetIDString(NetID netid) {
|
static const char* GetDeviceTypeString(DeviceType::Enum type) {
|
||||||
// switch(netid) {
|
switch(type) {
|
||||||
// default:
|
case Unknown:
|
||||||
// return "Invalid Network";
|
return "Unknown";
|
||||||
// }
|
case BLUE:
|
||||||
// }
|
return "neoVI BLUE";
|
||||||
|
case ECU_AVB:
|
||||||
|
return "neoECU AVB";
|
||||||
|
case RADSupermoon:
|
||||||
|
return "RADSupermoon";
|
||||||
|
case DW_VCAN:
|
||||||
|
return "DW_VCAN";
|
||||||
|
case RADMoon2:
|
||||||
|
return "RADMoon2";
|
||||||
|
case RADGigalog:
|
||||||
|
return "RADGigalog";
|
||||||
|
case VCAN4_1:
|
||||||
|
return "ValueCAN 4-1";
|
||||||
|
case FIRE:
|
||||||
|
return "neoVI FIRE";
|
||||||
|
case RADPluto:
|
||||||
|
return "RADPluto";
|
||||||
|
case VCAN4_2EL:
|
||||||
|
return "ValueCAN 4-2EL";
|
||||||
|
case RADIO_CANHUB:
|
||||||
|
return "RADIO_CANHUB";
|
||||||
|
case VCAN3:
|
||||||
|
return "ValueCAN 3";
|
||||||
|
case RED:
|
||||||
|
return "neoVI RED";
|
||||||
|
case ECU:
|
||||||
|
return "neoECU";
|
||||||
|
case IEVB:
|
||||||
|
return "IEVB";
|
||||||
|
case Pendant:
|
||||||
|
return "Pendant";
|
||||||
|
case OBD2_PRO:
|
||||||
|
return "neoOBD2-PRO";
|
||||||
|
case ECUChip_UART:
|
||||||
|
return "neoECU Chip UART";
|
||||||
|
case PLASMA:
|
||||||
|
return "neoVI PLASMA";
|
||||||
|
case NEOAnalog:
|
||||||
|
return "NEOAnalog";
|
||||||
|
case CT_OBD:
|
||||||
|
return "CT_OBD";
|
||||||
|
case ION:
|
||||||
|
return "ION";
|
||||||
|
case RADStar:
|
||||||
|
return "RADStar";
|
||||||
|
case VCAN4_4:
|
||||||
|
return "ValueCAN 4-4";
|
||||||
|
case VCAN4_2:
|
||||||
|
return "ValueCAN 4-2";
|
||||||
|
case CMProbe:
|
||||||
|
return "CMProbe";
|
||||||
|
case EEVB:
|
||||||
|
return "Intrepid Ethernet Evaluation Board";
|
||||||
|
case VCANrf:
|
||||||
|
return "ValueCAN.rf";
|
||||||
|
case FIRE2:
|
||||||
|
return "neoVI FIRE 2";
|
||||||
|
case Flex:
|
||||||
|
return "neoVI Flex";
|
||||||
|
case RADGalaxy:
|
||||||
|
return "RADGalaxy";
|
||||||
|
case RADStar2:
|
||||||
|
return "RADStar2";
|
||||||
|
case VividCAN:
|
||||||
|
return "VividCAN";
|
||||||
|
case OBD2_SIM:
|
||||||
|
return "neoOBD2-SIM";
|
||||||
|
case DONT_REUSE0:
|
||||||
|
case DONT_REUSE1:
|
||||||
|
case DONT_REUSE2:
|
||||||
|
case DONT_REUSE3:
|
||||||
|
// Intentionally don't use default so that the compiler throws a warning when something is added
|
||||||
|
return "Unknown neoVI";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Network() { setValue(NetID::Invalid); }
|
DeviceType() { value = DeviceType::Enum::Unknown; }
|
||||||
// Network(uint16_t netid) { setValue((NetID)netid); }
|
DeviceType(uint32_t netid) { value = (DeviceType::Enum)netid; }
|
||||||
// Network(NetID netid) { setValue(netid); }
|
DeviceType(DeviceType::Enum netid) { value = netid; }
|
||||||
// NetID getNetID() const { return value; }
|
DeviceType::Enum getDeviceType() const { return value; }
|
||||||
// Type getType() const { return type; }
|
friend std::ostream& operator<<(std::ostream& os, const DeviceType& DeviceType) {
|
||||||
// friend std::ostream& operator<<(std::ostream& os, const Network& network) {
|
os << GetDeviceTypeString(DeviceType.getDeviceType());
|
||||||
// os << GetNetIDString(network.getNetID());
|
return os;
|
||||||
// return os;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// NetID value; // Always use setValue so that value and type stay in sync
|
DeviceType::Enum value;
|
||||||
// Type type;
|
|
||||||
// void setValue(NetID id) {
|
|
||||||
// value = id;
|
|
||||||
// type = GetTypeOfNetID(value);
|
|
||||||
// }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue