commit 3fa496d6969afcb8b930c2581457c613ce142081
Author: Martin Toutant <martin.toutant@inrae.fr>
Date:   Thu Sep 15 16:57:20 2022 +0200

    bug & error fix

diff --git a/TestXamConnections/TestXamConnections.Android/Connection/BluetoothConnectionService.cs b/TestXamConnections/TestXamConnections.Android/Connection/BluetoothConnectionService.cs
index 8fbb3b1..7dc92da 100644
--- a/TestXamConnections/TestXamConnections.Android/Connection/BluetoothConnectionService.cs
+++ b/TestXamConnections/TestXamConnections.Android/Connection/BluetoothConnectionService.cs
@@ -1,22 +1,14 @@
 ﻿using Android.App;
 using Android.Bluetooth;
-using Android.Content;
-using Android.OS;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
 using Java.Util;
 using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 using TestXamConnections.Droid.Utils;
-using TestXamConnections.Models;
 using TestXamConnections.Connection;
-using TestXamConnections.Helper;
 
 namespace TestXamConnections.Droid.Connection
 {
@@ -126,9 +118,8 @@ namespace TestXamConnections.Droid.Connection
             return Task.FromResult(true);
         }
 
-        public Task<bool> SendCommand(IConvertible command)
+        public Task<bool> SendCommand(byte[] command)
         {
-            byte[] hexValues = Encoding.ASCII.GetBytes(command.ToString());
 
             if (socket.IsConnected == false)
             {
@@ -137,7 +128,7 @@ namespace TestXamConnections.Droid.Connection
             else
             {
                 // Envoi de la commande
-                socket.OutputStream.Write(hexValues, 0, hexValues.Length);
+                socket.OutputStream.Write(command, 0, command.Length);
                 socket.OutputStream.Flush();
             }
             return Task.FromResult(true);
diff --git a/TestXamConnections/TestXamConnections.Android/Connection/InternConnectionService.cs b/TestXamConnections/TestXamConnections.Android/Connection/InternConnectionService.cs
index 08ec126..a50fd5c 100644
--- a/TestXamConnections/TestXamConnections.Android/Connection/InternConnectionService.cs
+++ b/TestXamConnections/TestXamConnections.Android/Connection/InternConnectionService.cs
@@ -1,15 +1,9 @@
 ﻿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.Models;
 using TestXamConnections.Connection;
 using TestXamConnections.Droid.Receivers;
 using TestXamConnections.Device.RFID.Agrident;
@@ -50,9 +44,10 @@ namespace TestXamConnections.Droid.Connection
             return Task.FromResult(true);
         }
 
-        public Task<bool> SendCommand(IConvertible command)
+        public Task<bool> SendCommand(byte[] commandBytes)
         {
-            Intent launchIntent = appContext.PackageManager.GetLaunchIntentForPackage(command.ToString());
+            string command = Encoding.ASCII.GetString(commandBytes);
+            Intent launchIntent = appContext.PackageManager.GetLaunchIntentForPackage(command);
             if (launchIntent != null)
             {
                 appContext.StartActivity(launchIntent);
@@ -86,10 +81,5 @@ namespace TestXamConnections.Droid.Connection
                     break;
             }
         }
-
-        public Task<bool> SendCommand(byte[] hexValues)
-        {
-            throw new NotImplementedException();
-        }
     }
 }
\ No newline at end of file
diff --git a/TestXamConnections/TestXamConnections.Android/Connection/WifiConnectionService.cs b/TestXamConnections/TestXamConnections.Android/Connection/WifiConnectionService.cs
index dde61a4..a799c6d 100644
--- a/TestXamConnections/TestXamConnections.Android/Connection/WifiConnectionService.cs
+++ b/TestXamConnections/TestXamConnections.Android/Connection/WifiConnectionService.cs
@@ -1,16 +1,7 @@
-﻿using Android.App;
-using Android.Content;
-using Android.OS;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
-using System;
+﻿using System;
 using System.Collections.Generic;
