How to Scan GS1 barcode with zebra MC9300 for Xamarin.Forms App

92 views Asked by At

I am developing a Xamarin app to scan gs1 barcode with Zebra MC9300,

I have three textboxes in Xamarin forms, Serial Number, Lot Number, and Quantity. Now what I want is to scan with this Zebra scanner and autofill data into three textboxes I have from the information of GS1 Barcode.

Here is some code but I don't know where to start:

public void ParseGS1Data(string gs1Data)
{

    string serialNumber = string.Empty;
    string lot = string.Empty;
    string quantity = string.Empty;

    // Assuming GS1 data format is "01<SerialNumber>10<Lot>30<Quantity>"
    int serialIndex = gs1Data.IndexOf("01");
    int lotIndex = gs1Data.IndexOf("10");
    int quantityIndex = gs1Data.IndexOf("30");

    if (serialIndex >= 0 && lotIndex >= 0 && quantityIndex >= 0)
    {
        serialNumber = gs1Data.Substring(serialIndex + 2, lotIndex - serialIndex - 2);
        lot = gs1Data.Substring(lotIndex + 2, quantityIndex - lotIndex - 2);
        quantity = gs1Data.Substring(quantityIndex + 2);
    }

    // Update your Xamarin UI textboxes with the extracted values
    serialNumberEntry.Text = serialNumber;
    lotEntry.Text = lot;
    quantityEntry.Text = quantity;
}

Before I used Zxing library to scan but with camera to scan and autofill data into textboxes, but with the zebra scanner do know what to do

0

There are 0 answers