Exemplo n.º 1
0
        public void GetAvailableDevices(SerialSearchStarted started, SerialSearchFound found, SerialSearchFinished finished)
        {
            started();

            foreach (string portName in SerialPort.GetPortNames())
            {
                found(portName);
            }

            finished();
        }
Exemplo n.º 2
0
        public void SearchAvailableDevices(SerialSearchStarted started, SerialSearchFound found, SerialSearchFinished finished)
        {
            // Search for bluetooth devices
            _bluetoothBroadcastRecevicer = new BluetoothBroadcastReceiver(started, found, finished);

            IntentFilter deviceFoundFilter = new IntentFilter(BluetoothDevice.ActionFound);

            Context.RegisterReceiver(_bluetoothBroadcastRecevicer, deviceFoundFilter);

            IntentFilter discoveryFinishedFilter = new IntentFilter(Android.Bluetooth.BluetoothAdapter.ActionDiscoveryFinished);

            Context.RegisterReceiver(_bluetoothBroadcastRecevicer, discoveryFinishedFilter);

            IntentFilter discoveryStartedFilter = new IntentFilter(Android.Bluetooth.BluetoothAdapter.ActionDiscoveryStarted);

            Context.RegisterReceiver(_bluetoothBroadcastRecevicer, discoveryStartedFilter);

            _bluetoothAdapter.StartDiscovery();
        }
Exemplo n.º 3
0
 public BluetoothBroadcastReceiver(SerialSearchStarted started, SerialSearchFound found, SerialSearchFinished finished)
 {
     _startedDelegate  = started;
     _foundDelegate    = found;
     _finishedDelegate = finished;
 }