solarnetwork-api-core
    Preparing search index...

    Class DeviceOperatingState

    An enumeration of standardized device operating states.

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    • get bitmaskBitNumber(): number

      Get the bit offset value, starting from 1 for the least significant bit.

      Returns number

      the 1-based value

    • get bitmaskBitOffset(): number

      Get the bit offset value, starting from 0 for the least significant bit.

      Returns number

      the 0-based value

    • get name(): string

      Get the enum name.

      Returns string

      the name

    Methods

    • Test if a string is equal to this enum's name.

      As long as enum values are consistently obtained from the Util.Enum.enumValues array then enum instances can be compared with ===. If unsure, this method can be used to compare string values instead.

      If value is passed as an actual Enum instance, then if that enum is the same class as this enum it's name is compared to this instance's name.

      Parameters

      • value: string | Enum

        the value to test

      Returns boolean

      true if value is the same as this instance's name value

    • Get a BitmaskEnum objects for a bit number.

      Type Parameters

      Parameters

      • bitNumber: number

        a bit number value of the BitmaskEnum object to find

      • values: Iterable<T>

        the complete set of possible BitmaskEnum objects

      Returns undefined | T

      the matching BitmaskEnum, or undefined

    • This method takes an array of enums and turns them into a mapped object, using the enum name as object property names.

      Type Parameters

      Parameters

      • enums: readonly T[]

        the enum list to turn into a value object

      Returns { readonly [key: string]: object }

      an object with enum name properties with associated enum values

    • Get the names of a set of Enum instances.

      Type Parameters

      Parameters

      • set: Iterable<T>

        the set of Enum instances to get the names of

      Returns string[]

      array of Enum name values

    • Convert a bitmask value into a set of BitmaskEnum objects.

      Type Parameters

      Parameters

      • mask: number

        a bitmask value of a set of BitmaskEnum objects

      • Optionalvalues: Iterable<T, any, any>

        the complete set of possible BitmaskEnum objects

      Returns Set<T>

      a set of BitmaskEnum objects

    • Get an enum instance from its name.

      This method searches the Util.Enum.enumValues array for a matching value.

      Type Parameters

      Parameters

      • name: string

        the enum name to get an instnace for

      Returns undefined | T

      the instance, or undefined if no instance exists for the given name