HRPC:如何检索心率值?

6 posts / 0 new
Last post
s.miermont
Offline
Last seen:3 years 7 months ago
Joined:2015-11-17 13:21
HRPC:如何检索心率值?

Hi,

I want to use DA14580 to connect to an of the shelve heart rate sensor and get its data.

Starting from the sps example, I'm able to connect to the belt.
I added the hrpc functionnality by adding the relevant define in the config header file.
Walking thru the code, I can see that the hrpc_init() function is automatically called by prf_init_func().

I sent HRPC_ENABLE_REQ message to the hprc task.

I have 2 questions :
- Is it the right way to do?
- What is the good method to retreive the heart rate value? Is there a kind of notification when a new
value is available or should I poll it?
I suppose it may have something to do with HRPC_HR_MEAS_IND but I don't know how to catch this message.

Thanks

Device:
MT_dialog
Offline
Last seen:1 week 18 hours ago
Staff
Joined:2015-06-08 11:34
Hi s.miermont,

Hi s.miermont,

Please check the RW BLE Heart Rate Profile (HPR) Interface specification, in the Profiles & API Documents. Yes since you have the BLE_HR_COLLECTOR defined the prf_init_func() will be called. According to the Specification document the HRPC_ENABLE_REQ is used to enable the collectros role of the Heart Rate profile. And yes the belt should send a notification every time a new value is aquired. You should send the HRPC_CFG_INDNTF_REQ message from your collector in order to configure the notifications to your device (or your device might have the notifications allready enabled when the profile is enabled in the belt). When a notification is send you should catch the HRPC_HR_MEAS_IND message. Currently there is no application implementation of the heart rate profile in the collector side for the heart rate monitor you can try to implement one by taking other client implementations as an example (the battery client for instance).

Thanks MT_dialog

s.miermont
Offline
Last seen:3 years 7 months ago
Joined:2015-11-17 13:21
Hi MT,

Hi MT,

Thanks for your help. Now, i'm able to read a value.
It seems that the app is notified only once. (in the current implementation, the notification handler only returns KE_MSG_CONSUMED).
Is there something special to do in the handler ?

I don't find the application implementation of the battery profile you're dealing with. Can you point it ?

Some comments :
RW BLE Heart Rate Profile (HRP) document v0.4, says "The definitions for the different codes for characteristics that can be
configured to indicate/notify are in hrpc.h." while they are in prh_types.h

In the same document, HRPC_CFG_INDNTF_REQ message is describe with 3 params while there are only 2 in the sdk.
Response message should be HRPC_WR_CHAR_RSP or HRPC_ERROR_IND_SEND, HRPC_ERROR_IND_SEND does not exist.
As I can see, it should be HRPC_ERROR_IND.

Regards
Julien

s.miermont
Offline
Last seen:3 years 7 months ago
Joined:2015-11-17 13:21
Update : after porting this

Update : after porting this project (coming from the sps example) to SDK 5.0.3, the notification issue has disappeared.

The issue I'm facing now is that after 4 notifications, I get an app_on_disconnect call.

Regards
Julien

s.miermont
Offline
Last seen:3 years 7 months ago
Joined:2015-11-17 13:21
Well, after some manual

Well, after some manual reconnexions, it never disconnects anymore...

MT_dialog
Offline
Last seen:1 week 18 hours ago
Staff
Joined:2015-06-08 11:34
Hi s.miermont,

Hi s.miermont,

The profile documents are a bit obsolete and based on older SDKs. The HRPC_HR_MEAS_IND message should hit every time you get a new indication and should be handled in the catch rest handler, there isn't anything special to do with it just send the below command in order to enable the notifications on the peripherals side and then you should get the indications i 've mentioned. Unfortunatelly the implementation for the battery client is located in the previous sdk under the directory \dk_apps\src\modules\app\src\app_profiles you can check this and port it to the new SDK also have a look at the allready implemented profiles like the bass profile in order to see how the messages are handled in application level.

What is the disconnection reason you get in the disconnection handler ? perhaps your peripheral is terminating the connection.

Thanks MT_dialog