android - 如何使用 evothings phonegap 插件从 Polar 设备读取心率值

标签 android cordova bluetooth-lowenergy

如何从polar h7心率监测设备读取心率数据?我正在使用适用于 Android 的 evothings phonegap 插件。我能够读取包括特征列表、句柄值的服务数据。但是如何读取心率值呢?

// ..
{
    "type": 0,
    "uuid": "0000180d-0000-1000-8000-00805f9b34fb",
    "handle": 3,
    "characteristics": [
      {
        "permissions": 0,
        "writeType": 2,
        "properties": 16,
        "uuid": "00002a37-0000-1000-8000-00805f9b34fb",
        "handle": 13,
        "descriptors": [
          {
            "permissions": 0,
            "uuid": "00002902-0000-1000-8000-00805f9b34fb",
            "handle": 24
          }
        ]
      },
      {
        "permissions": 0,
        "writeType": 2,
        "properties": 2,
        "uuid": "00002a38-0000-1000-8000-00805f9b34fb",
        "handle": 14,
        "descriptors": [

        ]
      }
    ]
  }, // ...

调用 evothings.ble.enableNotification(1, 13, ..) 给出 null

最佳答案

看起来 Polar H7 遵循心率配置文件规范。感兴趣的是 heart_rate_measurement特征,其 UUID 为 2a37,可以在您的列表中看到。

调用 evothings.ble.enableNotification 只是您需要做的一半。您还必须调用 evothings.ble.writeDescriptor(1, 24, new Uint8Array([1,0]), ...) 以实际启动通知。

如果通知失败,可以使用readDescriptor()进行轮询。

关于android - 如何使用 evothings phonegap 插件从 Polar 设备读取心率值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27957677/

相关文章:

android - 在 Android 主页小部件(不在 Activity 中)中获取 TextView 的文本?

java - 如何在socket io和android聊天应用程序中检查用户是否在线

android - 在完全加载 JavaScript 之前在 CordovaWebView 中显示 native 加载

java - 正确格式化日期

android - 我可以使用来自不同 google 项目的两个 google-services json 文件吗?

javascript - 我可以在带有 phonegap 的移动设备上使用 html5 拖放吗?

angular - 按键事件在 ionic 2 Android 中不起作用

ios - 无法在 didUpdateNotificationStateForCharacteristic 中获取 CBcharacteristic 值

android - 使用低功耗蓝牙解锁 Linux

蓝牙嗅探器 : How can I install btmon on raspberry Pi?