private void TransmitCurrentDigit() { DigitViewModel model = (DigitViewModel)BindingContext; if (model != null && !model.Reciving) { App.CurrentBluetoothConnection.Transmit(new Memory <byte>(new byte[] { model.Digit })); } }
public DigitPage() { InitializeComponent(); DigitViewModel model = (DigitViewModel)BindingContext; model.PropertyChanged += Model_PropertyChanged; if (App.CurrentBluetoothConnection != null) { App.CurrentBluetoothConnection.OnStateChanged += CurrentBluetoothConnection_OnStateChanged; App.CurrentBluetoothConnection.OnRecived += CurrentBluetoothConnection_OnRecived; App.CurrentBluetoothConnection.OnError += CurrentBluetoothConnection_OnError; } }
private void CurrentBluetoothConnection_OnRecived(object sender, Plugin.BluetoothClassic.Abstractions.RecivedEventArgs recivedEventArgs) { DigitViewModel model = (DigitViewModel)BindingContext; if (model != null) { model.SetReciving(); for (int index = 0; index < recivedEventArgs.Buffer.Length; index++) { byte value = recivedEventArgs.Buffer.ToArray()[index]; model.Digit = value; } model.SetRecived(); } }