LED

Description

The LED object represents an LED attached to the device. It allows turning on/off or toggling an LED.

This object was introduced in InCore 2.0.

› Inherits:Object

Properties

index

This property holds the index of the LED which to control through the object instance. If systemName is set, this property is ignored.

› Type:Index
› Default:LED.None
› Signal:indexChanged()
› Attributes:Writable

networkInterfaceName

This property holds the name of the network interface (i.e. NetworkInterface.hardwareName) which to indicate traffic for.

This property was introduced in InCore 2.5.

› Type:String
› Signal:networkInterfaceNameChanged()
› Attributes:Writable

systemName

This property holds the system name of the LED (i.e. the name of the corresponding entry in /sys/class/leds/) which to control through the object instance. This property takes precedence over index.

This property was introduced in InCore 2.5.

› Type:String
› Signal:systemNameChanged()
› Attributes:Writable

trigger

This property holds a trigger which controls the LED at the system level automatically. See the LED.Trigger enumeration for details.

This property was introduced in InCore 2.5.

› Type:Trigger
› Default:LED.NoTrigger
› Signal:triggerChanged()
› Attributes:Writable

value

This property holds the desired state of the LED.

› Type:Boolean
› Default:false
› Signal:valueChanged()
› Attributes:Writable

Methods

toggle()

This method toggles the current state of the LED, i.e. inverts the value property.

Enumerations

Index

This enumeration describes the supported LED indexes.

Name Value Description
LED.None 0 No valid LED configured.
LED.StatusRed 1 The red status LED.
LED.StatusGreen 2 The green status LED.
LED.StatusBlue 3 The blue status LED.

Trigger

This enumeration describes the supported triggers for controlling LEDs at the system level. A trigger makes the configured LED flash on certain events or under certain conditions.

This enumeration was introduced in InCore 2.5.

Name Value Description
LED.NoTrigger 0 No trigger configured.
LED.Heartbeat 1 A trigger indicating a running system as well as the system load.
LED.StorageAccess 2 A trigger indicating access to the local storage (MMC/NAND).
LED.NetworkTraffic 3 A trigger indicating traffic at a certain network interface (networkInterfaceName).
LED.SystemActivity 4 A trigger indicating any kind of CPU usage.

Example

import InCore.Foundation 2.5
import InCore.IO 2.5

Application {

    LED {
        id: blueLed
        index: LED.StatusBlue
    }

    // toggle blue LED every 1000 ms
    Timer {
        onTriggered: blueLed.toggle()
    }

    AnalogInput {
        id: ain
        index: AnalogInput.AIN1
        mode: AnalogInput.Mode10V
        Polling on value { }
    }

    // turn on red LED if AIN1 exceeds 5 V
    LED {
        index: LED.StatusRed
        value: ain.value > 2048
    }
}