コード例 #1
0
        private void TransmitCurrentDigit()
        {
            DigitViewModel model = (DigitViewModel)BindingContext;

            if (model != null && !model.Reciving)
            {
                App.CurrentBluetoothConnection.Transmit(new Memory <byte>(new byte[] { model.Digit }));
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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();
            }
        }