限制BLE外围设备仅连接到一个Master [英] Restricting the BLE peripheral device to connect to only one Master

查看:128
本文介绍了限制BLE外围设备仅连接到一个Master的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想限制我的BLE外围设备始终仅与一个主机连接.如果我收到其他某个主/中央设备的连接请求,它应该拒绝该连接请求!

I want to restrict my BLE Peripheral device to connect with only one master always .IF i receive a connection request from some other master/central device, it should reject the connection request !

感谢您的帮助!

此致

森提尔

推荐答案

您的问题有点含糊,因此我将其分为两种情况:

Your question is a bit vague so I break it into two cases:

(1)如果已连接到主服务器,则无法连接到另一个.此限制是BLE标准强加的.

(1) If it is connected to a master, it can't connect to another. This restriction is imposed by BLE standard.

(2)也许您是这个意思.如果已连接到主服务器,但由于某种原因,该连接已丢失,并且外围设备再次发出广告.您不希望此外设连接到耳中的任何其他中央设备,而仍然等待其原始主设备,对吗?好吧,您的外围设备只能做可连接的广告,并对发起连接请求的任何中央设备做出响应.但是,一旦两者都连接好,您的外围设备便可以要求主机发送任何信息以进行识别.如果主机不能正确回答,您的外围设备可能会断开连接并再次做广告,直到原始中央设备连接到它.

(2) Probably you meant this one. If it was connected to a master, but due to some reason, the connection was lost and the peripheral is advertising again. You do not want this peripheral to connect to any other central devices in the earshot and still wait its original master, right? Well, your peripheral can only do connectable advertising and respond to whatever central device that initiates a connection request. But once both are connected, your peripheral could ask for whatever information from the master for identification. If the master can't respond with a correct answer, your peripheral could disconnect and do advertising again until the original central device connects to it.

希望这会有所帮助.

这篇关于限制BLE外围设备仅连接到一个Master的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