/// <summary> /// Raises the characteristic write event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnCharacteristicWrite(IBleDevice sender, BleCharacteristicWriteEventArgs e) { if (CharacteristicWrite != null) { CharacteristicWrite(sender, e); } }
/// <summary> /// Raises the characteristic changed event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnCharacteristicChanged(IBleDevice sender, BleCharacteristicChangedEventArgs e) { if (CharacteristicChanged != null) { CharacteristicChanged(sender, e); } }
void sensor_ConnectionStateChanged(IBleDevice sender, BleConnectionStateChangedEventArgs e) { if (e.NewState == BleConnectionState.Disconnected) { this.SelectedDevice = null; } }
/// <summary> /// Raises the descriptor write event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnDescriptorWrite(IBleDevice sender, BleDescriptorWriteEventArgs e) { if (DescriptorWrite != null) { DescriptorWrite(sender, e); } }
/// <summary> /// Raises the descriptor read event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnDescriptorRead(IBleDevice sender, BleDescriptorReadEventArgs e) { if (DescriptorRead != null) { DescriptorRead(sender, e); } }
/// <summary> /// Raises the read remote rssi event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnReadRemoteRssi(IBleDevice sender, BleReadRemoteRssiEventArgs e) { if (ReadRemoteRssi != null) { ReadRemoteRssi(sender, e); } }
/// <summary> /// Raises the reliable write completed event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnReliableWriteCompleted(IBleDevice sender, BleReliableWriteCompletedEventArgs e) { if (ReliableWriteCompleted != null) { ReliableWriteCompleted(sender, e); } }
/// <summary> /// Raises the services discovered event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnServicesDiscovered(IBleDevice sender, BleServicesDiscoveredEventArgs e) { if (ServicesDiscovered != null) { ServicesDiscovered(sender, e); } }
void BleCyclingSensor_ServicesDiscovered(IBleDevice sender, BleServicesDiscoveredEventArgs e) { if (e.State == BleGattOperationState.Success) { object CSCMeasurement = this.GetCharacteristic(new Guid("00002a5b-0000-1000-8000-00805f9b34fb")); this.EnableNotifications(CSCMeasurement, true); } }
void BleCyclingSensor_ConnectionStateChanged(IBleDevice sender, BleConnectionStateChangedEventArgs e) { RaisePropertyChanged("ConnectionState"); if (ConnectionState == BleConnectionState.Connected) { this.DiscoverServices(); } }
/// <summary> /// Raises the connection state changed event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnConnectionStateChanged(IBleDevice sender, BleConnectionStateChangedEventArgs e) { ConnectionState = e.NewState; if (ConnectionStateChanged != null) { ConnectionStateChanged(sender, e); } }
/// <summary> /// Compares to. /// </summary> /// <returns>The to.</returns> /// <param name="obj">Object.</param> public int CompareTo(object obj) { IBleDevice otherDevice = obj as IBleDevice; if (otherDevice != null) { return(otherDevice.ID.CompareTo(this.ID)); } throw new NotSupportedException("Unable to compare: " + this.GetType() + " with " + obj.GetType()); }
/// <summary> /// Determines whether the specified <see cref="System.Object"/> is equal to the current <see cref="XBleApi.BleDevice"/>. /// </summary> /// <param name="obj">The <see cref="System.Object"/> to compare with the current <see cref="XBleApi.BleDevice"/>.</param> /// <returns><c>true</c> if the specified <see cref="System.Object"/> is equal to the current <see cref="XBleApi.BleDevice"/>; /// otherwise, <c>false</c>.</returns> public override bool Equals(object obj) { IBleDevice otherDevice = obj as IBleDevice; if (otherDevice != null) { return(otherDevice.ID == this.ID); } else { return(false); } }
void BleCyclingSensor_CharacteristicChanged(IBleDevice sender, BleCharacteristicChangedEventArgs e) { WheelRev = BitConverter.ToUInt32(e.CharacteristicValue, 1); WheelTime = BitConverter.ToUInt16(e.CharacteristicValue, 5); CrankRev = BitConverter.ToUInt16(e.CharacteristicValue, 7); CrankTime = BitConverter.ToUInt16(e.CharacteristicValue, 9); RaisePropertyChanged("WheelRev"); RaisePropertyChanged("WheelTime"); RaisePropertyChanged("CrankRev"); RaisePropertyChanged("CrankTime"); }
/// <summary> /// Create a BLE device proxy object from a BLE device information /// </summary> /// <param name="device_info">BLE device information to use</param> /// <returns>BLE device proxy object on success, null otherwise</returns> public async Task <IBleDevice> CreateDeviceAsync(BleDeviceInformation device_info) { IBleDevice ble_device = null; UwpBleDevice win_ble_device = new UwpBleDevice(device_info); bool init_succeed = await win_ble_device.Initialize(); if (init_succeed) { ble_device = win_ble_device; } return(ble_device); }
async void Connect(object param) { if (lvDevices.SelectedItem != null) { lbStatus.Text = "Connecting..."; IBleDevice ble_device = await _ble_stack.CreateDeviceAsync(lvDevices.SelectedItem as BleDeviceInformation); _open_vario_device = new OpenVarioDevice(ble_device); if (await _open_vario_device.Initialize()) { lbStatus.Text = "Connected!"; } else { lbStatus.Text = "Not an Open Vario device!"; } } }
/// <summary> /// Constructor /// </summary> /// <param name="ble_device">BLE device proxy to use to communicate with the Open Vario device</param> /// <param name="ble_service">BLE service representing the altimeter service</param> public AltimeterService(IBleDevice ble_device, BleGattService ble_service) : base(ble_device, ble_service) { _altitude_characteristics = new Dictionary <Altitude, BleGattCharacteristic>(10); }
/// <summary> /// Raises the characteristic changed event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnCharacteristicChanged(IBleDevice sender, BleCharacteristicChangedEventArgs e) { dev.OnCharacteristicChanged(sender, e); }
/// <summary> /// Raises the descriptor read event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnDescriptorRead(IBleDevice sender, BleDescriptorReadEventArgs e) { dev.OnDescriptorRead(sender, e); }
/// <summary> /// Raises the descriptor write event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnDescriptorWrite(IBleDevice sender, BleDescriptorWriteEventArgs e) { dev.OnDescriptorWrite(sender, e); }
/// <summary> /// Raises the read remote rssi event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnReadRemoteRssi(IBleDevice sender, BleReadRemoteRssiEventArgs e) { dev.OnReadRemoteRssi(sender, e); }
/// <summary> /// Raises the reliable write completed event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnReliableWriteCompleted(IBleDevice sender, BleReliableWriteCompletedEventArgs e) { dev.OnReliableWriteCompleted(sender, e); }
/// <summary> /// Raises the services discovered event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnServicesDiscovered(IBleDevice sender, BleServicesDiscoveredEventArgs e) { dev.OnServicesDiscovered(sender, e); }
/// <summary> /// Constructor /// </summary> /// <param name="ble_device">BLE device proxy to use to communicate with the Open Vario device</param> /// <param name="ble_service">BLE service representing the navigation service</param> public NavigationService(IBleDevice ble_device, BleGattService ble_service) : base(ble_device, ble_service) { _navigation_characteristics = new Dictionary <NavigationValue, BleGattCharacteristic>(10); }
/// <summary> /// Constructor /// </summary> /// <param name="ble_device">BLE device proxy to use to communicate with the Open Vario device</param> /// <param name="ble_service">BLE service representing the identification service</param> public IdentificationService(IBleDevice ble_device, BleGattService ble_service) : base(ble_device, ble_service) { _identification_info = null; }
/// <summary> /// Constructor /// </summary> /// <param name="ble_device">BLE device proxy to use to communicate with the Open Vario device</param> public OpenVarioDevice(IBleDevice ble_device) { _ble_device = ble_device; _ble_services = new Dictionary <Guid, BleGattService>(10); }
/// <summary> /// Raises the characteristic write event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnCharacteristicWrite(IBleDevice sender, BleCharacteristicWriteEventArgs e) { dev.OnCharacteristicWrite(sender, e); }
/// <summary> /// Constructor /// </summary> /// <param name="ble_device">BLE device proxy to use to communicate with the Open Vario device</param> /// <param name="ble_service">BLE service representing the service</param> public OpenVarioBleService(IBleDevice ble_device, BleGattService ble_service) { BleDevice = ble_device; BleService = ble_service; BleCharacteristics = new Dictionary <Guid, BleGattCharacteristic>(20); }
/// <summary> /// Constructor /// </summary> /// <param name="ble_device">BLE device proxy to use to communicate with the Open Vario device</param> /// <param name="ble_service">BLE service representing the variometer service</param> public VariometerService(IBleDevice ble_device, BleGattService ble_service) : base(ble_device, ble_service) { _variometer_characteristics = new Dictionary <VariometerValue, BleGattCharacteristic>(10); }
/// <summary> /// Raises the connection state changed event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> public void OnConnectionStateChanged(IBleDevice sender, BleConnectionStateChangedEventArgs e) { dev.OnConnectionStateChanged(sender, e); }