BlinkLed does nothing

Hi,

I would like to use the SetLed and BlinkLed functions in a .NET MAUI application.

I loaded the sample application form https://github.com/datalogic/xamarin-samples/tree/master/DeviceSampleAPI and ran it on a Datalogic Skorpio X5.

The TurnOnGreenSpotLed procedure works as expected, but the BtnLedBlinkClicked procedure that calls led.BlinkLed(Led.LedGreenSpot, 10, 500, 500); does nothing. I tried the other two LEDs but they behave the same. Nothing happens.

Charl

Hello @Charl_Pohlmann ,

Unfortunately this is a known defect, common among MAUI and low level Java SDK. Currently we do not have a schedule for a fix yet.
However, there is a pretty simple solution, which is to implement the same behavior through a LedOn/Delay/LedOff sequence.

This could be a possible custom C# implementation:

        private void CustomBlinkLed(Led led, int count, int onMs, int offMs)
        {
            ErrorManager.EnableExceptions(true);
            try
            {
                LedManager lm = new LedManager();

                for (int i = 0; i < count; i++)
                {
                    lm.SetLed(led, true);
                    Thread.Sleep(onMs);
                    lm.SetLed(led, false);
                    Thread.Sleep(offMs);
                }
            }
            catch (Exception exception)
            {
                Log.Error(this.GetType().Name, "Exception in CustomBlinkLed: " + exception.Message );
            }
        }

Simone Callegari
Mobile Products Specialist - SW Engineer

Thank you @Simone_Callegari ,

I will use the functionality as you explained.

1 Like