Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What should I do if I want to use RN to obtain device data #489

Open
3 of 5 tasks
liuzy1993 opened this issue Oct 14, 2024 · 3 comments
Open
3 of 5 tasks

What should I do if I want to use RN to obtain device data #489

liuzy1993 opened this issue Oct 14, 2024 · 3 comments
Labels
question Further information is requested

Comments

@liuzy1993
Copy link

liuzy1993 commented Oct 14, 2024

Platform your question concerns:

  • Android
  • iOS
  • Other
  • Platform is not relevant for this question

Device:

  • Polar Verity Sense

Description:

@liuzy1993 liuzy1993 added the question Further information is requested label Oct 14, 2024
@orestesgaolin
Copy link
Contributor

I presume you're using React Native? You would have to expose the SDK methods via native module. I don't think Polar team maintains any official cross-platform libraries. With Flutter app we just built ourselves a plugin that uses native libraries on Android and iOS.

@liuzy1993
Copy link
Author

我猜你使用的是 React Native?你必须通过native module公开 SDK 方法。我认为 Polar 团队没有维护任何官方的跨平台库。借助 Flutter 应用,我们只需为自己构建一个在 Android 和 iOS 上使用原生库的插件即可。

Thank you for your answer. If I need to obtain UUIDs for related services such as ACC or PPI, where should I go to check

@dustex
Copy link

dustex commented Oct 25, 2024

I'm working on a similar issue. I want to read ACC Data and want to set the time on the Polar H10 via a python script.
I have written a script which scans for BLE devices and lists all services, characteristics of a BLE device:

import asyncio
from bleak import BleakClient, BleakScanner

async def list_services(address):
    async with BleakClient(address) as client:
        if client.is_connected:
            print(f"Connected to {address}")
            services = await client.get_services()
            for service in services:
                print(f"\nService: {service.uuid} | {service.description}")
                for characteristic in service.characteristics:
                    print(f"  Characteristic: {characteristic.uuid} | {characteristic.description}")
                    for descriptor in characteristic.descriptors:
                        print(f"    Descriptor: {descriptor.uuid}")
        else:
            print(f"Failed to connect to {address}")

async def main():
    print("Scanning for BLE devices...")
    devices = await BleakScanner.discover()
    if not devices:
        print("No BLE devices found.")
        return

    for i, device in enumerate(devices):
        print(f"{i}: {device.name or 'Unknown'} [{device.address}]")

    index = int(input("Select a device by index: "))
    if 0 <= index < len(devices):
        await list_services(devices[index].address)
    else:
        print("Invalid index selected.")

if __name__ == "__main__":
    asyncio.run(main())

Here is the output when I select the Polar H10 for listing all services:

Scanning for BLE devices...
0: Polar H10 D6CEAD20 [E3:49:CE:CE:DE:27]
1: Unknown [39:1A:2B:DF:E4:3F]
2: TY [1F:EE:D1:06:8A:51]
3: Unknown [A0:D7:F3:28:7F:33]
Select a device by index: 0
Connected to E3:49:CE:CE:DE:27

Service: 00001800-0000-1000-8000-00805f9b34fb | Generic Access Profile
  Characteristic: 00002a00-0000-1000-8000-00805f9b34fb | Device Name
  Characteristic: 00002a01-0000-1000-8000-00805f9b34fb | Appearance
  Characteristic: 00002a04-0000-1000-8000-00805f9b34fb | Peripheral Preferred Connection Parameters
  Characteristic: 00002aa6-0000-1000-8000-00805f9b34fb | Central Address Resolution

Service: 00001801-0000-1000-8000-00805f9b34fb | Generic Attribute Profile
  Characteristic: 00002a05-0000-1000-8000-00805f9b34fb | Service Changed
    Descriptor: 00002902-0000-1000-8000-00805f9b34fb

Service: 0000180d-0000-1000-8000-00805f9b34fb | Heart Rate
  Characteristic: 00002a37-0000-1000-8000-00805f9b34fb | Heart Rate Measurement
    Descriptor: 00002902-0000-1000-8000-00805f9b34fb
  Characteristic: 00002a38-0000-1000-8000-00805f9b34fb | Body Sensor Location

Service: 0000180a-0000-1000-8000-00805f9b34fb | Device Information
  Characteristic: 00002a29-0000-1000-8000-00805f9b34fb | Manufacturer Name String
  Characteristic: 00002a24-0000-1000-8000-00805f9b34fb | Model Number String
  Characteristic: 00002a25-0000-1000-8000-00805f9b34fb | Serial Number String
  Characteristic: 00002a27-0000-1000-8000-00805f9b34fb | Hardware Revision String
  Characteristic: 00002a26-0000-1000-8000-00805f9b34fb | Firmware Revision String
  Characteristic: 00002a28-0000-1000-8000-00805f9b34fb | Software Revision String
  Characteristic: 00002a23-0000-1000-8000-00805f9b34fb | System ID

Service: 0000180f-0000-1000-8000-00805f9b34fb | Battery Service
  Characteristic: 00002a19-0000-1000-8000-00805f9b34fb | Battery Level
    Descriptor: 00002902-0000-1000-8000-00805f9b34fb

Service: 6217ff4b-fb31-1140-ad5a-a45545d7ecf3 | Unknown
  Characteristic: 6217ff4c-c8ec-b1fb-1380-3ad986708e2d | Unknown
  Characteristic: 6217ff4d-91bb-91d0-7e2a-7cd3bda8a1f3 | Unknown
    Descriptor: 00002902-0000-1000-8000-00805f9b34fb

Service: fb005c80-02e7-f387-1cad-8acd2d8df0c8 | Unknown
  Characteristic: fb005c81-02e7-f387-1cad-8acd2d8df0c8 | Unknown
    Descriptor: 00002902-0000-1000-8000-00805f9b34fb
  Characteristic: fb005c82-02e7-f387-1cad-8acd2d8df0c8 | Unknown
    Descriptor: 00002902-0000-1000-8000-00805f9b34fb

Service: 0000feee-0000-1000-8000-00805f9b34fb | Polar Electro Oy
  Characteristic: fb005c51-02e7-f387-1cad-8acd2d8df0c8 | Unknown
    Descriptor: 00002902-0000-1000-8000-00805f9b34fb
  Characteristic: fb005c52-02e7-f387-1cad-8acd2d8df0c8 | Unknown
    Descriptor: 00002902-0000-1000-8000-00805f9b34fb
  Characteristic: fb005c53-02e7-f387-1cad-8acd2d8df0c8 | Unknown

The services for ACC or Time are not listed, so this must be some vendor/device specific functionality I guess. Still investigating on this topic and would be happy to get input if someone else has more info on this topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants