polarofficial / polar-ble-sdk

Repository includes SDK and code examples. More info https://polar.com/en/developers
Other
485 stars 153 forks source link

real time processing #123

Closed alyfreym closed 3 years ago

alyfreym commented 3 years ago

Hello! In iOS you can create listener in to HealthApi and is called each time when something was changed, it returns a structure that stores data - calories, distance in meters, heart rate and so on. Does this SDK have this functionality? Or the developer must do all the calculations himself? If Yes, with respect to what data everything can be calculated? . For example if sdk give me distance and speed, i can count steps and calories. In SDK docs I see some data called - PolarEcgData, PolarPpgData etc.. Can I count in relation to them calories, distance? There is a more detailed explanation of what these structures are. ? PolarPpgData, PolarPpiData etc..

I would be happy with a small example, let's say how to calculate the distance that the user has passed If possible.

I am not a user Polar watch. Therefore, you may think that I am asking stupid questions. I hope for your understanding

Thank you for your attention.

JOikarinen commented 3 years ago

@alyfreym good questions. Lets start discussion by splitting your questions to smaller pieces.

In iOS you can create listener in to HealthApi and is called each time when something was changed, it returns a structure that stores data - calories, distance in meters, heart rate and so on. Does this SDK have this functionality?

  • Yes. Polar SDK API uses two approaches: function callbacks (i.e. listeners) and asynchronous reactive API. The approach is chosen depending on the what the SDK is asked to do, for example BLE connection created with SDK uses callbacks to tell the status of connection whereas data streams requested from connected device uses reactive approach. On iOS side the Polar SDK reactive implementation is RxSwift

Or the developer must do all the calculations himself? If Yes, with respect to what data everything can be calculated?

  • The SDK is not providing (at the moment of writing) speed or distance data. The data available and calculated by the SDK is explained here https://www.polar.com/en/developers/sdk. So whether the application using SDK needs to process or calculate the data even further depends on what that particular application wants to do with the data.

In SDK docs I see some data called - PolarEcgData, PolarPpgData etc.. Can I count in relation to them calories, distance? There is a more detailed explanation of what these structures are. ? PolarPpgData, PolarPpiData etc..

I would be happy with a small example, let's say how to calculate the distance that the user has passed If possible.

  • The iOS SDK example is good starting point, which shows the usage available API's.
JOikarinen commented 3 years ago

@alyfreym closing the issue. Please feel free to continue discussion and reopen the issue.