commit d14bc0b18fd78b809f30b59f4b625d889a1925b6
Author: Martin Toutant <martin.toutant@inrae.fr>
Date:   Tue Aug 9 17:08:56 2022 +0200

    resp object ok - to test

diff --git a/TestTeoBluetooth.sln b/TestTeoBluetooth.sln
deleted file mode 100644
index b92f5ff..0000000
--- a/TestTeoBluetooth.sln
+++ /dev/null
@@ -1,35 +0,0 @@
-﻿
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.31729.503
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestXamConnections.Android", "TestTeoBluetooth\TestTeoBluetooth.Android\TestXamConnections.Android.csproj", "{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestXamConnections", "TestTeoBluetooth\TestTeoBluetooth\TestXamConnections.csproj", "{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
-		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Release|Any CPU.Build.0 = Release|Any CPU
-		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Release|Any CPU.Deploy.0 = Release|Any CPU
-		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
-		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Release|Any CPU.Build.0 = Release|Any CPU
-		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Release|Any CPU.Deploy.0 = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-		SolutionGuid = {5962BE11-9ED3-4A22-B6CA-D8B4D3F98D54}
-	EndGlobalSection
-EndGlobal
diff --git a/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/BluetoothConnectionService.cs b/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/BluetoothConnectionService.cs
index 21affeb..c1c2a24 100644
--- a/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/BluetoothConnectionService.cs
+++ b/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/BluetoothConnectionService.cs
@@ -24,14 +24,11 @@ namespace TestXamConnections.Droid.Connection
      */
     public class BluetoothConnectionService : IConnectionService
     {
-
         private readonly BluetoothAdapter bluetoothAdapter;
         private Thread listeningThread;
         private BluetoothSocket socket;
         private readonly string sppUUID = "00001101-0000-1000-8000-00805f9b34fb";
 
-        public static readonly BluetoothConnectionService Instance = new BluetoothConnectionService();
-
         public BluetoothConnectionService()
         { 
             bluetoothAdapter = BluetoothAdapter.DefaultAdapter;
@@ -49,7 +46,6 @@ namespace TestXamConnections.Droid.Connection
                 }
 
                 BluetoothDevice droidBtDevice = bluetoothAdapter.GetRemoteDevice(btDevice.MACAddress);
-                //Android.Bluetooth.BluetoothDevice droidBtDevice = adapter.BondedDevices.FirstOrDefault(x => (x.Address == bluetoothDevice.Address));
                 if (droidBtDevice != null)
                 {
                     // Si le socket est occupé pour une autre connexion
@@ -67,7 +63,11 @@ namespace TestXamConnections.Droid.Connection
                     cts.CancelAfter(50000);
                     await socket.ConnectAsync().WithCancellation(cts.Token);
 
-                    if (listeningThread != null) listeningThread.Abort();
+                    if (listeningThread != null)
+                    {
+                        listeningThread.Abort();
+                    }
+
                     listeningThread = new Thread(async delagate => await ListeningAsync());
                     listeningThread.Start();
 
@@ -82,6 +82,8 @@ namespace TestXamConnections.Droid.Connection
             return false;
         }
 
+        public EventHandler<byte[]> DataReceivedEvent { get; set; }
+
         // Fonction d'écoute pour le Thread d'écoute
         private async Task ListeningAsync()
         {
@@ -93,7 +95,8 @@ namespace TestXamConnections.Droid.Connection
                     int byteAvailable = await socket.InputStream.ReadAsync(buffer, 0, buffer.Length);
                     // Resize the byte array 
                     byte[] filledBuffer = buffer.Take(byteAvailable).ToArray();
-                    Application.SynchronizationContext.Post(_ => { OnDataReceived(filledBuffer); }, null);
+                    // Trigger DataReceivedEvent
+                    Application.SynchronizationContext.Post(_ => { DataReceivedEvent.Invoke(this, filledBuffer); }, null);
                 }
             }
             catch (IOException ex)
@@ -110,48 +113,6 @@ namespace TestXamConnections.Droid.Connection
             }
         }
 
