AMLBarcodeScannerLib 1.6.0

dotnet add package AMLBarcodeScannerLib --version 1.6.0                
NuGet\Install-Package AMLBarcodeScannerLib -Version 1.6.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AMLBarcodeScannerLib" Version="1.6.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AMLBarcodeScannerLib --version 1.6.0                
#r "nuget: AMLBarcodeScannerLib, 1.6.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AMLBarcodeScannerLib as a Cake Addin
#addin nuget:?package=AMLBarcodeScannerLib&version=1.6.0

// Install AMLBarcodeScannerLib as a Cake Tool
#tool nuget:?package=AMLBarcodeScannerLib&version=1.6.0                

AML Barcode Scanner Library NuGet

Overview

AML Barcode Scanner Library provides an easy way to interface with an AML device's barcode scanner. The library allows you to create an instance of AMLBarcodeScanner. You can listen for incoming barcode scan data and configure scanner settings. This library works for Android.Xamarin, Xamarin Forms, and Maui.

Usage

The library contains a class called AMLBarcodeScanner that is used to interface with the scanner:

var scanner = new AMLBarcodeScanner(this);

The parameter for the constructor is the Context of the Android application.

Example

Opening the scanner and registering for scan data.

var scanner;

public void initScanner()
{
    scanner = new AMLBarcodeScanner(this);

    //Open the scanner connection
    scanner.Open();
    scanner.Scanned += ReceiveScan;   
}

public void ReceiveScan(string barcode, string rawBarcode)
{
    //Process barcode data
}

Querying and updating scanner settings.

public void QueryScannerSettings()
{
    scanner.GetScannerSettings(ScannerSettingsReceived);
}

public void ScannerSettingsReceived(ScannerSettings settings)
{
    var currentSuffix = settings.GetSuffix();
    if (currentSuffix == null || currentSuffix != "!")
    {
        settings.SetSuffix("!");
        scanner.ChangeSettings(settings);
    }
}

Registering for trigger events.

public void RegisterTriggerEvents()
{
    scanner.TriggerPulled += TriggerWasPulled;   
    scanner.TriggerReleased += TriggerWasReleased; 
}

public void TriggerWasPulled()
{
    //Handle trigger pull
}

public void TriggerWasReleased()
{
    //Handle trigger release
}

Querying BT Scanner and registering for events.

BTDeviceInfo storedBTScanner;

public void GetCurrentBTDevice()
{
    if (AMLDevice.IsBTScannerSupported())
        scanner.GetBTScannerInfo(ReceivedBTScannerInfo);
}

public void ReceivedBTScannerInfo(BTDeviceInfo btDevice)
{
    var name = btDevice.GetBTName();
    if (!String.IsNullOrEmpty(name))
    {
        storedBTScanner = btDevice;
        RegisterBTScannerEvents();
    }
}

public void RegisterBTScannerEvents()
{
    scanner.BTScannerConnected += BTScannerConnect;   
    scanner.BTScannerDisconnected += BTScannerDisconnect; 
    scanner.BTScannerLowBattery += BTLowBattery;
}

public void BTScannerConnect(BTScanDevice btDevice)
{
    //Add functionality
}

public void BTScannerDisconnect(BTScanDevice btDevice)
{
    //Add functionality
}

public void BTLowBattery(int batteryLevel)
{
    //Add functionality
}
Product Compatible and additional computed target framework versions.
MonoAndroid monoandroid10 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.6.0 151 4/2/2024
1.5.0 124 4/2/2024
1.4.0 105 4/2/2024
1.3.0 937 3/6/2024
1.2.0 195 2/22/2024
1.1.0 211 2/20/2024
1.0.0 227 2/20/2024

Added BT Scanner functionality.