首页 > 解决方案 > 是否可以/允许使用 iOS 作为蓝牙设备和云之间的网关(当应用程序在后台时)

问题描述

当应用程序在后台时,我想使用 iOS 设备作为 BLE 设备和云之间的网关。这是否 (a) 可能和 (b) 根据 Apple 的指导方针?

Architecture:

BLE device <-> iOS <-> Cloud

场景如下:

  1. 云向BLE设备发送消息
  2. BLE 设备向云端发送响应(结果)

第 1 步的解决方案:

据我了解,“后台通知”[1] 可用于在应用程序处于后台时触发 iOS 设备上的操作。在这种情况下是否允许向 BLE 设备发送消息?有没有更通用的解决方案,适用于 android 和 iOS?

第 2 步的解决方案:

iOS“核心蓝牙”允许后台处理 [2]。因此,一旦结果可用,iOS 应用程序将再次被触发。在这种情况下,是否允许打开与云(RESTful API、Azure 服务总线、Azure IoT Hub 或类似)的连接来转发结果?

[1] https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app

[2] https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html

标签: iosweb-servicesbluetooth-lowenergyiot

解决方案


是的!有可能,我创建了一篇文章,展示了如何使用 BLE 制作 iPhone 网关并连接到另一块板 (ESP32)。

我所做的是我首先使用 MQTT 连接到 Google Cloud IoT Core,一旦连接了 iPhone,我就使用 Core Bluetooth 扫描了电路板。然后它会连接到 ESP32,ESP32 会将数据发送到 iPhone,iPhone 会将这些数据发布到 PubSub。

从云端控制您的手机


推荐阅读