commit c32a628f86eea4358747fb152bc66914637e0e79
Author: Martin Toutant <martin.toutant@inrae.fr>
Date:   Wed Sep 14 11:07:37 2022 +0200

    nouvelle structure après discussion avec JF

diff --git a/TestXamConnections/TestXamConnections.Android/Connection/InternConnectionService.cs b/TestXamConnections/TestXamConnections.Android/Connection/InternConnectionService.cs
index 1c1d0a4..08ec126 100644
--- a/TestXamConnections/TestXamConnections.Android/Connection/InternConnectionService.cs
+++ b/TestXamConnections/TestXamConnections.Android/Connection/InternConnectionService.cs
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
 using TestXamConnections.Models;
 using TestXamConnections.Connection;
 using TestXamConnections.Droid.Receivers;
-using TestXamConnections.Helper;
+using TestXamConnections.Device.RFID.Agrident;
 
 namespace TestXamConnections.Droid.Connection
 {
@@ -82,14 +82,6 @@ namespace TestXamConnections.Droid.Connection
                     DataReceivedEvent.Invoke(this, Encoding.ASCII.GetBytes(AgridentConstants.ACTION_AGRIDENT_ERROR));
                     break;
 
-                case AgridentConstants.ACTION_AGRIDENT_SERVICE_START:
-                    DataReceivedEvent.Invoke(this, Encoding.ASCII.GetBytes(AgridentConstants.ACTION_AGRIDENT_SERVICE_START));
-                    break;
-
-                case AgridentConstants.ACTION_AGRIDENT_SERVICE_STOP:
-                    DataReceivedEvent.Invoke(this, Encoding.ASCII.GetBytes(AgridentConstants.ACTION_AGRIDENT_SERVICE_STOP));
-                    break;
-
                 default:
                     break;
             }