-using System.Linq;
-using System.Text;
 using System.Threading.Tasks;
 using TestXamConnections.Connection;
-using TestXamConnections.Models;
 
 namespace TestXamConnections.Droid.Connection
 {
@@ -26,7 +17,7 @@ namespace TestXamConnections.Droid.Connection
             throw new NotImplementedException();
         }
 
-        public Task<bool> SendCommand(IConvertible hexValues)
+        public Task<bool> SendCommand(byte[] hexValues)
         {
             throw new NotImplementedException();
         }
diff --git a/TestXamConnections/TestXamConnections.Android/Helper/ConnectionServiceProvider.cs b/TestXamConnections/TestXamConnections.Android/Helper/ConnectionServiceProvider.cs
index d851d8f..5c45c0c 100644
--- a/TestXamConnections/TestXamConnections.Android/Helper/ConnectionServiceProvider.cs
+++ b/TestXamConnections/TestXamConnections.Android/Helper/ConnectionServiceProvider.cs
@@ -1,19 +1,5 @@
-﻿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.Connection;
 using TestXamConnections.Droid.Connection;
-using TestXamConnections.Helper;
-using Xamarin.Forms;
 
 namespace TestBLE.Droid.Helper
 {
diff --git a/TestXamConnections/TestXamConnections.Android/MainActivity.cs b/TestXamConnections/TestXamConnections.Android/MainActivity.cs
index b656de0..2f47b97 100644
--- a/TestXamConnections/TestXamConnections.Android/MainActivity.cs
+++ b/TestXamConnections/TestXamConnections.Android/MainActivity.cs
@@ -1,14 +1,11 @@
-﻿using System;
-
+﻿
 using Android.App;
 using Android.Content.PM;
 using Android.Runtime;
 using Android.OS;
 using Xamarin.Forms;
 using TestXamConnections.Services;
-using TestXamConnections.Droid.Connection;
 using TestXamConnections.Connection;
-using TestXamConnections.Helper;
 using TestBLE.Droid.Helper;
 using TestXamConnections.Droid.Services;
 
diff --git a/TestXamConnections/TestXamConnections.Android/Properties/AssemblyInfo.cs b/TestXamConnections/TestXamConnections.Android/Properties/AssemblyInfo.cs
index e0010f5..06e0da0 100644
--- a/TestXamConnections/TestXamConnections.Android/Properties/AssemblyInfo.cs
+++ b/TestXamConnections/TestXamConnections.Android/Properties/AssemblyInfo.cs
@@ -1,5 +1,4 @@
 ﻿using System.Reflection;
-using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 using Android.App;
 
diff --git a/TestXamConnections/TestXamConnections.Android/Receivers/BluetoothReceiver.cs b/TestXamConnections/TestXamConnections.Android/Receivers/BluetoothReceiver.cs
index 6e01057..d715171 100644
--- a/TestXamConnections/TestXamConnections.Android/Receivers/BluetoothReceiver.cs
+++ b/TestXamConnections/TestXamConnections.Android/Receivers/BluetoothReceiver.cs
@@ -1,14 +1,7 @@
-﻿using Android.App;
-using Android.Bluetooth;
+﻿using Android.Bluetooth;
 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 TestXamConnections.Device;
 
 namespace TestXamConnections.Droid.Receivers
 {
@@ -16,6 +9,7 @@ namespace TestXamConnections.Droid.Receivers
     {
         public EventHandler<BluetoothDevice> OnBluetoothDeviceDiscovered;
         public EventHandler<string> OnScanFinished;
+
         public override void OnReceive(Context context, Intent intent)
         {
             if (intent.Action.Equals(BluetoothDevice.ActionFound))
@@ -23,7 +17,7 @@ namespace TestXamConnections.Droid.Receivers
                 BluetoothDevice foundDevice = intent.GetParcelableExtra(BluetoothDevice.ExtraDevice) as BluetoothDevice;
                 if (foundDevice != null)
                 {
-                    var btDevice = new Models.Device
+                    var btDevice = new DeviceInfo
                     {
                         MACAddress = foundDevice.Address,
                         Name = foundDevice.Name
diff --git a/TestXamConnections/TestXamConnections.Android/Receivers/IntentReceiver.cs b/TestXamConnections/TestXamConnections.Android/Receivers/IntentReceiver.cs
index d7e4111..a86dc26 100644
--- a/TestXamConnections/TestXamConnections.Android/Receivers/IntentReceiver.cs
+++ b/TestXamConnections/TestXamConnections.Android/Receivers/IntentReceiver.cs
@@ -1,14 +1,5 @@
-﻿using Android.App;
-using Android.Content;
-using Android.OS;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
+﻿using Android.Content;
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using TestXamConnections.Models;
 
 namespace TestXamConnections.Droid.Receivers
 {
diff --git a/TestXamConnections/TestXamConnections.Android/Services/BluetoothService.cs b/TestXamConnections/TestXamConnections.Android/Services/BluetoothService.cs
index 6d8f5fb..97222e3 100644
--- a/TestXamConnections/TestXamConnections.Android/Services/BluetoothService.cs
+++ b/TestXamConnections/TestXamConnections.Android/Services/BluetoothService.cs
@@ -1,22 +1,7 @@
-﻿using Android.App;
-using Android.Bluetooth;
-using Android.Content;
-using Android.OS;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
-using Java.IO;
-using Java.Util;
-using System;
+﻿using Android.Bluetooth;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using TestXamConnections.Droid.Receivers;
-using TestXamConnections.Droid.Utils;
-using TestXamConnections.Models;
+using TestXamConnections.Device;
 using TestXamConnections.Services;
 
 namespace TestXamConnections.Droid.Services
@@ -25,19 +10,19 @@ namespace TestXamConnections.Droid.Services
     {
         private readonly BluetoothAdapter bluetoothAdapter;
 
-        public ObservableCollection<Device> FoundDevices = new ObservableCollection<Device>();
+        public ObservableCollection<DeviceInfo> FoundDevices = new ObservableCollection<DeviceInfo>();
         public BluetoothService()
         {
-            FoundDevices = new ObservableCollection<Device>();
+            FoundDevices = new ObservableCollection<DeviceInfo>();
             bluetoothAdapter = BluetoothAdapter.DefaultAdapter;
         }
 
-        public ICollection<Device> GetBondedDevices()
+        public ICollection<DeviceInfo> GetBondedDevices()
         {
-            ICollection<Device> ret = new ObservableCollection<Device>();
+            ICollection<DeviceInfo> ret = new ObservableCollection<DeviceInfo>();
             foreach (BluetoothDevice bondedDevice in bluetoothAdapter.BondedDevices)
             {
-                Device toAddItem = new Device
+                DeviceInfo toAddItem = new DeviceInfo
                 {
                     MACAddress = bondedDevice.Address,
                     Name = bondedDevice.Name
diff --git a/TestXamConnections/TestXamConnections.Android/Utils/TaskExtensions.cs b/TestXamConnections/TestXamConnections.Android/Utils/TaskExtensions.cs
index db81bac..48f0869 100644
--- a/TestXamConnections/TestXamConnections.Android/Utils/TaskExtensions.cs
+++ b/TestXamConnections/TestXamConnections.Android/Utils/TaskExtensions.cs
@@ -1,14 +1,4 @@
-﻿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;
+﻿using System.Threading;
 using System.Threading.Tasks;
 
 namespace TestXamConnections.Droid.Utils
diff --git a/TestXamConnections/TestXamConnections/App.xaml.cs b/TestXamConnections/TestXamConnections/App.xaml.cs
index f3630b2..ffaea9b 100644
--- a/TestXamConnections/TestXamConnections/App.xaml.cs
+++ b/TestXamConnections/TestXamConnections/App.xaml.cs
@@ -1,7 +1,5 @@
-﻿using System;
-using TestXamConnections.Views;
+﻿using TestXamConnections.Views;
 using Xamarin.Forms;
-using Xamarin.Forms.Xaml;
 
 namespace TestXamConnections
 {
diff --git a/TestXamConnections/TestXamConnections/Connection/ConnectionConstants.cs b/TestXamConnections/TestXamConnections/Connection/ConnectionConstants.cs
index 9da5f6c..a05002a 100644
--- a/TestXamConnections/TestXamConnections/Connection/ConnectionConstants.cs
+++ b/TestXamConnections/TestXamConnections/Connection/ConnectionConstants.cs
@@ -1,8 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TestXamConnections.Connection
+﻿namespace TestXamConnections.Connection
 {
     /// <summary>
     /// Constantes de connexion à utiliser lors de l'utilisation 
diff --git a/TestXamConnections/TestXamConnections/Connection/IConnectionService.cs b/TestXamConnections/TestXamConnections/Connection/IConnectionService.cs
index 0098362..6d14c95 100644
--- a/TestXamConnections/TestXamConnections/Connection/IConnectionService.cs
+++ b/TestXamConnections/TestXamConnections/Connection/IConnectionService.cs
@@ -1,8 +1,6 @@
 ﻿using System;
 using System.Collections.Generic;
-using System.Text;
 using System.Threading.Tasks;
-using TestXamConnections.Models;
 
 namespace TestXamConnections.Connection
 {
diff --git a/TestXamConnections/TestXamConnections/Connection/IConnectionServiceProvider.cs b/TestXamConnections/TestXamConnections/Connection/IConnectionServiceProvider.cs
index ef46b10..87f0b0e 100644
--- a/TestXamConnections/TestXamConnections/Connection/IConnectionServiceProvider.cs
+++ b/TestXamConnections/TestXamConnections/Connection/IConnectionServiceProvider.cs
@@ -1,10 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.Connection;
-
-namespace TestXamConnections.Connection
+﻿namespace TestXamConnections.Connection
 {
     /// <summary>
     /// Type de connection service à demander.
diff --git a/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs b/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs
index 3b20d34..38a1238 100644
--- a/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs
+++ b/TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs
@@ -1,8 +1,5 @@
 ﻿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;
 
diff --git a/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs b/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs
index f3451b1..b8f4bac 100644
--- a/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs
+++ b/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs
@@ -4,7 +4,6 @@ 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;
diff --git a/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoConstants.cs b/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoConstants.cs
index 49c592d..0501628 100644
--- a/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoConstants.cs
+++ b/TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoConstants.cs
@@ -1,6 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
+﻿using System.Collections.Generic;
 
 namespace TestXamConnections.Device.Balance.Teo
 {
diff --git a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs
index 8d00260..830f3a8 100644
--- a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs
@@ -1,9 +1,5 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TestXamConnections.Device.Barcode.Honeywell
-
+﻿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
index 13f6c43..45c15d9 100644
--- a/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs
@@ -1,6 +1,5 @@
 ﻿using System;
 using System.Collections.Generic;
-using System.Text;
 using System.Threading.Tasks;
 using TestXamConnections.Connection;
 using Xamarin.Forms;
diff --git a/TestXamConnections/TestXamConnections/Device/Barcode/IBarcodeReader.cs b/TestXamConnections/TestXamConnections/Device/Barcode/IBarcodeReader.cs
index a9de6fa..abbbb48 100644
--- a/TestXamConnections/TestXamConnections/Device/Barcode/IBarcodeReader.cs
+++ b/TestXamConnections/TestXamConnections/Device/Barcode/IBarcodeReader.cs
@@ -1,6 +1,4 @@
 ﻿using System;
-using System.Collections.Generic;
-using System.Text;
 using System.Threading.Tasks;
 
 namespace TestXamConnections.Device.Barcode
diff --git a/TestXamConnections/TestXamConnections/Device/DeviceInfo.cs b/TestXamConnections/TestXamConnections/Device/DeviceInfo.cs
index ccc1251..05da5e6 100644
--- a/TestXamConnections/TestXamConnections/Device/DeviceInfo.cs
+++ b/TestXamConnections/TestXamConnections/Device/DeviceInfo.cs
@@ -1,8 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TestXamConnections.Device
+﻿namespace TestXamConnections.Device
 {
     /// <summary>
     /// Représente un appareil caractérisé par un nom et une adresse MAC.
diff --git a/TestXamConnections/TestXamConnections/Device/IDevice.cs b/TestXamConnections/TestXamConnections/Device/IDevice.cs
index 44d8adc..e5cc603 100644
--- a/TestXamConnections/TestXamConnections/Device/IDevice.cs
+++ b/TestXamConnections/TestXamConnections/Device/IDevice.cs
@@ -1,7 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-using TestXamConnections.Connection;
+﻿using TestXamConnections.Connection;
 
 namespace TestXamConnections.Device
 {
diff --git a/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentConstants.cs b/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentConstants.cs
index 3d016c5..d471da6 100644
--- a/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentConstants.cs
+++ b/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentConstants.cs
@@ -1,8 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TestXamConnections.Device.RFID.Agrident
+﻿namespace TestXamConnections.Device.RFID.Agrident
 {
     /// <summary>
     /// Constantes utilisées pour la communication avec le module Agrident Wedge.
diff --git a/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs b/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs
index 68b9ee4..216e6f0 100644
--- a/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs
+++ b/TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs
@@ -80,7 +80,8 @@ namespace TestXamConnections.Device.RFID.Agrident
         /// <returns>true si le scan s'est lancé correctement, false sinon.</returns>
         public async Task<bool> StartScanAsync()
         {
-            return await ConnectionService.SendCommand(AgridentConstants.AGRIDENT_WEDGE);
+            byte[] startIntentBytes = Encoding.ASCII.GetBytes(AgridentConstants.AGRIDENT_WEDGE);
+            return await ConnectionService.SendCommand(startIntentBytes);
         }
 
     }
diff --git a/TestXamConnections/TestXamConnections/Device/RFID/IRFIDReader.cs b/TestXamConnections/TestXamConnections/Device/RFID/IRFIDReader.cs
index b5c7159..1628cf9 100644
--- a/TestXamConnections/TestXamConnections/Device/RFID/IRFIDReader.cs
+++ b/TestXamConnections/TestXamConnections/Device/RFID/IRFIDReader.cs
@@ -1,6 +1,4 @@
 ﻿using System;
-using System.Collections.Generic;
-using System.Text;
 using System.Threading.Tasks;
 
 namespace TestXamConnections.Device.RFID
diff --git a/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs b/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs
index 2b048fb..3af9bf1 100644
--- a/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs
+++ b/TestXamConnections/TestXamConnections/Models/ReponsePesee.cs
@@ -1,7 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+﻿using System.Linq;
 
 namespace TestXamConnections.Models
 {
diff --git a/TestXamConnections/TestXamConnections/Models/ReponseRFID.cs b/TestXamConnections/TestXamConnections/Models/ReponseRFID.cs
index 6136818..7b71968 100644
--- a/TestXamConnections/TestXamConnections/Models/ReponseRFID.cs
+++ b/TestXamConnections/TestXamConnections/Models/ReponseRFID.cs
@@ -1,8 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace TestXamConnections.Models
+﻿namespace TestXamConnections.Models
 {
     public class ReponseRFID
     {
diff --git a/TestXamConnections/TestXamConnections/Services/IBluetoothService.cs b/TestXamConnections/TestXamConnections/Services/IBluetoothService.cs
index 74f5579..a8615f6 100644
--- a/TestXamConnections/TestXamConnections/Services/IBluetoothService.cs
+++ b/TestXamConnections/TestXamConnections/Services/IBluetoothService.cs
@@ -1,14 +1,10 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.Models;
+﻿using System.Collections.Generic;
+using TestXamConnections.Device;
 
 namespace TestXamConnections.Services
 {
     public interface IBluetoothService
     {
-        ICollection<Device> GetBondedDevices();
+        ICollection<DeviceInfo> GetBondedDevices();
     }
 }
diff --git a/TestXamConnections/TestXamConnections/ViewModels/AccueilViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/AccueilViewModel.cs
index 9ebc052..6967c77 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/AccueilViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/AccueilViewModel.cs
@@ -1,13 +1,6 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Linq;
-using System.Text;
+﻿using System.Collections.ObjectModel;
 using System.Threading.Tasks;
 using System.Windows.Input;
-using TestXamConnections.Connection;
-using TestXamConnections.Helper;
-using TestXamConnections.Models;
 using TestXamConnections.Services;
 using TestXamConnections.Views;
 using Xamarin.Essentials;
@@ -42,9 +35,9 @@ namespace TestXamConnections.ViewModels
         {
             ShowBondedDevices = true;
             BondedDevicesList.Clear();
-            foreach (Models.Device bondedDevice in BluetoothService.GetBondedDevices())
+            foreach (Device.DeviceInfo bondedDeviceInfo in BluetoothService.GetBondedDevices())
             {
-                DeviceItemViewModel toAddItem = new DeviceItemViewModel(bondedDevice);
+                DeviceItemViewModel toAddItem = new DeviceItemViewModel(bondedDeviceInfo);
                 BondedDevicesList.Add(toAddItem);
             }
         }
diff --git a/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs
index b4dc7aa..909f579 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs
@@ -1,12 +1,9 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Text;
+﻿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;
 
 namespace TestXamConnections.ViewModels
diff --git a/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs
index e893a19..5106acb 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs
@@ -1,10 +1,4 @@
 ﻿using System.Collections.Generic;
-using System.Threading.Tasks;
-using System.Windows.Input;
-using TestXamConnections.Connection;
-using TestXamConnections.Models;
-using TestXamConnections.Services;
-using Xamarin.Forms;
 using static TestXamConnections.Device.Balance.Teo.TeoConstants;
 
 namespace TestXamConnections.ViewModels
diff --git a/TestXamConnections/TestXamConnections/ViewModels/DeviceItemViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/DeviceItemViewModel.cs
index 7e78aaf..3b6eb9e 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/DeviceItemViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/DeviceItemViewModel.cs
@@ -1,12 +1,6 @@
-﻿
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
+﻿using System.Threading.Tasks;
 using System.Windows.Input;
 using TestXamConnections.Device;
-using TestXamConnections.Models;
-using TestXamConnections.Services;
 using TestXamConnections.Views;
 using Xamarin.Forms;
 
diff --git a/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs
index 7989154..ea05174 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs
@@ -1,9 +1,7 @@
 ﻿using System;
-using System.Collections.Generic;
-using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Input;
-using TestXamConnections.Models;
+using TestXamConnections.Device.RFID.Agrident;
 using Xamarin.Forms;
 
 namespace TestXamConnections.ViewModels
@@ -66,36 +64,29 @@ namespace TestXamConnections.ViewModels
             RFIDResult = "";
             ErrorMessage = "";
             agridentReader = new AgridentInternReader();
-            agridentReader.AgridentDataReceivedEvent += OnRFIDResultReceived;
-            agridentReader.AgridentNORFIDEvent += OnNoRFIDReceived;
-            agridentReader.AgridentScanStatusChangedEvent += OnScanStatusChanged;
+            agridentReader.RFIDDataReceivedEvent += OnRFIDResultReceived;
             bool err = agridentReader.EnableServiceAsync().Result;
             StartScanCommand = new Command(async () => await StartScan());
         }
 
-        private void OnScanStatusChanged(object sender, bool e)
+        private void ResetAffichage()
         {
-            IsScanning = e;
-            if (e == false)
-            {
-                ShowError = true;
-                ShowRFID = true;
-            }
-        }
-
-        private void OnNoRFIDReceived(object sender, EventArgs e)
-        {
-            ShowError = true;
+            ShowError = false;
             ShowRFID = false;
-            ErrorMessage = "Pas de TAG RFID detecté";
-            IsScanning = false;
         }
 
         private void OnRFIDResultReceived(object sender, string e)
         {
-            ShowRFID = true;
-            ShowError = false;
-            RFIDResult = e;
+            ResetAffichage();
+            if (e == "")
+            {
+                ShowError = true;
+                ErrorMessage = "Pas de TAG RFID detecté";
+            } else
+            {
+                ShowRFID = true;
+                RFIDResult = e;
+            }
             IsScanning = false;
         }
     }
diff --git a/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs b/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs
index baee76e..561a993 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs
@@ -1,15 +1,11 @@
 ﻿using System;
-using System.Collections.Generic;
 using System.Collections.ObjectModel;
-using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Input;
-using TestXamConnections.Connection;
 using TestXamConnections.Device;
 using TestXamConnections.Device.Balance;
 using TestXamConnections.Device.Balance.Teo;
 using TestXamConnections.Models;
-using TestXamConnections.Services;
 using Xamarin.Forms;
 using static TestXamConnections.Device.Balance.Teo.TeoConstants;
 
diff --git a/TestXamConnections/TestXamConnections/ViewModels/ViewModelBase.cs b/TestXamConnections/TestXamConnections/ViewModels/ViewModelBase.cs
index 17c0380..0f94164 100644
--- a/TestXamConnections/TestXamConnections/ViewModels/ViewModelBase.cs
+++ b/TestXamConnections/TestXamConnections/ViewModels/ViewModelBase.cs
@@ -1,8 +1,5 @@
-﻿using System;
-using System.Collections.Generic;
-using System.ComponentModel;
+﻿using System.ComponentModel;
 using System.Runtime.CompilerServices;
-using System.Text;
 
 namespace TestXamConnections.ViewModels
 {
diff --git a/TestXamConnections/TestXamConnections/Views/AccueilView.xaml.cs b/TestXamConnections/TestXamConnections/Views/AccueilView.xaml.cs
index da3cf59..0150c2e 100644
--- a/TestXamConnections/TestXamConnections/Views/AccueilView.xaml.cs
+++ b/TestXamConnections/TestXamConnections/Views/AccueilView.xaml.cs
@@ -1,9 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.ViewModels;
+﻿using TestXamConnections.ViewModels;
 using Xamarin.Forms;
 using Xamarin.Forms.Xaml;
 
diff --git a/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs b/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs
index 5f0117c..8922082 100644
--- a/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs
+++ b/TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs
@@ -1,9 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.Device;
+﻿using TestXamConnections.Device;
 using TestXamConnections.ViewModels;
 using Xamarin.Forms;
 using Xamarin.Forms.Xaml;
diff --git a/TestXamConnections/TestXamConnections/Views/InternServiceView.xaml.cs b/TestXamConnections/TestXamConnections/Views/InternServiceView.xaml.cs
index 624f0af..67966a0 100644
--- a/TestXamConnections/TestXamConnections/Views/InternServiceView.xaml.cs
+++ b/TestXamConnections/TestXamConnections/Views/InternServiceView.xaml.cs
@@ -1,9 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.ViewModels;
+﻿using TestXamConnections.ViewModels;
 using Xamarin.Forms;
 using Xamarin.Forms.Xaml;
 
diff --git a/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml.cs b/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml.cs
index 2fc0961..37da867 100644
--- a/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml.cs
+++ b/TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml.cs
@@ -1,10 +1,4 @@
-﻿using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using TestXamConnections.Device;
-using TestXamConnections.Models;
+﻿using TestXamConnections.Device;
 using TestXamConnections.ViewModels;
 using Xamarin.Forms;
 using Xamarin.Forms.Xaml;
