protected async Task Initialize() { await _device.WaitForPropertyValueAsync("Connected", value : true, TIMEOUT); _properties = await _device.GetAllAsync(); Log.Debug("Waiting for services to resolve..."); await _device.WaitForPropertyValueAsync("ServicesResolved", value : true, TIMEOUT); foreach (var s in await _device.GetUUIDsAsync()) { var g = Guid.Parse(s); var svc = await _device.GetServiceAsync(s); _services[Guid.Parse(s)] = svc; if (g == DEVICE_INFORMATION_SERVICE) { Log.Debug("Found DeviceInformationService."); DeviceInformationService = new DeviceInformationService(svc); } else if (g == BATTERY_SERVICE) { Log.Debug("Found BatteryService."); BatteryService = new BatteryService(svc); } } Log.Debug("Services resolved."); await BleDeviceConnected(); Log.Information($"Connected to {this}."); }
public static IDictionary <string, object> AsDictionary(this Device1Properties properties) { return(new Dictionary <string, object>() { { nameof(properties.Address), properties.Address }, { nameof(properties.AddressType), properties.AddressType }, { nameof(properties.Name), properties.Name }, { nameof(properties.Alias), properties.Alias }, { nameof(properties.Class), properties.Class }, { nameof(properties.Appearance), properties.Appearance }, { nameof(properties.Icon), properties.Icon }, { nameof(properties.Paired), properties.Paired }, { nameof(properties.Trusted), properties.Trusted }, { nameof(properties.Blocked), properties.Blocked }, { nameof(properties.LegacyPairing), properties.LegacyPairing }, { nameof(properties.RSSI), properties.RSSI }, { nameof(properties.Connected), properties.Connected }, { nameof(properties.UUIDs), properties.UUIDs }, { nameof(properties.Modalias), properties.Modalias }, { nameof(properties.Adapter), properties.Adapter }, { nameof(properties.ManufacturerData), properties.ManufacturerData }, { nameof(properties.ServiceData), properties.ServiceData }, { nameof(properties.TxPower), properties.TxPower }, { nameof(properties.ServicesResolved), properties.ServicesResolved }, }); }
internal BluetoothDevice(IDevice1 device, Device1Properties properties) { _device1 = device; Address = properties.Address; Name = properties.Name; Alias = properties.Alias; Paired = properties.Paired; Trusted = properties.Trusted; Blocked = properties.Blocked; LegacyPairing = properties.LegacyPairing; RSSI = properties.RSSI; Connected = properties.Connected; UUIDs = properties.UUIDs; ManufacturerData = properties.ManufacturerData; ServiceData = properties.ServiceData; TxPower = properties.TxPower; ServicesResolved = properties.ServicesResolved; }
public DotNetBlueZProperties(Device1Properties properties) { _dnbProperties = properties; }