我有蓝牙手写笔设备。它上面有三个按钮:电源/通话,音量增大,音量减小。在我的Windows手机上运行的C#项目与手写笔配对时,如何检测其中一个按钮何时被按下?
注意:我已经可以在代码中看到设备:
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???
}
}
}