예제 #1
0
 private void HandleFailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs e)
 {
     System.Threading.Tasks.Task.Run(() =>
     {
         GetPeripheralManager().HandleFailedToConnectPeripheral(e);
     }).FireAndForget();
 }
예제 #2
0
        private void DisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            var deviceId = Device.DeviceIdentifierToGuid(e.Peripheral.Identifier);
            //var device = _devices.FirstOrDefault (x => x.Id == deviceId);
            var device = new Device(e.Peripheral);

            DeviceDisconnected(this, new DeviceConnectionEventArgs(device));
        }
예제 #3
0
        void DisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            var peripheral     = e.Peripheral;
            var ble_peripheral = devices [peripheral.Identifier.ToString()];

            ble_peripheral.State = "Disconnected";

            OnSomethingHappened();
        }
예제 #4
0
        private void OnFailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            if (!ReferenceEquals(e.Peripheral, Peripheral))
            {
                return;
            }

            RaiseConnectFailed(e.Error.ToShared());
        }
예제 #5
0
        void FailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            var peripheral     = e.Peripheral;
            var ble_peripheral = devices [peripheral.Identifier.ToString()];

            ble_peripheral.State = "Failed to connect";

            OnSomethingHappened();
        }
예제 #6
0
        private void FailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            var device = new Device(e.Peripheral);
            var args   = new DeviceConnectionEventArgs(device)
            {
                ErrorMessage = e.Error.Description
            };

            DeviceFailedToConnect(this, args);
        }
예제 #7
0
        private void DisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            var deviceId        = Device.DeviceIdentifierToGuid(e.Peripheral.Identifier);
            var connectedDevice = ConnectedDevices.FirstOrDefault(x => x.Id == deviceId);

            if (connectedDevice != null)
            {
                ConnectedDevices.Remove(connectedDevice);
                DeviceDisconnected(this, new DeviceConnectionEventArgs(connectedDevice));
            }
        }
예제 #8
0
		void HandleDeviceDisconnected (object sender, CBPeripheralErrorEventArgs e)
		{
			string title = string.Format ("Peripheral Disconnected {0} disconnected", e.Peripheral.Name);

			var alert = new UIAlertView (title, null, null, "ok", null);
			alert.Clicked += (s, args) => {
				Console.WriteLine ("Alert.Clicked");
				NavigationController.PopToRootViewController (true);
			};
			alert.Show ();
		}
예제 #9
0
        void HandleDeviceDisconnected(object sender, CBPeripheralErrorEventArgs e)
        {
            string title = string.Format("Peripheral Disconnected {0} disconnected", e.Peripheral.Name);

            var alert = new UIAlertView(title, null, null, "ok", null);

            alert.Clicked += (s, args) => {
                Console.WriteLine("Alert.Clicked");
                NavigationController.PopToRootViewController(true);
            };
            alert.Show();
        }
예제 #10
0
        private void OnDisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            if (!ReferenceEquals(e.Peripheral, Peripheral))
            {
                return;
            }

            if (e.Error != null)
            {
                RaiseConnectionLost(e.Error.ToShared());
            }
            else
            {
                RaiseDisconnected();
            }
        }
예제 #11
0
        static void OnManagerDisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            Console.WriteLine("Disconnected peripheral: " + e.Error?.ToString());

            peripheral.DiscoveredService             -= OnPeripheralDiscoveredService;
            peripheral.DiscoveredCharacteristic      -= OnPeripheralDiscoveredCharacteristic;
            peripheral.UpdatedCharacterteristicValue -= OnPeripheralUpdatedCharacteristicValue;
            peripheral = null;

            IsConnected = false;

            if (Disconnected != null)
            {
                Disconnected(null, EventArgs.Empty);
            }

            Connect(e.Peripheral);
        }
예제 #12
0
        void OnDisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
            BLEPeripheral peripheral = null;

            foreach (BLEPeripheral blep in discoveredPeripherals)
            {
                if (blep.UUID.StringValue == e.Peripheral.ToString())
                {
                    peripheral = blep;

                    break;
                }
            }

            EventHandler <BLEPeripheralErrorEventArgs> handler = DisconnectedFromPeripheral;

            if (handler != null)
            {
                BLEPeripheralErrorEventArgs args = new BLEPeripheralErrorEventArgs();
                args.Peripheral = peripheral;
                args.Error      = e.Error?.ToString();
            }
        }
 private void OnFailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs e)
 => _wes.RaiseEvent(nameof(FailedToConnectPeripheral), sender, e);
 private void OnDisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
 => _wes.RaiseEvent(nameof(DisconnectedPeripheral), sender, e);
예제 #15
0
		private void FailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs e)
		{
			var device = new Device(e.Peripheral);
			var args = new DeviceConnectionEventArgs(device) {
				ErrorMessage = e.Error.Description
			};

			DeviceFailedToConnect(this, args);
		}
예제 #16
0
 private void ManagerOnDisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
 {
 }
예제 #17
0
        // connection

        private void ManagerOnFailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs e)
        {
        }
예제 #18
0
		private void DisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
		{
			var deviceId = Device.DeviceIdentifierToGuid(e.Peripheral.Identifier);
			var connectedDevice = ConnectedDevices.FirstOrDefault(x => x.Id == deviceId);

			if (connectedDevice != null)
			{
				ConnectedDevices.Remove(connectedDevice);
				DeviceDisconnected(this, new DeviceConnectionEventArgs(connectedDevice));
			}
		}
예제 #19
0
 void DisconnectedPeripheral(object sender, CBPeripheralErrorEventArgs e)
 {
     central.DisconnectedPeripheral -= DisconnectedPeripheral;
     DisconnectedFromPeripheralEventHandler?.Invoke(this, new DisconnectedFromPeripheralEventArgs(connectedPeripheral));
 }
예제 #20
0
 void FailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs e)
 {
     FailureEventHandler?.Invoke(this, new BluetoothFailureEventArgs(e.Error.Description));
 }
예제 #21
0
 private void OnFailedToConnectPeripheral(object sender, CBPeripheralErrorEventArgs args)
 {
     _connectedPeripheralTaskSource.TrySetException(
         new Exception("Failed to connect peripheral: " + args.Peripheral.Name));
 }
예제 #22
0
        public void HandleDisconnectedPeripheral(CBPeripheralErrorEventArgs evnt)
        {
            var descriptor = evnt.Peripheral.ToDeviceDescriptor();

            _manager.HandleDeviceDisconnected(descriptor, null);
        }
예제 #23
0
        public void HandleFailedToConnectPeripheral(CBPeripheralErrorEventArgs evnt)
        {
            var descriptor = evnt.Peripheral.ToDeviceDescriptor();

            _manager.HandleDeviceFailedToConnect(descriptor, null);
        }