6

I have a Bluetooth stylus device. It has three buttons on it: power/call, volume up, volume down. In a C# project running on my windows phone paired with the stylus, how can I detect when one of those buttons is pressed?

Note: I already can see the device in code:

BluetoothDevice currentDevice { get; set; }
string deviceName = "P1";
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
    foreach (DeviceInformation di in await DeviceInformation.FindAllAsync(BluetoothDevice.GetDeviceSelector()))
    {
        BluetoothDevice bdDevice = await BluetoothDevice.FromIdAsync(di.Id);
        if (bdDevice.Name == deviceName)
        {
            currentDevice = bdDevice;
            //OK, so now what do I do to listen for the button clicks???
        }
    }
}
John Kurtz
  • 775
  • 8
  • 16
  • Did you manage to resolve this? I have almost exactly the same problem. https://stackoverflow.com/questions/73424567/how-do-you-receive-a-bluetooth-speakers-volume-control-messages-in-a-wpf-window – jho Aug 20 '22 at 06:42

0 Answers0