Implementato sdk honeywell e metodi per lo scanner barcode
This commit is contained in:
32
SteUp.Shared/Core/BarcodeReader/BarcodeManager.cs
Normal file
32
SteUp.Shared/Core/BarcodeReader/BarcodeManager.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using SteUp.Shared.Core.BarcodeReader.Contracts;
|
||||
using SteUp.Shared.Core.Messages.Scanner;
|
||||
|
||||
namespace SteUp.Shared.Core.BarcodeReader;
|
||||
|
||||
public class BarcodeManager(
|
||||
IBarcodeReaderService scanner,
|
||||
IMessenger messenger) : IBarcodeManager
|
||||
{
|
||||
public void Init()
|
||||
{
|
||||
if (!scanner.IsRightAdapter())
|
||||
{
|
||||
Console.WriteLine("Dispositivo non compatibile con lo scanner Honeywell.");
|
||||
return;
|
||||
}
|
||||
|
||||
scanner.Register(
|
||||
onScanSuccessful: dto =>
|
||||
{
|
||||
messenger.Send(new NewScannerMessage(dto.StringValue));
|
||||
},
|
||||
onScanFailed: ex =>
|
||||
{
|
||||
messenger.Send(new ErrorScannerMessage(ex.Message));
|
||||
}
|
||||
);
|
||||
|
||||
scanner.Init(() => { scanner.ChangeSettings([("TRIGGER_SCAN_MODE", "ONE_SHOT")]); });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user