protected override async void InitializeNative()
        {
            //create local helper using the app context
            BluetoothLEHelper localHelper = BluetoothLEHelper.Context;

            this._bluetoothHelper = localHelper;

            // BloubulLE: We want to get the actually state and its changes.
            try
            {
                RadioAccessStatus tAccessStatus = await Radio.RequestAccessAsync();

                if (tAccessStatus == RadioAccessStatus.Allowed)
                {
                    BluetoothAdapter tAdapter = await BluetoothAdapter.GetDefaultAsync();

                    if (tAdapter != null)
                    {
                        this.DefaultRadio = await tAdapter.GetRadioAsync();

                        if (this.DefaultRadio != null)
                        {
                            this.DefaultRadio.StateChanged += this.OnRadioStateChanged;
                            this.OnRadioStateChanged(this.DefaultRadio, this);
                        }
                    }
                }
            }
            catch (Exception iEx)
            {
                //-
            }
        }
        protected override void InitializeNative()
        {
            //create local helper using the app context
            var localHelper = BluetoothLEHelper.Context;

            _bluetoothHelper = localHelper;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Called when the users starts the device enumeration
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void OnFindDevices(object sender, RoutedEventArgs e)
        {
            ShowFeedback("Starting find for BTLE Devices");

            await Windows.System.Threading.ThreadPool.RunAsync(_ =>
            {
                ble = BluetoothLEHelper.Instance;
                ble.StartEnumeration();
            });
        }
    public void OnEnumerateClicked()
    {
        ShowFeedback("OnEnumerateClicked");
#if UNITY_WSA_10_0 && !UNITY_EDITOR
        if (ble == null)
        {
            ble = BluetoothLEHelper.Instance;
        }
        ble.StartEnumeration();
#endif
    }
Exemplo n.º 5
0
 //--------------------------------------------------------Constructor:----------------------------------------------------------------\\
 #region --Constructors--
 /// <summary>
 /// Basic Constructor
 /// </summary>
 /// <history>
 /// 15/03/2018 Created [Fabian Sauter]
 /// </history>
 public ConnectBoardControl()
 {
     this.bluetoothLEHelper = BluetoothLEHelper.Context;
     this.InitializeComponent();
 }
 public Adapter(BluetoothLEHelper bluetoothHelper)
 {
     _bluetoothHelper        = bluetoothHelper;
     ConnectedDeviceRegistry = new Dictionary <string, IDevice>();
 }