tags:

views:

101

answers:

1

I am aiding in the development for a custom made application for the Motorola MC75. It is well tuned except for a random bug with the barcode reader. Periodically, the barcode reader will only activate (start a read) if the right shoulder button is pressed. The middle and left shoulder buttons somehow become disabled. This is a unique bug in that it happens randomly and only effects 2 of the three buttons. The EMDK enables all buttons simultaneously so I am clueless as to where this is coming from (Internal or code related). If anyone has any input or advice please let me know and thank you beforehand.

Thanks,

Zach

A: 

Hi Zach,

I've worked with the Motorola EMDK before on the MC55. I'm not sure why the buttons are being disabled, and since you posted this in June you probably don't need the answer anymore, but here's a possible workaround:

Instead of letting the EMDK handle the triggers on its own, you can capture all triggers by setting up an event:

// Create a trigger device to handle all trigger events of stage 2 (pressed) or RELEASED
var device = new TriggerDevice(TriggerID.ALL_TRIGGERS, new[] { TriggerState.RELEASED, TriggerState.STAGE2 });
var trigger = new Trigger(device);
trigger.Stage2Notify += OnTrigger;

Then, in your OnTrigger method, you can handle the trigger and perform the appropriate action. For example, you can activate your barcode reader when any trigger is pressed:

private void OnTrigger(object sender, TriggerEventArgs e)
{
    if (e.NewState == e.PreviousState)
        return;

    // Pseudocode
    if (e.NewState == TriggerState.RELEASED)
    {
        myBarcodeReader.Actions.ToggleSoftTrigger();
        myBarcodeReader.Actions.Flush();
        myBarcodeReader.Actions.Disable();
    }
    else if (e.NewState == TriggerState.STAGE2)
    {
        // Prepare the barcode reader for scanning
        // This initializes various objects but does not actually enable the scanner device
        // The scanner device would still need to be triggered either via hardware or software
        myBarcodeReader.Actions.Enable();
        myBarcodeReader.Actions.Read(data);
        // Finally, turn on the scanner via software
        myBarcodeReader.Actions.ToggleSoftTrigger();
    }
}
Pandincus