diff --git a/SteUp.Maui/Core/CoreModule.cs b/SteUp.Maui/Core/CoreModule.cs index 953a87a..0229573 100644 --- a/SteUp.Maui/Core/CoreModule.cs +++ b/SteUp.Maui/Core/CoreModule.cs @@ -1,5 +1,4 @@ -using System.Data; -using CommunityToolkit.Mvvm.Messaging; +using CommunityToolkit.Mvvm.Messaging; using Microsoft.AspNetCore.Components.Authorization; using Microsoft.EntityFrameworkCore; using SteUp.Data.LocalDb; @@ -7,6 +6,8 @@ using SteUp.Data.LocalDb.EntityServices; using SteUp.Maui.Core.Services; using SteUp.Maui.Core.System; using SteUp.Maui.Core.System.Network; +using SteUp.Shared.Core.BarcodeReader; +using SteUp.Shared.Core.BarcodeReader.Contracts; using SteUp.Shared.Core.Data; using SteUp.Shared.Core.Data.Contracts; using SteUp.Shared.Core.Interface; @@ -14,6 +15,7 @@ using SteUp.Shared.Core.Interface.IntegryApi; using SteUp.Shared.Core.Interface.LocalDb; using SteUp.Shared.Core.Interface.System; using SteUp.Shared.Core.Interface.System.Network; +using SteUp.Shared.Core.Messages.Scanner; using SteUp.Shared.Core.Messages.Scheda; using SteUp.Shared.Core.Services; @@ -21,49 +23,55 @@ namespace SteUp.Maui.Core; public static class CoreModule { - public static void RegisterAppServices(this MauiAppBuilder builder) + extension(MauiAppBuilder builder) { - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - - builder.Services.AddScoped(); - } - - public static void RegisterIntegryServices(this MauiAppBuilder builder) - { - builder.Services.AddScoped(); - builder.Services.AddScoped(); - } - - public static void RegisterSystemService(this MauiAppBuilder builder) - { - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - } - - public static void AddAuthorizationCore(this MauiAppBuilder builder) - { - builder.Services.AddAuthorizationCore(); - builder.Services.AddScoped(); - builder.Services.AddScoped(provider => - provider.GetRequiredService()); - } - - public static void RegisterMessageServices(this MauiAppBuilder builder) - { - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); - } - - public static void RegisterDbServices(this MauiAppBuilder builder) - { - builder.Services.AddSingleton(); - builder.Services.AddDbContext((sp, options) => + public void RegisterAppServices() { - var dbPath = sp.GetRequiredService().GetDbPath(); - options.UseSqlite($"Filename={dbPath}"); - }); - builder.Services.AddSingleton(); - builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + + builder.Services.AddScoped(); + builder.Services.AddSingleton(); + } + + public void RegisterIntegryServices() + { + builder.Services.AddScoped(); + builder.Services.AddScoped(); + } + + public void RegisterSystemService() + { + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + } + + public void AddAuthorizationCore() + { + builder.Services.AddAuthorizationCore(); + builder.Services.AddScoped(); + builder.Services.AddScoped(provider => + provider.GetRequiredService()); + } + + public void RegisterMessageServices() + { + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + } + + public void RegisterDbServices() + { + builder.Services.AddSingleton(); + builder.Services.AddDbContext((sp, options) => + { + var dbPath = sp.GetRequiredService().GetDbPath(); + options.UseSqlite($"Filename={dbPath}"); + }); + builder.Services.AddSingleton(); + builder.Services.AddSingleton(); + } } } \ No newline at end of file diff --git a/SteUp.Maui/Core/System/HoneywellScannerService.cs b/SteUp.Maui/Core/System/HoneywellScannerService.cs new file mode 100644 index 0000000..a64eda1 --- /dev/null +++ b/SteUp.Maui/Core/System/HoneywellScannerService.cs @@ -0,0 +1,24 @@ +using SteUp.Shared.Core.BarcodeReader.Contracts; +using SteUp.Shared.Core.BarcodeReader.Dto; +using SteUp.Shared.Core.Interface.System; + +namespace SteUp.Maui.Core.System; + +public partial class HoneywellScannerService : IBarcodeReaderService +{ + protected Action? OnScanSuccessful; + protected Action? OnScanFailed; + + public partial bool IsRightAdapter(); + public partial void Init(Action onDeviceReady); + public partial void Deinit(); + public partial string GetAdapterName(); + public partial void OnKeyEvent(object keyEvent); + public partial void ChangeSettings(List<(string Key, object Value)> settings); + + public void Register(Action onScanSuccessful, Action onScanFailed) + { + OnScanSuccessful = onScanSuccessful; + OnScanFailed = onScanFailed; + } +} \ No newline at end of file diff --git a/SteUp.Maui/Platforms/Android/Core/HoneywellScannerService.cs b/SteUp.Maui/Platforms/Android/Core/HoneywellScannerService.cs new file mode 100644 index 0000000..c1bacbb --- /dev/null +++ b/SteUp.Maui/Platforms/Android/Core/HoneywellScannerService.cs @@ -0,0 +1,140 @@ +using Android.OS; +using Com.Honeywell.Aidc; +using SteUp.Shared.Core.BarcodeReader.Dto; + +namespace SteUp.Maui.Core.System; + +public partial class HoneywellScannerService +{ + private AidcManager? _aidcManager; + private BarcodeReader? _barcodeReader; + + private static readonly List CompatibleModels = ["EDA50", "EDA51", "EDA52", "CT60"]; + + public partial bool IsRightAdapter() + { + return CompatibleModels.Contains(Build.Model ?? string.Empty); + } + + public partial string GetAdapterName() => "Honeywell"; + + public partial void Init(Action onDeviceReady) + { + if (!IsRightAdapter()) + throw new Exception($"Adapter non trovato per il modello: {Build.Model}"); + + AidcManager.Create( + Android.App.Application.Context, + new AidcCreatedCallback(this, onDeviceReady) + ); + } + + public partial void Deinit() + { + _barcodeReader?.Close(); + _barcodeReader = null; + + _aidcManager?.Close(); + _aidcManager = null; + } + + public partial void OnKeyEvent(object keyEvent) + { + // Honeywell gestisce il trigger hardware internamente, non serve implementazione + } + + public partial void ChangeSettings(List<(string Key, object Value)> settings) + { + if (_barcodeReader == null) return; + + var properties = GetDefaultProperties(); + + foreach (var (key, value) in settings) + { + switch (key) + { + case "TRIGGER_SCAN_MODE": + var scanMode = (string)value switch + { + "ONE_SHOT" => BarcodeReader.TriggerScanModeOneshot, + "CONTINUOUS" => BarcodeReader.TriggerScanModeContinuous, + "READ_ON_SECOND_TRIGGER_PRESS" => BarcodeReader.TriggerScanModeReadOnSecondTriggerPress, + "READ_ON_RELEASE" => BarcodeReader.TriggerScanModeReadOnRelease, + _ => BarcodeReader.TriggerScanModeOneshot + }; + properties[BarcodeReader.PropertyTriggerScanMode] = scanMode!; + break; + + case "TRIGGER_SCAN_DELAY": + properties[BarcodeReader.PropertyTriggerScanDelay] = int.Parse((string)value); + break; + } + } + + _barcodeReader.SetProperties(properties); + + try { _barcodeReader.Claim(); } + catch (ScannerUnavailableException ex) { OnScanFailed?.Invoke(ex); } + } + + private void RegisterListenersInternal() + { + _barcodeReader?.AddBarcodeListener(new BarcodeEventListener(this)); + } + + private void DispatchEvent(BarcodeReadEvent e) + { + var dto = new BarcodeScanDto + { + StringValue = e.BarcodeData, + Type = e.CodeId, + Name = e.CodeId + }; + + OnScanSuccessful?.Invoke(dto); + } + + private static Dictionary GetDefaultProperties() => new() + { + { BarcodeReader.PropertyEan8Enabled, true }, + { BarcodeReader.PropertyEan13Enabled, true }, + { BarcodeReader.PropertyCode39Enabled, true }, + { BarcodeReader.PropertyCode128Enabled, true }, + { BarcodeReader.PropertyGs1128Enabled, true }, + { BarcodeReader.PropertyUpcAEnable, true }, + { BarcodeReader.PropertyEan8CheckDigitTransmitEnabled, true }, + { BarcodeReader.PropertyEan13CheckDigitTransmitEnabled, true }, + { BarcodeReader.PropertyUpcACheckDigitTransmitEnabled, true } + }; + + private class AidcCreatedCallback(HoneywellScannerService service, Action onDeviceReady) + : Java.Lang.Object, AidcManager.ICreatedCallback + { + public void OnCreated(AidcManager? manager) + { + service._aidcManager = manager; + + try + { + if (manager == null) throw new Exception("AidcManager null"); + + service._barcodeReader = manager.CreateBarcodeReader(); + service.RegisterListenersInternal(); + } + catch (Exception ex) + { + service.OnScanFailed?.Invoke(ex); + } + + onDeviceReady.Invoke(); + } + } + + private class BarcodeEventListener(HoneywellScannerService service) + : Java.Lang.Object, BarcodeReader.IBarcodeListener + { + public void OnBarcodeEvent(BarcodeReadEvent? e) => service.DispatchEvent(e!); + public void OnFailureEvent(BarcodeFailureEvent? e) => + service.OnScanFailed?.Invoke(new Exception($"Scan failure: {e}")); + } +} \ No newline at end of file diff --git a/SteUp.Maui/Platforms/iOS/Core/HoneywellScannerService.cs b/SteUp.Maui/Platforms/iOS/Core/HoneywellScannerService.cs new file mode 100644 index 0000000..0e16dcc --- /dev/null +++ b/SteUp.Maui/Platforms/iOS/Core/HoneywellScannerService.cs @@ -0,0 +1,17 @@ +namespace SteUp.Maui.Core.System; + +public partial class HoneywellScannerService +{ + public partial bool IsRightAdapter() => false; + + public partial void Init(Action onDeviceReady) => + throw new NotSupportedException("Honeywell SDK non disponibile su iOS."); + + public partial void Deinit() { } + + public partial string GetAdapterName() => "Honeywell"; + + public partial void OnKeyEvent(object keyEvent) { } + + public partial void ChangeSettings(List<(string Key, object Value)> settings) { } +} \ No newline at end of file diff --git a/SteUp.Maui/SteUp.Maui.csproj b/SteUp.Maui/SteUp.Maui.csproj index 928460e..26b6cb4 100644 --- a/SteUp.Maui/SteUp.Maui.csproj +++ b/SteUp.Maui/SteUp.Maui.csproj @@ -124,6 +124,10 @@ + + + + diff --git a/SteUp.Shared/Components/Pages/LoginPage.razor b/SteUp.Shared/Components/Pages/LoginPage.razor index 1f9f011..a5174f5 100644 --- a/SteUp.Shared/Components/Pages/LoginPage.razor +++ b/SteUp.Shared/Components/Pages/LoginPage.razor @@ -1,10 +1,12 @@ @page "/login" @using SteUp.Shared.Components.Layout.Spinner +@using SteUp.Shared.Core.BarcodeReader.Contracts @using SteUp.Shared.Core.Interface.System @using SteUp.Shared.Core.Services @inject IUserAccountService UserAccountService @inject AppAuthenticationStateProvider AuthenticationStateProvider @inject IGenericSystemService GenericSystemService +@inject IBarcodeManager BarcodeManager @if (Spinner) { @@ -90,6 +92,7 @@ else await UserAccountService.Login(UserData.Username, UserData.Password, UserData.CodHash); AuthenticationStateProvider.NotifyAuthenticationState(); //Chiamato per forzare il refresh await SteupDataService.Init(); + BarcodeManager.Init(); LocalStorage.SetString("codHash", UserData.CodHash); NavigationManager.NavigateTo("/"); diff --git a/SteUp.Shared/Components/Routes.razor b/SteUp.Shared/Components/Routes.razor index 8ec23dd..91e187b 100644 --- a/SteUp.Shared/Components/Routes.razor +++ b/SteUp.Shared/Components/Routes.razor @@ -1,5 +1,7 @@ @using SteUp.Shared.Components.SingleElements.Modal.ExceptionModal +@using SteUp.Shared.Core.BarcodeReader.Contracts @inject NavigationManager NavigationManager +@inject IBarcodeManager BarcodeManager @@ -43,5 +45,6 @@ protected override async Task OnInitializedAsync() { await SteupDataService.Init(); + BarcodeManager.Init(); } } \ No newline at end of file diff --git a/SteUp.Shared/Components/SingleElements/Card/ModalForm/CardFormModal.razor.css b/SteUp.Shared/Components/SingleElements/Card/ModalForm/CardFormModal.razor.css index 6c52bad..15a0de4 100644 --- a/SteUp.Shared/Components/SingleElements/Card/ModalForm/CardFormModal.razor.css +++ b/SteUp.Shared/Components/SingleElements/Card/ModalForm/CardFormModal.razor.css @@ -1,6 +1,6 @@ .card-form-modal { background: var(--mud-palette-table-striped); - border-radius: 1em; + border-radius: 20px; padding: .5rem 1rem; width: -webkit-fill-available; } diff --git a/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor b/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor index e380ee6..602ccc9 100644 --- a/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor +++ b/SteUp.Shared/Components/SingleElements/Modal/ModalFormScheda.razor @@ -8,11 +8,13 @@ @using SteUp.Shared.Core.Interface.LocalDb @using SteUp.Shared.Core.Interface.System @using SteUp.Shared.Core.Interface.System.Network +@using SteUp.Shared.Core.Messages.Scanner @inject INetworkService NetworkService @inject IDialogService Dialog @inject IIntegryApiService IntegryApiService @inject IAttachedService AttachedService @inject IIspezioniService IspezioniService +@inject OnScannerService OnScannerService @@ -159,6 +161,9 @@ protected override void OnInitialized() { + OnScannerService.OnNewScanSuccessful += OnNewScanSuccessful; + OnScannerService.OnErrorScan += OnErrorScan; + _originalScheda = Scheda.Clone(); Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter; @@ -351,7 +356,7 @@ AttachedList.Add(new AttachedDto { Name = a.Name, MimeType = a.MimeType, FileBytes = a.FileBytes }); await InvokeAsync(StateHasChanged); - + RecalcDirty(true); // Processa in background e aggiorna UI man mano (o a blocchi) @@ -419,4 +424,19 @@ await InvokeAsync(StateHasChanged); }); } + + #region Scanner + + public static void OnNewScanSuccessful(string? value) + { + //To be implemented + } + + private static void OnErrorScan(string? value) + { + //To be implemented + } + + #endregion + } \ No newline at end of file diff --git a/SteUp.Shared/Core/BarcodeReader/BarcodeManager.cs b/SteUp.Shared/Core/BarcodeReader/BarcodeManager.cs new file mode 100644 index 0000000..3ec73de --- /dev/null +++ b/SteUp.Shared/Core/BarcodeReader/BarcodeManager.cs @@ -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")]); }); + } +} \ No newline at end of file diff --git a/SteUp.Shared/Core/BarcodeReader/Contracts/IBarcodeManager.cs b/SteUp.Shared/Core/BarcodeReader/Contracts/IBarcodeManager.cs new file mode 100644 index 0000000..eba0812 --- /dev/null +++ b/SteUp.Shared/Core/BarcodeReader/Contracts/IBarcodeManager.cs @@ -0,0 +1,6 @@ +namespace SteUp.Shared.Core.BarcodeReader.Contracts; + +public interface IBarcodeManager +{ + void Init(); +} \ No newline at end of file diff --git a/SteUp.Shared/Core/BarcodeReader/Contracts/IBarcodeReaderService.cs b/SteUp.Shared/Core/BarcodeReader/Contracts/IBarcodeReaderService.cs new file mode 100644 index 0000000..976f5aa --- /dev/null +++ b/SteUp.Shared/Core/BarcodeReader/Contracts/IBarcodeReaderService.cs @@ -0,0 +1,14 @@ +using SteUp.Shared.Core.BarcodeReader.Dto; + +namespace SteUp.Shared.Core.BarcodeReader.Contracts; + +public interface IBarcodeReaderService +{ + bool IsRightAdapter(); + void Init(Action onDeviceReady); + void Deinit(); + void Register(Action onScanSuccessful, Action onScanFailed); + string GetAdapterName(); + void OnKeyEvent(object keyEvent); + void ChangeSettings(List<(string Key, object Value)> settings); +} \ No newline at end of file diff --git a/SteUp.Shared/Core/BarcodeReader/Dto/BarcodeScanDto.cs b/SteUp.Shared/Core/BarcodeReader/Dto/BarcodeScanDto.cs new file mode 100644 index 0000000..906ffde --- /dev/null +++ b/SteUp.Shared/Core/BarcodeReader/Dto/BarcodeScanDto.cs @@ -0,0 +1,8 @@ +namespace SteUp.Shared.Core.BarcodeReader.Dto; + +public class BarcodeScanDto +{ + public string? StringValue { get; set; } + public string? Type { get; set; } + public string? Name { get; set; } +} \ No newline at end of file diff --git a/SteUp.Shared/Core/Data/SteupDataService.cs b/SteUp.Shared/Core/Data/SteupDataService.cs index e7c0b1d..0e55d5a 100644 --- a/SteUp.Shared/Core/Data/SteupDataService.cs +++ b/SteUp.Shared/Core/Data/SteupDataService.cs @@ -1,5 +1,6 @@ using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account; using IntegryApiClient.Core.Domain.Abstraction.Contracts.Device; +using SteUp.Shared.Core.BarcodeReader.Contracts; using SteUp.Shared.Core.Data.Contracts; using SteUp.Shared.Core.Dto; using SteUp.Shared.Core.Dto.PageState; diff --git a/SteUp.Shared/Core/Messages/Scanner/ErrorScannerMessage.cs b/SteUp.Shared/Core/Messages/Scanner/ErrorScannerMessage.cs new file mode 100644 index 0000000..0506f57 --- /dev/null +++ b/SteUp.Shared/Core/Messages/Scanner/ErrorScannerMessage.cs @@ -0,0 +1,5 @@ +using CommunityToolkit.Mvvm.Messaging.Messages; + +namespace SteUp.Shared.Core.Messages.Scanner; + +public class ErrorScannerMessage(string? value = null) : ValueChangedMessage(value); \ No newline at end of file diff --git a/SteUp.Shared/Core/Messages/Scanner/NewScannerMessage.cs b/SteUp.Shared/Core/Messages/Scanner/NewScannerMessage.cs new file mode 100644 index 0000000..244bcc0 --- /dev/null +++ b/SteUp.Shared/Core/Messages/Scanner/NewScannerMessage.cs @@ -0,0 +1,5 @@ +using CommunityToolkit.Mvvm.Messaging.Messages; + +namespace SteUp.Shared.Core.Messages.Scanner; + +public class NewScannerMessage(string? value = null) : ValueChangedMessage(value); \ No newline at end of file diff --git a/SteUp.Shared/Core/Messages/Scanner/OnScannerService.cs b/SteUp.Shared/Core/Messages/Scanner/OnScannerService.cs new file mode 100644 index 0000000..f599cf0 --- /dev/null +++ b/SteUp.Shared/Core/Messages/Scanner/OnScannerService.cs @@ -0,0 +1,15 @@ +using CommunityToolkit.Mvvm.Messaging; + +namespace SteUp.Shared.Core.Messages.Scanner; + +public class OnScannerService +{ + public event Action? OnNewScanSuccessful; + public event Action? OnErrorScan; + + public OnScannerService(IMessenger messenger) + { + messenger.Register(this, (_, x) => { OnNewScanSuccessful?.Invoke(x.Value); }); + messenger.Register(this, (_, x) => { OnErrorScan?.Invoke(x.Value); }); + } +} \ No newline at end of file diff --git a/SteUp.Shared/wwwroot/css/app.css b/SteUp.Shared/wwwroot/css/app.css index 456f917..9c37aac 100644 --- a/SteUp.Shared/wwwroot/css/app.css +++ b/SteUp.Shared/wwwroot/css/app.css @@ -197,7 +197,7 @@ h1:focus { aspect-ratio: 1; border-radius: 50%; border: 8px solid #0000; - border-right-color: var(--mud-palette-secondary); + border-right-color: var(--mud-palette-primary); position: relative; animation: l24 1s infinite linear; } diff --git a/SteUp.Shared/wwwroot/js/main.js b/SteUp.Shared/wwwroot/js/main.js index c29efbb..fbd9b20 100644 --- a/SteUp.Shared/wwwroot/js/main.js +++ b/SteUp.Shared/wwwroot/js/main.js @@ -26,14 +26,8 @@ function monitorBottomSheetClass(mutations) { }); } -// Esegui la funzione tabindex inizialmente -addTabindexToButtons(); - // Observer combinato per tutte le funzionalità const observer = new MutationObserver((mutations) => { - // Aggiungi tabindex ai nuovi bottoni - addTabindexToButtons(); - // Monitora bottom-sheet-container monitorBottomSheetClass(mutations); }); diff --git a/SteUp.sln b/SteUp.sln index 583f4b3..ce9439a 100644 --- a/SteUp.sln +++ b/SteUp.sln @@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SteUp.Web", "SteUp.Web\SteU EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteUp.Data", "SteUp.Data\SteUp.Data.csproj", "{A1AB9749-A367-4E5C-8A80-2D4CEF68DA59}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Steup.HoneywellScanner", "Steup.HoneywellScanner\Steup.HoneywellScanner.csproj", "{49E17405-466C-44AC-9F85-E2A4DB149170}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -71,6 +73,18 @@ Global {A1AB9749-A367-4E5C-8A80-2D4CEF68DA59}.Release|x64.Build.0 = Release|Any CPU {A1AB9749-A367-4E5C-8A80-2D4CEF68DA59}.Release|x86.ActiveCfg = Release|Any CPU {A1AB9749-A367-4E5C-8A80-2D4CEF68DA59}.Release|x86.Build.0 = Release|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Debug|Any CPU.Build.0 = Debug|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Debug|x64.ActiveCfg = Debug|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Debug|x64.Build.0 = Debug|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Debug|x86.ActiveCfg = Debug|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Debug|x86.Build.0 = Debug|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Release|Any CPU.ActiveCfg = Release|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Release|Any CPU.Build.0 = Release|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Release|x64.ActiveCfg = Release|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Release|x64.Build.0 = Release|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Release|x86.ActiveCfg = Release|Any CPU + {49E17405-466C-44AC-9F85-E2A4DB149170}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Steup.HoneywellScanner/Additions/AboutAdditions.txt b/Steup.HoneywellScanner/Additions/AboutAdditions.txt new file mode 100644 index 0000000..2775bd3 --- /dev/null +++ b/Steup.HoneywellScanner/Additions/AboutAdditions.txt @@ -0,0 +1,48 @@ +Additions allow you to add arbitrary C# to the generated classes +before they are compiled. This can be helpful for providing convenience +methods or adding pure C# classes. + +== Adding Methods to Generated Classes == + +Let's say the library being bound has a Rectangle class with a constructor +that takes an x and y position, and a width and length size. It will look like +this: + +public partial class Rectangle +{ + public Rectangle (int x, int y, int width, int height) + { + // JNI bindings + } +} + +Imagine we want to add a constructor to this class that takes a Point and +Size structure instead of 4 ints. We can add a new file called Rectangle.cs +with a partial class containing our new method: + +public partial class Rectangle +{ + public Rectangle (Point location, Size size) : + this (location.X, location.Y, size.Width, size.Height) + { + } +} + +At compile time, the additions class will be added to the generated class +and the final assembly will a Rectangle class with both constructors. + + +== Adding C# Classes == + +Another thing that can be done is adding fully C# managed classes to the +generated library. In the above example, let's assume that there isn't a +Point class available in Java or our library. The one we create doesn't need +to interact with Java, so we'll create it like a normal class in C#. + +By adding a Point.cs file with this class, it will end up in the binding library: + +public class Point +{ + public int X { get; set; } + public int Y { get; set; } +} \ No newline at end of file diff --git a/Steup.HoneywellScanner/DataCollection.aar b/Steup.HoneywellScanner/DataCollection.aar new file mode 100644 index 0000000..69f8ef9 Binary files /dev/null and b/Steup.HoneywellScanner/DataCollection.aar differ diff --git a/Steup.HoneywellScanner/Libs/DataCollection.aar b/Steup.HoneywellScanner/Libs/DataCollection.aar new file mode 100644 index 0000000..69f8ef9 Binary files /dev/null and b/Steup.HoneywellScanner/Libs/DataCollection.aar differ diff --git a/Steup.HoneywellScanner/Steup.HoneywellScanner.csproj b/Steup.HoneywellScanner/Steup.HoneywellScanner.csproj new file mode 100644 index 0000000..9c21a80 --- /dev/null +++ b/Steup.HoneywellScanner/Steup.HoneywellScanner.csproj @@ -0,0 +1,27 @@ + + + net10.0-android + 24 + enable + enable + + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/Steup.HoneywellScanner/Transforms/EnumFields.xml b/Steup.HoneywellScanner/Transforms/EnumFields.xml new file mode 100644 index 0000000..2295995 --- /dev/null +++ b/Steup.HoneywellScanner/Transforms/EnumFields.xml @@ -0,0 +1,14 @@ + + + \ No newline at end of file diff --git a/Steup.HoneywellScanner/Transforms/EnumMethods.xml b/Steup.HoneywellScanner/Transforms/EnumMethods.xml new file mode 100644 index 0000000..49216c6 --- /dev/null +++ b/Steup.HoneywellScanner/Transforms/EnumMethods.xml @@ -0,0 +1,13 @@ + + + \ No newline at end of file diff --git a/Steup.HoneywellScanner/Transforms/Metadata.xml b/Steup.HoneywellScanner/Transforms/Metadata.xml new file mode 100644 index 0000000..91493a2 --- /dev/null +++ b/Steup.HoneywellScanner/Transforms/Metadata.xml @@ -0,0 +1,9 @@ + + +