void OnStateChanged(BluetoothStateChangedArgs args)
        {
            switch (args.NewState)
            {
            case BluetoothState.On:
                _bluetoothState = BluetoothState.On;

                AnimationView.Animation         = "loader.json";
                AnimationView.IsVisible         = true;
                labelStatus.Text                = "En cours...";
                labelStatusDescription.Text     = "Votre Find Me est en cours de connexion";
                successConnectedImage.IsVisible = false;

                // Start scan
                _bleService.TryStartScanning(true);
                return;

            case BluetoothState.Off:
                _bleService.StopScan();

                _bluetoothState = BluetoothState.Off;

                AnimationView.Animation         = "cloud.json";
                AnimationView.IsVisible         = true;
                labelStatus.Text                = "Erreur";
                labelStatusDescription.Text     = "Le bluetooth de cet appareil semble désactivé.";
                successConnectedImage.IsVisible = false;
                buttonRetry.IsVisible           = false;
                buttonStart.IsEnabled           = false;
                return;

            default:
                return;
            }
        }
Ejemplo n.º 2
0
        private void BluetoothLeOnStateChanged(object sender, BluetoothStateChangedArgs bluetoothStateChangedArgs)
        {
            switch (bluetoothStateChangedArgs.NewState)
            {
            case BluetoothState.Unknown:
                break;

            case BluetoothState.Unavailable:
                OnError("Bluetooth error", GetStateText(bluetoothStateChangedArgs.NewState));
                break;

            case BluetoothState.Unauthorized:
                OnError("Bluetooth error", GetStateText(bluetoothStateChangedArgs.NewState));
                break;

            case BluetoothState.TurningOn:
                break;

            case BluetoothState.On:
                break;

            case BluetoothState.TurningOff:
                break;

            case BluetoothState.Off:
                OnError("Bluetooth error", GetStateText(bluetoothStateChangedArgs.NewState));
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 3
0
        public void OnStateChanged(object sender, BluetoothStateChangedArgs args)
        {
            System.Diagnostics.Debug.WriteLine("State changed - New state : " + args.NewState + " Old state : " + args.OldState);

            // Send message
            MessagingCenter.Send <BLEService, BluetoothStateChangedArgs>(this, "stateChanged", args);
        }
Ejemplo n.º 4
0
 private void Ble_StateChanged(object sender, BluetoothStateChangedArgs e)
 {
     Status = e.NewState switch
     {
         BluetoothState.TurningOn => AccelerometerStatus.BluetoothTurningOn,
         BluetoothState.On => AccelerometerStatus.NotConnected,
         _ => AccelerometerStatus.BluetoothTurnedOff,
     };
 }
 private void OnStateChanged(object sender, BluetoothStateChangedArgs e)
 {
     RaisePropertyChanged(nameof(IsStateOn));
     RaisePropertyChanged(nameof(StateText));
 }
Ejemplo n.º 6
0
        /**************************************************************************
        *
        *   Event handlers
        *
        **************************************************************************/

        private void OnStateChanged(object sender, BluetoothStateChangedArgs e)
        {
            Log.Debug("MAIN", $"##### State changed to {e.NewState.ToString()}");
        }
 private void OnStateChanged(object sender, BluetoothStateChangedArgs e)
 {
     BleStatus = GetStateText();
 }
Ejemplo n.º 8
0
 private void OnStateChanged(object sender, BluetoothStateChangedArgs e)
 {
 }
Ejemplo n.º 9
0
 private void OnStateChanged(object sender, BluetoothStateChangedArgs e)
 {
     btnScan.IsEnabled = e.NewState == BluetoothState.On;
     RefreshToast("Bluetooth State: " + e.NewState.ToString());
 }
 private void Ble_StateChanged(object sender, BluetoothStateChangedArgs e)
 {
     OnPropertyChanged();
 }
Ejemplo n.º 11
0
 private void OnStateChanged(object sender, BluetoothStateChangedArgs stateChangedArgs)
 {
     Debug.WriteLine($"The bluetooth state changed to {stateChangedArgs.NewState}");
 }