简体   繁体   English

使用pyBluez查找设备需要多长时间?

[英]How long does it take to discover a device with pyBluez?

I am considering using pyBluez, and my project requires quickly making a connection with a device. 我正在考虑使用pyBluez,我的项目需要快速与设备建立连接。 How long is the acquisition time before data can be received from the device? 从设备接收数据需要多长时间?

In this case the device will be a remote control, which will very frequently be taken out of range. 在这种情况下,该设备将是一个遥控器,通常会超出范围。 For bluetooth and pybluez to work for my application I need to be able to detect a button press on the remote within a few seconds of coming into range. 为了使蓝牙和pybluez能够适合我的应用程序,我需要能够在进入范围的几秒钟内检测到遥控器上的按钮按下。 I have read this similar answer . 我已经读过类似的答案 Does pyBluez introduce other overhead, which makes constant discovery impractical? pyBluez是否会引入其他开销,从而使不断发现变得不切实际? After the device is discovered (minimum of 1.28 seconds I assume), is there any further delay before it can send data? 发现设备后(我假设至少为1.28秒),在发送数据之前还会有进一步的延迟吗?

Thanks in advance. 提前致谢。

You are looking at the wrong part of the Bluetooth protocol. 您正在查看蓝牙协议的错误部分。 You should be looking at connection times and client to server min-max times. 您应该查看连接时间以及客户端到服务器的最小-最大时间。 Discovery is assumed over with, you only do that once to pair, right? 假设发现已结束,您只需配对一次,对吗? Afterwards the remote control should know which device it controls, or the controlled device would recognize its paired remotes. 之后,遥控器应知道其控制的设备,否则受控设备将识别其配对的遥控器。

Later it is just about connecting with a client server model. 稍后,它仅与连接客户端服务器模型有关。

You need to decide the roles of each device. 您需要确定每个设备的角色。 However, always trying to connect is not a good pattern even for a PC. 但是,即使对于PC,始终尝试连接也不是一个好习惯。 You should be having on demand connections, which could take a few seconds(1-12 seconds, with the greater distribution somewhere in 0-5 seconds range). 您应该拥有按需连接,这可能需要几秒钟(1至12秒,而较大的分布在0至5秒范围内)。

We can discuss this further on chat, if you can give more specific details about your project. 如果您可以提供有关项目的更多详细信息,我们可以在聊天中进一步讨论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM