![]() |
|
How to control the LED of your Pocket PC
By Stephane Sibue, January 11, 2001.
The LED of the Pocket PC
The necessary functions not declared in the SDKFunctions for handling LEDs can be found in 'coredll.dll' library, but they are not declared in the SDK (who knows why?). It is only the 'NLed.h' file that can make them appear, but the prototypes of the functions are not declared in this file. The first thing to do is to include the 'NLed.h' file and to declare 2 functions for handling LEDs: First of all, how many LEDs are there on my Pocket PC?Initially, it is necessary to know how many LEDs are present, knowing that the number of the first one is 0. To carry out this checking, we will use the 'NLedGetDeviceInfo' function: In case of a problem, this function returns 0. It also returns 0 if a Pocket PC does not have a LED to handle. In 99 cases out of a hundred this function returns 1. Off, On or BlinkWe can now modify the state of our LED. According to the contents of the 'NLed.h' file, the LED can appear in 3 states: off, on, and blink (stop, functioning, and blinking). Each state corresponds to a value of the 'OffOnBlink' parameter of the 'NLED_SETTINGS_INFO' structure. This structure also allows to implement other effects but this exceeds the topic of this article, we will return to this implementation later. Thus we will create a function, which takes the desired state of our LED as a parameter, which can be 0 for idle (off), 1 for fixed functioning (on), and 2 for the effect of blinking (blink): Thus, to light up the LED n°1, it is enough to write: to make it blink: and finally to estinguish it: DiscussDiscuss this article. Here you can write your comments and read comments of other developers. |
|||||||||||||||||||||