How-To use digium.setLedState for BLF

I am trying to get the msg LED to flash using the digium.setLedState(parameters); listed in the API and I’m having trouble with the parameters I think. Can you give an example?

I think something like the following will do the trick for you:

digium.setLedState({
    name: "msg",
     state: "slow",
     color: "red",
}) ;

I’m still not getting a msg LED to turn on. I think it is a foreground issue as my debug shows false…

is there a way to force the app into the foreground other than digium.foreground(); ?

Yes, that is true. There is no way to force the LED state while your app is not in the foreground.

What are you trying to do specifically? Perhaps you could describe an additional application you would like me to post to github.com/digium/digium-phone-apps that will demonstrate what you’re trying to accomplish?

I am trying send a message to the phone screen and flash the msg or blf LED, then the user can select from a menu to take action on it. The message needs to stay on the screen and flash msg or blf without timing out. The message can be updated from the server before a timeout.

I don’t know if this is the best way to do this but I did come up with the following…

[code]var app_foreground = function() {
util.debug("digium.app.inForeground?: "+digium.app.inForeground); // shows true
digium.setLedState({
name: “msg”,
state: “fast”,
color: “amber”,
}) ;
};

digium.event.observe({
‘eventName’ : ‘digium.app.foreground’,
‘callback’ : app_foreground

});[/code]

This does fast blink the MSG LED Amber, I will keep looking into this and if anybody out there has a better way, you can post here.

Sorry for necro-posting, but… maybe there is a way to control led from IDLE application? I mean, like, big clocks instead of logo. But looks liks it’s a background app… Can someone give a hint? I need control LEDs from idle application.

This is pretty stupid give access to LEDs only for foreground app, because of any incoming dial hides app and restore LEDs to default, and incoming call (just up handset) do same… This is not logical.