简体   繁体   English

iOS CoreBluetooth并阻止其他设备连接到外围设备

[英]iOS CoreBluetooth and preventing other devices to connect to your peripheral

I am creating a core bluetooth application and connecting to a peripheral device, is there a way for the peripheral to reject which centrals may connect to it? 我正在创建一个核心蓝牙应用程序并连接到外围设备,外围设备是否有办法拒绝哪些中央设备可以与其连接? What if a random person scanned and found my peripheral devices broadcasted UUID and then broadcasted that UUID and tried to connect to it, how would I prevent this? 如果一个随机的人扫描并发现我的外围设备广播了UUID,然后广播了该UUID并尝试连接该UUID,该怎么办,我该如何避免呢?

No, the iOS peripheral cannot prohibit centrals from connecting to it. 不,iOS外围设备不能禁止中央设备与其连接。 However it has some tricks to disable the connection. 但是,它有一些技巧可以禁用连接。 When a dynamic characteristic is read: 读取动态特性时:

  1. return an error instead of the value of the characteristic, 返回错误而不是特征值,
  2. don't respond to the request. 不要回应要求。 This will cause the connection to stall and then break up after about 30 seconds. 这将导致连接停止,然后在大约30秒后断开。

Think of the advertisement as a real advertisement in the media. 将广告视为媒体中的真实广告。 As many can see it as want. 许多人都可以看到它。 This is the same for iBeacons. 对于iBeacons,这是相同的。 You shouldn't rely any security on being hidden. 您不应该依赖任何安全性来隐藏它们。 (Wifi SSID broadcasting can be turned off but if your hotspot is not encrypted and authenticated, people with find you.) (可以关闭Wifi SSID广播,但如果未对热点进行加密和身份验证,则会找到您。)

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

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