The LED API is a child of the Notification API and allows access to the LEDs on your device
This API is part of the coreapi
extension that is included automatically.
extensions: ["coreapi"]
Be sure to review the JavaScript API Usage guide for important information about using this API in JavaScript
Be sure to review the Ruby API Usage guide for important information about using this API in Ruby
Called on an LED object returned from the enumerate method, the specified LED will be extinguished.
Synchronous Return:
Method Access:
myObject.extinguish()
Called on an LED object returned from the enumerate method, the specified LED will be flashed.
Parameters
The properties associated with the LED flash.
When flashing, the LED will remain on for this number of milliseconds
When flashing, the LED will remain off for this number of milliseconds
The LED will flash this number of times.
Synchronous Return:
Method Access:
myObject.flash(HASH propertyMap)
Called on an LED object returned from the enumerate method, the specified LED will be illuminated.
Synchronous Return:
Method Access:
myObject.illuminate()
Human readable name for the notification object, e.g. ‘Green LED’.
Property Access:
myObject.name
Enumerating the LEDs will return an array objects which will map to the real LEDs on the device, using these returned objects you can control the device LEDs
# --------------- # controller.rb # --------------- def choose_led # Obtain list of available leds on the device. $leds = Rho::Notification::Led.enumerate render end def flash_led # receive an integer as parameter, which represents the number of the LED we wish to use led = $leds[@params["ledIndex"].to_i] led.numberOfCycles = 4 led.flash({}) end # --------------- # choose_led.erb # --------------- <ul data-role="listview"> <% $leds.each_with_index do |led, index| %> <li><a href="<%= url_for(:action => :flash_led, :query => {:ledIndex => index}) %>"><%= led.name %></li> <% end %> </ul>
The LED API relies on Zebra drivers on Windows Mobile / CE and therefore will not work on non-Zebra platforms. Depending on your device configuration, not all LEDs reported by the API may exist physically on the device.