#pragma once #include #include "Hardware.h" #include "Identifier.h" #include "Parameter.h" #include #include "Control.h" #include "dll_macro.h" class Visitor; struct innerSensor; class DLL_API SensorValue { public: SensorValue(float value, time_t time) { this->value = value; this->timestamp = time; } time_t getTimestamp() { return timestamp; } bool operator==(const SensorValue& other) const { return (this->value == other.value) && (this->timestamp == other.timestamp); } float getValue() { return value; } private: time_t timestamp; float value; }; enum class SensorType { Voltage, // V Current, // A Power, // W Clock, // MHz Temperature, // °C Load, // % Frequency, // Hz Fan, // RPM Flow, // L/h Control, // % Level, // % Factor, // 1 Data, // GB = 2^30 Bytes SmallData, // MB = 2^20 Bytes Throughput, // B/s TimeSpan, // Seconds Energy, // milliwatt-hour (mWh) Noise, // dBA Conductivity, // µS/cm Humidity, // % ObjectIsNull }; class DLL_API Sensor { public: Sensor(std::shared_ptr inner); ~Sensor(); bool isNull() const; bool operator==(const Sensor& other) const; float getMax();//如果是null返回FLT_MIN即float最小值 float getMin();//如果是null返回FLT_MAX即float最大值 std::vector getValues(); SensorType getType(); float getValue(); //需自行delete[] char* getName(); std::vector getParameters(); time_t getTimeSpan(); void resetMin(); void resetMax(); void clearValues(); void Accept(Visitor* visitor); void Traverse(Visitor* visitor); Hardware getHardware(); Identifier getIdentifier(); bool isDefaultHidden(); int getIndex(); CsControl getControl(); private: std::shared_ptr inner; };