射频通信蓝牙连接到胰岛素泵



我使用 32feet.Net 连接到通过rfComm协议通信的胰岛素泵。我写了一个简单的代码来连接

public void Listen()
{
server = new BluetoothListener(mUUID) { ServiceName =  "SerialLink" };
Console.WriteLine("Start listen Devices");
Console.WriteLine(server.LocalEndPoint.ToString());
server.Start();
while (true)
{ 
using(BluetoothClient ConnectedClient = server.AcceptBluetoothClient())
{
//...
}
}
}

启动后泵此代码由窗口检测,但窗口t want to give a ConnectedClient callback, blocks it by the message asking to type pin-code. The main trick that it won无济于事,因为在窗口消息中输入 PIN 码并发送到泵后,我必须附加 hello-byte,然后她明白连接已稳定。阅读一个32英尺的Api,我试图在Windows UWP中使用现代rfComm Api,但它不想搜索我的胰岛素泵。这是代码:

public async void InitializeRfCommServer()
{
try
{
rfcommProvider = await 
RfcommServiceProvider.CreateAsync(RfcommServiceId.FromUuid(RfcommServiceUuid));
// Create a listener for this service and start listening
socketListener = new StreamSocketListener();
socketListener.ConnectionReceived += SocketListener_ConnectionReceived;
await socketListener.BindServiceNameAsync(rfcommProvider.ServiceId.AsString(),
SocketProtectionLevel.BluetoothEncryptionAllowNullAuthentication);
rfcommProvider.StartAdvertising(socketListener,true);
TextLabel.Text = "Listening for incoming connections";
ServerInitiated = true;
}
catch (Exception e)
{
TextLabel.Text = e.Message;
ServerInitiated = false;
}
} 

所以我很困惑。可以在Windows 7中尝试32英尺库吗?或者尝试更正 UWP 代码?

您是否使用 Windows 上的 wireshark 数据包分析器确认搜索未发生?

相关内容

  • 没有找到相关文章