Since AURA SDK v3.1 provides OLE Automation mechanism (IDispatch), it is easy to use functions provided by AURA SDK v3.1 in scripting languages such as Python.
win32com.client module: Dispatch() from win32com.client to create instance of AURA SDK. The ProgID aura.sdk.1 is used as the parameter to Dispatch(): After the instance of AuraSdk is created, we can aquire the control and then enumerated all AURA-compatible devices:
The parameter passed into Enumerate() means the type of devices that should be enumerated. 0 means all types of devices. You can enumerate specific type of devices by passing other values. For details, please refer to reference of Enumerate() .
devices returned by Enumerate() is a "collection" of all devices. Each device can be accessed via for-in loop: All LED's of a certain device can be accessed via the Lights property of the corresponding device. The Lights property is also a "collection", so the each LED can be easily accessed similar to the devices in a device collection. Besides that, it can also be accessed by indices, which is shown in the following code snippet.
Now, lets set all the LED's color to blue by modifying the color property of each light. The data type of color property is 32-bit unsigned integer, and it's format is "0x00GGBBRR", where G equals Green, B equals Blue, and R equals Red. So "blue" should be 0x00FF0000:
Note that besides color, there are also Red, Green and Blue properties in light object to set each color directly. Please refer to the reference chapter for more details.
If the device is a keyboard, we can access each LED by specifying its key code via Key property. The following code snippet set color of 'A', 'U' and 'R' to red:
Please check (Enumerate())[AuraServiceLib::IAuraSdk::Enumerate()] for device type ID's and Appendix A for key code list.
Apply() of device should be called to make the new settings take effect: