Révision 6e6ea455
TestXamConnections/TestXamConnections/Device/Balance/BalanceProvider.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 |
using TestXamConnections.Connection; |
|
5 |
using TestXamConnections.Device.Balance.Balea; |
|
6 |
|
|
7 |
namespace TestXamConnections.Device.Balance |
|
8 |
{ |
|
9 |
public enum Balance |
|
10 |
{ |
|
11 |
TeoBalance |
|
12 |
} |
|
13 |
|
|
14 |
public static class BalanceProvider |
|
15 |
{ |
|
16 |
public static IBalance GetBalance(Balance b, ConnectionType ct, DeviceInfo deviceI) |
|
17 |
{ |
|
18 |
return b switch |
|
19 |
{ |
|
20 |
Balance.TeoBalance => new TeoBalance(deviceI), |
|
21 |
_ => null, |
|
22 |
}; |
|
23 |
} |
|
24 |
} |
|
25 |
} |
TestXamConnections/TestXamConnections/Device/Balance/Balea/TeoBalance.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.Connection; |
|
7 |
using TestXamConnections.Models; |
|
8 |
using Xamarin.Forms; |
|
9 |
|
|
10 |
namespace TestXamConnections.Device.Balance.Balea |
|
11 |
{ |
|
12 |
public class TeoBalance : IBalance |
|
13 |
{ |
|
14 |
public DeviceInfo DeviceI { get; set; } |
|
15 |
public IConnectionService ConnectionService { get; set; } |
|
16 |
public EventHandler<ReponsePesee> PeseeReceivedEvent { get; set; } |
|
17 |
|
|
18 |
public TeoBalance(DeviceInfo deviceI) |
|
19 |
{ |
|
20 |
DeviceI = deviceI; |
|
21 |
ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Bluetooth); |
|
22 |
ConnectionService.DataReceivedEvent += TeoDataReceived; |
|
23 |
} |
|
24 |
|
|
25 |
~TeoBalance() |
|
26 |
{ |
|
27 |
ConnectionService.DataReceivedEvent -= TeoDataReceived; |
|
28 |
} |
|
29 |
|
|
30 |
/* |
|
31 |
* Fonction déclenchée à la reception de données par le ConnectionService |
|
32 |
* Trigger l'evenement TeoDataReceivedEvent ou TeoPeseeReceivedEvent. |
|
33 |
* |
|
34 |
* IMPORTANT: Les trames du Teo peuvent arriver découpées, |
|
35 |
* Donc les données sont gardées dans un buffer d'envoi |
|
36 |
* nommé _bufferedData |
|
37 |
*/ |
|
38 |
private string _bufferedData; |
|
39 |
private void TeoDataReceived(object sender, byte[] buffer) |
|
40 |
{ |
|
41 |
// Si le premier character est 2 (ASCII: STX) |
|
42 |
// Alors c'est le début de la trame. |
|
43 |
if (buffer[0] == 2) |
|
44 |
{ |
|
45 |
_bufferedData = ""; |
|
46 |
// Si character seul on quitte |
|
47 |
if (buffer.Length == 1) |
|
48 |
{ |
|
49 |
return; |
|
50 |
} |
|
51 |
// On enlève STX |
|
52 |
buffer = buffer.Skip(1).ToArray(); |
|
53 |
// On mets le début de la trame dans buffer d'envoi |
|
54 |
_bufferedData += Encoding.ASCII.GetString(buffer); |
|
55 |
} |
|
56 |
|
|
57 |
// Si le dernier character est 13 (ASCII: CR) |
|
58 |
// Alors la trame est terminée |
|
59 |
if (buffer[^1] == 13) |
|
60 |
{ |
|
61 |
// On enlève CR |
|
62 |
buffer = buffer.SkipLast(1).ToArray(); |
|
63 |
// Conversion en chaîne de caractères |
|
64 |
// Et on complète le buffer d'envoi |
|
65 |
_bufferedData += Encoding.ASCII.GetString(buffer); |
|
66 |
|
|
67 |
// Trigger evènement en fonction de la trame |
|
68 |
if (_bufferedData.Length == 12) |
|
69 |
{ |
|
70 |
PeseeReceivedEvent.Invoke(this, new ReponsePesee(_bufferedData)); |
|
71 |
} |
|
72 |
else if (_bufferedData[2] == '6') |
|
73 |
{ |
|
74 |
PeseeReceivedEvent.Invoke(this, new ReponsePesee("err")); |
|
75 |
} |
|
76 |
else |
|
77 |
{ |
|
78 |
PeseeReceivedEvent.Invoke(this, new ReponsePesee("err")); |
|
79 |
} |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
/// <summary> |
|
84 |
/// Permet d’établir une connection bluetooth avec la balance Teo. |
|
85 |
/// Important : le bluetooth doit être activé, la balance allumée et les appareils doivent déjà être appairés. |
|
86 |
/// </summary> |
|
87 |
/// <returns>true si la connection a réussi, false sinon.</returns> |
|
88 |
public async Task<bool> ConnectToBalanceAsync() |
|
89 |
{ |
|
90 |
Dictionary<string, string> param = new Dictionary<string, string>() |
|
91 |
{ |
|
92 |
{ ConnectionConstants.MAC_ADDR_KEY, DeviceI.MACAddress } |
|
93 |
}; |
|
94 |
return await ConnectionService.Connect(param); |
|
95 |
} |
|
96 |
|
|
97 |
/// <summary> |
|
98 |
/// Envoi d'une commande au Teo. |
|
99 |
/// </summary> |
|
100 |
/// <param name="commandType">La commande à envoyer.</param> |
|
101 |
/// <returns></returns> |
|
102 |
public async Task<bool> SendCommandAsync(TeoConstants.TeoCommandType cmd) |
|
103 |
{ |
|
104 |
byte[] commandValue = TeoConstants.TeoCommandValues.GetValueOrDefault(cmd); |
|
105 |
return await ConnectionService.SendCommand(commandValue); |
|
106 |
} |
|
107 |
} |
|
108 |
} |
TestXamConnections/TestXamConnections/Device/Balance/Balea/TeoConstants.cs | ||
---|---|---|
1 |
using System.Collections.Generic; |
|
2 |
|
|
3 |
namespace TestXamConnections.Device.Balance.Balea |
|
4 |
{ |
|
5 |
public static class TeoConstants |
|
6 |
{ |
|
7 |
/// <summary> |
|
8 |
/// Liste des commandes disponibles pour la balance Teo, pour le programme INRAE. |
|
9 |
/// </summary> |
|
10 |
public enum TeoCommandType |
|
11 |
{ |
|
12 |
// Voir documentation TEO INRAE |
|
13 |
// Codes ASCII |
|
14 |
ModeOrdre, |
|
15 |
SortieOrdre, |
|
16 |
EmissionPoids, |
|
17 |
ModePeseeSimple, |
|
18 |
SortiePeseeSimple |
|
19 |
} |
|
20 |
|
|
21 |
public static readonly Dictionary<TeoCommandType, string> TeoCommandNames = new Dictionary<TeoCommandType, string>() |
|
22 |
{ |
|
23 |
{ TeoCommandType.ModeOrdre, "Mode attente ordre" }, |
|
24 |
{ TeoCommandType.SortieOrdre, "Sortie mode ordre" }, |
|
25 |
{ TeoCommandType.EmissionPoids, "Emission poids" }, |
|
26 |
{ TeoCommandType.ModePeseeSimple, "Mode simple pesage" }, |
|
27 |
{ TeoCommandType.SortiePeseeSimple, "Sortie mode simple pesage" } |
|
28 |
|
|
29 |
}; |
|
30 |
|
|
31 |
public static readonly Dictionary<TeoCommandType, byte[]> TeoCommandValues = new Dictionary<TeoCommandType, byte[]>() |
|
32 |
{ |
|
33 |
{ TeoCommandType.ModeOrdre, new byte[] { 0x02, 0x61, 0x0D } }, |
|
34 |
{ TeoCommandType.SortieOrdre, new byte[] { 0x02, 0x6B, 0x0D } }, |
|
35 |
{ TeoCommandType.EmissionPoids, new byte[] { 0x02, 0x63, 0x0D } }, |
|
36 |
{ TeoCommandType.ModePeseeSimple, new byte[] { 0x02, 0x62, 0x0D } }, |
|
37 |
{ TeoCommandType.SortiePeseeSimple, new byte[] { 0x02, 0x65, 0x0D } } |
|
38 |
}; |
|
39 |
} |
|
40 |
} |
TestXamConnections/TestXamConnections/Device/Balance/IBalance.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Threading.Tasks; |
3 | 3 |
using TestXamConnections.Models; |
4 |
using static TestXamConnections.Device.Balance.Teo.TeoConstants;
|
|
4 |
using static TestXamConnections.Device.Balance.Balea.TeoConstants;
|
|
5 | 5 |
|
6 | 6 |
namespace TestXamConnections.Device.Balance |
7 | 7 |
{ |
TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoBalance.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.Connection; |
|
7 |
using TestXamConnections.Models; |
|
8 |
using Xamarin.Forms; |
|
9 |
using static TestXamConnections.Device.Balance.Teo.TeoConstants; |
|
10 |
|
|
11 |
namespace TestXamConnections.Device.Balance.Teo |
|
12 |
{ |
|
13 |
public class TeoBalance : IBalance |
|
14 |
{ |
|
15 |
public DeviceInfo Device { get; set; } |
|
16 |
public IConnectionService ConnectionService { get; set; } |
|
17 |
public EventHandler<ReponsePesee> PeseeReceivedEvent { get; set; } |
|
18 |
|
|
19 |
public TeoBalance(DeviceInfo device) |
|
20 |
{ |
|
21 |
Device.Name = device.Name; |
|
22 |
Device.MACAddress = device.MACAddress; |
|
23 |
ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Bluetooth); |
|
24 |
ConnectionService.DataReceivedEvent += TeoDataReceived; |
|
25 |
} |
|
26 |
|
|
27 |
~TeoBalance() |
|
28 |
{ |
|
29 |
ConnectionService.DataReceivedEvent -= TeoDataReceived; |
|
30 |
} |
|
31 |
|
|
32 |
/* |
|
33 |
* Fonction déclenchée à la reception de données par le ConnectionService |
|
34 |
* Trigger l'evenement TeoDataReceivedEvent ou TeoPeseeReceivedEvent. |
|
35 |
* |
|
36 |
* IMPORTANT: Les trames du Teo peuvent arriver découpées, |
|
37 |
* Donc les données sont gardées dans un buffer d'envoi |
|
38 |
* nommé _bufferedData |
|
39 |
*/ |
|
40 |
private string _bufferedData; |
|
41 |
private void TeoDataReceived(object sender, byte[] buffer) |
|
42 |
{ |
|
43 |
// Si le premier character est 2 (ASCII: STX) |
|
44 |
// Alors c'est le début de la trame. |
|
45 |
if (buffer[0] == 2) |
|
46 |
{ |
|
47 |
_bufferedData = ""; |
|
48 |
// Si character seul on quitte |
|
49 |
if (buffer.Length == 1) |
|
50 |
{ |
|
51 |
return; |
|
52 |
} |
|
53 |
// On enlève STX |
|
54 |
buffer = buffer.Skip(1).ToArray(); |
|
55 |
// On mets le début de la trame dans buffer d'envoi |
|
56 |
_bufferedData += Encoding.ASCII.GetString(buffer); |
|
57 |
} |
|
58 |
|
|
59 |
// Si le dernier character est 13 (ASCII: CR) |
|
60 |
// Alors la trame est terminée |
|
61 |
if (buffer[^1] == 13) |
|
62 |
{ |
|
63 |
// On enlève CR |
|
64 |
buffer = buffer.SkipLast(1).ToArray(); |
|
65 |
// Conversion en chaîne de caractères |
|
66 |
// Et on complète le buffer d'envoi |
|
67 |
_bufferedData += Encoding.ASCII.GetString(buffer); |
|
68 |
|
|
69 |
// Trigger evènement en fonction de la trame |
|
70 |
if (_bufferedData.Length == 12) |
|
71 |
{ |
|
72 |
PeseeReceivedEvent.Invoke(this, new ReponsePesee(_bufferedData)); |
|
73 |
} |
|
74 |
else if (_bufferedData[2] == '6') |
|
75 |
{ |
|
76 |
PeseeReceivedEvent.Invoke(this, new ReponsePesee("err")); |
|
77 |
} |
|
78 |
else |
|
79 |
{ |
|
80 |
PeseeReceivedEvent.Invoke(this, new ReponsePesee("err")); |
|
81 |
} |
|
82 |
} |
|
83 |
} |
|
84 |
|
|
85 |
/// <summary> |
|
86 |
/// Permet d’établir une connection bluetooth avec la balance Teo. |
|
87 |
/// Important : le bluetooth doit être activé, la balance allumée et les appareils doivent déjà être appairés. |
|
88 |
/// </summary> |
|
89 |
/// <returns>true si la connection a réussi, false sinon.</returns> |
|
90 |
public async Task<bool> ConnectToBalanceAsync() |
|
91 |
{ |
|
92 |
Dictionary<string, string> param = new Dictionary<string, string>() |
|
93 |
{ |
|
94 |
{ ConnectionConstants.MAC_ADDR_KEY, Device.MACAddress } |
|
95 |
}; |
|
96 |
return await ConnectionService.Connect(param); |
|
97 |
} |
|
98 |
|
|
99 |
/// <summary> |
|
100 |
/// Envoi d'une commande au Teo. |
|
101 |
/// </summary> |
|
102 |
/// <param name="commandType">La commande à envoyer.</param> |
|
103 |
/// <returns></returns> |
|
104 |
public async Task<bool> SendCommandAsync(TeoCommandType cmd) |
|
105 |
{ |
|
106 |
byte[] commandValue = TeoCommandValues.GetValueOrDefault(cmd); |
|
107 |
return await ConnectionService.SendCommand(commandValue); |
|
108 |
} |
|
109 |
} |
|
110 |
} |
TestXamConnections/TestXamConnections/Device/Balance/Teo/TeoConstants.cs | ||
---|---|---|
1 |
using System.Collections.Generic; |
|
2 |
|
|
3 |
namespace TestXamConnections.Device.Balance.Teo |
|
4 |
{ |
|
5 |
public static class TeoConstants |
|
6 |
{ |
|
7 |
/// <summary> |
|
8 |
/// Liste des commandes disponibles pour la balance Teo, pour le programme INRAE. |
|
9 |
/// </summary> |
|
10 |
public enum TeoCommandType |
|
11 |
{ |
|
12 |
// Voir documentation TEO INRAE |
|
13 |
// Codes ASCII |
|
14 |
ModeOrdre, |
|
15 |
SortieOrdre, |
|
16 |
EmissionPoids, |
|
17 |
ModePeseeSimple, |
|
18 |
SortiePeseeSimple |
|
19 |
} |
|
20 |
|
|
21 |
public static readonly Dictionary<TeoCommandType, string> TeoCommandNames = new Dictionary<TeoCommandType, string>() |
|
22 |
{ |
|
23 |
{ TeoCommandType.ModeOrdre, "Mode attente ordre" }, |
|
24 |
{ TeoCommandType.SortieOrdre, "Sortie mode ordre" }, |
|
25 |
{ TeoCommandType.EmissionPoids, "Emission poids" }, |
|
26 |
{ TeoCommandType.ModePeseeSimple, "Mode simple pesage" }, |
|
27 |
{ TeoCommandType.SortiePeseeSimple, "Sortie mode simple pesage" } |
|
28 |
|
|
29 |
}; |
|
30 |
|
|
31 |
public static readonly Dictionary<TeoCommandType, byte[]> TeoCommandValues = new Dictionary<TeoCommandType, byte[]>() |
|
32 |
{ |
|
33 |
{ TeoCommandType.ModeOrdre, new byte[] { 0x02, 0x61, 0x0D } }, |
|
34 |
{ TeoCommandType.SortieOrdre, new byte[] { 0x02, 0x6B, 0x0D } }, |
|
35 |
{ TeoCommandType.EmissionPoids, new byte[] { 0x02, 0x63, 0x0D } }, |
|
36 |
{ TeoCommandType.ModePeseeSimple, new byte[] { 0x02, 0x62, 0x0D } }, |
|
37 |
{ TeoCommandType.SortiePeseeSimple, new byte[] { 0x02, 0x65, 0x0D } } |
|
38 |
}; |
|
39 |
} |
|
40 |
} |
TestXamConnections/TestXamConnections/Device/Barcode/BarcodeReaderProvider.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 |
using TestXamConnections.Connection; |
|
5 |
using TestXamConnections.Device.Barcode.Honeywell; |
|
6 |
|
|
7 |
namespace TestXamConnections.Device.Barcode |
|
8 |
{ |
|
9 |
public enum BarcodeDevice |
|
10 |
{ |
|
11 |
HoneywellIntern, |
|
12 |
HoneywellBT |
|
13 |
} |
|
14 |
|
|
15 |
public static class BarcodeReaderProvider |
|
16 |
{ |
|
17 |
public static IBarcodeReader GetBarcodeReader(BarcodeDevice d, ConnectionType ct, DeviceInfo deviceI) |
|
18 |
{ |
|
19 |
return d switch |
|
20 |
{ |
|
21 |
BarcodeDevice.HoneywellIntern => new HoneywellInternReader(deviceI), |
|
22 |
BarcodeDevice.HoneywellBT => new HoneywellBTReader(deviceI), |
|
23 |
_ => null, |
|
24 |
}; |
|
25 |
} |
|
26 |
} |
|
27 |
} |
TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/BarcodeInternReader.cs | ||
---|---|---|
1 |
namespace TestXamConnections.Device.Barcode.Honeywell |
|
2 |
{ |
|
3 |
public class HoneywellInternReader |
|
4 |
{ |
|
5 |
// TODO |
|
6 |
} |
|
7 |
} |
TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneyWellConstants.cs | ||
---|---|---|
4 | 4 |
|
5 | 5 |
namespace TestXamConnections.Device.Barcode.Honeywell |
6 | 6 |
{ |
7 |
class HoneyWellConstants |
|
7 |
public static class HoneyWellConstants
|
|
8 | 8 |
{ |
9 | 9 |
} |
10 | 10 |
} |
TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellBTReader.cs | ||
---|---|---|
8 | 8 |
{ |
9 | 9 |
public class HoneywellBTReader : IBarcodeReader |
10 | 10 |
{ |
11 |
public DeviceInfo Device { get; set; } |
|
11 |
public DeviceInfo DeviceI { get; set; }
|
|
12 | 12 |
public IConnectionService ConnectionService { get; set; } |
13 | 13 |
/// <summary> |
14 | 14 |
/// Événement déclenché à la reception de données par le lecteur de code barre Honeywell. |
... | ... | |
17 | 17 |
|
18 | 18 |
public HoneywellBTReader(DeviceInfo device) |
19 | 19 |
{ |
20 |
Device.Name = device.Name; |
|
21 |
Device.MACAddress = device.MACAddress; |
|
20 |
DeviceI.Name = device.Name;
|
|
21 |
DeviceI.MACAddress = device.MACAddress;
|
|
22 | 22 |
ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Bluetooth); |
23 | 23 |
ConnectionService.DataReceivedEvent += BluetoothDataReceived; |
24 | 24 |
} |
... | ... | |
32 | 32 |
{ |
33 | 33 |
Dictionary<string, string> param = new Dictionary<string, string>() |
34 | 34 |
{ |
35 |
{ ConnectionConstants.MAC_ADDR_KEY, Device.MACAddress } |
|
35 |
{ ConnectionConstants.MAC_ADDR_KEY, DeviceI.MACAddress }
|
|
36 | 36 |
}; |
37 | 37 |
bool ret = await ConnectionService.Connect(param); |
38 | 38 |
return ret; |
TestXamConnections/TestXamConnections/Device/Barcode/Honeywell/HoneywellInternReader.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Threading.Tasks; |
|
3 |
using TestXamConnections.Connection; |
|
4 |
|
|
5 |
namespace TestXamConnections.Device.Barcode.Honeywell |
|
6 |
{ |
|
7 |
public class HoneywellInternReader : IBarcodeReader |
|
8 |
{ |
|
9 |
// TODO |
|
10 |
public HoneywellInternReader(DeviceInfo deviceI) |
|
11 |
{ |
|
12 |
|
|
13 |
} |
|
14 |
|
|
15 |
public EventHandler<byte[]> BarcodeDataReceivedEvent { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } |
|
16 |
public DeviceInfo DeviceI { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } |
|
17 |
public IConnectionService ConnectionService { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } |
|
18 |
|
|
19 |
public Task<bool> ConnectToBTReaderAsync() |
|
20 |
{ |
|
21 |
throw new NotImplementedException(); |
|
22 |
} |
|
23 |
} |
|
24 |
} |
TestXamConnections/TestXamConnections/Device/IDevice.cs | ||
---|---|---|
4 | 4 |
{ |
5 | 5 |
public interface IDevice |
6 | 6 |
{ |
7 |
DeviceInfo Device { get; set; } |
|
7 |
DeviceInfo DeviceI { get; set; }
|
|
8 | 8 |
IConnectionService ConnectionService { get; set; } |
9 | 9 |
} |
10 | 10 |
} |
TestXamConnections/TestXamConnections/Device/RFID/Agrident/AgridentInternReader.cs | ||
---|---|---|
12 | 12 |
/// </summary> |
13 | 13 |
public class AgridentInternReader : IRFIDReader |
14 | 14 |
{ |
15 |
public DeviceInfo Device { get; set; } |
|
15 |
public DeviceInfo DeviceI { get; set; }
|
|
16 | 16 |
public IConnectionService ConnectionService { get; set; } |
17 | 17 |
/// <summary> |
18 | 18 |
/// Événement déclenché à la reception de données par le lecteur RFID Agrident. |
19 | 19 |
/// </summary> |
20 | 20 |
public EventHandler<string> RFIDDataReceivedEvent { get; set; } |
21 | 21 |
|
22 |
public AgridentInternReader() |
|
22 |
public AgridentInternReader(DeviceInfo deviceI)
|
|
23 | 23 |
{ |
24 |
DeviceI = deviceI; |
|
24 | 25 |
ConnectionService = DependencyService.Get<IConnectionServiceProvider>().GetConnectionServiceInstance(ConnectionType.Intern); |
25 | 26 |
ConnectionService.DataReceivedEvent += InternDataReceived; |
26 | 27 |
} |
TestXamConnections/TestXamConnections/Device/RFID/RFIDReaderProvider.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Text; |
|
4 |
using TestXamConnections.Connection; |
|
5 |
using TestXamConnections.Device.RFID.Agrident; |
|
6 |
|
|
7 |
namespace TestXamConnections.Device.RFID |
|
8 |
{ |
|
9 |
public enum RFIDDevice |
|
10 |
{ |
|
11 |
AgridentIntern, |
|
12 |
AgridentBT |
|
13 |
} |
|
14 |
|
|
15 |
public static class RFIDReaderProvider |
|
16 |
{ |
|
17 |
public static IRFIDReader GetRFIDReader(RFIDDevice d, ConnectionType ct, DeviceInfo deviceI) |
|
18 |
{ |
|
19 |
return d switch |
|
20 |
{ |
|
21 |
RFIDDevice.AgridentBT => throw new NotImplementedException(), |
|
22 |
RFIDDevice.AgridentIntern => new AgridentInternReader(deviceI), |
|
23 |
_ => null, |
|
24 |
}; |
|
25 |
} |
|
26 |
} |
|
27 |
} |
TestXamConnections/TestXamConnections/Models/ReponsePesee.cs | ||
---|---|---|
11 | 11 |
/// </summary> |
12 | 12 |
public bool Err |
13 | 13 |
{ |
14 |
get { return err; }
|
|
15 |
set { err = value; }
|
|
14 |
get => err;
|
|
15 |
set => err = value;
|
|
16 | 16 |
} |
17 | 17 |
|
18 | 18 |
|
... | ... | |
22 | 22 |
/// </summary> |
23 | 23 |
public int NumPlateau |
24 | 24 |
{ |
25 |
get { return numPlateau; }
|
|
26 |
set { numPlateau = value; }
|
|
25 |
get => numPlateau;
|
|
26 |
set => numPlateau = value;
|
|
27 | 27 |
} |
28 | 28 |
|
29 | 29 |
private int typePlateau; |
... | ... | |
32 | 32 |
/// </summary> |
33 | 33 |
public int TypePlateau |
34 | 34 |
{ |
35 |
get { return typePlateau; }
|
|
36 |
set { typePlateau = value; }
|
|
35 |
get => typePlateau;
|
|
36 |
set => typePlateau = value;
|
|
37 | 37 |
} |
38 | 38 |
|
39 | 39 |
private string poidsMesure; |
... | ... | |
42 | 42 |
/// </summary> |
43 | 43 |
public string PoidsMesure |
44 | 44 |
{ |
45 |
get { return poidsMesure; }
|
|
46 |
set { poidsMesure = value; }
|
|
45 |
get => poidsMesure;
|
|
46 |
set => poidsMesure = value;
|
|
47 | 47 |
} |
48 | 48 |
|
49 | 49 |
private bool isNegative; |
... | ... | |
52 | 52 |
/// </summary> |
53 | 53 |
public bool IsNegative |
54 | 54 |
{ |
55 |
get { return isNegative; }
|
|
56 |
set { isNegative = value; }
|
|
55 |
get => isNegative;
|
|
56 |
set => isNegative = value;
|
|
57 | 57 |
} |
58 | 58 |
|
59 | 59 |
public ReponsePesee(string data) |
TestXamConnections/TestXamConnections/ViewModels/BarcodeReaderViewModel.cs | ||
---|---|---|
1 |
using System.Text; |
|
2 |
using System.Threading.Tasks; |
|
3 |
using System.Windows.Input; |
|
4 |
using TestXamConnections.Device; |
|
5 |
using TestXamConnections.Device.Barcode; |
|
6 |
using TestXamConnections.Device.Barcode.Honeywell; |
|
7 |
using Xamarin.Forms; |
|
8 |
|
|
9 |
namespace TestXamConnections.ViewModels |
|
10 |
{ |
|
11 |
public class BarcodeReaderViewModel : ViewModelBase |
|
12 |
{ |
|
13 |
private readonly IBarcodeReader bcReader; |
|
14 |
|
|
15 |
private bool isVisibleData; |
|
16 |
private string data; |
|
17 |
private string connectionIndicator; |
|
18 |
private string ciColor; |
|
19 |
|
|
20 |
public string CIColor |
|
21 |
{ |
|
22 |
get => ciColor; |
|
23 |
set => SetProperty(ref ciColor, value); |
|
24 |
} |
|
25 |
|
|
26 |
public string ConnectionIndicator |
|
27 |
{ |
|
28 |
get => connectionIndicator; |
|
29 |
set => SetProperty(ref connectionIndicator, value); |
|
30 |
} |
|
31 |
|
|
32 |
public string Data |
|
33 |
{ |
|
34 |
get => data; |
|
35 |
set => SetProperty(ref data, value); |
|
36 |
} |
|
37 |
|
|
38 |
public bool IsVisibleData |
|
39 |
{ |
|
40 |
get => isVisibleData; |
|
41 |
set => SetProperty(ref isVisibleData, value); |
|
42 |
} |
|
43 |
|
|
44 |
public async Task<bool> ConnectToDevice() |
|
45 |
{ |
|
46 |
if (await bcReader.ConnectToBTReaderAsync()) |
|
47 |
{ |
|
48 |
ConnectionIndicator = "Connecté"; |
|
49 |
CIColor = "Green"; |
|
50 |
return true; |
|
51 |
} |
|
52 |
else |
|
53 |
{ |
|
54 |
ConnectionIndicator = "Non Connecté"; |
|
55 |
CIColor = "Red"; |
|
56 |
return false; |
|
57 |
} |
|
58 |
} |
|
59 |
|
|
60 |
public ICommand ConnectToDeviceCommand { get; private set; } |
|
61 |
|
|
62 |
public BarcodeReaderViewModel(DeviceInfo deviceI) |
|
63 |
{ |
|
64 |
CIColor = "Red"; |
|
65 |
ConnectionIndicator = "Non connecté"; |
|
66 |
IsVisibleData = false; |
|
67 |
bcReader = BarcodeReaderProvider.GetBarcodeReader(BarcodeDevice.HoneywellBT, Connection.ConnectionType.Bluetooth, deviceI); |
|
68 |
ConnectToDeviceCommand = new Command(async () => await ConnectToDevice()); |
|
69 |
bcReader.BarcodeDataReceivedEvent += DataReceived; |
|
70 |
} |
|
71 |
|
|
72 |
~BarcodeReaderViewModel() |
|
73 |
{ |
|
74 |
bcReader.BarcodeDataReceivedEvent -= DataReceived; |
|
75 |
} |
|
76 |
|
|
77 |
private void DataReceived(object sender, byte[] e) |
|
78 |
{ |
|
79 |
IsVisibleData = true; |
|
80 |
Data += Encoding.ASCII.GetString(e) + "\n"; |
|
81 |
} |
|
82 |
} |
|
83 |
} |
TestXamConnections/TestXamConnections/ViewModels/BluetoothReaderViewModel.cs | ||
---|---|---|
1 |
using System.Text; |
|
2 |
using System.Threading.Tasks; |
|
3 |
using System.Windows.Input; |
|
4 |
using TestXamConnections.Device; |
|
5 |
using TestXamConnections.Device.Barcode; |
|
6 |
using TestXamConnections.Device.Barcode.Honeywell; |
|
7 |
using Xamarin.Forms; |
|
8 |
|
|
9 |
namespace TestXamConnections.ViewModels |
|
10 |
{ |
|
11 |
public class BluetoothReaderViewModel : ViewModelBase |
|
12 |
{ |
|
13 |
private IBarcodeReader btReader; |
|
14 |
private bool isVisibleData; |
|
15 |
private string data; |
|
16 |
private string connectionIndicator; |
|
17 |
private string ciColor; |
|
18 |
|
|
19 |
public string CIColor |
|
20 |
{ |
|
21 |
get => ciColor; |
|
22 |
set => SetProperty(ref ciColor, value); |
|
23 |
} |
|
24 |
|
|
25 |
public string ConnectionIndicator |
|
26 |
{ |
|
27 |
get => connectionIndicator; |
|
28 |
set => SetProperty(ref connectionIndicator, value); |
|
29 |
} |
|
30 |
|
|
31 |
public string Data |
|
32 |
{ |
|
33 |
get => data; |
|
34 |
set => SetProperty(ref data, value); |
|
35 |
} |
|
36 |
|
|
37 |
public bool IsVisibleData |
|
38 |
{ |
|
39 |
get => isVisibleData; |
|
40 |
set => SetProperty(ref isVisibleData, value); |
|
41 |
} |
|
42 |
|
|
43 |
public IBarcodeReader BCReader |
|
44 |
{ |
|
45 |
get => btReader; |
|
46 |
set => SetProperty(ref btReader, value); |
|
47 |
} |
|
48 |
|
|
49 |
public async Task<bool> ConnectToDevice() |
|
50 |
{ |
|
51 |
if (await BCReader.ConnectToBTReaderAsync()) |
|
52 |
{ |
|
53 |
ConnectionIndicator = "Connecté"; |
|
54 |
CIColor = "Green"; |
|
55 |
return true; |
|
56 |
} |
|
57 |
else |
|
58 |
{ |
|
59 |
ConnectionIndicator = "Non Connecté"; |
|
60 |
CIColor = "Red"; |
|
61 |
return false; |
|
62 |
} |
|
63 |
} |
|
64 |
|
|
65 |
public ICommand ConnectToDeviceCommand { get; private set; } |
|
66 |
|
|
67 |
public BluetoothReaderViewModel(DeviceInfo deviceI) |
|
68 |
{ |
|
69 |
CIColor = "Red"; |
|
70 |
ConnectionIndicator = "Non connecté"; |
|
71 |
IsVisibleData = false; |
|
72 |
BCReader = new HoneywellBTReader(deviceI); |
|
73 |
ConnectToDeviceCommand = new Command(async () => await ConnectToDevice()); |
|
74 |
BCReader.BarcodeDataReceivedEvent += DataReceived; |
|
75 |
} |
|
76 |
|
|
77 |
private void DataReceived(object sender, byte[] e) |
|
78 |
{ |
|
79 |
IsVisibleData = true; |
|
80 |
Data += Encoding.ASCII.GetString(e) + "\n"; |
|
81 |
} |
|
82 |
} |
|
83 |
} |
TestXamConnections/TestXamConnections/ViewModels/CommandItemViewModel.cs | ||
---|---|---|
1 | 1 |
using System.Collections.Generic; |
2 |
using static TestXamConnections.Device.Balance.Teo.TeoConstants;
|
|
2 |
using TestXamConnections.Device.Balance.Balea;
|
|
3 | 3 |
|
4 | 4 |
namespace TestXamConnections.ViewModels |
5 | 5 |
{ |
6 | 6 |
public class CommandItemViewModel : ViewModelBase |
7 | 7 |
{ |
8 | 8 |
private string name; |
9 |
private TeoCommandType toSendCommand; |
|
9 |
private TeoConstants.TeoCommandType toSendCommand;
|
|
10 | 10 |
private string commandBytes; |
11 | 11 |
|
12 | 12 |
public string CommandBytes |
13 | 13 |
{ |
14 |
get { return commandBytes; }
|
|
15 |
set { SetProperty( ref commandBytes, value); }
|
|
14 |
get => commandBytes;
|
|
15 |
set => SetProperty(ref commandBytes, value);
|
|
16 | 16 |
} |
17 | 17 |
|
18 | 18 |
public string Name |
19 | 19 |
{ |
20 |
get { return name; }
|
|
21 |
set { SetProperty(ref name, value); }
|
|
20 |
get => name;
|
|
21 |
set => SetProperty(ref name, value);
|
|
22 | 22 |
} |
23 | 23 |
|
24 |
public TeoCommandType ToSendCommand |
|
24 |
public TeoConstants.TeoCommandType ToSendCommand
|
|
25 | 25 |
{ |
26 |
get { return toSendCommand; }
|
|
27 |
set { SetProperty( ref toSendCommand, value); }
|
|
26 |
get => toSendCommand;
|
|
27 |
set => SetProperty(ref toSendCommand, value);
|
|
28 | 28 |
} |
29 | 29 |
|
30 |
public CommandItemViewModel(TeoCommandType cmd) |
|
30 |
public CommandItemViewModel(TeoConstants.TeoCommandType cmd)
|
|
31 | 31 |
{ |
32 | 32 |
ToSendCommand = cmd; |
33 |
Name = TeoCommandNames.GetValueOrDefault(cmd); |
|
34 |
CommandBytes = string.Join("-", TeoCommandValues.GetValueOrDefault(cmd)); |
|
33 |
Name = TeoConstants.TeoCommandNames.GetValueOrDefault(cmd);
|
|
34 |
CommandBytes = string.Join("-", TeoConstants.TeoCommandValues.GetValueOrDefault(cmd));
|
|
35 | 35 |
} |
36 | 36 |
|
37 | 37 |
} |
TestXamConnections/TestXamConnections/ViewModels/InternServiceViewModel.cs | ||
---|---|---|
1 | 1 |
using System; |
2 | 2 |
using System.Threading.Tasks; |
3 | 3 |
using System.Windows.Input; |
4 |
using TestXamConnections.Device.RFID; |
|
4 | 5 |
using TestXamConnections.Device.RFID.Agrident; |
5 | 6 |
using Xamarin.Forms; |
6 | 7 |
|
... | ... | |
8 | 9 |
{ |
9 | 10 |
public class InternServiceViewModel : ViewModelBase |
10 | 11 |
{ |
12 |
private readonly IRFIDReader agridentReader; |
|
13 |
|
|
11 | 14 |
private bool isScanning; |
12 | 15 |
private bool showRFID; |
13 | 16 |
private bool showError; |
14 |
private readonly AgridentInternReader agridentReader; |
|
15 | 17 |
private string rfidResult; |
16 | 18 |
private string errorMessage; |
17 | 19 |
|
18 | 20 |
public bool ShowRFID |
19 | 21 |
{ |
20 |
get { return showRFID; }
|
|
21 |
set { SetProperty(ref showRFID, value); }
|
|
22 |
get => showRFID;
|
|
23 |
set => SetProperty(ref showRFID, value);
|
|
22 | 24 |
} |
23 | 25 |
|
24 | 26 |
public bool ShowError |
25 | 27 |
{ |
26 |
get { return showError; }
|
|
27 |
set { SetProperty( ref showError, value); }
|
|
28 |
get => showError;
|
|
29 |
set => SetProperty(ref showError, value);
|
|
28 | 30 |
} |
29 | 31 |
|
30 | 32 |
public bool IsScanning |
31 | 33 |
{ |
32 |
get { return isScanning; }
|
|
33 |
set { SetProperty(ref isScanning, value); }
|
|
34 |
get => isScanning;
|
|
35 |
set => SetProperty(ref isScanning, value);
|
|
34 | 36 |
} |
35 | 37 |
|
36 | 38 |
public string RFIDResult |
37 | 39 |
{ |
38 |
get { return rfidResult; }
|
|
39 |
set { SetProperty(ref rfidResult, value); }
|
|
40 |
get => rfidResult;
|
|
41 |
set => SetProperty(ref rfidResult, value);
|
|
40 | 42 |
} |
41 | 43 |
|
42 | 44 |
public string ErrorMessage |
43 | 45 |
{ |
44 |
get { return errorMessage; }
|
|
45 |
set { SetProperty(ref errorMessage, value); }
|
|
46 |
get => errorMessage;
|
|
47 |
set => SetProperty(ref errorMessage, value);
|
|
46 | 48 |
} |
47 | 49 |
|
48 | 50 |
private async Task StartScan() |
... | ... | |
63 | 65 |
ShowError = false; |
64 | 66 |
RFIDResult = ""; |
65 | 67 |
ErrorMessage = ""; |
66 |
agridentReader = new AgridentInternReader();
|
|
68 |
agridentReader = RFIDReaderProvider.GetRFIDReader(RFIDDevice.AgridentIntern, Connection.ConnectionType.Intern, new Device.DeviceInfo()) ;
|
|
67 | 69 |
agridentReader.RFIDDataReceivedEvent += OnRFIDResultReceived; |
68 | 70 |
bool err = agridentReader.EnableServiceAsync().Result; |
69 | 71 |
StartScanCommand = new Command(async () => await StartScan()); |
TestXamConnections/TestXamConnections/ViewModels/TeoDeviceViewModel.cs | ||
---|---|---|
2 | 2 |
using System.Collections.ObjectModel; |
3 | 3 |
using System.Threading.Tasks; |
4 | 4 |
using System.Windows.Input; |
5 |
using TestXamConnections.Connection; |
|
5 | 6 |
using TestXamConnections.Device; |
6 | 7 |
using TestXamConnections.Device.Balance; |
7 |
using TestXamConnections.Device.Balance.Teo;
|
|
8 |
using TestXamConnections.Device.Balance.Balea;
|
|
8 | 9 |
using TestXamConnections.Models; |
9 | 10 |
using Xamarin.Forms; |
10 |
using static TestXamConnections.Device.Balance.Teo.TeoConstants; |
|
11 | 11 |
|
12 | 12 |
namespace TestXamConnections.ViewModels |
13 | 13 |
{ |
14 | 14 |
public class TeoDeviceViewModel : ViewModelBase |
15 | 15 |
{ |
16 |
private IBalance teoScale; |
|
16 | 17 |
private bool isConnected; |
17 | 18 |
private string data; |
18 |
private IBalance teoScale; |
|
19 | 19 |
private bool isVisibleData; |
20 | 20 |
private bool showError; |
21 | 21 |
private string errorMessage; |
22 | 22 |
|
23 |
public bool IsVisibleData
|
|
23 |
public IBalance TeoScale
|
|
24 | 24 |
{ |
25 |
get { return isVisibleData; }
|
|
26 |
set { SetProperty(ref isVisibleData, value); }
|
|
25 |
get => teoScale;
|
|
26 |
set => SetProperty(ref teoScale, value);
|
|
27 | 27 |
} |
28 | 28 |
|
29 |
public bool IsConnected
|
|
29 |
public bool IsVisibleData
|
|
30 | 30 |
{ |
31 |
get { return isConnected; }
|
|
32 |
set { SetProperty(ref isConnected, value); }
|
|
31 |
get => isVisibleData;
|
|
32 |
set => SetProperty(ref isVisibleData, value);
|
|
33 | 33 |
} |
34 | 34 |
|
35 |
public IBalance TeoScale
|
|
35 |
public bool IsConnected
|
|
36 | 36 |
{ |
37 |
get { return teoScale; }
|
|
38 |
set { SetProperty(ref teoScale, value); }
|
|
37 |
get => isConnected;
|
|
38 |
set => SetProperty(ref isConnected, value);
|
|
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
public string Data |
42 | 42 |
{ |
43 |
get { return data; }
|
|
44 |
set { SetProperty(ref data, value); }
|
|
43 |
get => data;
|
|
44 |
set => SetProperty(ref data, value);
|
|
45 | 45 |
} |
46 | 46 |
|
47 | 47 |
public bool ShowError |
48 | 48 |
{ |
49 |
get { return showError; }
|
|
50 |
set { SetProperty(ref showError, value); }
|
|
49 |
get => showError;
|
|
50 |
set => SetProperty(ref showError, value);
|
|
51 | 51 |
} |
52 | 52 |
|
53 | 53 |
public string ErrorMessage |
54 | 54 |
{ |
55 |
get { return errorMessage; }
|
|
56 |
set { SetProperty(ref errorMessage, value); }
|
|
55 |
get => errorMessage;
|
|
56 |
set => SetProperty(ref errorMessage, value);
|
|
57 | 57 |
} |
58 | 58 |
|
59 | 59 |
public ObservableCollection<CommandItemViewModel> AvailableCommandsList { get; set; } |
... | ... | |
61 | 61 |
public async Task<bool> ConnectToDevice() |
62 | 62 |
{ |
63 | 63 |
ShowError = false; |
64 |
IsConnected = await teoScale.ConnectToBalanceAsync();
|
|
64 |
IsConnected = await TeoScale.ConnectToBalanceAsync();
|
|
65 | 65 |
return IsConnected; |
66 | 66 |
} |
67 | 67 |
|
68 | 68 |
public ICommand ConnectToDeviceCommand { private set; get; } |
69 | 69 |
public ICommand SendValueCommand { private set; get; } |
70 | 70 |
|
71 |
public TeoDeviceViewModel(DeviceInfo device)
|
|
71 |
public void Init()
|
|
72 | 72 |
{ |
73 |
TeoScale = new TeoBalance(device);
|
|
73 |
// Init View Model
|
|
74 | 74 |
ShowError = false; |
75 | 75 |
IsConnected = false; |
76 | 76 |
IsVisibleData = false; |
77 | 77 |
ConnectToDeviceCommand = new Command(async () => await ConnectToDevice()); |
78 |
SendValueCommand = new Command(async (cmd) => await teoScale.SendCommandAsync((TeoCommandType)cmd));
|
|
79 |
TeoScale.PeseeReceivedEvent = PeseeReceived; |
|
78 |
SendValueCommand = new Command(async (cmd) => await TeoScale.SendCommandAsync((TeoConstants.TeoCommandType)cmd));
|
|
79 |
TeoScale.PeseeReceivedEvent += PeseeReceived;
|
|
80 | 80 |
|
81 |
// Ajout manuel des commandes
|
|
81 |
// Chargement des commandes
|
|
82 | 82 |
AvailableCommandsList = new ObservableCollection<CommandItemViewModel>(); |
83 |
foreach (TeoCommandType _cmd in Enum.GetValues(typeof(TeoCommandType)))
|
|
83 |
foreach (TeoConstants.TeoCommandType _cmd in Enum.GetValues(typeof(TeoConstants.TeoCommandType)))
|
|
84 | 84 |
{ |
85 | 85 |
AvailableCommandsList.Add(new CommandItemViewModel(_cmd)); |
86 | 86 |
} |
87 |
|
|
88 |
} |
|
89 |
|
|
90 |
public TeoDeviceViewModel(DeviceInfo device) |
|
91 |
{ |
|
92 |
// Appel au Balance provider pour récupérer l'item TeoBalancea avec les fonctions d'initiation |
|
93 |
TeoScale = BalanceProvider.GetBalance(Balance.TeoBalance, ConnectionType.Bluetooth, device); |
|
94 |
Init(); |
|
95 |
} |
|
96 |
|
|
97 |
~TeoDeviceViewModel() |
|
98 |
{ |
|
99 |
TeoScale.PeseeReceivedEvent -= PeseeReceived; |
|
87 | 100 |
} |
88 | 101 |
|
89 | 102 |
public void PeseeReceived(object sender, ReponsePesee args) |
TestXamConnections/TestXamConnections/Views/AccueilView.xaml | ||
---|---|---|
10 | 10 |
<StackLayout BackgroundColor="#001729" VerticalOptions="FillAndExpand"> |
11 | 11 |
<StackLayout VerticalOptions="CenterAndExpand"> |
12 | 12 |
<Frame |
13 |
Margin="0,20" |
|
13 | 14 |
Padding="0" |
14 | 15 |
BackgroundColor="Transparent" |
15 | 16 |
BorderColor="#4f5a64" |
... | ... | |
25 | 26 |
FontSize="18" |
26 | 27 |
HorizontalOptions="CenterAndExpand" |
27 | 28 |
HorizontalTextAlignment="Center" |
28 |
Text="Teo Test Bluetooth"
|
|
29 |
Text="Appareil Bluetooth"
|
|
29 | 30 |
TextColor="White" |
30 | 31 |
VerticalOptions="CenterAndExpand" /> |
31 | 32 |
<BoxView |
... | ... | |
94 | 95 |
<Label |
95 | 96 |
FontAttributes="Bold" |
96 | 97 |
HorizontalTextAlignment="Center" |
97 |
Text="{Binding Device.Name}" |
|
98 |
Text="{Binding DeviceI.Name}"
|
|
98 | 99 |
TextColor="White" /> |
99 | 100 |
<Label |
100 | 101 |
FontSize="12" |
101 | 102 |
HorizontalTextAlignment="Center" |
102 |
Text="{Binding Device.MACAddress}" |
|
103 |
Text="{Binding DeviceI.MACAddress}"
|
|
103 | 104 |
TextColor="DarkGray" /> |
104 | 105 |
</StackLayout> |
105 | 106 |
</DataTemplate> |
... | ... | |
109 | 110 |
</StackLayout> |
110 | 111 |
</Frame> |
111 | 112 |
|
112 |
<xe:BorderView |
|
113 |
Margin="0,20,0,0" |
|
114 |
xe:Commands.Tap="{Binding NavigateToInternServiceCommand}" |
|
115 |
xe:TouchEffect.Color="#0060a8" |
|
116 |
BackgroundColor="#003266" |
|
117 |
CornerRadius="65" |
|
118 |
HorizontalOptions="Center"> |
|
119 |
<StackLayout Padding="15,10"> |
|
113 |
<Frame |
|
114 |
Margin="0,20" |
|
115 |
Padding="0" |
|
116 |
BackgroundColor="Transparent" |
|
117 |
BorderColor="#4f5a64" |
|
118 |
CornerRadius="5" |
|
119 |
HasShadow="False" |
|
120 |
HorizontalOptions="Center" |
|
121 |
VerticalOptions="CenterAndExpand" |
|
122 |
WidthRequest="200"> |
|
123 |
<StackLayout Spacing="0"> |
|
120 | 124 |
<Label |
121 |
FontSize="16" |
|
122 |
HorizontalOptions="Center" |
|
125 |
Margin="0,10" |
|
126 |
FontAttributes="Bold" |
|
127 |
FontSize="18" |
|
128 |
HorizontalOptions="CenterAndExpand" |
|
123 | 129 |
HorizontalTextAlignment="Center" |
124 |
Text="Service interne" |
|
125 |
TextColor="#34a9ff" /> |
|
130 |
Text="Connection Interne" |
|
131 |
TextColor="White" |
|
132 |
VerticalOptions="CenterAndExpand" /> |
|
133 |
|
|
134 |
<BoxView |
|
135 |
HeightRequest="1" |
|
136 |
HorizontalOptions="FillAndExpand" |
|
137 |
Color="#4f5a64" /> |
|
138 |
|
|
139 |
<xe:BorderView |
|
140 |
Margin="0,20" |
|
141 |
xe:Commands.Tap="{Binding NavigateToInternServiceCommand}" |
|
142 |
xe:TouchEffect.Color="#0060a8" |
|
143 |
BackgroundColor="#003266" |
|
144 |
CornerRadius="65" |
|
145 |
HorizontalOptions="Center"> |
|
146 |
<StackLayout Padding="15,10"> |
|
147 |
<Label |
|
148 |
FontSize="16" |
|
149 |
HorizontalOptions="Center" |
|
150 |
HorizontalTextAlignment="Center" |
|
151 |
Text="Service interne" |
|
152 |
TextColor="#34a9ff" /> |
|
153 |
</StackLayout> |
|
154 |
</xe:BorderView> |
|
126 | 155 |
</StackLayout> |
127 |
</xe:BorderView>
|
|
156 |
</Frame>
|
|
128 | 157 |
|
129 | 158 |
</StackLayout> |
130 | 159 |
</StackLayout> |
TestXamConnections/TestXamConnections/Views/BluetoothReaderView.xaml.cs | ||
---|---|---|
11 | 11 |
public BluetoothReaderView(DeviceInfo deviceI) |
12 | 12 |
{ |
13 | 13 |
InitializeComponent(); |
14 |
BindingContext = new BluetoothReaderViewModel(deviceI);
|
|
14 |
BindingContext = new BarcodeReaderViewModel(deviceI);
|
|
15 | 15 |
} |
16 | 16 |
} |
17 | 17 |
} |
TestXamConnections/TestXamConnections/Views/TeoDeviceView.xaml | ||
---|---|---|
88 | 88 |
FontSize="28" |
89 | 89 |
HorizontalOptions="CenterAndExpand" |
90 | 90 |
HorizontalTextAlignment="Center" |
91 |
Text="{Binding TeoScale.Name}" |
|
91 |
Text="{Binding TeoScale.DeviceI.Name}"
|
|
92 | 92 |
TextColor="White" |
93 | 93 |
VerticalOptions="CenterAndExpand" /> |
94 | 94 |
<Label |
... | ... | |
97 | 97 |
FontSize="12" |
98 | 98 |
HorizontalOptions="CenterAndExpand" |
99 | 99 |
HorizontalTextAlignment="Center" |
100 |
Text="{Binding TeoScale.MACAddress}" |
|
100 |
Text="{Binding TeoScale.DeviceI.MACAddress}"
|
|
101 | 101 |
TextColor="DarkGray" |
102 | 102 |
VerticalOptions="CenterAndExpand" /> |
103 | 103 |
</StackLayout> |
Formats disponibles : Unified diff