commit 6e6ea455c8aa934237cff1264314d232067b6371
Author: mtoutant <martin.toutant@inrae.fr>
Date:   Mon Oct 3 14:00:38 2022 +0200

    update + add resolvers

diff --git a/TestXamConnections/TestXamConnections/Device/Balance/BalanceProvider.cs b/TestXamConnections/TestXamConnections/Device/Balance/BalanceProvider.cs
new file mode 100644
index 0000000..2e3bd82
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Balance/BalanceProvider.cs
@@ -0,0 +1,25 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using TestXamConnections.Connection;
+using TestXamConnections.Device.Balance.Balea;
+
+namespace TestXamConnections.Device.Balance
+{
+    public enum Balance
+    {
+        TeoBalance
+    }
+
+    public static class BalanceProvider
+    {
+        public static IBalance GetBalance(Balance b, ConnectionType ct, DeviceInfo deviceI)
+        {
+            return b switch
+            {
+                Balance.TeoBalance => new TeoBalance(deviceI),
+                _ => null,
+            };
+        }
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/Balance/Balea/TeoBalance.cs b/TestXamConnections/TestXamConnections/Device/Balance/Balea/TeoBalance.cs
new file mode 100644
index 0000000..8cef096
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Balance/Balea/TeoBalance.cs
@@ -0,0 +1,108 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TestXamConnections.Connection;
+using TestXamConnections.Models;
+using Xamarin.Forms;
+
+namespace TestXamConnections.Device.Balance.Balea
+{
+    public class TeoBalance : IBalance
+    {
+        public DeviceInfo DeviceI { get; set; }
+        public IConnectionService ConnectionService { get; set; }
+        public EventHandler<ReponsePesee> PeseeReceivedEvent { get; set; }
+
+        public TeoBalance(DeviceInfo deviceI)
+        {
+            DeviceI = deviceI;
+            ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Bluetooth);
+            ConnectionService.DataReceivedEvent += TeoDataReceived;
+        }
+
+        ~TeoBalance()
+        {
+            ConnectionService.DataReceivedEvent -= TeoDataReceived;
+        }
+
+        /* 
+         * Fonction déclenchée à la reception de données par le ConnectionService
+         * Trigger l'evenement TeoDataReceivedEvent ou TeoPeseeReceivedEvent.
+         * 
+         * IMPORTANT: Les trames du Teo peuvent arriver découpées,
+         * Donc les données sont gardées dans un buffer d'envoi
+         * nommé _bufferedData
+         */
+        private string _bufferedData;
+        private void TeoDataReceived(object sender, byte[] buffer)
+        {
+            // Si le premier character est 2 (ASCII: STX)
+            // Alors c'est le début de la trame.
+            if (buffer[0] == 2)
+            {
+                _bufferedData = "";
+                // Si character seul on quitte
+                if (buffer.Length == 1)
+                {
+                    return;
+                }
+                // On enlève STX
+                buffer = buffer.Skip(1).ToArray();
+                // On mets le début de la trame dans buffer d'envoi
+                _bufferedData += Encoding.ASCII.GetString(buffer);
+            }
+
+            // Si le dernier character est 13 (ASCII: CR)
+            // Alors la trame est terminée
+            if (buffer[^1] == 13)
+            {
+                // On enlève CR
+                buffer = buffer.SkipLast(1).ToArray();
+                // Conversion en chaîne de caractères
+                // Et on complète le buffer d'envoi
+                _bufferedData += Encoding.ASCII.GetString(buffer);
+                
+                // Trigger evènement en fonction de la trame
+                if (_bufferedData.Length == 12)
+                {
+                    PeseeReceivedEvent.Invoke(this, new ReponsePesee(_bufferedData));
+                }
+                else if (_bufferedData[2] == '6')
+                {
+                    PeseeReceivedEvent.Invoke(this, new ReponsePesee("err"));
+                } 
+                else
+                {
+                    PeseeReceivedEvent.Invoke(this, new ReponsePesee("err"));
+                }
+            }
+        }
+
+        /// <summary>
+        /// Permet d’établir une connection bluetooth avec la balance Teo. 
+        /// Important : le bluetooth doit être activé, la balance allumée et les appareils doivent déjà être appairés.
+        /// </summary>
+        /// <returns>true si la connection a réussi, false sinon.</returns>
+        public async Task<bool> ConnectToBalanceAsync()
+        {
+            Dictionary<string, string> param = new Dictionary<string, string>()
+            {
+                { ConnectionConstants.MAC_ADDR_KEY, DeviceI.MACAddress }
+            };
+            return await ConnectionService.Connect(param);
+        }
+
+        /// <summary>
+        /// Envoi d'une commande au Teo.
+        /// </summary>
+        /// <param name="commandType">La commande à envoyer.</param>
+        /// <returns></returns>
+        public async Task<bool> SendCommandAsync(TeoConstants.TeoCommandType cmd)
+        {
+            byte[] commandValue = TeoConstants.TeoCommandValues.GetValueOrDefault(cmd);
+            return await ConnectionService.SendCommand(commandValue);
+        }
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/Balance/Balea/TeoConstants.cs b/TestXamConnections/TestXamConnections/Device/Balance/Balea/TeoConstants.cs
new file mode 100644
index 0000000..881ff7f
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Balance/Balea/TeoConstants.cs
@@ -0,0 +1,40 @@
+﻿using System.Collections.Generic;
+
+namespace TestXamConnections.Device.Balance.Balea
+{
+    public static class TeoConstants
+    {
+        /// <summary>
+        /// Liste des commandes disponibles pour la balance Teo, pour le programme INRAE.
+        /// </summary>
+        public enum TeoCommandType
+        {
+            // Voir documentation TEO INRAE 
+            // Codes ASCII
+            ModeOrdre,
+            SortieOrdre,
+            EmissionPoids,
+            ModePeseeSimple,
+            SortiePeseeSimple
+        }
+
+        public static readonly Dictionary<TeoCommandType, string> TeoCommandNames = new Dictionary<TeoCommandType, string>()
+        {
+            { TeoCommandType.ModeOrdre,         "Mode attente ordre"        },
+            { TeoCommandType.SortieOrdre,       "Sortie mode ordre"         },
+            { TeoCommandType.EmissionPoids,     "Emission poids"            },
+            { TeoCommandType.ModePeseeSimple,   "Mode simple pesage"        },
+            { TeoCommandType.SortiePeseeSimple, "Sortie mode simple pesage" }
+
+        };
+
+        public static readonly Dictionary<TeoCommandType, byte[]> TeoCommandValues = new Dictionary<TeoCommandType, byte[]>()
+        {
+            { TeoCommandType.ModeOrdre,         new byte[] { 0x02, 0x61, 0x0D } },
+            { TeoCommandType.SortieOrdre,       new byte[] { 0x02, 0x6B, 0x0D } },
+            { TeoCommandType.EmissionPoids,     new byte[] { 0x02, 0x63, 0x0D } },
+            { TeoCommandType.ModePeseeSimple,   new byte[] { 0x02, 0x62, 0x0D } },
+            { TeoCommandType.SortiePeseeSimple, new byte[] { 0x02, 0x65, 0x0D } }
+        };
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs b/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs
index 38a1238..cb0bdf0 100644
--- a/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs
+++ b/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs
@@ -1,7 +1,7 @@
 ﻿using System;
 using System.Threading.Tasks;
 using TestXamConnections.Models;
-using static TestXamConnections.Device.Balance.Teo.TeoConstants;
+using static TestXamConnections.Device.Balance.Balea.TeoConstants;
 
 namespace TestXamConnections.Device.Balance
 {
diff --git a/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs b/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs
deleted file mode 100644
index b8f4bac..0000000
--- a/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.Connection;
-using TestXamConnections.Models;
-using Xamarin.Forms;
-using static TestXamConnections.Device.Balance.Teo.TeoConstants;
-
-namespace TestXamConnections.Device.Balance.Teo
-{
-    public class TeoBalance : IBalance
-    {
-        public DeviceInfo Device { get; set; }
-        public IConnectionService ConnectionService { get; set; }
-        public EventHandler<ReponsePesee> PeseeReceivedEvent { get; set; }
-
-        public TeoBalance(DeviceInfo device)
-        {
-            Device.Name = device.Name;
-            Device.MACAddress = device.MACAddress;
-            ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Bluetooth);
-            ConnectionService.DataReceivedEvent += TeoDataReceived;
-        }
-
-        ~TeoBalance()
-        {
-            ConnectionService.DataReceivedEvent -= TeoDataReceived;
-        }
-
-        /* 
-         * Fonction déclenchée à la reception de données par le ConnectionService
-         * Trigger l'evenement TeoDataReceivedEvent ou TeoPeseeReceivedEvent.
-         * 
-         * IMPORTANT: Les trames du Teo peuvent arriver découpées,
-         * Donc les données sont gardées dans un buffer d'envoi
-         * nommé _bufferedData
-         */
-        private string _bufferedData;
-        private void TeoDataReceived(object sender, byte[] buffer)
-        {
-            // Si le premier character est 2 (ASCII: STX)
-            // Alors c'est le début de la trame.
-            if (buffer[0] == 2)
-            {
-                _bufferedData = "";
-                // Si character seul on quitte
-                if (buffer.Length == 1)
-                {
-                    return;
-                }
-                // On enlève STX
-                buffer = buffer.Skip(1).ToArray();
-                // On mets le début de la trame dans buffer d'envoi
-                _bufferedData += Encoding.ASCII.GetString(buffer);
-            }
-
-            // Si le dernier character est 13 (ASCII: CR)
-            // Alors la trame est terminée
-            if (buffer[^1] == 13)
-            {
-                // On enlève CR
-                buffer = buffer.SkipLast(1).ToArray();
-                // Conversion en chaîne de caractères
-                // Et on complète le buffer d'envoi
-                _bufferedData += Encoding.ASCII.GetString(buffer);
-                
-                // Trigger evènement en fonction de la trame
-                if (_bufferedData.Length == 12)
-                {
-                    PeseeReceivedEvent.Invoke(this, new ReponsePesee(_bufferedData));
-                }
-                else if (_bufferedData[2] == '6')
-                {
-                    PeseeReceivedEvent.Invoke(this, new ReponsePesee("err"));
-                } 
-                else
-                {
-                    PeseeReceivedEvent.Invoke(this, new ReponsePesee("err"));
-                }
-            }
-        }
-
-        /// <summary>
-        /// Permet d’établir une connection bluetooth avec la balance Teo. 
-        /// Important : le bluetooth doit être activé, la balance allumée et les appareils doivent déjà être appairés.
-        /// </summary>
-        /// <returns>true si la connection a réussi, false sinon.</returns>
-        public async Task<bool> ConnectToBalanceAsync()
-        {
-            Dictionary<string, string> param = new Dictionary<string, string>()
-            {
-                { ConnectionConstants.MAC_ADDR_KEY, Device.MACAddress }
-            };
-            return await ConnectionService.Connect(param);
-        }
-
-        /// <summary>
-        /// Envoi d'une commande au Teo.
-        /// </summary>
-        /// <param name="commandType">La commande à envoyer.</param>
-        /// <returns></returns>
-        public async Task<bool> SendCommandAsync(TeoCommandType cmd)
-        {
-            byte[] commandValue = TeoCommandValues.GetValueOrDefault(cmd);
-            return await ConnectionService.SendCommand(commandValue);
-        }
-    }
-}
diff --git a/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoConstants.cs b/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoConstants.cs
deleted file mode 100644
index 0501628..0000000
--- a/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoConstants.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-﻿using System.Collections.Generic;
-
-namespace TestXamConnections.Device.Balance.Teo
-{
-    public static class TeoConstants
-    {
-        /// <summary>
-        /// Liste des commandes disponibles pour la balance Teo, pour le programme INRAE.
-        /// </summary>
-        public enum TeoCommandType
-        {
-            // Voir documentation TEO INRAE 
-            // Codes ASCII
-            ModeOrdre,
-            SortieOrdre,
-            EmissionPoids,
-            ModePeseeSimple,
-            SortiePeseeSimple
-        }
-
-        public static readonly Dictionary<TeoCommandType, string> TeoCommandNames = new Dictionary<TeoCommandType, string>()
-        {
-            { TeoCommandType.ModeOrdre,         "Mode attente ordre"        },
-            { TeoCommandType.SortieOrdre,       "Sortie mode ordre"         },
-            { TeoCommandType.EmissionPoids,     "Emission poids"            },
-            { TeoCommandType.ModePeseeSimple,   "Mode simple pesage"        },
-            { TeoCommandType.SortiePeseeSimple, "Sortie mode simple pesage" }
-
-        };
-
-        public static readonly Dictionary<TeoCommandType, byte[]> TeoCommandValues = new Dictionary<TeoCommandType, byte[]>()
-        {
-            { TeoCommandType.ModeOrdre,         new byte[] { 0x02, 0x61, 0x0D } },
-            { TeoCommandType.SortieOrdre,       new byte[] { 0x02, 0x6B, 0x0D } },
-            { TeoCommandType.EmissionPoids,     new byte[] { 0x02, 0x63, 0x0D } },
-            { TeoCommandType.ModePeseeSimple,   new byte[] { 0x02, 0x62, 0x0D } },
-            { TeoCommandType.SortiePeseeSimple, new byte[] { 0x02, 0x65, 0x0D } }
-        };
-    }
-}
diff --git a/TestXamConnections/TestXamConnections/Device/Barcode/BarcodeReaderProvider.cs b/TestXamConnections/TestXamConnections/Device/Barcode/BarcodeReaderProvider.cs
new file mode 100644
index 0000000..f4ee6b2
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/BarcodeReaderProvider.cs
@@ -0,0 +1,27 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using TestXamConnections.Connection;
+using TestXamConnections.Device.Barcode.Honeywell;
+
+namespace TestXamConnections.Device.Barcode
+{
+    public enum BarcodeDevice
+    {
+        HoneywellIntern,
+        HoneywellBT
+    }
+
+    public static class BarcodeReaderProvider
+    {
+        public static IBarcodeReader GetBarcodeReader(BarcodeDevice d, ConnectionType ct, DeviceInfo deviceI)
+        {
+            return d switch
+            {
+                BarcodeDevice.HoneywellIntern => new HoneywellInternReader(deviceI),
+                BarcodeDevice.HoneywellBT => new HoneywellBTReader(deviceI),
+                _ => null,
+            };
+        }
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs
deleted file mode 100644
index 830f3a8..0000000
--- a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs
+++ /dev/null
@@ -1,7 +0,0 @@
-﻿namespace TestXamConnections.Device.Barcode.Honeywell
-{
-    public class HoneywellInternReader
-    {
-        // TODO
-    }
-}
diff --git a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneyWellConstants.cs b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneyWellConstants.cs
index e6e583d..8353700 100644
--- a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneyWellConstants.cs
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneyWellConstants.cs
@@ -4,7 +4,7 @@ using System.Text;
 
 namespace TestXamConnections.Device.Barcode.Honeywell
 {
-    class HoneyWellConstants
+    public static class HoneyWellConstants
     {
     }
 }
diff --git a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs
index 45c15d9..d8e1197 100644
--- a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs
@@ -8,7 +8,7 @@ namespace TestXamConnections.Device.Barcode.Honeywell
 {
     public class HoneywellBTReader : IBarcodeReader
     {
-        public DeviceInfo Device { get; set; }
+        public DeviceInfo DeviceI { get; set; }
         public IConnectionService ConnectionService { get; set; }
         /// <summary>
         /// Événement déclenché à la reception de données par le lecteur de code barre Honeywell.
@@ -17,8 +17,8 @@ namespace TestXamConnections.Device.Barcode.Honeywell
 
         public HoneywellBTReader(DeviceInfo device)
         {
-            Device.Name = device.Name;
-            Device.MACAddress = device.MACAddress;
+            DeviceI.Name = device.Name;
+            DeviceI.MACAddress = device.MACAddress;
             ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Bluetooth);
             ConnectionService.DataReceivedEvent += BluetoothDataReceived;
         }
@@ -32,7 +32,7 @@ namespace TestXamConnections.Device.Barcode.Honeywell
         {
             Dictionary<string, string> param = new Dictionary<string, string>()
             {
-                { ConnectionConstants.MAC_ADDR_KEY, Device.MACAddress }
+                { ConnectionConstants.MAC_ADDR_KEY, DeviceI.MACAddress }
             };
             bool ret = await ConnectionService.Connect(param);
             return ret;
diff --git a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellInternReader.cs b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellInternReader.cs
new file mode 100644
index 0000000..9e93454
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellInternReader.cs
@@ -0,0 +1,24 @@
+﻿using System;
+using System.Threading.Tasks;
+using TestXamConnections.Connection;
+
+namespace TestXamConnections.Device.Barcode.Honeywell
+{
+    public class HoneywellInternReader : IBarcodeReader
+    {
+        // TODO
+        public HoneywellInternReader(DeviceInfo deviceI)
+        {
+
+        }
+
+        public EventHandler<byte[]> BarcodeDataReceivedEvent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+        public DeviceInfo DeviceI { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+        public IConnectionService ConnectionService { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+
+        public Task<bool> ConnectToBTReaderAsync()
+        {
+            throw new NotImplementedException();
+        }
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/IDevice.cs b/TestXamConnections/TestXamConnections/Device/IDevice.cs
index e5cc603..c5d223f 100644
--- a/TestXamConnections/TestXamConnections/Device/IDevice.cs
+++ b/TestXamConnections/TestXamConnections/Device/IDevice.cs
@@ -4,7 +4,7 @@ namespace TestXamConnections.Device
 {
     public interface IDevice
     {
-        DeviceInfo Device { get; set; }
+        DeviceInfo DeviceI { get; set; }
         IConnectionService ConnectionService { get; set; }
     }
 }
diff --git a/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs b/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs
index 216e6f0..814b69b 100644
--- a/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs
+++ b/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs
@@ -12,15 +12,16 @@ namespace TestXamConnections.Device.RFID.Agrident
     /// </summary>
     public class AgridentInternReader : IRFIDReader
     {
-        public DeviceInfo Device { get; set; }
+        public DeviceInfo DeviceI { get; set; }
         public IConnectionService ConnectionService { get; set; }
         /// <summary>
         /// Événement déclenché à la reception de données par le lecteur RFID Agrident.
         /// </summary>
         public EventHandler<string> RFIDDataReceivedEvent { get; set; }
 
-        public AgridentInternReader()
+        public AgridentInternReader(DeviceInfo deviceI)
         {
+            DeviceI = deviceI;
             ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Intern);
             ConnectionService.DataReceivedEvent += InternDataReceived;
         }
diff --git a/TestXamConnections/TestXamConnections/Device/RFID/RFIDReaderProvider.cs b/TestXamConnections/TestXamConnections/Device/RFID/RFIDReaderProvider.cs
new file mode 100644
index 0000000..d468508
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/RFID/RFIDReaderProvider.cs
@@ -0,0 +1,27 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using TestXamConnections.Connection;
+using TestXamConnections.Device.RFID.Agrident;
+
+namespace TestXamConnections.Device.RFID
+{
+    public enum RFIDDevice
+    {
+        AgridentIntern,
+        AgridentBT
+    }
+
+    public static class RFIDReaderProvider
+    {
+        public static IRFIDReader GetRFIDReader(RFIDDevice d, ConnectionType ct, DeviceInfo deviceI)
+        {
+            return d switch
+            {
+                RFIDDevice.AgridentBT => throw new NotImplementedException(),
+                RFIDDevice.AgridentIntern => new AgridentInternReader(deviceI),
+                _ => null,
+            };
+        }
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs b/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs
index 3af9bf1..97ddece 100644
--- a/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs
+++ b/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs
@@ -11,8 +11,8 @@ namespace TestXamConnections.Models
         /// </summary>
         public bool Err
         {
-            get { return err; }
-            set { err = value; }
+            get => err;
+            set => err = value;
         }
 
 
@@ -22,8 +22,8 @@ namespace TestXamConnections.Models
         /// </summary>
         public int NumPlateau
         {
-            get { return numPlateau; }
-            set { numPlateau = value; }
+            get => numPlateau;
+            set => numPlateau = value;
         }
 
         private int typePlateau;
@@ -32,8 +32,8 @@ namespace TestXamConnections.Models
         /// </summary>
         public int TypePlateau
         {
-            get { return typePlateau; }
-            set { typePlateau = value; }
+            get => typePlateau;
+            set => typePlateau = value;
         }
 
         private string poidsMesure;
@@ -42,8 +42,8 @@ namespace TestXamConnections.Models
         /// </summary>
         public string PoidsMesure
         {
-            get { return poidsMesure; }
-            set { poidsMesure = value; }
+            get => poidsMesure;
+            set => poidsMesure = value;
         }
 
         private bool isNegative;
@@ -52,8 +52,8 @@ namespace TestXamConnections.Models
         /// </summary>
         public bool IsNegative
         {
-            get { return isNegative; }
-            set { isNegative = value; }
+            get => isNegative;
+            set => isNegative = value;
         }
 
         public ReponsePesee(string data)
diff --git a/TestXamConnections/TestXamConnections/ViewModels/BarcodeReaderViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/BarcodeReaderViewModel.cs
new file mode 100644
index 0000000..be79267
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/ViewModels/BarcodeReaderViewModel.cs
@@ -0,0 +1,83 @@
+﻿using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using TestXamConnections.Device;
+using TestXamConnections.Device.Barcode;
+using TestXamConnections.Device.Barcode.Honeywell;
+using Xamarin.Forms;
+
+namespace TestXamConnections.ViewModels
+{
+    public class BarcodeReaderViewModel : ViewModelBase
+    {
+        private readonly IBarcodeReader bcReader;
+
+        private bool isVisibleData;
+        private string data;
+        private string connectionIndicator;
+        private string ciColor;
+
+        public string CIColor
+        {
+            get => ciColor;
+            set => SetProperty(ref ciColor, value);
+        }
+
+        public string ConnectionIndicator
+        {
+            get => connectionIndicator;
+            set => SetProperty(ref connectionIndicator, value);
+        }
+
+        public string Data
+        {
+            get => data;
+            set => SetProperty(ref data, value);
+        }
+
+        public bool IsVisibleData
+        {
+            get => isVisibleData;
+            set => SetProperty(ref isVisibleData, value);
+        }
+
+        public async Task<bool> ConnectToDevice()
+        {
+            if (await bcReader.ConnectToBTReaderAsync())
+            {
+                ConnectionIndicator = "Connecté";
+                CIColor = "Green";
+                return true;
+            }
+            else
+            {
+                ConnectionIndicator = "Non Connecté";
+                CIColor = "Red";
+                return false;
+            }
+        }
+
+        public ICommand ConnectToDeviceCommand { get; private set; }
+
+        public BarcodeReaderViewModel(DeviceInfo deviceI)
+        {
+            CIColor = "Red";
+            ConnectionIndicator = "Non connecté";
+            IsVisibleData = false;
+            bcReader = BarcodeReaderProvider.GetBarcodeReader(BarcodeDevice.HoneywellBT, Connection.ConnectionType.Bluetooth, deviceI);
+            ConnectToDeviceCommand = new Command(async () => await ConnectToDevice());
+            bcReader.BarcodeDataReceivedEvent += DataReceived;
+        }
+
+        ~BarcodeReaderViewModel()
+        {
+            bcReader.BarcodeDataReceivedEvent -= DataReceived;
+        }
+
+        private void DataReceived(object sender, byte[] e)
+        {
+            IsVisibleData = true;
+            Data += Encoding.ASCII.GetString(e) + "\n";
+        }
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs
deleted file mode 100644
index 909f579..0000000
--- a/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-﻿using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Input;
-using TestXamConnections.Device;
-using TestXamConnections.Device.Barcode;
-using TestXamConnections.Device.Barcode.Honeywell;
-using Xamarin.Forms;
-
-namespace TestXamConnections.ViewModels
-{
-    public class BluetoothReaderViewModel : ViewModelBase
-    {
-        private IBarcodeReader btReader;
-        private bool isVisibleData;
-        private string data;
-        private string connectionIndicator;
-        private string ciColor;
-
-        public string CIColor
-        {
-            get => ciColor;
-            set => SetProperty(ref ciColor, value);
-        }
-
-        public string ConnectionIndicator
-        {
-            get => connectionIndicator;
-            set => SetProperty(ref connectionIndicator, value);
-        }
-
-        public string Data
-        {
-            get => data;
-            set => SetProperty(ref data, value);
-        }
-
-        public bool IsVisibleData
-        {
-            get => isVisibleData;
-            set => SetProperty(ref isVisibleData, value);
-        }
-
-        public IBarcodeReader BCReader
-        {
-            get => btReader;
-            set => SetProperty(ref btReader, value);
-        }
-
-        public async Task<bool> ConnectToDevice()
-        {
-            if (await BCReader.ConnectToBTReaderAsync())
-            {
-                ConnectionIndicator = "Connecté";
-                CIColor = "Green";
-                return true;
-            }
-            else
-            {
-                ConnectionIndicator = "Non Connecté";
-                CIColor = "Red";
-                return false;
-            }
-        }
-
-        public ICommand ConnectToDeviceCommand { get; private set; }
-
-        public BluetoothReaderViewModel(DeviceInfo deviceI)
-        {
-            CIColor = "Red";
-            ConnectionIndicator = "Non connecté";
-            IsVisibleData = false;
-            BCReader = new HoneywellBTReader(deviceI);
-            ConnectToDeviceCommand = new Command(async () => await ConnectToDevice());
-            BCReader.BarcodeDataReceivedEvent += DataReceived;
-        }
-
-        private void DataReceived(object sender, byte[] e)
-        {
-            IsVisibleData = true;
-            Data += Encoding.ASCII.GetString(e) + "\n";
-        }
-    }
-}
diff --git a/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs
index 5106acb..1ab32e9 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs
@@ -1,37 +1,37 @@
 ﻿using System.Collections.Generic;
-using static TestXamConnections.Device.Balance.Teo.TeoConstants;
+using TestXamConnections.Device.Balance.Balea;
 
 namespace TestXamConnections.ViewModels
 {
     public class CommandItemViewModel : ViewModelBase
     {
         private string name;
-        private TeoCommandType toSendCommand;
+        private TeoConstants.TeoCommandType toSendCommand;
         private string commandBytes;
 
         public string CommandBytes
         {
-            get { return commandBytes; }
-            set { SetProperty( ref commandBytes, value); }
+            get => commandBytes;
+            set => SetProperty(ref commandBytes, value);
         }
 
         public string Name
         {
-            get { return name; }
-            set { SetProperty(ref name, value); }
+            get => name;
+            set => SetProperty(ref name, value);
         }
 
-        public TeoCommandType ToSendCommand
+        public TeoConstants.TeoCommandType ToSendCommand
         {
-            get { return toSendCommand; }
-            set { SetProperty( ref toSendCommand, value); }
+            get => toSendCommand;
+            set => SetProperty(ref toSendCommand, value);
         }
 
-        public CommandItemViewModel(TeoCommandType cmd)
+        public CommandItemViewModel(TeoConstants.TeoCommandType cmd)
         {
             ToSendCommand = cmd;
-            Name = TeoCommandNames.GetValueOrDefault(cmd);
-            CommandBytes = string.Join("-", TeoCommandValues.GetValueOrDefault(cmd));
+            Name = TeoConstants.TeoCommandNames.GetValueOrDefault(cmd);
+            CommandBytes = string.Join("-", TeoConstants.TeoCommandValues.GetValueOrDefault(cmd));
         }
 
     }
diff --git a/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs
index ea05174..b25938d 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.RFID;
 using TestXamConnections.Device.RFID.Agrident;
 using Xamarin.Forms;
 
@@ -8,41 +9,42 @@ namespace TestXamConnections.ViewModels
 {
     public class InternServiceViewModel : ViewModelBase
     {
+        private readonly IRFIDReader agridentReader;
+
         private bool isScanning;
         private bool showRFID;
         private bool showError;
-        private readonly AgridentInternReader agridentReader;
         private string rfidResult;
         private string errorMessage;
 
         public bool ShowRFID
         {
-            get { return showRFID; }
-            set { SetProperty(ref showRFID, value); }
+            get => showRFID;
+            set => SetProperty(ref showRFID, value);
         }
 
         public bool ShowError
         {
-            get { return showError; }
-            set { SetProperty( ref showError, value); }
+            get => showError;
+            set => SetProperty(ref showError, value);
         }
 
         public bool IsScanning
         {
-            get { return isScanning; }
-            set { SetProperty(ref isScanning, value); }
+            get => isScanning;
+            set => SetProperty(ref isScanning, value);
         }
 
         public string RFIDResult
         {
-            get { return rfidResult; }
-            set { SetProperty(ref rfidResult, value); }
+            get => rfidResult;
+            set => SetProperty(ref rfidResult, value);
         }
 
         public string ErrorMessage
         {
-            get { return errorMessage; }
-            set { SetProperty(ref errorMessage, value); }
+            get => errorMessage;
+            set => SetProperty(ref errorMessage, value);
         }
 
         private async Task StartScan()
@@ -63,7 +65,7 @@ namespace TestXamConnections.ViewModels
             ShowError = false;
             RFIDResult = "";
             ErrorMessage = "";
-            agridentReader = new AgridentInternReader();
+            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());
diff --git a/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs
index 561a993..9bd91f9 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs
@@ -2,58 +2,58 @@
 using System.Collections.ObjectModel;
 using System.Threading.Tasks;
 using System.Windows.Input;
+using TestXamConnections.Connection;
 using TestXamConnections.Device;
 using TestXamConnections.Device.Balance;
-using TestXamConnections.Device.Balance.Teo;
+using TestXamConnections.Device.Balance.Balea;
 using TestXamConnections.Models;
 using Xamarin.Forms;
-using static TestXamConnections.Device.Balance.Teo.TeoConstants;
 
 namespace TestXamConnections.ViewModels
 {
     public class TeoDeviceViewModel : ViewModelBase
     {
+        private IBalance teoScale;
         private bool isConnected;
         private string data;
-        private IBalance teoScale;
         private bool isVisibleData;
         private bool showError;
         private string errorMessage;
 
-        public bool IsVisibleData
+        public IBalance TeoScale
         {
-            get { return isVisibleData; }
-            set { SetProperty(ref isVisibleData, value); }
+            get => teoScale;
+            set => SetProperty(ref teoScale, value);
         }
 
-        public bool IsConnected
+        public bool IsVisibleData
         {
-            get { return isConnected; }
-            set { SetProperty(ref isConnected, value); }
+            get => isVisibleData;
+            set => SetProperty(ref isVisibleData, value);
         }
 
-        public IBalance TeoScale
+        public bool IsConnected
         {
-            get { return teoScale; }
-            set { SetProperty(ref teoScale, value); }
+            get => isConnected;
+            set => SetProperty(ref isConnected, value);
         }
 
         public string Data
         {
-            get { return data; }
-            set { SetProperty(ref data, value); }
+            get => data;
+            set => SetProperty(ref data, value);
         }
 
         public bool ShowError
         {
-            get { return showError; }
-            set { SetProperty(ref showError, value); }
+            get => showError;
+            set => SetProperty(ref showError, value);
         }
 
         public string ErrorMessage
         {
-            get { return errorMessage; }
-            set { SetProperty(ref errorMessage, value); }
+            get => errorMessage;
+            set => SetProperty(ref errorMessage, value);
         }
 
         public ObservableCollection<CommandItemViewModel> AvailableCommandsList { get; set; }
@@ -61,29 +61,42 @@ namespace TestXamConnections.ViewModels
         public async Task<bool> ConnectToDevice()
         {
             ShowError = false;
-            IsConnected = await teoScale.ConnectToBalanceAsync();
+            IsConnected = await TeoScale.ConnectToBalanceAsync();
             return IsConnected;
         }
 
         public ICommand ConnectToDeviceCommand { private set; get; }
         public ICommand SendValueCommand { private set; get; }
 
-        public TeoDeviceViewModel(DeviceInfo device)
+        public void Init()
         {
-            TeoScale = new TeoBalance(device);
+            // Init View Model
             ShowError = false;
             IsConnected = false;
             IsVisibleData = false;
             ConnectToDeviceCommand = new Command(async () => await ConnectToDevice());
-            SendValueCommand = new Command(async (cmd) => await teoScale.SendCommandAsync((TeoCommandType)cmd));
-            TeoScale.PeseeReceivedEvent = PeseeReceived;
+            SendValueCommand = new Command(async (cmd) => await TeoScale.SendCommandAsync((TeoConstants.TeoCommandType)cmd));
+            TeoScale.PeseeReceivedEvent += PeseeReceived;
 
-            // Ajout manuel des commandes
+            // Chargement des commandes
             AvailableCommandsList = new ObservableCollection<CommandItemViewModel>();
-            foreach (TeoCommandType _cmd in Enum.GetValues(typeof(TeoCommandType)))
+            foreach (TeoConstants.TeoCommandType _cmd in Enum.GetValues(typeof(TeoConstants.TeoCommandType)))
             {
                 AvailableCommandsList.Add(new CommandItemViewModel(_cmd));
             }
+
+        }
+
+        public TeoDeviceViewModel(DeviceInfo device)
+        {
+            // Appel au Balance provider pour récupérer l'item TeoBalancea avec les fonctions d'initiation
+            TeoScale = BalanceProvider.GetBalance(Balance.TeoBalance, ConnectionType.Bluetooth, device);
+            Init();
+        }
+
+        ~TeoDeviceViewModel()
+        {
+            TeoScale.PeseeReceivedEvent -= PeseeReceived;
         }
 
         public void PeseeReceived(object sender, ReponsePesee args)
diff --git a/TestXamConnections/TestXamConnections/Views/AccueilView.xaml b/TestXamConnections/TestXamConnections/Views/AccueilView.xaml
index 9f756b5..ff7d471 100644
--- a/TestXamConnections/TestXamConnections/Views/AccueilView.xaml
+++ b/TestXamConnections/TestXamConnections/Views/AccueilView.xaml
@@ -10,6 +10,7 @@
         <StackLayout BackgroundColor="#001729" VerticalOptions="FillAndExpand">
             <StackLayout VerticalOptions="CenterAndExpand">
                 <Frame
+                    Margin="0,20"
                     Padding="0"
                     BackgroundColor="Transparent"
                     BorderColor="#4f5a64"
@@ -25,7 +26,7 @@
                             FontSize="18"
                             HorizontalOptions="CenterAndExpand"
                             HorizontalTextAlignment="Center"
-                            Text="Teo Test Bluetooth"
+                            Text="Appareil Bluetooth"
                             TextColor="White"
                             VerticalOptions="CenterAndExpand" />
                         <BoxView
@@ -94,12 +95,12 @@
                                         <Label
                                             FontAttributes="Bold"
                                             HorizontalTextAlignment="Center"
-                                            Text="{Binding Device.Name}"
+                                            Text="{Binding DeviceI.Name}"
                                             TextColor="White" />
                                         <Label
                                             FontSize="12"
                                             HorizontalTextAlignment="Center"
-                                            Text="{Binding Device.MACAddress}"
+                                            Text="{Binding DeviceI.MACAddress}"
                                             TextColor="DarkGray" />
                                     </StackLayout>
                                 </DataTemplate>
@@ -109,22 +110,50 @@
                     </StackLayout>
                 </Frame>
 
-                <xe:BorderView
-                    Margin="0,20,0,0"
-                    xe:Commands.Tap="{Binding NavigateToInternServiceCommand}"
-                    xe:TouchEffect.Color="#0060a8"
-                    BackgroundColor="#003266"
-                    CornerRadius="65"
-                    HorizontalOptions="Center">
-                    <StackLayout Padding="15,10">
+                <Frame
+                    Margin="0,20"
+                    Padding="0"
+                    BackgroundColor="Transparent"
+                    BorderColor="#4f5a64"
+                    CornerRadius="5"
+                    HasShadow="False"
+                    HorizontalOptions="Center"
+                    VerticalOptions="CenterAndExpand"
+                    WidthRequest="200">
+                    <StackLayout Spacing="0">
                         <Label
-                            FontSize="16"
-                            HorizontalOptions="Center"
+                            Margin="0,10"
+                            FontAttributes="Bold"
+                            FontSize="18"
+                            HorizontalOptions="CenterAndExpand"
                             HorizontalTextAlignment="Center"
-                            Text="Service interne"
-                            TextColor="#34a9ff" />
+                            Text="Connection Interne"
+                            TextColor="White"
+                            VerticalOptions="CenterAndExpand" />
+
+                        <BoxView
+                            HeightRequest="1"
+                            HorizontalOptions="FillAndExpand"
+                            Color="#4f5a64" />
+
+                        <xe:BorderView
+                            Margin="0,20"
+                            xe:Commands.Tap="{Binding NavigateToInternServiceCommand}"
+                            xe:TouchEffect.Color="#0060a8"
+                            BackgroundColor="#003266"
+                            CornerRadius="65"
+                            HorizontalOptions="Center">
+                            <StackLayout Padding="15,10">
+                                <Label
+                                    FontSize="16"
+                                    HorizontalOptions="Center"
+                                    HorizontalTextAlignment="Center"
+                                    Text="Service interne"
+                                    TextColor="#34a9ff" />
+                            </StackLayout>
+                        </xe:BorderView>
                     </StackLayout>
-                </xe:BorderView>
+                </Frame>
 
             </StackLayout>
         </StackLayout>
diff --git a/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs b/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs
index 8922082..d8aa2f0 100644
--- a/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs
+++ b/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs
@@ -11,7 +11,7 @@ namespace TestXamConnections.Views
         public BluetoothReaderView(DeviceInfo deviceI)
         {
             InitializeComponent();
-            BindingContext = new BluetoothReaderViewModel(deviceI);
+            BindingContext = new BarcodeReaderViewModel(deviceI);
         }
     }
 }
\ No newline at end of file
diff --git a/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml b/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml
index 1974f65..3df17dc 100644
--- a/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml
+++ b/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml
@@ -88,7 +88,7 @@
                                     FontSize="28"
                                     HorizontalOptions="CenterAndExpand"
                                     HorizontalTextAlignment="Center"
-                                    Text="{Binding TeoScale.Name}"
+                                    Text="{Binding TeoScale.DeviceI.Name}"
                                     TextColor="White"
                                     VerticalOptions="CenterAndExpand" />
                                 <Label
@@ -97,7 +97,7 @@
                                     FontSize="12"
                                     HorizontalOptions="CenterAndExpand"
                                     HorizontalTextAlignment="Center"
-                                    Text="{Binding TeoScale.MACAddress}"
+                                    Text="{Binding TeoScale.DeviceI.MACAddress}"
                                     TextColor="DarkGray"
                                     VerticalOptions="CenterAndExpand" />
                             </StackLayout>
