示例#1
0
        private void Btn_Start_Click(object sender, RoutedEventArgs e)
        {
            m_Adapter = new BleAdapter();

            m_Adapter.StartWatcher();
            m_Adapter.DeviceAddedEvent   += Adapter_DeviceAddedEvent;
            m_Adapter.EnumCompletedEvent += Adapter_HandlerEnumCompleted;
        }
        public Task InitializeAsync()
        {
            connectiontcs = new TaskCompletionSource <IMovesenseDevice>();

            if (BleAdapter.Status == AdapterStatus.PoweredOn)
            {
                scan = this.BleAdapter.Scan().Subscribe(this.OnScanResult);
            }
            else
            {
                BleAdapter.WhenStatusChanged().Subscribe(status =>
                {
                    if (status == AdapterStatus.PoweredOn)
                    {
                        scan = this.BleAdapter.Scan().Subscribe(this.OnScanResult);
                    }
                });
            }

            return(connectiontcs.Task);
        }
 public BluetoothLowEnergyServer(IAdapter adapter) : base(BleAdapter.Wrap(adapter))
 {
 }