Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LED

Any device controlled by the generic LED driver. See https://www.kernel.org/doc/Documentation/leds/leds-class.txt for more details.

Hierarchy

Index

Constructors

constructor

  • new LED(deviceName: string): LED

Properties

connected

connected: boolean

deviceDirName

deviceDirName: string

deviceName

deviceName: string

deviceRoot

deviceRoot: string

Static overrideSysClassDir

overrideSysClassDir: string

Accessors

brightness

  • get brightness(): number
  • set brightness(value: number): void
  • Sets the brightness level. Possible values are from 0 to max_brightness.

    Returns number

  • Sets the brightness level. Possible values are from 0 to max_brightness.

    Parameters

    • value: number

    Returns void

brightnessPct

  • get brightnessPct(): number
  • set brightnessPct(brightnessPct: number): void
  • Sets the LED's brightness to the given percent (0-1) of the max value.

    Returns number

  • Sets the LED's brightness to the given percent (0-1) of the max value.

    Parameters

    • brightnessPct: number

    Returns void

delayOff

  • get delayOff(): number
  • set delayOff(value: number): void
  • The timer trigger will periodically change the LED brightness between 0 and the current brightness setting. The off time can be specified via delay_off attribute in milliseconds.

    Returns number

  • The timer trigger will periodically change the LED brightness between 0 and the current brightness setting. The off time can be specified via delay_off attribute in milliseconds.

    Parameters

    • value: number

    Returns void

delayOn

  • get delayOn(): number
  • set delayOn(value: number): void
  • The timer trigger will periodically change the LED brightness between 0 and the current brightness setting. The on time can be specified via delay_on attribute in milliseconds.

    Returns number

  • The timer trigger will periodically change the LED brightness between 0 and the current brightness setting. The on time can be specified via delay_on attribute in milliseconds.

    Parameters

    • value: number

    Returns void

maxBrightness

  • get maxBrightness(): number
  • Returns the maximum allowable brightness value.

    Returns number

trigger

  • get trigger(): string
  • set trigger(value: string): void
  • Sets the led trigger. A trigger is a kernel based source of led events. Triggers can either be simple or complex. A simple trigger isn't configurable and is designed to slot into existing subsystems with minimal additional code. Examples are the ide-disk and nand-disk triggers.

    Complex triggers whilst available to all LEDs have LED specific parameters and work on a per LED basis. The timer trigger is an example. The timer trigger will periodically change the LED brightness between 0 and the current brightness setting. The on and off time can be specified via delay_{on,off} attributes in milliseconds. You can change the brightness value of a LED independently of the timer trigger. However, if you set the brightness value to 0 it will also disable the timer trigger.

    Returns string

  • Sets the led trigger. A trigger is a kernel based source of led events. Triggers can either be simple or complex. A simple trigger isn't configurable and is designed to slot into existing subsystems with minimal additional code. Examples are the ide-disk and nand-disk triggers.

    Complex triggers whilst available to all LEDs have LED specific parameters and work on a per LED basis. The timer trigger is an example. The timer trigger will periodically change the LED brightness between 0 and the current brightness setting. The on and off time can be specified via delay_{on,off} attributes in milliseconds. You can change the brightness value of a LED independently of the timer trigger. However, if you set the brightness value to 0 it will also disable the timer trigger.

    Parameters

    • value: string

    Returns void

triggers

  • get triggers(): string[]
  • Returns a list of available triggers.

    Returns string[]

Methods

connect

  • connect(driverName: string, nameConvention?: string, propertyConstraints?: object): void
  • Parameters

    • driverName: string
    • Optional nameConvention: string
    • Optional propertyConstraints: object
      • [propertyName: string]: any

    Returns void

Protected constructPropertyPath

  • constructPropertyPath(property: string, deviceRoot?: string): string

flash

  • flash(onInterval: number, offInterval: number): void
  • Flashes the LED on a timer using the given intervals.

    Parameters

    • onInterval: number
    • offInterval: number

    Returns void

off

  • off(): void
  • Sets brightness to 0, turning the LED off

    Returns void

on

  • on(): void
  • Sets brightness to maximum value, turning the LED on

    Returns void

readNumber

  • readNumber(property: string, deviceRoot?: string): number
  • Parameters

    • property: string
    • Optional deviceRoot: string

    Returns number

readProperty

  • readProperty(property: string, deviceRoot?: string): any

readString

  • readString(property: string, deviceRoot?: string): string
  • Parameters

    • property: string
    • Optional deviceRoot: string

    Returns string

readStringArray

  • readStringArray(property: string, deviceRoot?: string): string[]

readStringArrayAsType

  • readStringArrayAsType<T>(property: string, deviceRoot?: string): T[]

readStringAsType

  • readStringAsType<T>(property: string, deviceRoot?: string): T

readStringSelector

  • readStringSelector(property: string, deviceRoot?: string): string

registerEventCallback

  • registerEventCallback(callbackFunction: function, eventPredicate: function, firstTriggerOnly?: boolean, userCallbackData?: any): void
  • Parameters

    • callbackFunction: function
        • (err?: Error, userData?: any): void
        • Parameters

          • Optional err: Error
          • Optional userData: any

          Returns void

    • eventPredicate: function
        • (userData?: any): boolean
        • Parameters

          • Optional userData: any

          Returns boolean

    • Default value firstTriggerOnly: boolean = false
    • Optional userCallbackData: any

    Returns void

registerEventPromise

  • registerEventPromise(eventPredicate: function, userCallbackData?: any): Promise<any>
  • Parameters

    • eventPredicate: function
        • (userData?: any): boolean
        • Parameters

          • Optional userData: any

          Returns boolean

    • Optional userCallbackData: any

    Returns Promise<any>

set

  • set(propertyDefs: any): void
  • Parameters

    • propertyDefs: any

    Returns void

setNumber

  • setNumber(property: string, value: number): void

setProperty

  • setProperty(property: string, value: any): any

setString

  • setString(property: string, value: string): void

Generated using TypeDoc