Initial commit
This commit is contained in:
commit
e1e03ba73f
38 files changed
+2968
No files matched your search
@@ -0,0 +1,13 @@
|
||||
package hu.gerviba.probe.util
|
||||
|
||||
object ProbeUtil {
|
||||
|
||||
fun formatId(probeName: String, sensorName: String): String {
|
||||
return "${probeName}__$sensorName"
|
||||
}
|
||||
|
||||
fun formatId(probeName: String, sensorName: String, measurementName: String): String {
|
||||
return "${probeName}__${sensorName}__$measurementName"
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package hu.gerviba.probe.util
|
||||
|
||||
enum class SensorDeviceClass(val literal: String, val description: String) {
|
||||
// Non-numerical device classes
|
||||
DATE("date", "Date. Unit of measurement: None. ISO8601 format."),
|
||||
DURATION("duration", "Fixed duration. Unit of measurement: d, h, min, s, ms."),
|
||||
ENUM("enum", "Enumeration. Provides a fixed list of options the state of the sensor can be in. Unit of measurement: None."),
|
||||
TIMESTAMP("timestamp", "Timestamp. Unit of measurement: None. ISO8601 format."),
|
||||
|
||||
// Numerical device classes
|
||||
APPARENT_POWER("apparent_power", "Apparent power. Unit of measurement: VA."),
|
||||
AQI("aqi", "Air Quality Index. Unit of measurement: None."),
|
||||
ATMOSPHERIC_PRESSURE("atmospheric_pressure", "Atmospheric pressure. Unit of measurement: UnitOfPressure units."),
|
||||
BATTERY("battery", "Percentage of battery that is left. Unit of measurement: %."),
|
||||
CO("carbon_monoxide", "Carbon Monoxide gas concentration. Unit of measurement: ppm."),
|
||||
CO2("carbon_dioxide", "Carbon Dioxide gas concentration. Unit of measurement: ppm."),
|
||||
CURRENT("current", "Current. Unit of measurement: A, mA."),
|
||||
DATA_RATE("data_rate", "Data rate. Unit of measurement: UnitOfDataRate."),
|
||||
DATA_SIZE("data_size", "Data size. Unit of measurement: UnitOfInformation."),
|
||||
DISTANCE("distance", "Generic distance. Unit of measurement: LENGTH_* units - SI /metric: mm, cm, m, km; USCS / imperial: in, ft, yd, mi."),
|
||||
ENERGY("energy", "Energy. Unit of measurement: Wh, kWh, MWh, MJ, GJ."),
|
||||
ENERGY_STORAGE("energy_storage", "Stored energy. Unit of measurement: Wh, kWh, MWh, MJ, GJ."),
|
||||
FREQUENCY("frequency", "Frequency. Unit of measurement: Hz, kHz, MHz, GHz."),
|
||||
GAS("gas", "Gas. Unit of measurement: SI / metric: m³; USCS / imperial: ft³, CCF."),
|
||||
HUMIDITY("humidity", "Relative humidity. Unit of measurement: %."),
|
||||
ILLUMINANCE("illuminance", "Illuminance. Unit of measurement: lx."),
|
||||
IRRADIANCE("irradiance", "Irradiance. Unit of measurement: SI / metric: W/m²; USCS / imperial: BTU/(h⋅ft²)."),
|
||||
MOISTURE("moisture", "Moisture. Unit of measurement: %."),
|
||||
MONETARY("monetary", "Amount of money. Unit of measurement: ISO4217 currency code."),
|
||||
NITROGEN_DIOXIDE("nitrogen_dioxide", "Amount of NO2. Unit of measurement: µg/m³."),
|
||||
NITROGEN_MONOXIDE("nitrogen_monoxide", "Amount of NO. Unit of measurement: µg/m³."),
|
||||
NITROUS_OXIDE("nitrous_oxide", "Amount of N2O. Unit of measurement: µg/m³."),
|
||||
OZONE("ozone", "Amount of O3. Unit of measurement: µg/m³."),
|
||||
PM1("pm1", "Particulate matter <= 0.1 μm. Unit of measurement: µg/m³."),
|
||||
PM10("pm10", "Particulate matter <= 10 μm. Unit of measurement: µg/m³."),
|
||||
PM25("pm25", "Particulate matter <= 2.5 μm. Unit of measurement: µg/m³."),
|
||||
POWER_FACTOR("power_factor", "Power factor. Unit of measurement: %, None."),
|
||||
POWER("power", "Power. Unit of measurement: W, kW."),
|
||||
PRECIPITATION("precipitation", "Accumulated precipitation. Unit of measurement: UnitOfPrecipitationDepth."),
|
||||
PRECIPITATION_INTENSITY("precipitation_intensity", "Precipitation intensity. Unit of measurement: UnitOfVolumetricFlux."),
|
||||
PRESSURE("pressure", "Pressure. Unit of measurement: mbar, cbar, bar, Pa, hPa, kPa, inHg, psi."),
|
||||
REACTIVE_POWER("reactive_power", "Reactive power. Unit of measurement: var."),
|
||||
SIGNAL_STRENGTH("signal_strength", "Signal strength. Unit of measurement: dB, dBm."),
|
||||
SOUND_PRESSURE("sound_pressure", "Sound pressure. Unit of measurement: dB, dBA."),
|
||||
SPEED("speed", "Generic speed. Unit of measurement: SPEED_* units or UnitOfVolumetricFlux."),
|
||||
SULPHUR_DIOXIDE("sulphur_dioxide", "Amount of SO2. Unit of measurement: µg/m³."),
|
||||
TEMPERATURE("temperature", "Temperature. Unit of measurement: °C, °F, K."),
|
||||
VOLATILE_ORGANIC_COMPOUNDS("volatile_organic_compounds", "Amount of VOC. Unit of measurement: µg/m³."),
|
||||
VOLATILE_ORGANIC_COMPOUNDS_PARTS("volatile_organic_compounds_parts", "Ratio of VOC. Unit of measurement: ppm, ppb."),
|
||||
VOLTAGE("voltage", "Voltage. Unit of measurement: V, mV."),
|
||||
VOLUME("volume", "Generic volume. Unit of measurement: VOLUME_* units."),
|
||||
VOLUME_STORAGE("volume_storage", "Generic stored volume. Unit of measurement: VOLUME_* units."),
|
||||
WATER("water", "Water. Unit of measurement: SI / metric: m³, L; USCS / imperial: ft³, CCF, gal."),
|
||||
WEIGHT("weight", "Generic weight, represents a measurement of an object's mass. Unit of measurement: MASS_* units."),
|
||||
WIND_SPEED("wind_speed", "Wind speed. Unit of measurement: SPEED_* units."),
|
||||
;
|
||||
|
||||
override fun toString(): String = literal
|
||||
}
|
||||
@@ -0,0 +1,178 @@
|
||||
package hu.gerviba.probe.util
|
||||
|
||||
enum class UnitOfMeasurement(val unit: String) {
|
||||
|
||||
// Apparent Power Units
|
||||
VOLT_AMPERE("VA"),
|
||||
|
||||
// Power Units
|
||||
WATT("W"),
|
||||
KILO_WATT("kW"),
|
||||
BTU_PER_HOUR("BTU/h"),
|
||||
|
||||
// Reactive Power Unit
|
||||
VOLT_AMPERE_REACTIVE("var"),
|
||||
|
||||
// Energy Units
|
||||
GIGA_JOULE("GJ"),
|
||||
KILO_WATT_HOUR("kWh"),
|
||||
MEGA_JOULE("MJ"),
|
||||
MEGA_WATT_HOUR("MWh"),
|
||||
WATT_HOUR("Wh"),
|
||||
|
||||
// Electric Current Units
|
||||
MILLIAMPERE("mA"),
|
||||
AMPERE("A"),
|
||||
|
||||
// Electric Potential Units
|
||||
MILLIVOLT("mV"),
|
||||
VOLT("V"),
|
||||
|
||||
// Temperature Units
|
||||
CELSIUS("°C"),
|
||||
FAHRENHEIT("°F"),
|
||||
KELVIN("K"),
|
||||
|
||||
// Time Units
|
||||
MICROSECONDS("μs"),
|
||||
MILLISECONDS("ms"),
|
||||
SECONDS("s"),
|
||||
MINUTES("min"),
|
||||
HOURS("h"),
|
||||
DAYS("d"),
|
||||
WEEKS("w"),
|
||||
MONTHS("m"),
|
||||
YEARS("y"),
|
||||
|
||||
// Length Units
|
||||
MILLIMETERS("mm"),
|
||||
CENTIMETERS("cm"),
|
||||
METERS("m"),
|
||||
KILOMETERS("km"),
|
||||
INCHES("in"),
|
||||
FEET("ft"),
|
||||
YARDS("yd"),
|
||||
MILES("mi"),
|
||||
|
||||
// Frequency Units
|
||||
HERTZ("Hz"),
|
||||
KILOHERTZ("kHz"),
|
||||
MEGAHERTZ("MHz"),
|
||||
GIGAHERTZ("GHz"),
|
||||
|
||||
// Pressure Units
|
||||
PA("Pa"),
|
||||
HPA("hPa"),
|
||||
KPA("kPa"),
|
||||
BAR("bar"),
|
||||
CBAR("cbar"),
|
||||
MBAR("mbar"),
|
||||
MMHG("mmHg"),
|
||||
INHG("inHg"),
|
||||
PSI("psi"),
|
||||
|
||||
// Sound Pressure Units
|
||||
DECIBEL("dB"),
|
||||
WEIGHTED_DECIBEL_A("dBA"),
|
||||
|
||||
// Volume Units
|
||||
CUBIC_FEET("ft³"),
|
||||
CENTUM_CUBIC_FEET("CCF"),
|
||||
CUBIC_METERS("m³"),
|
||||
LITERS("L"),
|
||||
MILLILITERS("mL"),
|
||||
GALLONS("gal"),
|
||||
FLUID_OUNCES("fl. oz."),
|
||||
|
||||
// Volume Flow Rate Units
|
||||
CUBIC_METERS_PER_HOUR("m³/h"),
|
||||
CUBIC_FEET_PER_MINUTE("ft³/m"),
|
||||
|
||||
// Mass Units
|
||||
GRAMS("g"),
|
||||
KILOGRAMS("kg"),
|
||||
MILLIGRAMS("mg"),
|
||||
MICROGRAMS("µg"),
|
||||
OUNCES("oz"),
|
||||
POUNDS("lb"),
|
||||
STONES("st"),
|
||||
|
||||
// Irradiance Units
|
||||
WATTS_PER_SQUARE_METER("W/m²"),
|
||||
BTUS_PER_HOUR_SQUARE_FOOT("BTU/(h⋅ft²)"),
|
||||
|
||||
// Volumetric Flux Units
|
||||
INCHES_PER_DAY("in/d"),
|
||||
INCHES_PER_HOUR("in/h"),
|
||||
MILLIMETERS_PER_DAY("mm/d"),
|
||||
MILLIMETERS_PER_HOUR("mm/h"),
|
||||
|
||||
// Precipitation Depth Units
|
||||
PRECIPITATION_INCHES("in"),
|
||||
PRECIPITATION_MILLIMETERS("mm"),
|
||||
PRECIPITATION_CENTIMETERS("cm"),
|
||||
|
||||
// Speed Units
|
||||
FEET_PER_SECOND("ft/s"),
|
||||
METERS_PER_SECOND("m/s"),
|
||||
KILOMETERS_PER_HOUR("km/h"),
|
||||
KNOTS("kn"),
|
||||
MILES_PER_HOUR("mph"),
|
||||
|
||||
// Information Units
|
||||
BITS("bit"),
|
||||
KILOBITS("kbit"),
|
||||
MEGABITS("Mbit"),
|
||||
GIGABITS("Gbit"),
|
||||
BYTES("B"),
|
||||
KILOBYTES("kB"),
|
||||
MEGABYTES("MB"),
|
||||
GIGABYTES("GB"),
|
||||
TERABYTES("TB"),
|
||||
PETABYTES("PB"),
|
||||
EXABYTES("EB"),
|
||||
ZETTABYTES("ZB"),
|
||||
YOTTABYTES("YB"),
|
||||
KIBIBYTES("KiB"),
|
||||
MEBIBYTES("MiB"),
|
||||
GIBIBYTES("GiB"),
|
||||
TEBIBYTES("TiB"),
|
||||
PEBIBYTES("PiB"),
|
||||
EXBIBYTES("EiB"),
|
||||
ZEBIBYTES("ZiB"),
|
||||
YOBIBYTES("YiB"),
|
||||
|
||||
// Data Rate Units
|
||||
BITS_PER_SECOND("bit/s"),
|
||||
KILOBITS_PER_SECOND("kbit/s"),
|
||||
MEGABITS_PER_SECOND("Mbit/s"),
|
||||
GIGABITS_PER_SECOND("Gbit/s"),
|
||||
BYTES_PER_SECOND("B/s"),
|
||||
KILOBYTES_PER_SECOND("kB/s"),
|
||||
MEGABYTES_PER_SECOND("MB/s"),
|
||||
GIGABYTES_PER_SECOND("GB/s"),
|
||||
KIBIBYTES_PER_SECOND("KiB/s"),
|
||||
MEBIBYTES_PER_SECOND("MiB/s"),
|
||||
GIBIBYTES_PER_SECOND("GiB/s"),
|
||||
|
||||
// Additional Units
|
||||
DEGREE("°"),
|
||||
CURRENCY_EURO("€"),
|
||||
CURRENCY_DOLLAR("$"),
|
||||
CURRENCY_CENT("¢"),
|
||||
PERCENTAGE("%"),
|
||||
AREA_SQUARE_METERS("m²"),
|
||||
CONDUCTIVITY("µS/cm"),
|
||||
LIGHT_LUX("lx"),
|
||||
UV_INDEX("UV index"),
|
||||
REVOLUTIONS_PER_MINUTE("rpm"),
|
||||
SIGNAL_STRENGTH_DECIBELS("dB"),
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT("dBm"),
|
||||
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER("µg/m³"),
|
||||
CONCENTRATION_PARTS_PER_MILLION("ppm"),
|
||||
CONCENTRATION_PARTS_PER_BILLION("ppb"),
|
||||
;
|
||||
|
||||
override fun toString(): String = unit
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user