SDI12Address struct

Conversion and validation for the 62 permitted SDI-12 sensor addresses.

The numeric mapping follows the established library examples: 0 through 9 map to 0 through 9, a through z map to 10 through 35, and A through Z map to 36 through 61. The wildcard ? is not a sensor address.

Public types

enum (anonymous): uint8_t { kAddressCount = 62U }

Public static functions

static bool isValid(char address) -> bool
Check whether a character is a valid sensor address.
static int8_t toIndex(char address) -> int8_t
Convert a sensor address to its numeric index.
static char fromIndex(uint8_t index) -> char
Convert a numeric index to its sensor address character.

Enum documentation

enum SDI12Address::(anonymous): uint8_t

Enumerators
kAddressCount

Number of valid SDI-12 sensor addresses.



Function documentation

static bool SDI12Address::isValid(char address)

Check whether a character is a valid sensor address.

Parameters
address Character to check.
Returns bool true for 0-9, a-z, or A-Z; otherwise false.

static int8_t SDI12Address::toIndex(char address)

Convert a sensor address to its numeric index.

Parameters
address Valid sensor address character.
Returns int8_t Address index from 0 through 61, or -1 when address is invalid.

static char SDI12Address::fromIndex(uint8_t index)

Convert a numeric index to its sensor address character.

Parameters
index Address index from 0 through 61.
Returns char The corresponding address, or the null character when index is invalid.