Windows Management Instrumentation (WMI) LED API
The WMI LED API provides a way to control the LEDs on a device programmatically through WMI. The API includes a WMI class named "LED" and a method named "SetState" that can be used to turn on and off the LEDs.
LED WMI Class
The LED WMI class can be accessed through the ROOT\WMI
namespace. It has the following properties:
Property | Type | Description |
---|---|---|
CurrentBrightness | UInt8 | The current brightness level of the LED, ranging from 0 to 100. |
MaxBrightness | UInt8 | The maximum brightness level of the LED, ranging from 0 to 100. |
SupportedFeatures | UInt32 | A bitmask that indicates which features are supported by the LED. The following features are defined: |
Note: The LED WMI class is only available on devices that have LEDs.
SetState Method
The SetState method can be used to turn on and off the LED. It takes the following parameters:
Parameter | Type | Description |
---|---|---|
LedId | UInt32 | The ID of the LED to control. This parameter is optional, and if it is not specified, the method will control all available LEDs. |
State | UInt32 | The state to set the LED to. The following states are defined: |
Flags | UInt32 | Additional flags that can be used to control the LED. The following flags are defined: |
The possible values for the State
parameter are:
Value | Description |
---|---|
0 | Off |
1 | On |
2 | Blinking |
The possible values for the Flags
parameter are:
Value | Description |
---|---|
00h | No Error |
E1h | Error (Function not support) |
E2h | Error (Undefined device) |
E3h | Error (EC no respond) |
E4h | Error (Invalid Parameter) |
EFh | Error (Unexpected error) |
Others | Reserved |
Sample code to invoke the SetState Method
Example of sample code to invoke the SetState Method in the LED WMI interface:
For more on how to write code to call into WMI, see: