package client // HardwareType type // https://github.com/openhardwaremonitor/openhardwaremonitor/blob/e199e0ccc69b4da92495266ebc0faf7daad97608/Hardware/IHardware.cs type HardwareType int const ( // UnknownHardware type UnknownHardware HardwareType = iota // Mainboard type Mainboard // SuperIO type SuperIO // CPU type CPU // RAM type RAM // GpuNvidia type GpuNvidia // GpuAti type GpuAti // TBalancer type TBalancer // Heatmaster type Heatmaster // HDD type HDD // Controller type for TBalancer or Heatmaster Controller // Computer type for host Computer ) // Hardware value type Hardware struct { Type HardwareType Value string TypeIndex int TypeCount int } // Sensor for unit // https://github.com/openhardwaremonitor/openhardwaremonitor/blob/e199e0ccc69b4da92495266ebc0faf7daad97608/Hardware/ISensor.cs type Sensor int const ( // UnknownSensor in V UnknownSensor Sensor = iota // Voltage in V Voltage // Clock in MHz Clock // Temperature in °C Temperature // Load in % Load // Fan in RPM Fan // Flow in L/h Flow // Control in % Control // Level in % Level // Factor in 1 Factor // Power in W Power // Data in GB = 2^30 Bytes Data // SmallData in MB = 2^20 Bytes SmallData ) var hardwareToMetric = map[HardwareType]string{ UnknownHardware: "unknown", Mainboard: "mainboard", SuperIO: "superio", CPU: "cpu", RAM: "ram", GpuNvidia: "gpu", GpuAti: "gpu", TBalancer: "tbalancer", Heatmaster: "heatmaster", HDD: "hdd", Controller: "controller", Computer: "host", } var sensorToMetric = map[Sensor]string{ UnknownSensor: "unknown", Voltage: "voltage", Clock: "mhz", Temperature: "temp", Load: "load", Fan: "rpm", Flow: "flow", Control: "control", Level: "level", Factor: "factor", Power: "power", Data: "gb", SmallData: "mb", } var imageToHardware = map[string]HardwareType{ "ati.png": GpuAti, // "bigng.png": Heatmaster, // "bigng.png": TBalancer, "bigng.png": Controller, "chip.png": SuperIO, "cpu.png": CPU, "hdd.png": HDD, "mainboard.png": Mainboard, "nvidia.png": GpuNvidia, "ram.png": RAM, "computer.png": Computer, } var sensorToType = map[string]Sensor{ "Clocks": Clock, "Controls": Control, "Data": Data, "Factors": Factor, "Fans": Fan, "Flows": Flow, "Levels": Level, "Load": Load, "Powers": Power, "Temperatures": Temperature, "Voltages": Voltage, } func (s Sensor) String() string { switch s { case Clock: return "Clock" case Control: return "Control" case Data: return "Data" case Factor: return "Factor" case Fan: return "Fan" case Flow: return "Flow" case Level: return "Level" case Load: return "Load" case Power: return "Power" case SmallData: return "SmallData" case Temperature: return "Temperature" case Voltage: return "Voltage" } return "Unknown" } func (h HardwareType) String() string { switch h { case UnknownHardware: return "Unknown" case Mainboard: return "Mainboard" case SuperIO: return "SuperIO" case CPU: return "CPU" case RAM: return "RAM" case GpuNvidia: return "GpuNvidia" case GpuAti: return "GpuAti" case TBalancer: return "TBalancer" case Heatmaster: return "Heatmaster" case HDD: return "HDD" case Controller: return "Controller" case Computer: return "Computer" } return "Unknown" }