Next: , Previous: , Up: API Definitions: Constants and Enumerations   [Contents]


B.2.2 STUnit Enumeration

Enumeration: STUnit

Quantity kind for an I/O value. The enumeration is append-only — never reorder existing values. Full list in starter/defs.h:

ST_UNIT_NULL

Dimensionless / unspecified

ST_UNIT_CELSIUS

Temperature, °C

ST_UNIT_PERCENT

Percentage, %

ST_UNIT_BAR

Pressure, bar

ST_UNIT_ONOFF

Binary 0/1

ST_UNIT_ENUM

Discrete enumerated value

ST_UNIT_V

Voltage, volt

ST_UNIT_W

Active power, watt

ST_UNIT_VAR

Reactive power, var

ST_UNIT_KW

Active power, kilowatt

ST_UNIT_WH

Energy, watt-hour

ST_UNIT_KWH

Energy, kilowatt-hour

ST_UNIT_SECONDS

Time, s

ST_UNIT_MINUTES

Time, min

ST_UNIT_HOURS

Time, h

ST_UNIT_FAHRENHEIT

Temperature, °F

ST_UNIT_KELVIN

Temperature, K

ST_UNIT_PA

Pressure, pascal

ST_UNIT_HPA

Pressure, hectopascal

ST_UNIT_KPA

Pressure, kilopascal

ST_UNIT_MPA

Pressure, megapascal

ST_UNIT_MBAR

Pressure, millibar

ST_UNIT_PSI

Pressure, psi

ST_UNIT_ATM

Pressure, atmosphere

ST_UNIT_MV

Voltage, millivolt

ST_UNIT_KV

Voltage, kilovolt

ST_UNIT_A

Current, ampere

ST_UNIT_MA

Current, milliampere

ST_UNIT_KA

Current, kiloampere

ST_UNIT_OHM

Resistance, ohm

ST_UNIT_HZ

Frequency, hertz

ST_UNIT_VA

Apparent power, VA

ST_UNIT_KVA

Apparent power, kVA

ST_UNIT_KVAR

Reactive power, kvar

ST_UNIT_MW

Active power, megawatt

ST_UNIT_J

Energy, joule

ST_UNIT_KJ

Energy, kilojoule

ST_UNIT_MJ

Energy, megajoule

ST_UNIT_MM

Length, millimetre

ST_UNIT_CM

Length, centimetre

ST_UNIT_M

Length, metre

ST_UNIT_KM

Length, kilometre

ST_UNIT_M2

Area, square metre

ST_UNIT_ML

Volume, millilitre

ST_UNIT_L

Volume, litre

ST_UNIT_M3

Volume, cubic metre

ST_UNIT_G

Mass, gram

ST_UNIT_KG

Mass, kilogram

ST_UNIT_T

Mass, tonne

ST_UNIT_M_S

Speed, m/s

ST_UNIT_KM_H

Speed, km/h

ST_UNIT_RPM

Rotational speed, rpm

ST_UNIT_L_MIN

Volumetric flow, L/min

ST_UNIT_M3_H

Volumetric flow, m³/h

ST_UNIT_DEGREE

Angle, degree

ST_UNIT_RADIAN

Angle, radian

ST_UNIT_LUX

Illuminance, lux

ST_UNIT_PPM

Concentration, ppm

ST_UNIT_PPB

Concentration, ppb

ST_UNIT_DB

Level, decibel

ST_UNIT_DBA

A-weighted sound level, dB(A)

ST_UNIT_PH

Acidity, pH

ST_UNIT_COUNT

Dimensionless count

ST_UNIT_RATIO

Dimensionless ratio

ST_UNIT_MS

Time, millisecond

ST_UNIT_DAYS

Time, day

ST_UNIT_BPS

Bit rate, bit/s

ST_UNIT_KBPS

Bit rate, kbit/s

ST_UNIT_MBPS

Bit rate, Mbit/s

ST_UNIT_BYTE

Data size, byte

ST_UNIT_KIB

Data size, kibibyte

ST_UNIT_MIB

Data size, mebibyte

ST_UNIT_GIB

Data size, gibibyte

ST_UNIT_N_UNITS

Sentinel (not a unit); count of valid values

Function: const gchar * st_unit_to_string (STUnit unit)

Maps a unit enumerator to a static lowercase token (e.g. "celsius", "kwh").

unit

Enumerator to render.

Returns: Static string owned by the library, or NULL if unit is out of range.

Function: gboolean st_unit_from_string (const gchar *str, STUnit *unit)

Case-insensitive parse of a unit token into an enumerator.

str

Token to parse; NULL or empty fails.

unit

Out-parameter for the parsed enumerator.

Returns: TRUE on success, FALSE if unknown.


Next: Special Constants, Previous: I/O Flags, Up: API Definitions: Constants and Enumerations   [Contents]