且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

[UWP]无法知道配对后我的蓝牙MIDI设备是否可用于通信。

更新时间:2023-01-24 07:38:52

DeepakSOS,

DeepakSOS,

>>有没有办法弹出消息来通知该设备无法使用或类似的东西。这样用户就可以知道出了什么问题。

>>Is there any way to popup message to inform that device is not available to use or something like that. so that user can know what is going wrong.

我们可以使用  BluetoothLEDevice.ConnectionStatusChanged 事件,它发生在设备
的连接状态发生变化时。

We can use the BluetoothLEDevice.ConnectionStatusChanged event, it occurs when the connection status for the device has changed.

因此我们可以在事件被触发时更改消息的更改。

So we can change the alter the message when the event is fired.

>>有没有办法选择第一个输入端口作为通信的默认设备或我应该如何处理从多个同名输入端口选择一个midi输入端口的情况。

>>Is there any way to select the 1st input port as a default device for communication or How should I handle the situation of choosing one midi input port from multiple input port of same name.

我们可以得到默认设备的DeviceInformation.Id 属性,我们可以使用BluetoothLEDevice.FromIdAsync方法返回给定Id的BluetoothLEDevice对象。

We can get the DeviceInformation.Id  property of the default device that we can use BluetoothLEDevice.FromIdAsync method to returns a BluetoothLEDevice object for the given Id.

最诚挚的问候,

Jayden Gu

Jayden Gu