commit e4b899edeca9cfdced6bf3b1477fb2f399e69e99
Author: mtoutant <martin.toutant@inrae.fr>
Date:   Tue Oct 4 13:44:33 2022 +0200

    Intern service page update + test with codebar reader

diff --git a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellInternReader.cs b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellInternReader.cs
index 31181d8..545c76e 100644
--- a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellInternReader.cs
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellInternReader.cs
@@ -59,6 +59,7 @@ namespace TestXamConnections.Device.Barcode.Honeywell
 
         /// <summary>
         /// Lance un scan de code barre avec le lecteur Honeywell interne.
+        /// Important : Il faut d'abord 
         /// </summary>
         /// <returns>true si le scan s'est lancé correctement, false sinon.</returns>
         public async Task<bool> StartScanAsync()
diff --git a/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs
index 35b81c3..b29e2df 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs
@@ -1,6 +1,7 @@
 ﻿using System;
 using System.Threading.Tasks;
 using System.Windows.Input;
+using TestXamConnections.Device.Barcode;
 using TestXamConnections.Device.RFID;
 using TestXamConnections.Device.RFID.Agrident;
 using TestXamConnections.Models;
@@ -10,12 +11,17 @@ namespace TestXamConnections.ViewModels
 {
     public class InternServiceViewModel : ViewModelBase
     {
-        private readonly IRFIDReader agridentReader;
+        private IRFIDReader agridentReader;
+        private IBarcodeReader honeyWellReader;
 
         private bool isScanning;
+
         private bool showRFID;
-        private bool showError;
         private string rfidResult;
+        private bool showBarcode;
+        private string barcodeResult;
+
+        private bool showError;
         private string errorMessage;
 
         public bool ShowRFID
@@ -24,6 +30,12 @@ namespace TestXamConnections.ViewModels
             set => SetProperty(ref showRFID, value);
         }
 
+        public bool ShowBarcode
+        {
+            get => showBarcode;
+            set => SetProperty(ref showBarcode, value);
+        }
+
         public bool ShowError
         {
             get => showError;
@@ -42,13 +54,19 @@ namespace TestXamConnections.ViewModels
             set => SetProperty(ref rfidResult, value);
         }
 
+        public string BarcodeResult
+        {
+            get => barcodeResult;
+            set => SetProperty(ref barcodeResult, value);
+        }
+
         public string ErrorMessage
         {
             get => errorMessage;
             set => SetProperty(ref errorMessage, value);
         }
 
-        private async Task StartScan()
+        private async Task StartScanRFID()
         {
             IsScanning = true;
             if (await agridentReader.StartScanAsync() == false)
@@ -58,24 +76,48 @@ namespace TestXamConnections.ViewModels
             }
         }
 
-        public ICommand StartScanCommand { private set; get; }
+        public ICommand StartScanRFIDCommand { private set; get; }
 
-        public InternServiceViewModel()
+        private async Task StartScanBarcode()
+        {
+            IsScanning = true;
+            if (await honeyWellReader.StartScanAsync() == false)
+            {
+                ShowError = true;
+                ErrorMessage = "Service barcode non trouvé";
+            }
+        }
+
+        public ICommand StartScanBarcodeCommand { private set; get; }
+
+        public void Init()
         {
             ShowRFID = false;
             ShowError = false;
             RFIDResult = "";
             ErrorMessage = "";
-            agridentReader = RFIDReaderProvider.GetRFIDReader(RFIDDevice.AgridentIntern, Connection.ConnectionType.Intern, new Device.DeviceInfo()) ;
+            StartScanRFIDCommand = new Command(async () => await StartScanRFID());
+            StartScanBarcodeCommand = new Command(async () => await StartScanBarcode());
+            agridentReader = RFIDReaderProvider.GetRFIDReader(RFIDDevice.AgridentIntern, Connection.ConnectionType.Intern, new Device.DeviceInfo());
             agridentReader.RFIDDataReceivedEvent += OnRFIDResultReceived;
-            bool err = agridentReader.EnableServiceAsync().Result;
-            StartScanCommand = new Command(async () => await StartScan());
+            honeyWellReader = BarcodeReaderProvider.GetBarcodeReader(BarcodeDevice.HoneywellIntern, Connection.ConnectionType.Intern, new Device.DeviceInfo());
+            honeyWellReader.BarcodeDataReceivedEvent += OnBarcodeResultReceived;
+            agridentReader.EnableServiceAsync().Wait();
+            honeyWellReader.EnableServiceAsync().Wait();
+        }
+
+        public InternServiceViewModel()
+        {
+            Init();
         }
 
+        
+
         private void ResetAffichage()
         {
             ShowError = false;
             ShowRFID = false;
+            ShowBarcode = false;
         }
 
         private void OnRFIDResultReceived(object sender, ReponseRFID reponseRFID)
