Révision 3fa496d6
TestXamConnections/TestXamConnections.Android/Connection/BluetoothConnectionService.cs | ||
---|---|---|
1 | 1 |
using Android.App; |
2 | 2 |
using Android.Bluetooth; |
3 |
using Android.Content; |
|
4 |
using Android.OS; |
|
5 |
using Android.Runtime; |
|
6 |
using Android.Views; |
|
7 |
using Android.Widget; |
|
8 | 3 |
using Java.Util; |
9 | 4 |
using System; |
10 | 5 |
using System.Collections.Generic; |
11 | 6 |
using System.IO; |
12 | 7 |
using System.Linq; |
13 |
using System.Text; |
|
14 | 8 |
using System.Threading; |
15 | 9 |
using System.Threading.Tasks; |
16 | 10 |
using TestXamConnections.Droid.Utils; |
17 |
using TestXamConnections.Models; |
|
18 | 11 |
using TestXamConnections.Connection; |
19 |
using TestXamConnections.Helper; |
|
20 | 12 | |
21 | 13 |
namespace TestXamConnections.Droid.Connection |
22 | 14 |
{ |
... | ... | |
126 | 118 |
return Task.FromResult(true); |
127 | 119 |
} |
128 | 120 | |
129 |
public Task<bool> SendCommand(IConvertible command)
|
|
121 |
public Task<bool> SendCommand(byte[] command)
|
|
130 | 122 |
{ |
131 |
byte[] hexValues = Encoding.ASCII.GetBytes(command.ToString()); |
|
132 | 123 | |
133 | 124 |
if (socket.IsConnected == false) |
134 | 125 |
{ |
... | ... | |
137 | 128 |
else |
138 | 129 |
{ |
139 | 130 |
// Envoi de la commande |
140 |
socket.OutputStream.Write(hexValues, 0, hexValues.Length);
|
|
131 |
socket.OutputStream.Write(command, 0, command.Length);
|
|
141 | 132 |
socket.OutputStream.Flush(); |
142 | 133 |
} |
143 | 134 |
return Task.FromResult(true); |
TestXamConnections/TestXamConnections.Android/Connection/InternConnectionService.cs | ||
---|---|---|
1 | 1 |
using Android.App; |
2 | 2 |
using Android.Content; |
3 |
using Android.OS; |
|
4 |
using Android.Runtime; |
|
5 |
using Android.Views; |
|
6 |
using Android.Widget; |
|
7 | 3 |
using System; |
8 | 4 |
using System.Collections.Generic; |
9 |
using System.Linq; |
|
10 | 5 |
using System.Text; |
11 | 6 |
using System.Threading.Tasks; |
12 |
using TestXamConnections.Models; |
|
13 | 7 |
using TestXamConnections.Connection; |
14 | 8 |
using TestXamConnections.Droid.Receivers; |
15 | 9 |
using TestXamConnections.Device.RFID.Agrident; |
... | ... | |
50 | 44 |
return Task.FromResult(true); |
51 | 45 |
} |
52 | 46 | |
53 |
public Task<bool> SendCommand(IConvertible command)
|
|
47 |
public Task<bool> SendCommand(byte[] commandBytes)
|
|
54 | 48 |
{ |
55 |
Intent launchIntent = appContext.PackageManager.GetLaunchIntentForPackage(command.ToString()); |
|
49 |
string command = Encoding.ASCII.GetString(commandBytes); |
|
50 |
Intent launchIntent = appContext.PackageManager.GetLaunchIntentForPackage(command); |
|
56 | 51 |
if (launchIntent != null) |
57 | 52 |
{ |
58 | 53 |
appContext.StartActivity(launchIntent); |
... | ... | |
86 | 81 |
break; |
87 | 82 |
} |
88 | 83 |
} |
89 | ||
90 |
public Task<bool> SendCommand(byte[] hexValues) |
|
91 |
{ |
|
92 |
throw new NotImplementedException(); |
|
93 |
} |
|
94 | 84 |
} |
95 | 85 |
} |
TestXamConnections/TestXamConnections.Android/Connection/WifiConnectionService.cs | ||
---|---|---|
1 |
using Android.App; |
|
2 |
using Android.Content; |
|
3 |
using Android.OS; |
|
4 |
using Android.Runtime; |
|
5 |
using Android.Views; |
|
6 |
using Android.Widget; |
|
7 |
using System; |
|
1 |
using System; |
|
8 | 2 |
using System.Collections.Generic; |
9 |
using System.Linq; |
|
10 |
using System.Text; |
|
11 | 3 |
using System.Threading.Tasks; |
12 | 4 |
using TestXamConnections.Connection; |
13 |
using TestXamConnections.Models; |
|
14 | 5 | |
15 | 6 |
namespace TestXamConnections.Droid.Connection |
16 | 7 |
{ |
... | ... | |
26 | 17 |
throw new NotImplementedException(); |
27 | 18 |
} |
28 | 19 | |
29 |
public Task<bool> SendCommand(IConvertible hexValues)
|
|
20 |
public Task<bool> SendCommand(byte[] hexValues)
|
|
30 | 21 |
{ |
31 | 22 |
throw new NotImplementedException(); |
32 | 23 |
} |
TestXamConnections/TestXamConnections.Android/Helper/ConnectionServiceProvider.cs | ||
---|---|---|
1 |
using Android.App; |
|
2 |
using Android.Content; |
|
3 |
using Android.OS; |
|
4 |
using Android.Runtime; |
|
5 |
using Android.Views; |
|
6 |
using Android.Widget; |
|
7 |
using System; |
|
8 |
using System.Collections.Generic; |
|
9 |
using System.Linq; |
|
10 |
using System.Text; |
|
11 |
using System.Threading.Tasks; |
|
12 |
using TestXamConnections; |
|
13 |
using TestXamConnections.Connection; |
|
1 |
using TestXamConnections.Connection; |
|
14 | 2 |
using TestXamConnections.Droid.Connection; |
15 |
using TestXamConnections.Helper; |
|
16 |
using Xamarin.Forms; |
|
17 | 3 | |
18 | 4 |
namespace TestBLE.Droid.Helper |
19 | 5 |
{ |
TestXamConnections/TestXamConnections.Android/MainActivity.cs | ||
---|---|---|
1 |
using System; |
|
2 | ||
1 |
|
|
3 | 2 |
using Android.App; |
4 | 3 |
using Android.Content.PM; |
5 | 4 |
using Android.Runtime; |
6 | 5 |
using Android.OS; |
7 | 6 |
using Xamarin.Forms; |
8 | 7 |
using TestXamConnections.Services; |
9 |
using TestXamConnections.Droid.Connection; |
|
10 | 8 |
using TestXamConnections.Connection; |
11 |
using TestXamConnections.Helper; |
|
12 | 9 |
using TestBLE.Droid.Helper; |
13 | 10 |
using TestXamConnections.Droid.Services; |
14 | 11 |
TestXamConnections/TestXamConnections.Android/Properties/AssemblyInfo.cs | ||
---|---|---|
1 | 1 |
using System.Reflection; |
2 |
using System.Runtime.CompilerServices; |
|
3 | 2 |
using System.Runtime.InteropServices; |
4 | 3 |
using Android.App; |
5 | 4 |
TestXamConnections/TestXamConnections.Android/Receivers/BluetoothReceiver.cs | ||
---|---|---|
1 |
using Android.App; |
|
2 |
using Android.Bluetooth; |
|
1 |
using Android.Bluetooth; |
|
3 | 2 |
using Android.Content; |
4 |
using Android.OS; |
|
5 |
using Android.Runtime; |
|
6 |
using Android.Views; |
|
7 |
using Android.Widget; |
|
8 | 3 |
using System; |
9 |
using System.Collections.Generic; |
|
10 |
using System.Linq; |
|
11 |
using System.Text; |
|
4 |
using TestXamConnections.Device; |
|
12 | 5 | |
13 | 6 |
namespace TestXamConnections.Droid.Receivers |
14 | 7 |
{ |
... | ... | |
16 | 9 |
{ |
17 | 10 |
public EventHandler<BluetoothDevice> OnBluetoothDeviceDiscovered; |
18 | 11 |
public EventHandler<string> OnScanFinished; |
12 | ||
19 | 13 |
public override void OnReceive(Context context, Intent intent) |
20 | 14 |
{ |
21 | 15 |
if (intent.Action.Equals(BluetoothDevice.ActionFound)) |
... | ... | |
23 | 17 |
BluetoothDevice foundDevice = intent.GetParcelableExtra(BluetoothDevice.ExtraDevice) as BluetoothDevice; |
24 | 18 |
if (foundDevice != null) |
25 | 19 |
{ |
26 |
var btDevice = new Models.Device
|
|
20 |
var btDevice = new DeviceInfo
|
|
27 | 21 |
{ |
28 | 22 |
MACAddress = foundDevice.Address, |
29 | 23 |
Name = foundDevice.Name |
TestXamConnections/TestXamConnections.Android/Receivers/IntentReceiver.cs | ||
---|---|---|
1 |
using Android.App; |
|
2 |
using Android.Content; |
|
3 |
using Android.OS; |
|
4 |
using Android.Runtime; |
|
5 |
using Android.Views; |
|
6 |
using Android.Widget; |
|
1 |
using Android.Content; |
|
7 | 2 |
using System; |
8 |
using System.Collections.Generic; |
|
9 |
using System.Linq; |
|
10 |
using System.Text; |
|
11 |
using TestXamConnections.Models; |
|
12 | 3 | |
13 | 4 |
namespace TestXamConnections.Droid.Receivers |
14 | 5 |
{ |
TestXamConnections/TestXamConnections.Android/Services/BluetoothService.cs | ||
---|---|---|
1 |
using Android.App; |
|
2 |
using Android.Bluetooth; |
|
3 |
using Android.Content; |
|
4 |
using Android.OS; |
|
5 |
using Android.Runtime; |
|
6 |
using Android.Views; |
|
7 |
using Android.Widget; |
|
8 |
using Java.IO; |
|
9 |
using Java.Util; |
|
10 |
using System; |
|
1 |
using Android.Bluetooth; |
|
11 | 2 |
using System.Collections.Generic; |
12 | 3 |
using System.Collections.ObjectModel; |
13 |
using System.Linq; |
|
14 |
using System.Text; |
|
15 |
using System.Threading; |
|
16 |
using System.Threading.Tasks; |
|
17 |
using TestXamConnections.Droid.Receivers; |
|
18 |
using TestXamConnections.Droid.Utils; |
|
19 |
using TestXamConnections.Models; |
|
4 |
using TestXamConnections.Device; |
|
20 | 5 |
using TestXamConnections.Services; |
21 | 6 | |
22 | 7 |
namespace TestXamConnections.Droid.Services |
... | ... | |
25 | 10 |
{ |
26 | 11 |
private readonly BluetoothAdapter bluetoothAdapter; |
27 | 12 | |
28 |
public ObservableCollection<Device> FoundDevices = new ObservableCollection<Device>();
|
|
13 |
public ObservableCollection<DeviceInfo> FoundDevices = new ObservableCollection<DeviceInfo>();
|
|
29 | 14 |
public BluetoothService() |
30 | 15 |
{ |
31 |
FoundDevices = new ObservableCollection<Device>(); |
|
16 |
FoundDevices = new ObservableCollection<DeviceInfo>();
|
|
32 | 17 |
bluetoothAdapter = BluetoothAdapter.DefaultAdapter; |
33 | 18 |
} |
34 | 19 | |
35 |
public ICollection<Device> GetBondedDevices() |
|
20 |
public ICollection<DeviceInfo> GetBondedDevices()
|
|
36 | 21 |
{ |
37 |
ICollection<Device> ret = new ObservableCollection<Device>();
|
|
22 |
ICollection<DeviceInfo> ret = new ObservableCollection<DeviceInfo>();
|
|
38 | 23 |
foreach (BluetoothDevice bondedDevice in bluetoothAdapter.BondedDevices) |
39 | 24 |
{ |
40 |
Device toAddItem = new Device
|
|
25 |
DeviceInfo toAddItem = new DeviceInfo
|
|
41 | 26 |
{ |
42 | 27 |
MACAddress = bondedDevice.Address, |
43 | 28 |
Name = bondedDevice.Name |
TestXamConnections/TestXamConnections.Android/Utils/TaskExtensions.cs | ||
---|---|---|
1 |
using Android.App; |
|
2 |
using Android.Content; |
|
3 |
using Android.OS; |
|
4 |
using Android.Runtime; |
|
5 |
using Android.Views; |
|
6 |
using Android.Widget; |
|
7 |
using System; |
|
8 |
using System.Collections.Generic; |
|
9 |
using System.Linq; |
|
10 |
using System.Text; |
|
11 |
using System.Threading; |
|
1 |
using System.Threading; |
|
12 | 2 |
using System.Threading.Tasks; |
13 | 3 | |
14 | 4 |
namespace TestXamConnections.Droid.Utils |
TestXamConnections/TestXamConnections/App.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using TestXamConnections.Views; |
|
1 |
using TestXamConnections.Views; |
|
3 | 2 |
using Xamarin.Forms; |
4 |
using Xamarin.Forms.Xaml; |
|
5 | 3 | |
6 | 4 |
namespace TestXamConnections |
7 | 5 |
{ |
TestXamConnections/TestXamConnections/Connection/ConnectionConstants.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 | ||
5 |
namespace TestXamConnections.Connection |
|
1 |
namespace TestXamConnections.Connection |
|
6 | 2 |
{ |
7 | 3 |
/// <summary> |
8 | 4 |
/// Constantes de connexion à utiliser lors de l'utilisation |
TestXamConnections/TestXamConnections/Connection/IConnectionService.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Collections.Generic; |
3 |
using System.Text; |
|
4 | 3 |
using System.Threading.Tasks; |
5 |
using TestXamConnections.Models; |
|
6 | 4 | |
7 | 5 |
namespace TestXamConnections.Connection |
8 | 6 |
{ |
TestXamConnections/TestXamConnections/Connection/IConnectionServiceProvider.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 |
using System.Threading.Tasks; |
|
5 |
using TestXamConnections.Connection; |
|
6 | ||
7 |
namespace TestXamConnections.Connection |
|
1 |
namespace TestXamConnections.Connection |
|
8 | 2 |
{ |
9 | 3 |
/// <summary> |
10 | 4 |
/// Type de connection service à demander. |
TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs | ||
---|---|---|
1 | 1 |
using System; |
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 | 2 |
using System.Threading.Tasks; |
5 |
using TestXamConnections.Connection; |
|
6 | 3 |
using TestXamConnections.Models; |
7 | 4 |
using static TestXamConnections.Device.Balance.Teo.TeoConstants; |
8 | 5 |
TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.cs | ||
---|---|---|
4 | 4 |
using System.Text; |
5 | 5 |
using System.Threading.Tasks; |
6 | 6 |
using TestXamConnections.Connection; |
7 |
using TestXamConnections.Device.Balance; |
|
8 | 7 |
using TestXamConnections.Models; |
9 | 8 |
using Xamarin.Forms; |
10 | 9 |
using static TestXamConnections.Device.Balance.Teo.TeoConstants; |
TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoConstants.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
1 |
using System.Collections.Generic; |
|
4 | 2 | |
5 | 3 |
namespace TestXamConnections.Device.Balance.Teo |
6 | 4 |
{ |
TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 | ||
5 |
namespace TestXamConnections.Device.Barcode.Honeywell |
|
6 | ||
1 |
namespace TestXamConnections.Device.Barcode.Honeywell |
|
2 |
{ |
|
7 | 3 |
public class HoneywellInternReader |
8 | 4 |
{ |
9 | 5 |
// TODO |
TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Collections.Generic; |
3 |
using System.Text; |
|
4 | 3 |
using System.Threading.Tasks; |
5 | 4 |
using TestXamConnections.Connection; |
6 | 5 |
using Xamarin.Forms; |
TestXamConnections/TestXamConnections/Device/Barcode/IBarcodeReader.cs | ||
---|---|---|
1 | 1 |
using System; |
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 | 2 |
using System.Threading.Tasks; |
5 | 3 | |
6 | 4 |
namespace TestXamConnections.Device.Barcode |
TestXamConnections/TestXamConnections/Device/DeviceInfo.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 | ||
5 |
namespace TestXamConnections.Device |
|
1 |
namespace TestXamConnections.Device |
|
6 | 2 |
{ |
7 | 3 |
/// <summary> |
8 | 4 |
/// Représente un appareil caractérisé par un nom et une adresse MAC. |
TestXamConnections/TestXamConnections/Device/IDevice.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 |
using TestXamConnections.Connection; |
|
1 |
using TestXamConnections.Connection; |
|
5 | 2 | |
6 | 3 |
namespace TestXamConnections.Device |
7 | 4 |
{ |
TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentConstants.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 | ||
5 |
namespace TestXamConnections.Device.RFID.Agrident |
|
1 |
namespace TestXamConnections.Device.RFID.Agrident |
|
6 | 2 |
{ |
7 | 3 |
/// <summary> |
8 | 4 |
/// Constantes utilisées pour la communication avec le module Agrident Wedge. |
TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs | ||
---|---|---|
80 | 80 |
/// <returns>true si le scan s'est lancé correctement, false sinon.</returns> |
81 | 81 |
public async Task<bool> StartScanAsync() |
82 | 82 |
{ |
83 |
return await ConnectionService.SendCommand(AgridentConstants.AGRIDENT_WEDGE); |
|
83 |
byte[] startIntentBytes = Encoding.ASCII.GetBytes(AgridentConstants.AGRIDENT_WEDGE); |
|
84 |
return await ConnectionService.SendCommand(startIntentBytes); |
|
84 | 85 |
} |
85 | 86 | |
86 | 87 |
} |
TestXamConnections/TestXamConnections/Device/RFID/IRFIDReader.cs | ||
---|---|---|
1 | 1 |
using System; |
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 | 2 |
using System.Threading.Tasks; |
5 | 3 | |
6 | 4 |
namespace TestXamConnections.Device.RFID |
TestXamConnections/TestXamConnections/Models/ReponsePesee.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
1 |
using System.Linq; |
|
5 | 2 | |
6 | 3 |
namespace TestXamConnections.Models |
7 | 4 |
{ |
TestXamConnections/TestXamConnections/Models/ReponseRFID.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 | ||
5 |
namespace TestXamConnections.Models |
|
1 |
namespace TestXamConnections.Models |
|
6 | 2 |
{ |
7 | 3 |
public class ReponseRFID |
8 | 4 |
{ |
TestXamConnections/TestXamConnections/Services/IBluetoothService.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Collections.ObjectModel; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using TestXamConnections.Models; |
|
1 |
using System.Collections.Generic; |
|
2 |
using TestXamConnections.Device; |
|
7 | 3 | |
8 | 4 |
namespace TestXamConnections.Services |
9 | 5 |
{ |
10 | 6 |
public interface IBluetoothService |
11 | 7 |
{ |
12 |
ICollection<Device> GetBondedDevices(); |
|
8 |
ICollection<DeviceInfo> GetBondedDevices();
|
|
13 | 9 |
} |
14 | 10 |
} |
TestXamConnections/TestXamConnections/ViewModels/AccueilViewModel.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Collections.ObjectModel; |
|
4 |
using System.Linq; |
|
5 |
using System.Text; |
|
1 |
using System.Collections.ObjectModel; |
|
6 | 2 |
using System.Threading.Tasks; |
7 | 3 |
using System.Windows.Input; |
8 |
using TestXamConnections.Connection; |
|
9 |
using TestXamConnections.Helper; |
|
10 |
using TestXamConnections.Models; |
|
11 | 4 |
using TestXamConnections.Services; |
12 | 5 |
using TestXamConnections.Views; |
13 | 6 |
using Xamarin.Essentials; |
... | ... | |
42 | 35 |
{ |
43 | 36 |
ShowBondedDevices = true; |
44 | 37 |
BondedDevicesList.Clear(); |
45 |
foreach (Models.Device bondedDevice in BluetoothService.GetBondedDevices())
|
|
38 |
foreach (Device.DeviceInfo bondedDeviceInfo in BluetoothService.GetBondedDevices())
|
|
46 | 39 |
{ |
47 |
DeviceItemViewModel toAddItem = new DeviceItemViewModel(bondedDevice); |
|
40 |
DeviceItemViewModel toAddItem = new DeviceItemViewModel(bondedDeviceInfo);
|
|
48 | 41 |
BondedDevicesList.Add(toAddItem); |
49 | 42 |
} |
50 | 43 |
} |
TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
1 |
using System.Text; |
|
4 | 2 |
using System.Threading.Tasks; |
5 | 3 |
using System.Windows.Input; |
6 | 4 |
using TestXamConnections.Device; |
7 | 5 |
using TestXamConnections.Device.Barcode; |
8 | 6 |
using TestXamConnections.Device.Barcode.Honeywell; |
9 |
using TestXamConnections.Models; |
|
10 | 7 |
using Xamarin.Forms; |
11 | 8 | |
12 | 9 |
namespace TestXamConnections.ViewModels |
TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs | ||
---|---|---|
1 | 1 |
using System.Collections.Generic; |
2 |
using System.Threading.Tasks; |
|
3 |
using System.Windows.Input; |
|
4 |
using TestXamConnections.Connection; |
|
5 |
using TestXamConnections.Models; |
|
6 |
using TestXamConnections.Services; |
|
7 |
using Xamarin.Forms; |
|
8 | 2 |
using static TestXamConnections.Device.Balance.Teo.TeoConstants; |
9 | 3 | |
10 | 4 |
namespace TestXamConnections.ViewModels |
TestXamConnections/TestXamConnections/ViewModels/DeviceItemViewModel.cs | ||
---|---|---|
1 |
|
|
2 |
using System; |
|
3 |
using System.Collections.Generic; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
1 |
using System.Threading.Tasks; |
|
6 | 2 |
using System.Windows.Input; |
7 | 3 |
using TestXamConnections.Device; |
8 |
using TestXamConnections.Models; |
|
9 |
using TestXamConnections.Services; |
|
10 | 4 |
using TestXamConnections.Views; |
11 | 5 |
using Xamarin.Forms; |
12 | 6 |
TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs | ||
---|---|---|
1 | 1 |
using System; |
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 | 2 |
using System.Threading.Tasks; |
5 | 3 |
using System.Windows.Input; |
6 |
using TestXamConnections.Models;
|
|
4 |
using TestXamConnections.Device.RFID.Agrident;
|
|
7 | 5 |
using Xamarin.Forms; |
8 | 6 | |
9 | 7 |
namespace TestXamConnections.ViewModels |
... | ... | |
66 | 64 |
RFIDResult = ""; |
67 | 65 |
ErrorMessage = ""; |
68 | 66 |
agridentReader = new AgridentInternReader(); |
69 |
agridentReader.AgridentDataReceivedEvent += OnRFIDResultReceived; |
|
70 |
agridentReader.AgridentNORFIDEvent += OnNoRFIDReceived; |
|
71 |
agridentReader.AgridentScanStatusChangedEvent += OnScanStatusChanged; |
|
67 |
agridentReader.RFIDDataReceivedEvent += OnRFIDResultReceived; |
|
72 | 68 |
bool err = agridentReader.EnableServiceAsync().Result; |
73 | 69 |
StartScanCommand = new Command(async () => await StartScan()); |
74 | 70 |
} |
75 | 71 | |
76 |
private void OnScanStatusChanged(object sender, bool e)
|
|
72 |
private void ResetAffichage()
|
|
77 | 73 |
{ |
78 |
IsScanning = e; |
|
79 |
if (e == false) |
|
80 |
{ |
|
81 |
ShowError = true; |
|
82 |
ShowRFID = true; |
|
83 |
} |
|
84 |
} |
|
85 | ||
86 |
private void OnNoRFIDReceived(object sender, EventArgs e) |
|
87 |
{ |
|
88 |
ShowError = true; |
|
74 |
ShowError = false; |
|
89 | 75 |
ShowRFID = false; |
90 |
ErrorMessage = "Pas de TAG RFID detecté"; |
|
91 |
IsScanning = false; |
|
92 | 76 |
} |
93 | 77 | |
94 | 78 |
private void OnRFIDResultReceived(object sender, string e) |
95 | 79 |
{ |
96 |
ShowRFID = true; |
|
97 |
ShowError = false; |
|
98 |
RFIDResult = e; |
|
80 |
ResetAffichage(); |
|
81 |
if (e == "") |
|
82 |
{ |
|
83 |
ShowError = true; |
|
84 |
ErrorMessage = "Pas de TAG RFID detecté"; |
|
85 |
} else |
|
86 |
{ |
|
87 |
ShowRFID = true; |
|
88 |
RFIDResult = e; |
|
89 |
} |
|
99 | 90 |
IsScanning = false; |
100 | 91 |
} |
101 | 92 |
} |
TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs | ||
---|---|---|
1 | 1 |
using System; |
2 |
using System.Collections.Generic; |
|
3 | 2 |
using System.Collections.ObjectModel; |
4 |
using System.Text; |
|
5 | 3 |
using System.Threading.Tasks; |
6 | 4 |
using System.Windows.Input; |
7 |
using TestXamConnections.Connection; |
|
8 | 5 |
using TestXamConnections.Device; |
9 | 6 |
using TestXamConnections.Device.Balance; |
10 | 7 |
using TestXamConnections.Device.Balance.Teo; |
11 | 8 |
using TestXamConnections.Models; |
12 |
using TestXamConnections.Services; |
|
13 | 9 |
using Xamarin.Forms; |
14 | 10 |
using static TestXamConnections.Device.Balance.Teo.TeoConstants; |
15 | 11 |
TestXamConnections/TestXamConnections/ViewModels/ViewModelBase.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.ComponentModel; |
|
1 |
using System.ComponentModel; |
|
4 | 2 |
using System.Runtime.CompilerServices; |
5 |
using System.Text; |
|
6 | 3 | |
7 | 4 |
namespace TestXamConnections.ViewModels |
8 | 5 |
{ |
TestXamConnections/TestXamConnections/Views/AccueilView.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using TestXamConnections.ViewModels; |
|
1 |
using TestXamConnections.ViewModels; |
|
7 | 2 |
using Xamarin.Forms; |
8 | 3 |
using Xamarin.Forms.Xaml; |
9 | 4 |
TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using TestXamConnections.Device; |
|
1 |
using TestXamConnections.Device; |
|
7 | 2 |
using TestXamConnections.ViewModels; |
8 | 3 |
using Xamarin.Forms; |
9 | 4 |
using Xamarin.Forms.Xaml; |
TestXamConnections/TestXamConnections/Views/InternServiceView.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using TestXamConnections.ViewModels; |
|
1 |
using TestXamConnections.ViewModels; |
|
7 | 2 |
using Xamarin.Forms; |
8 | 3 |
using Xamarin.Forms.Xaml; |
9 | 4 |
TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using TestXamConnections.Device; |
|
7 |
using TestXamConnections.Models; |
|
1 |
using TestXamConnections.Device; |
|
8 | 2 |
using TestXamConnections.ViewModels; |
9 | 3 |
using Xamarin.Forms; |
10 | 4 |
using Xamarin.Forms.Xaml; |
Formats disponibles : Unified diff