コード例 #1
0
        Task OnDeviceConnected(DeviceConnectedEvent arg)
        {
            if (AutomaticallyUploadFirmware || arg.DeviceViewModel.IsBoot)
            {
                return(arg.DeviceViewModel.StartFirmwareUpdate(FirmwareFilePath));
            }

            return(Task.CompletedTask);
        }
コード例 #2
0
        /// <summary>
        /// Event handler to receive notice that the device has connected
        /// </summary>
        /// <param name="sender">Sender</param>
        /// <param name="e">Event args including the device info</param>
        private void _bleManager_DeviceConnectedEvent(object sender, DeviceEventArgs e)
        {
            Log(string.Format("Device {0} [{1}] connected", e.Device.Name, e.Device.Address));

            DeviceInfo device = FindDeviceInfo(e.Device);

            if (device != null)
            {
                DeviceConnectedEvent?.Invoke(this, new DeviceInfoEventArgs(FindDeviceInfo(e.Device)));
            }
        }
コード例 #3
0
 /// <summary>
 /// Clear all event handlers
 /// </summary>
 public void ClearEventHandlers()
 {
     if (DeviceConnectedEvent != null)
     {
         foreach (Delegate d in DeviceConnectedEvent?.GetInvocationList())
         {
             DeviceConnectedEvent -= (EventHandler <DeviceEventArgs>)d;
         }
     }
     if (DeviceReadyEvent != null)
     {
         foreach (Delegate d in DeviceReadyEvent?.GetInvocationList())
         {
             DeviceReadyEvent -= (EventHandler <DeviceEventArgs>)d;
         }
     }
     if (DeviceDisconnectedEvent != null)
     {
         foreach (Delegate d in DeviceDisconnectedEvent?.GetInvocationList())
         {
             DeviceDisconnectedEvent -= (EventHandler <DeviceEventArgs>)d;
         }
     }
     if (MtuChangeEvent != null)
     {
         foreach (Delegate d in MtuChangeEvent?.GetInvocationList())
         {
             MtuChangeEvent -= (EventHandler <DeviceMtuEventArgs>)d;
         }
     }
     if (ServicesDiscoveredEvent != null)
     {
         foreach (Delegate d in ServicesDiscoveredEvent?.GetInvocationList())
         {
             ServicesDiscoveredEvent -= (EventHandler <EventArgs>)d;
         }
     }
 }
コード例 #4
0
 public void RaiseDeviceConnectedEvent(IChannel channel)
 {
     Services.DispatcherServices.Invoke(() => DeviceConnectedEvent?.Invoke(this, channel));
 }
コード例 #5
0
 public void OnDeviceConnected(BluetoothDevice p0)
 {
     DeviceConnectedEvent?.Invoke(this, new DeviceEventArgs(p0));
 }
コード例 #6
0
 /// <summary>
 /// Event handler for when the device is connected
 /// </summary>
 /// <param name="sender">Sender</param>
 /// <param name="e">Event arguments including a Bluetooth device</param>
 private void _skfBleManagerCallbacks_DeviceConnectedEvent(object sender, DeviceEventArgs e)
 {
     _currentDevice = e.Device;
     DeviceConnectedEvent?.Invoke(this, new DeviceEventArgs(e.Device));
 }
コード例 #7
0
 public void Accept(DeviceConnectedEvent evt)
 {
     this.OnDeviceConnected(evt.Data.Id, evt.Data.Address);
 }