@@ -92,5 +134,13 @@ namespace TestXamConnections.ViewModels
             }
             IsScanning = false;
         }
+
+        private void OnBarcodeResultReceived(object sender, string reponseBarcode)
+        {
+            ResetAffichage();
+            ShowBarcode = true;
+            BarcodeResult = reponseBarcode;
+            IsScanning = false;
+        }
     }
 }
diff --git a/TestXamConnections/TestXamConnections/Views/AccueilView.xaml b/TestXamConnections/TestXamConnections/Views/AccueilView.xaml
index ff7d471..c34b64f 100644
--- a/TestXamConnections/TestXamConnections/Views/AccueilView.xaml
+++ b/TestXamConnections/TestXamConnections/Views/AccueilView.xaml
@@ -127,7 +127,7 @@
                             FontSize="18"
                             HorizontalOptions="CenterAndExpand"
                             HorizontalTextAlignment="Center"
-                            Text="Connection Interne"
+                            Text="Services internes"
                             TextColor="White"
                             VerticalOptions="CenterAndExpand" />
 
diff --git a/TestXamConnections/TestXamConnections/Views/InternServiceView.xaml b/TestXamConnections/TestXamConnections/Views/InternServiceView.xaml
index 2c9135c..dec499f 100644
--- a/TestXamConnections/TestXamConnections/Views/InternServiceView.xaml
+++ b/TestXamConnections/TestXamConnections/Views/InternServiceView.xaml
@@ -3,16 +3,18 @@
     x:Class="TestXamConnections.Views.InternServiceView"
     xmlns="http://xamarin.com/schemas/2014/forms"
     xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-    xmlns:xe="clr-namespace:XamEffects;assembly=XamEffects">
+    xmlns:xe="clr-namespace:XamEffects;assembly=XamEffects"
+    Title="Services internes">
     <ContentPage.Content>
 
         <StackLayout BackgroundColor="#001729" VerticalOptions="FillAndExpand">
             <Grid VerticalOptions="FillAndExpand">
                 <StackLayout Spacing="15" VerticalOptions="CenterAndExpand">
 
+                    <!--#region SCANRFID-->
                     <xe:BorderView
                         Margin="0,20,0,0"
-                        xe:Commands.Tap="{Binding StartScanCommand}"
+                        xe:Commands.Tap="{Binding StartScanRFIDCommand}"
                         xe:TouchEffect.Color="#0060a8"
                         BackgroundColor="#003266"
                         CornerRadius="65"
@@ -59,7 +61,61 @@
                                 TextColor="White" />
                         </StackLayout>
                     </Frame>
+                    <!--#endregion-->
 
+                    <!--#region SCAN BARCODE-->
+                    <xe:BorderView
+                        Margin="0,20,0,0"
+                        xe:Commands.Tap="{Binding StartScanBarcodeCommand}"
+                        xe:TouchEffect.Color="#0060a8"
+                        BackgroundColor="#003266"
+                        CornerRadius="65"
+                        HorizontalOptions="Center">
+                        <StackLayout Padding="15,10">
+                            <Label
+                                FontSize="Medium"
+                                HorizontalOptions="Center"
+                                HorizontalTextAlignment="Center"
+                                Text="Scan Barcode"
+                                TextColor="#34a9ff" />
+                        </StackLayout>
+                    </xe:BorderView>
+
+                    <Frame
+                        Padding="0"
+                        BackgroundColor="Transparent"
+                        BorderColor="#4f5a64"
+                        CornerRadius="5"
+                        HasShadow="False"
+                        HorizontalOptions="Center"
+                        IsVisible="{Binding ShowBarcode}"
+                        VerticalOptions="CenterAndExpand"
+                        WidthRequest="200">
+                        <StackLayout Spacing="0">
+                            <Label
+                                Margin="15"
+                                FontSize="15"
+                                HorizontalTextAlignment="Center"
+                                Text="RFID Scanné"
+                                TextColor="#34a9ff" />
+
+                            <BoxView
+                                HeightRequest="1"
+                                HorizontalOptions="FillAndExpand"
+                                Color="#4f5a64" />
+
+                            <Label
+                                Margin="0,10"
+                                FontAttributes="Bold"
+                                FontSize="17"
+                                HorizontalTextAlignment="Center"
+                                Text="{Binding BarcodeResult}"
+                                TextColor="White" />
+                        </StackLayout>
+                    </Frame>
+                    <!--#endregion-->
+
+                    <!--#region ERROR-->
                     <Frame
                         Padding="0"
                         BackgroundColor="Transparent"
@@ -92,6 +148,7 @@
                                 TextColor="RED" />
                         </StackLayout>
                     </Frame>
+                    <!--#endregion-->
 
                 </StackLayout>
                 <Grid
