Application Level

The Application Level regroups the features that are required for the application to operate in an optimum way.

One piece of information that is useful, especially in case of an anomaly, is to retrieve the version of Capture and the version of the Scanner connected to the host.

In the event multiple scanners are used on a single device, there is then a way to identify them by assigning a friendly name.

Another useful feature is the scenario where the host computer is out of range from where the scan happens, and to confirm the barcode was actually received by the application.

Display the Capture Version

This feature is useful when an issue arises in a deployment in order to help identify the version of CaptureSDK actually in use. Here is a sample of code for retrieving the Capture Version:

// retrieve the version of Capture
CaptureHelper.VersionResult versionResult = await capture.GetCaptureVersionAsync();
labelCaptureVersion.Text =
    "Capture: v" + versionResult.ToStringVersion() + "   " + versionResult.ToStringDate(true);

In this sample code, capture is a CaptureHelper object instance.

Give a Friendly Name to a Scanner

In a deployment where multiple scanners are present, it is helpful to identify them with a friendly name that makes sense (e.g. ‘’Register1Scanner’’). Here is a sample code to change the friendly name:

CaptureHelper.AsyncResult result = await Device.SetFriendlyNameAsync(textBoxFriendlyName.Text);
if (!result.IsSuccessful())
{
    MessageBox.Show(string.Format("Error trying to change the friendly name: {0:d}", result.Result),
        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

Here Device is a CaptureHelperDevice object instance.

Data confirmation from the application

For some deployments where the user might be unable to see the screen of the host when scanning a barcode, there is a way to have the application confirm receipt of the barcode. In this case the trigger button will be disabled until the application confirms the decoded data or until the trigger lock out timer elapses. First, Capture needs to be configured with Data Confirmation Mode set to ‘’App’’. This mode is persistent in Capture. If a scanner is connected then it will be configured to App mode as well at this time, otherwise, when a scanner connects it will be automatically configured to App mode during the connection process.

Here is a code that reads the current Data Confirmation Mode and updates some of Radio Buttons in the UI with the result:

// retrieve the Data Confirmation Mode
CaptureHelper.DataConfirmationModeResult confirmationMode =
    await capture.GetDataConfirmationModeAsync();
if (confirmationMode.IsSuccessful())
{
    appConfirmation = false;
    if (confirmationMode.Mode == ICaptureProperty.Values.ConfirmationMode.kApp)
    {
        radioButtonDataConfirmationApp.Checked = true;
        appConfirmation = true;
    }
    else if (confirmationMode.Mode == ICaptureProperty.Values.ConfirmationMode.kCapture)
    {
        radioButtonDataConfirmationCapture.Checked = true;
    }
    else if (confirmationMode.Mode == ICaptureProperty.Values.ConfirmationMode.kDevice)
    {
        radioButtonDataConfirmationLocal.Checked = true;
    }
    else
    {
        radioButtonDataConfirmationNone.Checked = true;
    }
}
else
{
    DialogResult dialogResult = MessageBox.Show(
        "Unable to retrieve the Data Confirmation Mode",
        "Error",
        MessageBoxButtons.OK,
        MessageBoxIcon.Error);
}

The following code shows how to change the Data Confirmation Mode, and in this case it happens on a timer that starts when one of these Radio Buttons changes:

byte mode = ICaptureProperty.Values.ConfirmationMode.kOff;
if (radioButtonDataConfirmationApp.Checked)
{
    mode = ICaptureProperty.Values.ConfirmationMode.kApp;
}
else if (radioButtonDataConfirmationCapture.Checked)
{
    mode = ICaptureProperty.Values.ConfirmationMode.kCapture;
}
else if (radioButtonDataConfirmationLocal.Checked)
{
    mode = ICaptureProperty.Values.ConfirmationMode.kDevice;
}
CaptureHelper.AsyncResult result = await capture.SetDataConfirmationModeAsync(mode);
if (!result.IsSuccessful())
{
    DialogResult dialogResult = MessageBox.Show(
        "Unable to change the Data Confirmation Mode",
        "Error",
        MessageBoxButtons.OK,
        MessageBoxIcon.Error);
}

If the Data Confirmation Mode is configured to ‘’App’’, then the application is responsible for acknowledging the decoded data to the scanner. Here is example code showing how an application can acknowledge the decoded data:

async void CaptureDecodedData(object sender, CaptureHelper.DecodedDataArgs e)
{
    textBoxDecodedData.Text = e.DecodedData.DataToUTF8String;
    if (appConfirmation)
    {
        int beep = ICaptureProperty.Values.DataConfirmation.kBeepGood;
        int led = ICaptureProperty.Values.DataConfirmation.kLedGreen;
        int rumble = ICaptureProperty.Values.DataConfirmation.kRumbleGood;
        await capture.SetDataConfirmationActionAsync(beep, led, rumble);
    }
}

Note

The Data Confirmation Mode set to ‘’App’’ is the slowest way of scanning barcodes. Another way to handle cases where the barcode might be incorrect, is to have the application sending a Bad Beep, Bad Vibration and Red LED to the scanner and disabling the trigger button until the user acknowledges a message on the host screen explaining the issue. Please refer to Wrong Barcode Indication and Disabling the Scanner Trigger Button