首页 > 解决方案 > BLE Gatt 自定义服务 - 如何仅通知已注册的中心(基于应用级别)

问题描述

语境

我的设置

外围设备

我已经实现了一个 Gatt-Server,在Raspberry Pi4上使用Python3/DBusBluez 5.50(ControllerMode = le only)

我从以下示例开始:

https://github.com/Douglas6/cputemp/blob/master/cputemp.py

我还从以下 Apple 文档中获得了一些想法:

https://developer.apple.com/library/archive/documentation/CoreBluetooth/Reference/AppleNotificationCenterServiceSpecification/Specification/Specification.html#//apple_ref/doc/uid/TP40013460-CH1-SW7

特征权限

对于配对:

中环

我有一个 iOS 应用,使用 Swift5 和 CoreBluetooth

从中心的角度来看,有点像 Apple Notifications Center Service 的文档中所示:

我的基本沟通过程(目前对我来说很有效)

  1. 应用程序连接到 Pi(无需 PIN 码的简单配对)
  2. 应用程序读取所有服务、特征并启用带有通知标志的特征的通知
  3. 应用程序提供一个授权码(从扫描的二维码中提取)并接收一个应用程序 id 和一个密码并存储它以供下次使用
  4. 请求属性 x 并接收属性 x 的当前值的通知

我的问题、想法和疑问

当第二个中心激活该特定特征的通知时,它也会收到属性 x 的信息。Central B 使用一个免费的应用程序来扫描所有可用的服务/特性。(我使用 LightBlue for Mac 或 Beacon Grabber for iPhone)。Central B 刚刚与 Raspberry Pi 配对,不需要提供其他东西。

dbus.ObjectPath('/org/bluez/hci0....

我对一些想法和意见感到高兴。

谢谢!

标签: swiftbluetooth-lowenergycore-bluetoothbluezbluetooth-gatt

解决方案


推荐阅读