ios - 是否可以/允许使用 iOS 作为蓝牙设备和云之间的网关(当应用程序在后台时)
问题描述
当应用程序在后台时,我想使用 iOS 设备作为 BLE 设备和云之间的网关。这是否 (a) 可能和 (b) 根据 Apple 的指导方针?
Architecture:
BLE device <-> iOS <-> Cloud
场景如下:
- 云向BLE设备发送消息
- BLE 设备向云端发送响应(结果)
第 1 步的解决方案:
据我了解,“后台通知”[1] 可用于在应用程序处于后台时触发 iOS 设备上的操作。在这种情况下是否允许向 BLE 设备发送消息?有没有更通用的解决方案,适用于 android 和 iOS?
第 2 步的解决方案:
iOS“核心蓝牙”允许后台处理 [2]。因此,一旦结果可用,iOS 应用程序将再次被触发。在这种情况下,是否允许打开与云(RESTful API、Azure 服务总线、Azure IoT Hub 或类似)的连接来转发结果?
解决方案
是的!有可能,我创建了一篇文章,展示了如何使用 BLE 制作 iPhone 网关并连接到另一块板 (ESP32)。
我所做的是我首先使用 MQTT 连接到 Google Cloud IoT Core,一旦连接了 iPhone,我就使用 Core Bluetooth 扫描了电路板。然后它会连接到 ESP32,ESP32 会将数据发送到 iPhone,iPhone 会将这些数据发布到 PubSub。
推荐阅读
- html - 当 SVG 被隐藏或外部时,SVG 过滤器会失去颜色
- amazon-web-services - DynamoDb - 吞吐量限制究竟是如何工作的?
- bash - for 中的 printf 不在 bash 中迭代
- c# - “用户操作”结束时如何调用函数?
- python - 调用 .bounds 方法时 GeoSeries 对象解释为 NoneType
- javascript - 在云功能firebase中单击时如何调用功能?
- android - 无法删除 Android tabLayout 中的操作栏
- python - 有没有办法根据特定数组而不是索引绘制 Matplotlib 的 Imshow?
- ruby-on-rails - Rails GraphQL 嵌套突变/查询结构
- javascript - 有没有办法一次从紫色空中服务器获取 3 个请求而不会被阻塞?