通过rfComm协议实现与胰岛素泵的32feet.Net连接。我写了一个简单的代码来连接
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())
{
//...
}
}
}Pump after start此代码会被windows检测到,但windows t want to give a ConnectedClient callback, blocks it by the message asking to type pin-code. The main trick that it won不会提供帮助,因为在窗口消息中键入PIN码并发送到pump后,我必须附加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代码?
发布于 2019-09-30 14:52:34
您是否已使用windows上的wireshark数据包分析器确认未进行搜索?
https://stackoverflow.com/questions/58136670
复制相似问题