Smobiler上海石磨_.NET移动开发平台
标题:
蓝牙blue搜索和连接放到一起是否可行?
[打印本页]
作者:
chengxianchao
时间:
2021-4-12 23:36
标题:
蓝牙blue搜索和连接放到一起是否可行?
搜索和连接如下,却发现连接已经成功,用getblestatus()获取到的状态却不成功,甚至返回“未连接到蓝牙设备”
bluetooth1.SearchBle(xx, xx, xx, (abj, args) =>
{
bluetooth1.ConnectBle(args.MacAddress, xx, xx, xx, (abjj, argsj) =>
{
if (argsj.isError == true)
{
Toast(argsj.error);
}
else
{
bluetooth1.GetBleStatus((abjc, argsc) =>
{
if (argsc.isError == true)
{
Toast(argsc.error);
}
else
{
if (argsc.Status == Smobiler.Plugins.BluetoothStatus.Connected)
{
this.button1.Text = "在线";
}
}
});
}
});
});
作者:
neil
时间:
2021-4-13 09:41
1. search本身选中后会自动连接,不需要再调用connect.
2. search和connect的回调并不等于连接成功,只是表示设备找到,正在尝试连接.
3. 连接成功或者失败的判定,在DataReceived中判断, 连接成功失败和接收数据,均会触发DataReceived.具体请参考:
https://www.smobiler.com/Help/ht ... ugins_Bluetooth.htm
作者:
chengxianchao
时间:
2021-4-14 22:06
neil 发表于 2021-4-13 09:41
1. search本身选中后会自动连接,不需要再调用connect.
2. search和connect的回调并不等于连接成功,只是表示 ...
调试发现使用search和connect连接后,并没有在DataReceived中受到数据,也没有触发DataReceived函数
欢迎光临 Smobiler上海石磨_.NET移动开发平台 (https://www.smobiler.com/)
Powered by Discuz! X3.2