diff --git a/TestXamConnections/TestXamConnections/Connection/ConnectionConstants.cs b/TestXamConnections/TestXamConnections/Connection/ConnectionConstants.cs
new file mode 100644
index 0000000..9da5f6c
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Connection/ConnectionConstants.cs
@@ -0,0 +1,18 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TestXamConnections.Connection
+{
+    /// <summary>
+    /// Constantes de connexion à utiliser lors de l'utilisation 
+    /// de la fonction Connect de IConnection Service
+    /// </summary>
+    public static class ConnectionConstants
+    {
+        public static readonly string MAC_ADDR_KEY = "mac_address";
+        // public static readonly string LAUNCH_INTENT_KEY = "launch_intent";
+        public static readonly string RECEIVABLE_INTENTS_KEY = "receivable_intents";
+
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Connection/IConnectionService.cs b/TestXamConnections/TestXamConnections/Connection/IConnectionService.cs
index 9fd1383..0098362 100644
--- a/TestXamConnections/TestXamConnections/Connection/IConnectionService.cs
+++ b/TestXamConnections/TestXamConnections/Connection/IConnectionService.cs
@@ -2,7 +2,6 @@
 using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
-using TestXamConnections.Helper;
 using TestXamConnections.Models;
 
 namespace TestXamConnections.Connection
@@ -20,9 +19,9 @@ namespace TestXamConnections.Connection
         /// <summary>
         /// Fonction d'envoi de commande pour le bluetooth
         /// </summary>
-        /// <param name="hexValues">Données à envoyer sous forme de tableau d'octets ou d'une chaine de caractère</param>
+        /// <param name="hexValues">Données à envoyer sous forme de tableau d'octets</param>
         /// <returns>true si la commande s'est bien envoyée, false sinon.</returns>
-        Task<bool> SendCommand(IConvertible hexValues);
+        Task<bool> SendCommand(byte[] hexValues);
 
         /// <summary>
         /// Événement déclenché à la réception de données. Présente les donénes sous forme d’un tableau d’octets.
diff --git a/TestXamConnections/TestXamConnections/Connection/IConnectionServiceProvider.cs b/TestXamConnections/TestXamConnections/Connection/IConnectionServiceProvider.cs
new file mode 100644
index 0000000..ef46b10
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Connection/IConnectionServiceProvider.cs
@@ -0,0 +1,23 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TestXamConnections.Connection;
+
+namespace TestXamConnections.Connection
+{
+    /// <summary>
+    /// Type de connection service à demander.
+    /// </summary>
+    public enum ConnectionType
+    {
+        Bluetooth,
+        Intern,
+        Wifi
+    }
+
+    public interface IConnectionServiceProvider
+    {
+        IConnectionService GetConnectionServiceInstance(ConnectionType ct);
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs b/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs
new file mode 100644
index 0000000..3b20d34
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs
@@ -0,0 +1,33 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TestXamConnections.Connection;
+using TestXamConnections.Models;
+using static TestXamConnections.Device.Balance.Teo.TeoConstants;
+
+namespace TestXamConnections.Device.Balance
+{
+    public interface IBalance : IDevice
+    {
+        /// <summary>
+        /// Événement déclenché à la reception d'une pesée de la part du Teo.
+        /// </summary>
+        EventHandler<ReponsePesee> PeseeReceivedEvent { get; set; }
+
+        /// <summary>
+        /// Permet d’établir une connection bluetooth avec une balance. 
+        /// 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>
+        Task<bool> ConnectToBalanceAsync();
+
+        // <summary>
+        /// Envoie d'une commande à la balance.
+        /// </summary>
+        /// <param name="commandType">La commande à envoyer.</param>
+        /// <returns></returns>
+        Task<bool> SendCommandAsync(TeoCommandType cmd);
+
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs b/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs
new file mode 100644
index 0000000..f3451b1
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs
@@ -0,0 +1,111 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TestXamConnections.Connection;
+using TestXamConnections.Device.Balance;
+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
new file mode 100644
index 0000000..49c592d
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoConstants.cs
@@ -0,0 +1,42 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+
+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/Honeywell/BarcodeInternReader.cs b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs
new file mode 100644
index 0000000..8d00260
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs
@@ -0,0 +1,11 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TestXamConnections.Device.Barcode.Honeywell
+
+    public class HoneywellInternReader
+    {
+        // TODO
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs
new file mode 100644
index 0000000..13f6c43
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs
@@ -0,0 +1,42 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TestXamConnections.Connection;
+using Xamarin.Forms;
+
+namespace TestXamConnections.Device.Barcode.Honeywell
+{
+    public class HoneywellBTReader : IBarcodeReader
+    {
+        public DeviceInfo Device { get; set; }
+        public IConnectionService ConnectionService { get; set; }
+        /// <summary>
+        /// Événement déclenché à la reception de données par le lecteur de code barre Honeywell.
+        /// </summary>
+        public EventHandler<byte[]> BarcodeDataReceivedEvent { get; set; }
+
+        public HoneywellBTReader(DeviceInfo device)
+        {
+            Device.Name = device.Name;
+            Device.MACAddress = device.MACAddress;
+            ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Bluetooth);
+            ConnectionService.DataReceivedEvent += BluetoothDataReceived;
+        }
+
+        private void BluetoothDataReceived(object sender, byte[] e)
+        {
+            BarcodeDataReceivedEvent.Invoke(this, e);
+        }
+
+        public async Task<bool> ConnectToBTReaderAsync()
+        {
+            Dictionary<string, string> param = new Dictionary<string, string>()
+            {
+                { ConnectionConstants.MAC_ADDR_KEY, Device.MACAddress }
+            };
+            bool ret = await ConnectionService.Connect(param);
+            return ret;
+        }
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/Barcode/IBarcodeReader.cs b/TestXamConnections/TestXamConnections/Device/Barcode/IBarcodeReader.cs
new file mode 100644
index 0000000..a9de6fa
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/IBarcodeReader.cs
@@ -0,0 +1,17 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TestXamConnections.Device.Barcode
+{
+    public interface IBarcodeReader : IDevice
+    {
+        /// <summary>
+        /// Événement déclenché à la reception de données par le lecteur de code barre.
+        /// </summary>
+        public EventHandler<byte[]> BarcodeDataReceivedEvent { get; set; }
+
+        Task<bool> ConnectToBTReaderAsync();
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/DeviceInfo.cs b/TestXamConnections/TestXamConnections/Device/DeviceInfo.cs
new file mode 100644
index 0000000..ccc1251
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/DeviceInfo.cs
@@ -0,0 +1,27 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TestXamConnections.Device
+{
+    /// <summary>
+    /// Représente un appareil caractérisé par un nom et une adresse MAC.
+    /// </summary>
+    public class DeviceInfo
+    {
+        /// <summary>
+        /// Le nom de l'appareil.
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// L'adresse MAC de l'appareil
+        /// </summary>
+        public string MACAddress { get; set; }
+
+        public override string ToString()
+        {
+            return Name + ":" + MACAddress;
+        }
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/IDevice.cs b/TestXamConnections/TestXamConnections/Device/IDevice.cs
new file mode 100644
index 0000000..44d8adc
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/IDevice.cs
@@ -0,0 +1,13 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using TestXamConnections.Connection;
+
+namespace TestXamConnections.Device
+{
+    public interface IDevice
+    {
+        DeviceInfo Device { get; set; }
+        IConnectionService ConnectionService { get; set; }
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentConstants.cs b/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentConstants.cs
new file mode 100644
index 0000000..3d016c5
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentConstants.cs
@@ -0,0 +1,20 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TestXamConnections.Device.RFID.Agrident
+{
+    /// <summary>
+    /// Constantes utilisées pour la communication avec le module Agrident Wedge.
+    /// </summary>
+    public class AgridentConstants
+    {
+        public const string ACTION_AGRIDENT_SUCCESS = "fr.coppernic.intent.agridentsuccess";
+        public const string ACTION_AGRIDENT_ERROR = "fr.coppernic.intent.agridentfailed";
+        public const string ACTION_AGRIDENT_SERVICE_STOP = "fr.coppernic.intent.action.stop.agrident.service";
+        public const string ACTION_AGRIDENT_SERVICE_START = "fr.coppernic.intent.action.start.agrident.service";
+        public const string ACTION_AGRIDENT_READ = "fr.coppernic.tools.agrident.wedge.READ";
+        public const string KEY_BARCODE_DATA = "BarcodeData";
+        public const string AGRIDENT_WEDGE = "fr.coppernic.tools.cpcagridentwedge";
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs b/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs
new file mode 100644
index 0000000..68b9ee4
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs
@@ -0,0 +1,87 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+using TestXamConnections.Connection;
+using Xamarin.Forms;
+
+namespace TestXamConnections.Device.RFID.Agrident
+{
+    /// <summary>
+    /// Important: Cette classe est utilisable avec le lecteur agrident interne au C-One.
+    /// </summary>
+    public class AgridentInternReader : IRFIDReader
+    {
+        public DeviceInfo Device { 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()
+        {
+            ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Intern);
+            ConnectionService.DataReceivedEvent += InternDataReceived;
+        }
+
+        ~AgridentInternReader()
+        {
+            ConnectionService.DataReceivedEvent -= InternDataReceived;
+        }
+
+        /* Fonction déclenchée à la reception de données Agrident
+         * Trigger l'évènement AgridentDataReceivedEvent
+         */
+        private void InternDataReceived(object sender, byte[] intent)
+        {
+            string data = Encoding.ASCII.GetString(intent);
+
+            switch (data)
+            {
+                case AgridentConstants.ACTION_AGRIDENT_ERROR:
+                    RFIDDataReceivedEvent.Invoke(this, "");
+                    break;
+
+                default:
+                    RFIDDataReceivedEvent.Invoke(this, data);
+                    break;
+            }
+        }
+
+        /// <summary>
+        /// Initialise la lecture de tag RFID avec lecteur interne Agrident.
+        /// </summary>
+        /// <returns>true la connexion a réussi, false sinon.</returns>
+        public async Task<bool> EnableServiceAsync()
+        {
+            bool ret;
+            // Enregistrement des intents recevable par Agrident
+            List<string> intentsList = new List<string>()
+            {
+                AgridentConstants.ACTION_AGRIDENT_SUCCESS,
+                AgridentConstants.ACTION_AGRIDENT_ERROR
+            };
+            string intents = string.Join(',', intentsList);
+
+            // Encapuslation des intents recevables pour envoyer au service de connexion
+            Dictionary<string, string> param = new Dictionary<string, string>()
+            {
+                { ConnectionConstants.RECEIVABLE_INTENTS_KEY, intents }
+            };
+
+            ret = await ConnectionService.Connect(param);
+            return ret;
+        }
+
+        /// <summary>
+        /// Lance un scan de tag RFID avec le lecteur Agrident interne.
+        /// </summary>
+        /// <returns>true si le scan s'est lancé correctement, false sinon.</returns>
+        public async Task<bool> StartScanAsync()
+        {
+            return await ConnectionService.SendCommand(AgridentConstants.AGRIDENT_WEDGE);
+        }
+
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Device/RFID/IRFIDReader.cs b/TestXamConnections/TestXamConnections/Device/RFID/IRFIDReader.cs
new file mode 100644
index 0000000..b5c7159
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Device/RFID/IRFIDReader.cs
@@ -0,0 +1,27 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TestXamConnections.Device.RFID
+{
+    public interface IRFIDReader : IDevice
+    {
+        /// <summary>
+        /// Événement déclenché à la reception de données par le lecteur RFID.
+        /// </summary>
+        public EventHandler<string> RFIDDataReceivedEvent { get; set; }
+
+        /// <summary>
+        /// Initialise la lecture de tag RFID.
+        /// </summary>
+        /// <returns>true la connexion a réussi, false sinon.</returns>
+        Task<bool> EnableServiceAsync();
+
+        /// <summary>
+        /// Lance un scan de tag RFID.
+        /// </summary>
+        /// <returns>true si le scan s'est lancé correctement, false sinon.</returns>
+        Task<bool> StartScanAsync();
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Helper/ConnectionConstants.cs b/TestXamConnections/TestXamConnections/Helper/ConnectionConstants.cs
deleted file mode 100644
index 9a19568..0000000
--- a/TestXamConnections/TestXamConnections/Helper/ConnectionConstants.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TestXamConnections.Helper
-{
-    /// <summary>
-    /// Constantes de connexion à utiliser lors de l'utilisation 
-    /// de la fonction Connect de IConnection Service
-    /// </summary>
-    public static class ConnectionConstants
-    {
-        public static readonly string MAC_ADDR_KEY = "mac_address";
-        // public static readonly string LAUNCH_INTENT_KEY = "launch_intent";
-        public static readonly string RECEIVABLE_INTENTS_KEY = "receivable_intents";
-
-    }
-}
diff --git a/TestXamConnections/TestXamConnections/Helper/IConnectionServiceProvider.cs b/TestXamConnections/TestXamConnections/Helper/IConnectionServiceProvider.cs
deleted file mode 100644
index 215ee76..0000000
--- a/TestXamConnections/TestXamConnections/Helper/IConnectionServiceProvider.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.Connection;
-
-namespace TestXamConnections.Helper
-{
-    /// <summary>
-    /// Type de connection service à demander.
-    /// </summary>
-    public enum ConnectionType
-    {
-        Bluetooth,
-        Intern,
-        Wifi
-    }
-
-    public interface IConnectionServiceProvider
-    {
-        IConnectionService GetConnectionServiceInstance(ConnectionType ct);
-    }
-}
diff --git a/TestXamConnections/TestXamConnections/Models/AgridentReader.cs b/TestXamConnections/TestXamConnections/Models/AgridentReader.cs
deleted file mode 100644
index 6f885b0..0000000
--- a/TestXamConnections/TestXamConnections/Models/AgridentReader.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.Connection;
-using TestXamConnections.Helper;
-using Xamarin.Forms;
-
-namespace TestXamConnections.Models
-{
-    /// <summary>
-    /// Constantes utilisées pour la communication avec le module Agrident Wedge.
-    /// </summary>
-    public class AgridentConstants
-    {
-        public const string ACTION_AGRIDENT_SUCCESS = "fr.coppernic.intent.agridentsuccess";
-        public const string ACTION_AGRIDENT_ERROR = "fr.coppernic.intent.agridentfailed";
-        public const string ACTION_AGRIDENT_SERVICE_STOP = "fr.coppernic.intent.action.stop.agrident.service";
-        public const string ACTION_AGRIDENT_SERVICE_START = "fr.coppernic.intent.action.start.agrident.service";
-        public const string ACTION_AGRIDENT_READ = "fr.coppernic.tools.agrident.wedge.READ";
-        public const string KEY_BARCODE_DATA = "BarcodeData";
-        public const string AGRIDENT_WEDGE = "fr.coppernic.tools.cpcagridentwedge";
-    }
-
-    public class AgridentReader
-    {
-        private IConnectionService ConnectionService { get; set; }
-
-        /// <summary>
-        /// Événement déclenché à la reception de données par le lecteur RFID.
-        /// </summary>
-        public EventHandler<string> AgridentDataReceivedEvent { get; set; }
-
-        /// <summary>
-        /// Événement déclenché lorsque le scan de tag RFID a échoué.
-        /// </summary>
-        public EventHandler AgridentNORFIDEvent { get; set; }
-
-        /// <summary>
-        /// Ne marche pas pour l'instant
-        /// </summary>
-        public EventHandler<bool> AgridentScanStatusChangedEvent { get; set; }
-
-        public AgridentReader()
-        {
-            ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Intern);
-            ConnectionService.DataReceivedEvent += InternDataReceived;
-        }
-
-        ~AgridentReader()
-        {
-            ConnectionService.DataReceivedEvent -= InternDataReceived;
-        }
-
-        /* Fonction déclenchée à la reception de données Agrident
-         * Trigger l'évènement AgridentDataReceivedEvent
-         */
-        private void InternDataReceived(object sender, byte[] intent)
-        {
-            string data = Encoding.ASCII.GetString(intent);
-
-            switch (data)
-            {
-                case AgridentConstants.ACTION_AGRIDENT_ERROR:
-                    AgridentNORFIDEvent.Invoke(this, null);
-                    break;
-
-                case AgridentConstants.ACTION_AGRIDENT_SERVICE_START:
-                    AgridentScanStatusChangedEvent.Invoke(this, true);
-                    break;
-
-                case AgridentConstants.ACTION_AGRIDENT_SERVICE_STOP:
-                    AgridentScanStatusChangedEvent.Invoke(this, false);
-                    break;
-
-                default:
-                    AgridentDataReceivedEvent.Invoke(this, data);
-                    break;
-            }
-        }
-
-        /// <summary>
-        /// Initialise la lecture de tag RFID.
-        /// </summary>
-        /// <returns>true la connexion a réussi, false sinon.</returns>
-        public async Task<bool> EnableServiceAsync()
-        {
-            bool ret;
-            // Enregistrement des intents recevable par Agrident
-            List<string> intentsList = new List<string>()
-            {
-                AgridentConstants.ACTION_AGRIDENT_SUCCESS,
-                AgridentConstants.ACTION_AGRIDENT_ERROR,
-                AgridentConstants.ACTION_AGRIDENT_SERVICE_START,
-                AgridentConstants.ACTION_AGRIDENT_SERVICE_STOP
-            };
-            string intents = string.Join(',', intentsList);
-
-            // Encapuslation des intents recevables pour envoyer au service de connexion
-            Dictionary<string, string> param = new Dictionary<string, string>()
-            {
-                { ConnectionConstants.RECEIVABLE_INTENTS_KEY, intents }
-            };
-
-            ret = await ConnectionService.Connect(param);
-            return ret;
-        }
-
-        /// <summary>
-        /// Lance un scan de tag RFID.
-        /// </summary>
-        /// <returns>true si le scan s'est lancé correctement, false sinon.</returns>
-        public async Task<bool> StartScanAsync()
-        {
-            return await ConnectionService.SendCommand(AgridentConstants.AGRIDENT_WEDGE);
-        }
-
-    }
-}
diff --git a/TestXamConnections/TestXamConnections/Models/BluetoothReader.cs b/TestXamConnections/TestXamConnections/Models/BluetoothReader.cs
deleted file mode 100644
index cee3e81..0000000
--- a/TestXamConnections/TestXamConnections/Models/BluetoothReader.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.Connection;
-using TestXamConnections.Helper;
-using Xamarin.Forms;
-
-namespace TestXamConnections.Models
-{
-    public class BluetoothReader : Device
-    {
-        private IConnectionService ConnectionService { get; set; }
-        public EventHandler<byte[]> BluetoothDataReceivedEvent { get; set; }
-
-        public BluetoothReader(Device device)
-        {
-            Name = device.Name;
-            MACAddress = device.MACAddress;
-            ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Bluetooth);
-            ConnectionService.DataReceivedEvent += BluetoothDataReceived;
-        }
-
-        private void BluetoothDataReceived(object sender, byte[] e)
-        {
-            BluetoothDataReceivedEvent.Invoke(this, e);
-        }
-
-        public async Task<bool> ConnectToBTReaderAsync()
-        {
-            Dictionary<string, string> param = new Dictionary<string, string>()
-            {
-                { ConnectionConstants.MAC_ADDR_KEY, MACAddress }
-            };
-            bool ret = await ConnectionService.Connect(param);
-            return ret;
-        }
-    }
-}
diff --git a/TestXamConnections/TestXamConnections/Models/Device.cs b/TestXamConnections/TestXamConnections/Models/Device.cs
deleted file mode 100644
index 3d434e1..0000000
--- a/TestXamConnections/TestXamConnections/Models/Device.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TestXamConnections.Models
-{
-    /// <summary>
-    /// Représente un appareil caractérisé par un nom et une adresse MAC.
-    /// </summary>
-    public class Device
-    {
-        /// <summary>
-        /// Le nom de l'appareil.
-        /// </summary>
-        public string Name { get; set; }
-
-        /// <summary>
-        /// L'adresse MAC de l'appareil
-        /// </summary>
-        public string MACAddress { get; set; }
-
-        public override string ToString()
-        {
-            return Name + ":" + MACAddress;
-        }
-    }
-}
diff --git a/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs b/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs
index 480d521..2b048fb 100644
--- a/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs
+++ b/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs
@@ -7,6 +7,18 @@ namespace TestXamConnections.Models
 {
     public class ReponsePesee
     {
+
+        private bool err;
+        /// <summary>
+        /// Indicateur si erreur de pesée
+        /// </summary>
+        public bool Err
+        {
+            get { return err; }
+            set { err = value; }
+        }
+
+
         private int numPlateau;
         /// <summary>
         /// Le numéro du plateau.
@@ -49,11 +61,18 @@ namespace TestXamConnections.Models
 
         public ReponsePesee(string data)
         {
-            // Voir doc Balance Teo INRAE
-            NumPlateau = int.Parse(data[0].ToString());
-            TypePlateau = int.Parse(data[1].ToString());
-            IsNegative = data[4] == '-';
-            PoidsMesure = new string(data.Skip(5).ToArray()).Trim();
+            if (data == "err")
+            { 
+                Err = true;
+            } else
+            {
+                // Voir doc Balance Teo INRAE
+                NumPlateau = int.Parse(data[0].ToString());
+                TypePlateau = int.Parse(data[1].ToString());
+                IsNegative = data[4] == '-';
+                PoidsMesure = new string(data.Skip(5).ToArray()).Trim();
+
+            }
         }
     }
 }
diff --git a/TestXamConnections/TestXamConnections/Models/ReponseRFID.cs b/TestXamConnections/TestXamConnections/Models/ReponseRFID.cs
new file mode 100644
index 0000000..6136818
--- /dev/null
+++ b/TestXamConnections/TestXamConnections/Models/ReponseRFID.cs
@@ -0,0 +1,11 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TestXamConnections.Models
+{
+    public class ReponseRFID
+    {
+        // TODO (doc JF Bompa)
+    }
+}
diff --git a/TestXamConnections/TestXamConnections/Models/TeoBalance.cs b/TestXamConnections/TestXamConnections/Models/TeoBalance.cs
deleted file mode 100644
index e0a2515..0000000
--- a/TestXamConnections/TestXamConnections/Models/TeoBalance.cs
+++ /dev/null
@@ -1,283 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.Connection;
-using TestXamConnections.Helper;
-using Xamarin.Forms;
-
-namespace TestXamConnections.Models
-{
-    /// <summary>
-    /// Liste des commandes disponibles pour la balance Teo, pour le programme INRAE.
-    /// </summary>
-    public enum TeoCommandType
-    {
-        // Voir documentation TEO INRAE 
-        // Codes ASCII
-        ModeOrdre,
-        EmissionPoids,
-        SortieOrdreGardeBluetooth,
-        SortieOrdreEtBluetooth,
-        ModePeseeSimple,
-        SortiePeseeSimple,
-        PeseeStabilisee,
-        InterrompPS,
-        TareP1,
-        TareP2,
-        ZeroP1,
-        ZeroP2,
-        InfosMetrologie,
-    }
-
-    public class TeoBalance : Device
-    {
-        private IConnectionService ConnectionService { get; set; }
-
-        /// <summary>
-        /// Événement déclenché à la réception d'une donnée de la part du Teo, autre qu'une pesée.
-        /// </summary>
-        public EventHandler<string> TeoDataReceivedEvent { get; set; }
-        /// <summary>
-        /// Événement déclenché à la reception d'une pesée de la part du Teo.
-        /// </summary>
-        public EventHandler<ReponsePesee> TeoPeseeReceivedEvent { get; set; }
-
-        public TeoBalance(Device device)
-        {
-            Name = device.Name;
-            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)
-                {
-                    TeoPeseeReceivedEvent.Invoke(this, new ReponsePesee(_bufferedData));
-                }
-                else if (_bufferedData[2] == '6')
-                {
-                    TeoDataReceivedEvent.Invoke(this, "Erreur pesée");
-                } 
-                else
-                {
-                    TeoDataReceivedEvent.Invoke(this, _bufferedData);
-                }
-            }
-        }
-
-        /// <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> ConnectToTeoAsync()
-        {
-            Dictionary<string, string> param = new Dictionary<string, string>()
-            {
-                { ConnectionConstants.MAC_ADDR_KEY, MACAddress }
-            };
-            _ = await ConnectionService.Connect(param);
-            return true;
-        }
-
-        /// <summary>
-        /// Envoie d'une commande au Teo.
-        /// </summary>
-        /// <param name="commandType">La commande à envoyer.</param>
-        /// <returns></returns>
-        public async Task<bool> SendTeoCommandAsync(TeoCommandType commandType)
-        {
-            return await ConnectionService.SendCommand(GetCommandCode(commandType));
-        }
-
-        /// <summary>
-        /// Récupère le code hexadécimal d'une commande donnée.
-        /// </summary>
-        /// <param name="commandType">La commande dont on souhaite le code hexa.</param>
-        /// <returns>Le code héxadécimal de la command sur forme de tableau d'octet.</returns>
-        public static byte[] GetCommandCode(TeoCommandType commandType)
-        {
-            // Les commandes envoyées sont sur 3 octets
-            byte[] ret = new byte[3];
-            // STX
-            ret[0] = 0x02;
-            // CR
-            ret[2] = 0x0D;
-
-            // Commande
-            switch (commandType)
-            {
-                case TeoCommandType.ModeOrdre:
-                    ret[1] = 0x61;
-                    break;
-
-                case TeoCommandType.SortieOrdreGardeBluetooth:
-                    ret[1] = 0x6B;
-                    break;
-
-                case TeoCommandType.SortieOrdreEtBluetooth:
-                    ret[1] = 0x67;
-                    break;
-
-                case TeoCommandType.ModePeseeSimple:
-                    ret[1] = 0x62;
-                    break;
-
-                case TeoCommandType.SortiePeseeSimple:
-                    ret[1] = 0x65;
-                    break;
-
-                case TeoCommandType.TareP1:
-                    ret[1] = 0x74;
-                    break;
-
-                case TeoCommandType.TareP2:
-                    ret[1] = 0x6A;
-                    break;
-
-                case TeoCommandType.ZeroP1:
-                    ret[1] = 0x7A;
-                    break;
-
-                case TeoCommandType.ZeroP2:
-                    ret[1] = 0x64;
-                    break;
-
-                case TeoCommandType.InfosMetrologie:
-                    ret[1] = 0x73;
-                    break;
-
-                case TeoCommandType.EmissionPoids:
-                    ret[1] = 0x63;
-                    break;
-                // TODO
-                case TeoCommandType.PeseeStabilisee:
-                    break;
-
-                case TeoCommandType.InterrompPS:
-                    break;
-
-                default:
-                    break;
-            }
-            return ret;
-        }
-
-        /// <summary>
-        /// Recupère le nom d'une commande donnée.
-        /// </summary>
-        /// <param name="commandType">La commande dont on souhaite le nom.</param>
-        /// <returns>Le nom de la commande.</returns>
-        public static string GetCommandName(TeoCommandType commandType)
-        {
-            // Les commandes envoyées sont sur 3 octets
-            string ret = "";
-
-            // Commande
-            switch (commandType)
-            {
-                case TeoCommandType.ModeOrdre:
-                    ret = "Mode attente ordre";
-                    break;
-
-                case TeoCommandType.SortieOrdreGardeBluetooth:
-                    ret = "Sortie mode ordre";
-                    break;
-
-                case TeoCommandType.SortieOrdreEtBluetooth:
-                    ret = "Sortie mode ordre & couper bluetooth";
-                    break;
-
-                case TeoCommandType.ModePeseeSimple:
-                    ret = "Mode simple pesage";
-                    break;
-
-                case TeoCommandType.SortiePeseeSimple:
-                    ret = "Sortie mode simple pesage";
-                    break;
-
-                case TeoCommandType.TareP1:
-                    ret = "Tare plateau 1";
-                    break;
-
-                case TeoCommandType.TareP2:
-                    ret = "Tare plateau 2";
-                    break;
-
-                case TeoCommandType.ZeroP1:
-                    ret = "Zero plateau 1";
-                    break;
-
-                case TeoCommandType.ZeroP2:
-                    ret = "Zero plateau 2";
-                    break;
-
-                case TeoCommandType.InfosMetrologie:
-                    ret = "Informations métrologie";
-                    break;
-
-                case TeoCommandType.EmissionPoids:
-                    ret = "Emission poids";
-                    break;
-                // TODO
-                case TeoCommandType.PeseeStabilisee:
-                    ret = "Pesée stabilisée - NON implémenté";
-                    break;
-
-                case TeoCommandType.InterrompPS:
-                    ret = "STOP Pesée stabilisée - NON implémenté";
-                    break;
-
-                default:
-                    break;
-            }
-            return ret;
-        }
-
-    }
-}
diff --git a/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs
index db8ee4a..b4dc7aa 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs
@@ -3,6 +3,9 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Input;
+using TestXamConnections.Device;
+using TestXamConnections.Device.Barcode;
+using TestXamConnections.Device.Barcode.Honeywell;
 using TestXamConnections.Models;
 using Xamarin.Forms;
 
@@ -10,7 +13,7 @@ namespace TestXamConnections.ViewModels
 {
     public class BluetoothReaderViewModel : ViewModelBase
     {
-        private BluetoothReader btReader;
+        private IBarcodeReader btReader;
         private bool isVisibleData;
         private string data;
         private string connectionIndicator;
@@ -40,7 +43,7 @@ namespace TestXamConnections.ViewModels
             set => SetProperty(ref isVisibleData, value);
         }
 
-        public BluetoothReader BTReader
+        public IBarcodeReader BCReader
         {
             get => btReader;
             set => SetProperty(ref btReader, value);
@@ -48,7 +51,7 @@ namespace TestXamConnections.ViewModels
 
         public async Task<bool> ConnectToDevice()
         {
-            if (await BTReader.ConnectToBTReaderAsync())
+            if (await BCReader.ConnectToBTReaderAsync())
             {
                 ConnectionIndicator = "Connecté";
                 CIColor = "Green";
@@ -64,14 +67,14 @@ namespace TestXamConnections.ViewModels
 
         public ICommand ConnectToDeviceCommand { get; private set; }
 
-        public BluetoothReaderViewModel(Models.Device device)
+        public BluetoothReaderViewModel(DeviceInfo deviceI)
         {
             CIColor = "Red";
             ConnectionIndicator = "Non connecté";
             IsVisibleData = false;
-            BTReader = new BluetoothReader(device);
+            BCReader = new HoneywellBTReader(deviceI);
             ConnectToDeviceCommand = new Command(async () => await ConnectToDevice());
-            BTReader.BluetoothDataReceivedEvent += DataReceived;
+            BCReader.BarcodeDataReceivedEvent += DataReceived;
         }
 
         private void DataReceived(object sender, byte[] e)
diff --git a/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs
index 7acf651..e893a19 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs
@@ -1,10 +1,11 @@
-﻿using System.Threading.Tasks;
+﻿using System.Collections.Generic;
+using System.Threading.Tasks;
 using System.Windows.Input;
 using TestXamConnections.Connection;
-using TestXamConnections.Helper;
 using TestXamConnections.Models;
 using TestXamConnections.Services;
 using Xamarin.Forms;
+using static TestXamConnections.Device.Balance.Teo.TeoConstants;
 
 namespace TestXamConnections.ViewModels
 {
@@ -35,8 +36,8 @@ namespace TestXamConnections.ViewModels
         public CommandItemViewModel(TeoCommandType cmd)
         {
             ToSendCommand = cmd;
-            Name = TeoBalance.GetCommandName(cmd);
-            CommandBytes = string.Join("-", TeoBalance.GetCommandCode(cmd));
+            Name = TeoCommandNames.GetValueOrDefault(cmd);
+            CommandBytes = string.Join("-", TeoCommandValues.GetValueOrDefault(cmd));
         }
 
     }
diff --git a/TestXamConnections/TestXamConnections/ViewModels/DeviceItemViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/DeviceItemViewModel.cs
index ad6ed2d..7e78aaf 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/DeviceItemViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/DeviceItemViewModel.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Input;
+using TestXamConnections.Device;
 using TestXamConnections.Models;
 using TestXamConnections.Services;
 using TestXamConnections.Views;
@@ -13,42 +14,42 @@ namespace TestXamConnections.ViewModels
 {
     public class DeviceItemViewModel : ViewModelBase
     {
-        private Models.Device device;
-        public Models.Device Device
+        private DeviceInfo deviceI;
+        public DeviceInfo DeviceI
         {
 
-            get => device;
+            get => deviceI;
 
-            set => SetProperty(ref device, value);
+            set => SetProperty(ref deviceI, value);
         }
 
         private async Task NavigateToDevice()
         {
             // Si c'est le teo du bureau
-            if (Device.MACAddress == "60:A4:23:EB:FB:5C")
+            if (DeviceI.MACAddress == "60:A4:23:EB:FB:5C")
             {
-                await Application.Current.MainPage.Navigation.PushAsync(new TeoDeviceView(Device));
+                await Application.Current.MainPage.Navigation.PushAsync(new TeoDeviceView(DeviceI));
             }
             // Si c'est le scanner HoneyWell
-            else if (Device.MACAddress == "00:10:20:30:92:7D")
+            else if (DeviceI.MACAddress == "00:10:20:30:92:7D" || DeviceI.MACAddress == "00:04:3E:54:A9:B8")
             {
-                await Application.Current.MainPage.Navigation.PushAsync(new BluetoothReaderView(Device));
+                await Application.Current.MainPage.Navigation.PushAsync(new BluetoothReaderView(DeviceI));
             }
         }
 
         public ICommand NavigateToDeviceViewCommand { private set; get; }
 
-        public DeviceItemViewModel(Models.Device device)
+        public DeviceItemViewModel(DeviceInfo deviceInfo)
         {
-            Device = device;
+            DeviceI = deviceInfo;
             NavigateToDeviceViewCommand = new Command(async () => await NavigateToDevice());
         }
 
-        public void Update(Models.Device newDevice = null)
+        public void Update(DeviceInfo newDevice = null)
         {
             if (newDevice != null)
             {
-                Device = newDevice;
+                DeviceI = newDevice;
             }
         }
     }
diff --git a/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs
index d590ca0..7989154 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs
@@ -13,7 +13,7 @@ namespace TestXamConnections.ViewModels
         private bool isScanning;
         private bool showRFID;
         private bool showError;
-        private readonly AgridentReader agridentReader;
+        private readonly AgridentInternReader agridentReader;
         private string rfidResult;
         private string errorMessage;
 
@@ -65,7 +65,7 @@ namespace TestXamConnections.ViewModels
             ShowError = false;
             RFIDResult = "";
             ErrorMessage = "";
-            agridentReader = new AgridentReader();
+            agridentReader = new AgridentInternReader();
             agridentReader.AgridentDataReceivedEvent += OnRFIDResultReceived;
             agridentReader.AgridentNORFIDEvent += OnNoRFIDReceived;
             agridentReader.AgridentScanStatusChangedEvent += OnScanStatusChanged;
diff --git a/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs
index f5c7bb5..baee76e 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs
@@ -5,11 +5,13 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Input;
 using TestXamConnections.Connection;
-using TestXamConnections.Helper;
+using TestXamConnections.Device;
+using TestXamConnections.Device.Balance;
+using TestXamConnections.Device.Balance.Teo;
 using TestXamConnections.Models;
 using TestXamConnections.Services;
 using Xamarin.Forms;
-using static TestXamConnections.Models.TeoBalance;
+using static TestXamConnections.Device.Balance.Teo.TeoConstants;
 
 namespace TestXamConnections.ViewModels
 {
@@ -17,7 +19,7 @@ namespace TestXamConnections.ViewModels
     {
         private bool isConnected;
         private string data;
-        private TeoBalance teoScale;
+        private IBalance teoScale;
         private bool isVisibleData;
         private bool showError;
         private string errorMessage;
@@ -34,7 +36,7 @@ namespace TestXamConnections.ViewModels
             set { SetProperty(ref isConnected, value); }
         }
 
-        public TeoBalance TeoScale
+        public IBalance TeoScale
         {
             get { return teoScale; }
             set { SetProperty(ref teoScale, value); }
@@ -63,28 +65,22 @@ namespace TestXamConnections.ViewModels
         public async Task<bool> ConnectToDevice()
         {
             ShowError = false;
-            IsConnected = await teoScale.ConnectToTeoAsync();
+            IsConnected = await teoScale.ConnectToBalanceAsync();
             return IsConnected;
         }
 
-        public async Task<bool> SendValue(TeoCommandType cmd)
-        {
-            return await teoScale.SendTeoCommandAsync(cmd);
-        }
-
         public ICommand ConnectToDeviceCommand { private set; get; }
         public ICommand SendValueCommand { private set; get; }
 
-        public TeoDeviceViewModel(Models.Device device)
+        public TeoDeviceViewModel(DeviceInfo device)
         {
             TeoScale = new TeoBalance(device);
             ShowError = false;
             IsConnected = false;
             IsVisibleData = false;
             ConnectToDeviceCommand = new Command(async () => await ConnectToDevice());
-            SendValueCommand = new Command(async (cmd) => await teoScale.SendTeoCommandAsync((TeoCommandType)cmd));
-            TeoScale.TeoDataReceivedEvent = DataReceived;
-            TeoScale.TeoPeseeReceivedEvent = PeseeReceived;
+            SendValueCommand = new Command(async (cmd) => await teoScale.SendCommandAsync((TeoCommandType)cmd));
+            TeoScale.PeseeReceivedEvent = PeseeReceived;
 
             // Ajout manuel des commandes
             AvailableCommandsList = new ObservableCollection<CommandItemViewModel>();
@@ -94,15 +90,15 @@ namespace TestXamConnections.ViewModels
             }
         }
 
-        public void DataReceived(object sender, string args)
-        {
-            IsVisibleData = true;
-            Data += args.Trim() + "\n";
-        }
-
         public void PeseeReceived(object sender, ReponsePesee args)
         {
-            Data = args.PoidsMesure;
+            if (args.Err == false)
+            {
+                Data = args.PoidsMesure;
+            } else
+            {
+                Data = "Erreur de lecture";
+            }
         }
     }
 }
diff --git a/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs b/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs
index 2689992..5f0117c 100644
--- a/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs
+++ b/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using TestXamConnections.Device;
 using TestXamConnections.ViewModels;
 using Xamarin.Forms;
 using Xamarin.Forms.Xaml;
@@ -12,10 +13,10 @@ namespace TestXamConnections.Views
     [XamlCompilation(XamlCompilationOptions.Compile)]
     public partial class BluetoothReaderView : ContentPage
     {
-        public BluetoothReaderView(Models.Device device)
+        public BluetoothReaderView(DeviceInfo deviceI)
         {
             InitializeComponent();
-            BindingContext = new BluetoothReaderViewModel(device);
+            BindingContext = new BluetoothReaderViewModel(deviceI);
         }
     }
 }
\ No newline at end of file
diff --git a/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml.cs b/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml.cs
index 043bc65..2fc0961 100644
--- a/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml.cs
+++ b/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using TestXamConnections.Device;
 using TestXamConnections.Models;
 using TestXamConnections.ViewModels;
 using Xamarin.Forms;
@@ -13,10 +14,10 @@ namespace TestXamConnections.Views
     [XamlCompilation(XamlCompilationOptions.Compile)]
     public partial class TeoDeviceView : ContentPage
     {
-        public TeoDeviceView(Models.Device device)
+        public TeoDeviceView(DeviceInfo deviceI)
         {
             InitializeComponent();
-            BindingContext = new TeoDeviceViewModel(device);
+            BindingContext = new TeoDeviceViewModel(deviceI);
         }
     }
 }
\ No newline at end of file