-        public EventHandler<string> DataReceivedEvent { get; set; }
-        private string _bufferedData;
-
-        /* 
-         * Fonction appelée à la reception de données
-         * Trigger l'evenement DataReceivedEvent
-         * 
-         * IMPORTANT: Les trames peuvent arriver découpées,
-         * Donc les données sont gardées dans un buffer d'envoi
-         * nommé _bufferedData
-         */
-        private void OnDataReceived(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
-                DataReceivedEvent.Invoke(this, _bufferedData);
-            }
-        }
 
         private Task<bool> CloseConnection()
         {
diff --git a/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/InternConnectionService.cs b/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/InternConnectionService.cs
index 1aaac3c..d86f34a 100644
--- a/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/InternConnectionService.cs
+++ b/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/InternConnectionService.cs
@@ -20,8 +20,7 @@ namespace TestXamConnections.Droid.Connection
      */
     public class InternConnectionService : IConnectionService
     {
-        public static readonly InternConnectionService Instance = new InternConnectionService();
-        public EventHandler<string> DataReceivedEvent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+        public EventHandler<byte[]> DataReceivedEvent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
 
         public Task<bool> Connect(Device device)
         {
diff --git a/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/WifiConnectionService.cs b/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/WifiConnectionService.cs
index c931d69..fcd942b 100644
--- a/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/WifiConnectionService.cs
+++ b/TestTeoBluetooth/TestTeoBluetooth.Android/Connection/WifiConnectionService.cs
@@ -19,8 +19,7 @@ namespace TestXamConnections.Droid.Connection
      */
     public class WifiConnectionService : IConnectionService
     {
-        public static readonly WifiConnectionService Instance = new WifiConnectionService();
-        public EventHandler<string> DataReceivedEvent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
+        public EventHandler<byte[]> DataReceivedEvent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
 
         public Task<bool> Connect(Device device)
         {
diff --git a/TestTeoBluetooth/TestTeoBluetooth.Android/Helper/ConnectionServiceProvider.cs b/TestTeoBluetooth/TestTeoBluetooth.Android/Helper/ConnectionServiceProvider.cs
new file mode 100644
index 0000000..710ff1c
--- /dev/null
+++ b/TestTeoBluetooth/TestTeoBluetooth.Android/Helper/ConnectionServiceProvider.cs
@@ -0,0 +1,47 @@
+﻿using Android.App;
+using Android.Content;
+using Android.OS;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TestXamConnections;
+using TestXamConnections.Connection;
+using TestXamConnections.Droid.Connection;
+using TestXamConnections.Helper;
+using Xamarin.Forms;
+
+namespace TestBLE.Droid.Helper
+{
+    public class ConnectionServiceProvider : IConnectionServiceProvider
+    {
+        public IConnectionService GetConnectionInstance(ConnectionType ct)
+        {
+            IConnectionService instance = null;
+            switch (ct)
+            {
+                case ConnectionType.Bluetooth:
+                    // instance = BluetoothConnectionService.Instance;
+                    instance = new BluetoothConnectionService();
+                    break;
+
+                case ConnectionType.Intern:
+                    instance = new InternConnectionService();
+                    break;
+
+                case ConnectionType.Wifi:
+                    instance = new WifiConnectionService ();
+                    break;
+
+                default:
+                    break;
+            }
+
+            return instance;
+        }
+    }
+}
\ No newline at end of file
diff --git a/TestTeoBluetooth/TestTeoBluetooth.Android/Helper/ConnectionServiceUpdater.cs b/TestTeoBluetooth/TestTeoBluetooth.Android/Helper/ConnectionServiceUpdater.cs
deleted file mode 100644
index 2107ba1..0000000
--- a/TestTeoBluetooth/TestTeoBluetooth.Android/Helper/ConnectionServiceUpdater.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-﻿using Android.App;
-using Android.Content;
-using Android.OS;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections;
-using TestXamConnections.Connection;
-using TestXamConnections.Droid.Connection;
-using TestXamConnections.Helper;
-using Xamarin.Forms;
-
-namespace TestBLE.Droid.Helper
-{
-    public class ConnectionServiceUpdater : IConnectionServiceProvider
-    {
-        public IConnectionService GetConnectionInstance(ConnectionType ct)
-        {
-            IConnectionService instance = null;
-            switch (ct)
-            {
-                case ConnectionType.Bluetooth:
-                    instance = BluetoothConnectionService.Instance;
-                    break;
-
-                case ConnectionType.Intern:
-                    instance = InternConnectionService.Instance;
-                    break;
-
-                case ConnectionType.Wifi:
-                    instance = WifiConnectionService.Instance;
-                    break;
-
-                default:
-                    break;
-            }
-
-            return instance;
-        }
-    }
-}
\ No newline at end of file
diff --git a/TestTeoBluetooth/TestTeoBluetooth.Android/MainActivity.cs b/TestTeoBluetooth/TestTeoBluetooth.Android/MainActivity.cs
index b185d0a..f14899b 100644
--- a/TestTeoBluetooth/TestTeoBluetooth.Android/MainActivity.cs
+++ b/TestTeoBluetooth/TestTeoBluetooth.Android/MainActivity.cs
@@ -14,7 +14,7 @@ using TestXamConnections.Droid.Services;
 
 namespace TestXamConnections.Droid
 {
-    [Activity(Label = "TestBLE", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
+    [Activity(Label = "TestXamConnections", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize )]
     public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
     {
         protected override void OnCreate(Bundle savedInstanceState)
@@ -23,7 +23,7 @@ namespace TestXamConnections.Droid
 
             Xamarin.Essentials.Platform.Init(this, savedInstanceState);
             Forms.Init(this, savedInstanceState);
-            DependencyService.RegisterSingleton<IConnectionServiceProvider>(new ConnectionServiceUpdater());
+            DependencyService.RegisterSingleton<IConnectionServiceProvider>(new ConnectionServiceProvider());
             DependencyService.RegisterSingleton<IBluetoothService>(new BluetoothService());
             LoadApplication(new App());
         }
diff --git a/TestTeoBluetooth/TestTeoBluetooth.Android/TestXamConnections.Android.csproj b/TestTeoBluetooth/TestTeoBluetooth.Android/TestXamConnections.Android.csproj
index 046240e..8455669 100644
--- a/TestTeoBluetooth/TestTeoBluetooth.Android/TestXamConnections.Android.csproj
+++ b/TestTeoBluetooth/TestTeoBluetooth.Android/TestXamConnections.Android.csproj
@@ -33,6 +33,10 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <AndroidLinkMode>None</AndroidLinkMode>
+    <AotAssemblies>false</AotAssemblies>
+    <EnableLLVM>false</EnableLLVM>
+    <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
+    <BundleAssemblies>false</BundleAssemblies>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -59,7 +63,7 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Connection\BluetoothConnectionService.cs" />
-    <Compile Include="Helper\ConnectionServiceUpdater.cs" />
+    <Compile Include="Helper\ConnectionServiceProvider.cs" />
     <Compile Include="Connection\InternConnectionService.cs" />
     <Compile Include="Connection\WifiConnectionService.cs" />
     <Compile Include="MainActivity.cs" />
diff --git a/TestTeoBluetooth/TestTeoBluetooth/Connection/IConnectionService.cs b/TestTeoBluetooth/TestTeoBluetooth/Connection/IConnectionService.cs
index d793077..7a1f049 100644
--- a/TestTeoBluetooth/TestTeoBluetooth/Connection/IConnectionService.cs
+++ b/TestTeoBluetooth/TestTeoBluetooth/Connection/IConnectionService.cs
@@ -11,6 +11,6 @@ namespace TestXamConnections.Connection
     {
         Task<bool> Connect(Device device);
         Task<bool> SendCommand(byte[] hexValues);
-        EventHandler<string> DataReceivedEvent { get; set; }
+        EventHandler<byte[]> DataReceivedEvent { get; set; }
     }
 }
diff --git a/TestTeoBluetooth/TestTeoBluetooth/Helper/AsyncLazy.cs b/TestTeoBluetooth/TestTeoBluetooth/Helper/AsyncLazy.cs
deleted file mode 100644
index a0c720d..0000000
--- a/TestTeoBluetooth/TestTeoBluetooth/Helper/AsyncLazy.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace TestXamConnections.Helper
-{
-    public class AsyncLazy<T>
-    {
-        readonly Lazy<Task<T>> instance;
-
-        public AsyncLazy(Func<T> factory)
-        {
-            instance = new Lazy<Task<T>>(() => Task.Run(factory));
-        }
-
-        public AsyncLazy(Func<Task<T>> factory)
-        {
-            instance = new Lazy<Task<T>>(() => Task.Run(factory));
-        }
-
-        public TaskAwaiter<T> GetAwaiter()
-        {
-            return instance.Value.GetAwaiter();
-        }
-
-        public void Start()
-        {
-            var unused = instance.Value;
-        }
-    }
-}
diff --git a/TestTeoBluetooth/TestTeoBluetooth/Models/ReponsePesee.cs b/TestTeoBluetooth/TestTeoBluetooth/Models/ReponsePesee.cs
index 6f33957..956450a 100644
--- a/TestTeoBluetooth/TestTeoBluetooth/Models/ReponsePesee.cs
+++ b/TestTeoBluetooth/TestTeoBluetooth/Models/ReponsePesee.cs
@@ -42,10 +42,10 @@ namespace TestXamConnections.Models
         public ReponsePesee(string data)
         {
             // Voir doc Balance Teo INRAE
-            NumPlateau = data[0];
-            TypePlateau = data[1];
+            NumPlateau = int.Parse(data[0].ToString());
+            TypePlateau = int.Parse(data[1].ToString());
             IsNegative = data[4] == '-';
-            PoidsMesure = data.ToCharArray().Skip(7).ToArray().ToString();
+            PoidsMesure = new string(data.Skip(5).ToArray()).Trim();
         }
     }
 }
diff --git a/TestTeoBluetooth/TestTeoBluetooth/Models/TeoBalance.cs b/TestTeoBluetooth/TestTeoBluetooth/Models/TeoBalance.cs
new file mode 100644
index 0000000..2f92bea
--- /dev/null
+++ b/TestTeoBluetooth/TestTeoBluetooth/Models/TeoBalance.cs
@@ -0,0 +1,240 @@
+﻿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
+{
+    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
+    {
+        public IConnectionService ConnectionService { get; set; }
+        public EventHandler<string> TeoDataReceivedEvent { get; set; }
+        public EventHandler<ReponsePesee> TeoPeseeReceivedEvent { get; set; }
+
+        public TeoBalance(Device device)
+        {
+            Name = device.Name;
+            MACAddress = device.MACAddress;
+            ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionInstance(ConnectionType.Bluetooth);
+            ConnectionService.DataReceivedEvent += (s, args) => TeoDataReceived(args);
+        }
+
+        ~TeoBalance()
+        {
+            ConnectionService.DataReceivedEvent -= (s, args) => TeoDataReceived(args);
+        }
+
+        /* 
+         * Fonction déclenchée à la reception de données
+         * Trigger l'evenement TeoDataReceivedEvent
+         * 
+         * 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(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);
+                }
+            }
+        }
+
+        // Retourne la chaine d'octets d'une commande Teo (prog INRAE)
+        public static byte[] GetCommandCode(TeoCommandType c)
+        {
+            // Les commandes envoyées sont sur 3 octets
+            byte[] ret = new byte[3];
+            // STX
+            ret[0] = 0x02;
+            // CR
+            ret[2] = 0x0D;
+
+            // Commande
+            switch (c)
+            {
+                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;
+        }
+
+        // Retourne le nom d'une commande Teo (prog INRAE)
+        public static string GetCommandName(TeoCommandType c)
+        {
+            // Les commandes envoyées sont sur 3 octets
+            string ret = "";
+
+            // Commande
+            switch (c)
+            {
+                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/TestTeoBluetooth/TestTeoBluetooth/Models/TeoBluetoothCommands.cs b/TestTeoBluetooth/TestTeoBluetooth/Models/TeoBluetoothCommands.cs
deleted file mode 100644
index 32880bb..0000000
--- a/TestTeoBluetooth/TestTeoBluetooth/Models/TeoBluetoothCommands.cs
+++ /dev/null
@@ -1,164 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TestXamConnections.Models
-{
-    public static class TeoBluetoothCommand
-    {
-        public enum CommandType
-        {
-            // Voir documentation TEO INRAE 
-            // Codes ASCII
-            ModeOrdre,
-            EmissionPoids,
-            SortieOrdreGardeBluetooth,
-            SortieOrdreEtBluetooth,
-            ModePeseeSimple,
-            SortiePeseeSimple,
-            PeseeStabilisee,
-            InterrompPS,
-            TareP1,
-            TareP2,
-            ZeroP1,
-            ZeroP2,
-            InfosMetrologie,
-        }
-
-        // Retourne la chaine d'octets d'une commande Teo (prog INRAE)
-        public static byte[] GetCommandCode(CommandType c)
-        {
-            // Les commandes envoyées sont sur 3 octets
-            byte[] ret = new byte[3];
-            // STX
-            ret[0] = 0x02;
-            // CR
-            ret[2] = 0x0D;
-
-            // Commande
-            switch (c)
-            {
-                case CommandType.ModeOrdre:
-                    ret[1] = 0x61;
-                    break;
-
-                case CommandType.SortieOrdreGardeBluetooth:
-                    ret[1] = 0x6B;
-                    break;
-
-                case CommandType.SortieOrdreEtBluetooth:
-                    ret[1] = 0x67;
-                    break;
-
-                case CommandType.ModePeseeSimple:
-                    ret[1] = 0x62;
-                    break;
-
-                case CommandType.SortiePeseeSimple:
-                    ret[1] = 0x65;
-                    break;
-
-                case CommandType.TareP1:
-                    ret[1] = 0x74;
-                    break;
-
-                case CommandType.TareP2:
-                    ret[1] = 0x6A;
-                    break;
-
-                case CommandType.ZeroP1:
-                    ret[1] = 0x7A;
-                    break;
-
-                case CommandType.ZeroP2:
-                    ret[1] = 0x64;
-                    break;
-
-                case CommandType.InfosMetrologie:
-                    ret[1] = 0x73;
-                    break;
-
-                case CommandType.EmissionPoids:
-                    ret[1] = 0x63;
-                    break;
-                // TODO
-                case CommandType.PeseeStabilisee:
-                    break;
-
-                case CommandType.InterrompPS:
-                    break;
-
-                default:
-                    break;
-            }
-            return ret;
-        }
-
-        // Retourne le nom d'une commande Teo (prog INRAE)
-        public static string GetCommandName(CommandType c)
-        {
-            // Les commandes envoyées sont sur 3 octets
-            string ret = "";
-
-            // Commande
-            switch (c)
-            {
-                case CommandType.ModeOrdre:
-                    ret = "Mode attente ordre";
-                    break;
-
-                case CommandType.SortieOrdreGardeBluetooth:
-                    ret = "Sortie mode ordre";
-                    break;
-
-                case CommandType.SortieOrdreEtBluetooth:
-                    ret = "Sortie mode ordre & couper bluetooth";
-                    break;
-
-                case CommandType.ModePeseeSimple:
-                    ret = "Mode simple pesage";
-                    break;
-
-                case CommandType.SortiePeseeSimple:
-                    ret = "Sortie mode simple pesage";
-                    break;
-
-                case CommandType.TareP1:
-                    ret = "Tare plateau 1";
-                    break;
-
-                case CommandType.TareP2:
-                    ret = "Tare plateau 2";
-                    break;
-
-                case CommandType.ZeroP1:
-                    ret = "Zero plateau 1";
-                    break;
-
-                case CommandType.ZeroP2:
-                    ret = "Zero plateau 2";
-                    break;
-
-                case CommandType.InfosMetrologie:
-                    ret = "Informations métrologie";
-                    break;
-
-                case CommandType.EmissionPoids:
-                    ret = "Emission poids";
-                    break;
-                // TODO
-                case CommandType.PeseeStabilisee:
-                    ret = "Pesée stabilisée - NON implémenté";
-                    break;
-
-                case CommandType.InterrompPS:
-                    ret = "STOP Pesée stabilisée - NON implémenté";
-                    break;
-
-                default:
-                    break;
-            }
-            return ret;
-        }
-    }
-}
diff --git a/TestTeoBluetooth/TestTeoBluetooth/TestXamConnections.csproj b/TestTeoBluetooth/TestTeoBluetooth/TestXamConnections.csproj
index 318e089..12f0aec 100644
--- a/TestTeoBluetooth/TestTeoBluetooth/TestXamConnections.csproj
+++ b/TestTeoBluetooth/TestTeoBluetooth/TestXamConnections.csproj
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netstandard2.0</TargetFramework>
+    <TargetFramework>netstandard2.1</TargetFramework>
     <ProduceReferenceAssembly>true</ProduceReferenceAssembly>
     <AssemblyName>TestXamConnections</AssemblyName>
     <RootNamespace>TestXamConnections</RootNamespace>
@@ -22,8 +22,8 @@
     <Compile Update="Views\AccueilView.xaml.cs">
       <DependentUpon>AccueilView.xaml</DependentUpon>
     </Compile>
-    <Compile Update="Views\DeviceView.xaml.cs">
-      <DependentUpon>DeviceView.xaml</DependentUpon>
+    <Compile Update="Views\TeoDeviceView.xaml.cs">
+      <DependentUpon>TeoDeviceView.xaml</DependentUpon>
     </Compile>
   </ItemGroup>
 
@@ -31,7 +31,7 @@
     <EmbeddedResource Update="Views\AccueilView.xaml">
       <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
     </EmbeddedResource>
-    <EmbeddedResource Update="Views\DeviceView.xaml">
+    <EmbeddedResource Update="Views\TeoDeviceView.xaml">
       <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
     </EmbeddedResource>
   </ItemGroup>
diff --git a/TestTeoBluetooth/TestTeoBluetooth/ViewModels/CommandItemViewModel.cs b/TestTeoBluetooth/TestTeoBluetooth/ViewModels/CommandItemViewModel.cs
index edb5ba6..b58dda4 100644
--- a/TestTeoBluetooth/TestTeoBluetooth/ViewModels/CommandItemViewModel.cs
+++ b/TestTeoBluetooth/TestTeoBluetooth/ViewModels/CommandItemViewModel.cs
@@ -9,12 +9,10 @@ using Xamarin.Forms;
 namespace TestXamConnections.ViewModels
 {
     public class CommandItemViewModel : ViewModelBase
-    {   
-        public IConnectionService ConnectionService { get; set; }
-
+    {
         private string name;
-        private TeoBluetoothCommand.CommandType toSendCommand;
-
+        private TeoCommandType toSendCommand;
+        private IConnectionService ConnectionService;
         private string commandBytes;
 
         public string CommandBytes
@@ -29,7 +27,7 @@ namespace TestXamConnections.ViewModels
             set { SetProperty(ref name, value); }
         }
 
-        public TeoBluetoothCommand.CommandType ToSendCommand
+        public TeoCommandType ToSendCommand
         {
             get { return toSendCommand; }
             set { SetProperty( ref toSendCommand, value); }
@@ -37,18 +35,18 @@ namespace TestXamConnections.ViewModels
 
         private async Task<bool> SendValue()
         {
-            await ConnectionService.SendCommand(TeoBluetoothCommand.GetCommandCode(ToSendCommand));
+            await ConnectionService.SendCommand(TeoBalance.GetCommandCode(ToSendCommand));
             return true;
         }
 
         public ICommand SendValueCommand { private set; get; }
 
-        public CommandItemViewModel(TeoBluetoothCommand.CommandType cmd)
+        public CommandItemViewModel(TeoCommandType cmd, IConnectionService cs)
         {
             ToSendCommand = cmd;
-            Name = TeoBluetoothCommand.GetCommandName(cmd);
-            CommandBytes = string.Join("-", TeoBluetoothCommand.GetCommandCode(cmd));
-            ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionInstance(ConnectionType.Bluetooth);
+            ConnectionService = cs;
+            Name = TeoBalance.GetCommandName(cmd);
+            CommandBytes = string.Join("-", TeoBalance.GetCommandCode(cmd));
             SendValueCommand = new Command(async () => await SendValue());
         }
 
diff --git a/TestTeoBluetooth/TestTeoBluetooth/ViewModels/DeviceItemViewModel.cs b/TestTeoBluetooth/TestTeoBluetooth/ViewModels/DeviceItemViewModel.cs
index e1f5c72..1d1c3da 100644
--- a/TestTeoBluetooth/TestTeoBluetooth/ViewModels/DeviceItemViewModel.cs
+++ b/TestTeoBluetooth/TestTeoBluetooth/ViewModels/DeviceItemViewModel.cs
@@ -24,7 +24,7 @@ namespace TestXamConnections.ViewModels
 
         private async Task NavigateToDevice()
         {
-            await Application.Current.MainPage.Navigation.PushAsync(new DeviceView(Device));
+            await Application.Current.MainPage.Navigation.PushAsync(new TeoDeviceView(Device));
         }
 
         public ICommand NavigateToDeviceViewCommand { private set; get; }
diff --git a/TestTeoBluetooth/TestTeoBluetooth/ViewModels/DeviceViewModel.cs b/TestTeoBluetooth/TestTeoBluetooth/ViewModels/DeviceViewModel.cs
index 840cce5..aa6f26b 100644
--- a/TestTeoBluetooth/TestTeoBluetooth/ViewModels/DeviceViewModel.cs
+++ b/TestTeoBluetooth/TestTeoBluetooth/ViewModels/DeviceViewModel.cs
@@ -9,15 +9,15 @@ using TestXamConnections.Helper;
 using TestXamConnections.Models;
 using TestXamConnections.Services;
 using Xamarin.Forms;
-using static TestXamConnections.Models.TeoBluetoothCommand;
+using static TestXamConnections.Models.TeoBalance;
 
 namespace TestXamConnections.ViewModels
 {
-    public class DeviceViewModel : ViewModelBase
+    public class TeoDeviceViewModel : ViewModelBase
     {
         private bool isConnected;
         private string data;
-        private Models.Device device;
+        private TeoBalance teoScale;
 
         private bool isVisibleData;
 
@@ -33,10 +33,10 @@ namespace TestXamConnections.ViewModels
             set { SetProperty(ref isConnected, value); }
         }
 
-        public Models.Device Device
+        public TeoBalance TeoScale
         {
-            get { return device; }
-            set { SetProperty(ref device, value); }
+            get { return teoScale; }
+            set { SetProperty(ref teoScale, value); }
         }
 
         public string Data
@@ -44,47 +44,46 @@ namespace TestXamConnections.ViewModels
             get { return data; }
             set { SetProperty(ref data, value); }
         }
-
-        public IConnectionService ConnectionService { get; set; }
         
         public ObservableCollection<CommandItemViewModel> AvailableCommandsList { get; set; }
 
         public async Task<bool> ConnectToDevice()
         {
-            await ConnectionService.Connect(Device);
-            IsConnected = true;
-            return true;
+            IsConnected = await teoScale.ConnectionService.Connect(TeoScale);
+            return IsConnected;
+        }
+
+        public void DataReceived(string args)
+        {
+            IsVisibleData = true;
+            Data += args.Trim() + "\n";
+        }
+
+        public void PeseeReceived(ReponsePesee args)
+        {
+            Data = args.PoidsMesure;
         }
+
         public ICommand ConnectToDeviceCommand { private set; get; }
 
-        public DeviceViewModel(Models.Device device)
+        public TeoDeviceViewModel(Models.Device device)
         {
-            Device = device;
+            TeoScale = new TeoBalance(device);
             IsConnected = false;
             IsVisibleData = false;
-            ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionInstance(ConnectionType.Bluetooth);
-            ConnectionService.DataReceivedEvent += (s, args) => DataReceived(args);
             ConnectToDeviceCommand = new Command(async () => await ConnectToDevice());
+            TeoScale.TeoDataReceivedEvent = (s, args) => DataReceived(args);
+            TeoScale.TeoPeseeReceivedEvent = (s, args) => PeseeReceived(args);
 
             // Ajout manuel des commandes
             AvailableCommandsList = new ObservableCollection<CommandItemViewModel>();
-            foreach (CommandType _cmd in Enum.GetValues(typeof(CommandType)))
+            foreach (TeoCommandType _cmd in Enum.GetValues(typeof(TeoCommandType)))
             {
-                AvailableCommandsList.Add(new CommandItemViewModel(_cmd));
+                AvailableCommandsList.Add(new CommandItemViewModel(_cmd, TeoScale.ConnectionService));
             }
         }
 
-        ~DeviceViewModel()
-        {
-            ConnectionService.DataReceivedEvent -= (s, args) => DataReceived(args);
-        }
-
-        private void DataReceived(string recData)
-        {
-            IsVisibleData = true;
-            ReponsePesee resp = new ReponsePesee(recData);
-            Data += resp.PoidsMesure + "\n";
-        }
+        
 
     }
 }
diff --git a/TestTeoBluetooth/TestTeoBluetooth/Views/DeviceView.xaml b/TestTeoBluetooth/TestTeoBluetooth/Views/DeviceView.xaml
deleted file mode 100644
index 82518ba..0000000
--- a/TestTeoBluetooth/TestTeoBluetooth/Views/DeviceView.xaml
+++ /dev/null
@@ -1,128 +0,0 @@
-﻿<?xml version="1.0" encoding="UTF-8" ?>
-<ContentPage
-    x:Class="TestXamConnections.Views.DeviceView"
-    xmlns="http://xamarin.com/schemas/2014/forms"
-    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-    xmlns:xe="clr-namespace:XamEffects;assembly=XamEffects"
-    Title="Device Page">
-    <ContentPage.Content>
-
-        <StackLayout
-            Padding="10"
-            BackgroundColor="#001729"
-            VerticalOptions="FillAndExpand">
-            <StackLayout VerticalOptions="CenterAndExpand">
-                <Frame
-                    Padding="0"
-                    BackgroundColor="Transparent"
-                    BorderColor="#4f5a64"
-                    CornerRadius="5"
-                    HasShadow="False"
-                    HorizontalOptions="Center"
-                    VerticalOptions="CenterAndExpand"
-                    WidthRequest="250">
-                    <StackLayout Spacing="0">
-                        <StackLayout Margin="0,10">
-                            <Label
-                                Margin="0"
-                                FontAttributes="Bold"
-                                FontSize="28"
-                                HorizontalOptions="CenterAndExpand"
-                                HorizontalTextAlignment="Center"
-                                Text="{Binding Device.Name}"
-                                TextColor="White"
-                                VerticalOptions="CenterAndExpand" />
-                            <Label
-                                Margin="0"
-                                FontAttributes="Italic"
-                                FontSize="12"
-                                HorizontalOptions="CenterAndExpand"
-                                HorizontalTextAlignment="Center"
-                                Text="{Binding Device.MACAddress}"
-                                TextColor="DarkGray"
-                                VerticalOptions="CenterAndExpand" />
-                        </StackLayout>
-                        <!--  Bouton Connect  -->
-                        <xe:BorderView
-                            Margin="0,10,0,20"
-                            xe:Commands.Tap="{Binding ConnectToDeviceCommand}"
-                            xe:TouchEffect.Color="#0060a8"
-                            BackgroundColor="#003266"
-                            CornerRadius="65"
-                            HorizontalOptions="Center">
-                            <StackLayout Padding="15,10">
-                                <Label
-                                    FontSize="16"
-                                    HorizontalOptions="Center"
-                                    Text="Connect"
-                                    TextColor="#34a9ff" />
-                            </StackLayout>
-                        </xe:BorderView>
-                        <BoxView
-                            HeightRequest="1"
-                            HorizontalOptions="FillAndExpand"
-                            IsVisible="{Binding IsConnected}"
-                            Color="#4f5a64" />
-                        <ScrollView Padding="0,10" IsVisible="{Binding IsConnected}">
-                            <StackLayout
-                                x:Name="commandsList"
-                                Padding="0"
-                                BindableLayout.ItemsSource="{Binding AvailableCommandsList}"
-                                HorizontalOptions="FillAndExpand"
-                                Orientation="Vertical"
-                                Spacing="5">
-                                <BindableLayout.ItemTemplate>
-                                    <DataTemplate>
-                                        <StackLayout
-                                            Padding="0,5"
-                                            xe:Commands.Tap="{Binding SendValueCommand}"
-                                            xe:TouchEffect.Color="#34a9ff"
-                                            Spacing="0">
-                                            <Label
-                                                FontAttributes="Bold"
-                                                HorizontalTextAlignment="Center"
-                                                Text="{Binding Name}"
-                                                TextColor="White" />
-                                            <Label
-                                                FontAttributes="Italic"
-                                                HorizontalTextAlignment="Center"
-                                                Text="{Binding CommandBytes}"
-                                                TextColor="DarkGray" />
-                                        </StackLayout>
-                                    </DataTemplate>
-                                </BindableLayout.ItemTemplate>
-                            </StackLayout>
-
-                        </ScrollView>
-                    </StackLayout>
-
-                </Frame>
-                <Frame
-                    Padding="0"
-                    BackgroundColor="Transparent"
-                    BorderColor="#4f5a64"
-                    CornerRadius="5"
-                    HasShadow="False"
-                    HorizontalOptions="Center"
-                    IsVisible="{Binding IsVisibleData}"
-                    VerticalOptions="CenterAndExpand"
-                    WidthRequest="200">
-                    <StackLayout HorizontalOptions="CenterAndExpand">
-                        <Label
-                            FontAttributes="Bold"
-                            FontSize="18"
-                            HorizontalTextAlignment="Center"
-                            Text="Received Data"
-                            TextColor="White" />
-                        <Label
-                            FontAttributes="Italic"
-                            FontSize="14"
-                            HorizontalTextAlignment="Center"
-                            Text="{Binding Data}"
-                            TextColor="DarkGray" />
-                    </StackLayout>
-                </Frame>
-            </StackLayout>
-        </StackLayout>
-    </ContentPage.Content>
-</ContentPage>
\ No newline at end of file
diff --git a/TestTeoBluetooth/TestTeoBluetooth/Views/DeviceView.xaml.cs b/TestTeoBluetooth/TestTeoBluetooth/Views/DeviceView.xaml.cs
deleted file mode 100644
index c1a0bb4..0000000
--- a/TestTeoBluetooth/TestTeoBluetooth/Views/DeviceView.xaml.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.Models;
-using TestXamConnections.ViewModels;
-using Xamarin.Forms;
-using Xamarin.Forms.Xaml;
-
-namespace TestXamConnections.Views
-{
-    [XamlCompilation(XamlCompilationOptions.Compile)]
-    public partial class DeviceView : ContentPage
-    {
-        public DeviceView(Models.Device device)
-        {
-            InitializeComponent();
-            BindingContext = new DeviceViewModel(device);
-        }
-    }
-}
\ No newline at end of file
diff --git a/TestTeoBluetooth/TestTeoBluetooth/Views/TeoDeviceView.xaml b/TestTeoBluetooth/TestTeoBluetooth/Views/TeoDeviceView.xaml
new file mode 100644
index 0000000..5cb2f1a
--- /dev/null
+++ b/TestTeoBluetooth/TestTeoBluetooth/Views/TeoDeviceView.xaml
@@ -0,0 +1,156 @@
+﻿<?xml version="1.0" encoding="UTF-8" ?>
+<ContentPage
+    x:Class="TestXamConnections.Views.TeoDeviceView"
+    xmlns="http://xamarin.com/schemas/2014/forms"
+    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+    xmlns:xe="clr-namespace:XamEffects;assembly=XamEffects"
+    Title="Device Page">
+    <ContentPage.Content>
+        <ScrollView>
+            <StackLayout
+                Padding="10"
+                BackgroundColor="#001729"
+                VerticalOptions="FillAndExpand">
+                <StackLayout VerticalOptions="CenterAndExpand">
+
+                    <Frame
+                        Padding="0"
+                        BackgroundColor="Transparent"
+                        BorderColor="#4f5a64"
+                        CornerRadius="5"
+                        HasShadow="False"
+                        HorizontalOptions="Center"
+                        IsVisible="{Binding IsVisibleData}"
+                        VerticalOptions="CenterAndExpand"
+                        WidthRequest="200">
+                        <StackLayout HorizontalOptions="CenterAndExpand">
+                            <Label
+                                FontAttributes="Bold"
+                                FontSize="18"
+                                HorizontalTextAlignment="Center"
+                                Text="Received Data"
+                                TextColor="White" />
+                            <Label
+                                FontAttributes="Italic"
+                                FontSize="14"
+                                HorizontalTextAlignment="Center"
+                                Text="{Binding Data}"
+                                TextColor="DarkGray" />
+                        </StackLayout>
+                    </Frame>
+
+                    <Frame
+                        Padding="0"
+                        BackgroundColor="Transparent"
+                        BorderColor="#4f5a64"
+                        CornerRadius="5"
+                        HasShadow="False"
+                        HorizontalOptions="Center"
+                        VerticalOptions="CenterAndExpand"
+                        WidthRequest="250">
+                        <StackLayout Spacing="0">
+                            <StackLayout Margin="0,10">
+                                <Label
+                                    Margin="0"
+                                    FontAttributes="Bold"
+                                    FontSize="28"
+                                    HorizontalOptions="CenterAndExpand"
+                                    HorizontalTextAlignment="Center"
+                                    Text="{Binding TeoScale.Name}"
+                                    TextColor="White"
+                                    VerticalOptions="CenterAndExpand" />
+                                <Label
+                                    Margin="0"
+                                    FontAttributes="Italic"
+                                    FontSize="12"
+                                    HorizontalOptions="CenterAndExpand"
+                                    HorizontalTextAlignment="Center"
+                                    Text="{Binding TeoScale.MACAddress}"
+                                    TextColor="DarkGray"
+                                    VerticalOptions="CenterAndExpand" />
+                            </StackLayout>
+                            <!--  Bouton Connect  -->
+                            <xe:BorderView
+                                Margin="0,10,0,20"
+                                xe:Commands.Tap="{Binding ConnectToDeviceCommand}"
+                                xe:TouchEffect.Color="#0060a8"
+                                BackgroundColor="#003266"
+                                CornerRadius="65"
+                                HorizontalOptions="Center">
+                                <StackLayout Padding="15,10">
+                                    <Label
+                                        FontSize="16"
+                                        HorizontalOptions="Center"
+                                        Text="Connect"
+                                        TextColor="#34a9ff" />
+                                </StackLayout>
+                            </xe:BorderView>
+                            <BoxView
+                                HeightRequest="1"
+                                HorizontalOptions="FillAndExpand"
+                                IsVisible="{Binding IsConnected}"
+                                Color="#4f5a64" />
+                            <ScrollView Padding="0,10" IsVisible="{Binding IsConnected}">
+                                <StackLayout
+                                    x:Name="commandsList"
+                                    Padding="0"
+                                    BindableLayout.ItemsSource="{Binding AvailableCommandsList}"
+                                    HorizontalOptions="FillAndExpand"
+                                    Orientation="Vertical"
+                                    Spacing="5">
+                                    <BindableLayout.ItemTemplate>
+                                        <DataTemplate>
+                                            <StackLayout
+                                                Padding="0,5"
+                                                xe:Commands.Tap="{Binding SendValueCommand}"
+                                                xe:TouchEffect.Color="#34a9ff"
+                                                Spacing="0">
+                                                <Label
+                                                    FontAttributes="Bold"
+                                                    HorizontalTextAlignment="Center"
+                                                    Text="{Binding Name}"
+                                                    TextColor="White" />
+                                                <Label
+                                                    FontAttributes="Italic"
+                                                    HorizontalTextAlignment="Center"
+                                                    Text="{Binding CommandBytes}"
+                                                    TextColor="DarkGray" />
+                                            </StackLayout>
+                                        </DataTemplate>
+                                    </BindableLayout.ItemTemplate>
+                                </StackLayout>
+
+                            </ScrollView>
+                        </StackLayout>
+
+                    </Frame>
+                    <Frame
+                        Padding="0"
+                        BackgroundColor="Transparent"
+                        BorderColor="#4f5a64"
+                        CornerRadius="5"
+                        HasShadow="False"
+                        HorizontalOptions="Center"
+                        IsVisible="{Binding IsVisibleData}"
+                        VerticalOptions="CenterAndExpand"
+                        WidthRequest="200">
+                        <StackLayout HorizontalOptions="CenterAndExpand">
+                            <Label
+                                FontAttributes="Bold"
+                                FontSize="18"
+                                HorizontalTextAlignment="Center"
+                                Text="Received Data"
+                                TextColor="White" />
+                            <Label
+                                FontAttributes="Italic"
+                                FontSize="14"
+                                HorizontalTextAlignment="Center"
+                                Text="{Binding Data}"
+                                TextColor="DarkGray" />
+                        </StackLayout>
+                    </Frame>
+                </StackLayout>
+            </StackLayout>
+        </ScrollView>
+    </ContentPage.Content>
+</ContentPage>
\ No newline at end of file
diff --git a/TestTeoBluetooth/TestTeoBluetooth/Views/TeoDeviceView.xaml.cs b/TestTeoBluetooth/TestTeoBluetooth/Views/TeoDeviceView.xaml.cs
new file mode 100644
index 0000000..043bc65
--- /dev/null
+++ b/TestTeoBluetooth/TestTeoBluetooth/Views/TeoDeviceView.xaml.cs
@@ -0,0 +1,22 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TestXamConnections.Models;
+using TestXamConnections.ViewModels;
+using Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace TestXamConnections.Views
+{
+    [XamlCompilation(XamlCompilationOptions.Compile)]
+    public partial class TeoDeviceView : ContentPage
+    {
+        public TeoDeviceView(Models.Device device)
+        {
+            InitializeComponent();
+            BindingContext = new TeoDeviceViewModel(device);
+        }
+    }
+}
\ No newline at end of file
diff --git a/TestXamConnections.sln b/TestXamConnections.sln
new file mode 100644
index 0000000..b92f5ff
--- /dev/null
+++ b/TestXamConnections.sln
@@ -0,0 +1,35 @@
+﻿
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31729.503
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestXamConnections.Android", "TestTeoBluetooth\TestTeoBluetooth.Android\TestXamConnections.Android.csproj", "{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestXamConnections", "TestTeoBluetooth\TestTeoBluetooth\TestXamConnections.csproj", "{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A6E319ED-E59B-4FAA-A143-1E1E653FD0BC}.Release|Any CPU.Deploy.0 = Release|Any CPU
+		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{5C87F357-DF5A-4AEC-9663-ED55C0E4904D}.Release|Any CPU.Deploy.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {5962BE11-9ED3-4A22-B6CA-D8B4D3F98D54}
+	EndGlobalSection
+EndGlobal
