MC75条形码阅读器问题

时间:2010-06-14 18:26:56

标签: c# motorola-emdk

我正在帮助开发摩托罗拉MC75的定制应用程序。除了条形码阅读器的随机错误外,它已经过很好的调整。如果按下右肩按钮,条形码阅读器将只会定期激活(开始读取)。中间和左肩按钮不知何故被禁用。这是一个独特的错误,它随机发生,只影响三个按钮中的2个。 EMDK同时启用所有按钮,因此我对它的来源(内部或代码相关)毫无头绪。如果有人有任何意见或建议,请事先告诉我并谢谢你。

谢谢,

扎克

1 个答案:

答案 0 :(得分:1)

之前我曾在MC55上使用摩托罗拉EMDK。我不确定为什么这些按钮被禁用,因为你在6月发布了这个按钮,你可能不再需要答案了,但是这里有一个可能的解决方法:

您可以通过设置事件来捕获所有触发器,而不是让EMDK自己处理触发器:

// 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;

然后,在OnTrigger方法中,您可以处理触发器并执行相应的操作。例如,您可以在按下任何触发器时激活条形码阅读器:

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();
    }
}
相关问题