1

I am currently playing with Windows.Devices.Power.

I have created a watcher for Bluetooth devices, and already retrieved the devices which were discovered nearby. But the problem is that when I try to get the battery level of specific device, I am just getting the response "System.__ComObject".

How can I retrieve value of battery level? What am I doing wrong?

    private void DeviceWatcherOnAdded(DeviceWatcher sender, DeviceInformation device)
    {
        if (!deviceNamesArray.Contains(device.Name) && device.Pairing.IsPaired && device.IsEnabled)
        {
            deviceNamesArray.Add(device.Name);
            //Retrieves name of device with no problem
            Console.WriteLine(device.Name);

            //Returns System.__ComObject
            var battery = Battery.FromIdAsync(device.Id);

            //Returns null
            Console.WriteLine(battery.GetResults());
        }
    }
L.V
  • 151
  • 1
  • 3
  • 9

0 Answers0