AMLBarcodeScannerLib 1.6.0
dotnet add package AMLBarcodeScannerLib --version 1.6.0
NuGet\Install-Package AMLBarcodeScannerLib -Version 1.6.0
<PackageReference Include="AMLBarcodeScannerLib" Version="1.6.0" />
paket add AMLBarcodeScannerLib --version 1.6.0
#r "nuget: AMLBarcodeScannerLib, 1.6.0"
// 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
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 | Versions Compatible and additional computed target framework versions. |
---|---|
MonoAndroid | monoandroid10 is compatible. |
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.
Added BT Scanner functionality.