我有一个蓝牙手写笔设备。它上面有三个按钮:电源/通话、音量增大、音量减小。在与手写笔配对的 Windows Phone 上运行的 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???
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
928 次 |
| 最近记录: |