Health Thermometer example

11 posts / 0 new
Last post
ronald
Offline
Last seen:4 years 3 months ago
Joined:2016-03-03 15:01
Health Thermometer example

I am using SDK 5.0.3, the DA14580DEVKIT with 14583 daughterboard.
I want to measure temperature so I use the htpt (Health Thermometer Profile Thermometer) profile. In a later state I will realy measure temp but for now the data may be a constant.
I have included #include "htpt.h" in “user_profiles.config.h”.

I see that the “htpt.c” code is embedded in the Keil debugger.

In the forum I readhttp://support.dialog-semiconductor.com/cant-not-find-taskappht-htpt-pro...about “You have to create the the app_htc_task and app_htc in order to interact with the profile”. This is not enough information for me to work with. I have read the UM-B-051 and the UM-B-050 pdf documents.
Reading the forum I understand that there is a need for a thermometer project example. Dialog Could you please provide an example. Because refering to SDK3 is not working for me.

thanks

Device:
MT_dialog
Offline
Last seen:2 months 1 week ago
年代taff
Joined:2015-06-08 11:34
Hi ronald,

Hi ronald,

年代ome of the application layer profiles in SDK3 like the thermometer are not 100% functional and they need some modifications, unfortunatelly there isn't any official example how to implement, port a profile or any existing reference design that can show the way of implementing the thermometer profile, i will try to provide some guidelines in order to port this from SDK3 to SDK5, i hope i dont forget anything since the process is a bit long. You can either start from blank .c files and try to implement the two app_ht_task.c/h and app_ht.c/h based on another profile example (the battery of the device information service) or port the allready existing profile and take the app_ht_task.c/h and app_ht.c/h from SDK3 which allready have the implementation of the application profile. The following steps describe a portion of the second option of applying modification to the existing implementation.

1) Take from the SDK3 the profile implementation from the directory src/modules/app/src/app_profiles/ht and place them to the application profile directory of the
年代DK5 project.

2) Open keil and place the health thermometer files in the sdk_app folder of the keil directory tree also include the corresposnding header files.

3) You will have to modify the app_ht.c/h and app_ht_task.c/h files, some of the key changes are:

a) You will have to replace the BLE_APP_HT and set the new definition BLE_HT_THERMOM in order for the proper inclusions to take place in all the neccesary files.

b) You will have to replace the TASK_APP_HT with the proper TASK either TASK_APP or TASK_HTPT to the corresponding tasks, please check the RW BLE Health Thermometer
Profile Interface Specification in order to get a clear understanding also you can refer to other profile implementation and the corresponding callbacks in order to
get it. Additionally the states of the corresponding tasks should be changed as well (for example instead of invoking ke_state_set(TASK_APP_HT, APP_HT_IDLE); should
be changed to ke_state_set(TASK_HTPT, HTPT_IDLE);)

c) Change the APP_HT_STATE_MAX and APP_HT_IDX_MAX to HTPT_STATE_MAX, HTPT_IDX_MAX in the app_ht.c file in the TASK_DESC_APP_HT and wherever those two defines occur.

d) In the file app_ht.c file at the app_ht_enable_prf() function remove the ke_state_set(TASK_APP_HT, APP_HT_CONNECTED).

e) In the app_htpt_temp_send() function change the instruction req->conhdl = app_env.conhdl to req->conhdl = app_env[0].conhdl.

f) In the app_ht_task.c remove the app_display.h file.

g) The callbacks and the corresponding messages should be created in the app_ht_task.c file and also the function that will handle those messages. Please check the below snippet:

static const struct ke_msg_handler app_htpt_process_handlers[]=
{
{HTPT_CREATE_DB_CFM, (ke_msg_func_t)htpt_create_db_cfm_handler},
{HTPT_DISABLE_IND, (ke_msg_func_t)htpt_disable_ind_handler},
{HTPT_MEAS_INTV_CHG_IND, (ke_msg_func_t)htpt_meas_intv_chg_ind_handler},
{APP_HT_TIMER, (ke_msg_func_t)app_ht_timer_handler},
};

enum process_event_response app_htpt_process_handler (ke_msg_id_t const msgid,
void const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id,
enum ke_msg_status_tag *msg_ret)
{
return (app_std_process_event(msgid, param,src_id,dest_id,msg_ret, app_htpt_process_handlers,
sizeof(app_htpt_process_handlers)/sizeof(struct ke_msg_handler)));
}

h) In the htpt_create_db_cfm_handler() change the if (ke_state_get(dest_id) == APP_HT_DISABLED) to if (ke_state_get(dest_id) == APP_DB_INIT) in order to receive the proper confirmation when you are going to get the confirmation for creating the database.

i) In order to get the 2 basic functions to be invoked by the application during the initialization you will have to add in the user_prf_funcs[] the next line {TASK_HTPT, app_ht_create_db_send, app_ht_enable_prf}, and you will have to set the app_htpt_process_handler as the handler for the messages that will come from the thermometer TASK, in order to do this add the below snippets in the app_entry_point.c (along with the other profile process handlers).

#if ((BLE_HT_THERMOM) && (!EXCLUDE_DLG_HTPT))
(process_event_func_t) app_htpt_process_handler,
#endif

By using the allready existing application profile implementations as examples it will be easier to get through the process.

Thanks MT_dialog

ronald
Offline
Last seen:4 years 3 months ago
Joined:2016-03-03 15:01
thanks for the information,

thanks for the information,
I will follow the description

Ronald

ronald
Offline
Last seen:4 years 3 months ago
Joined:2016-03-03 15:01
Hi,

Hi,

We took the prox app to modify.
It became clear that the tasks TASK_APP_HT is split in TASK_APP and TASK_HTPT in SDK5. In a lot of not user SDK files changes had to be made.
Personally I find this customer unfriendly.

In “htpt_enable_req_handler”
// Go to connected state
ke_state_set(TASK_HTPT, HTPT_CONNECTED);
is executed.

北欧Android应用的“健康温度计”n be openend. This app will stay connected. But will not show any temperature.

The “app_htpt_temp_send” functions in “app_ht.c” is never called.

The following code is added in “app_default_handlers.c”
#if BLE_HT_THERMOM
app_ht_init();
#endif

The following code is added in “app_entry_point.c”
#if ((BLE_HT_THERMOM) && (!EXCLUDE_DLG_BASS))
(process_event_func_t) app_htpt_process_handler,
#endif

The following code is added in “app.c”
#if BLE_HT_THERMOM
{TASK_HTPT, app_ht_create_db_send, app_ht_enable_prf},
#endif

Any suggestions?

MT_dialog
Offline
Last seen:2 months 1 week ago
年代taff
Joined:2015-06-08 11:34
Hi ronald,

Hi ronald,

标准配置文件在SDK3不是functional and require some modifications in order to operate, they have been placed in the SDK3 in order to act as examples in user implementations and since they weren't used in a design they were included in the SDK as a reference. Regarding your implementation, you should be ok with the above modifications. Now regarding the fact that you dont get the notifications or indications with new measurement values, in the app_ht_create_db_send if you left it as is then you should support all the optional features that the service requires, that means that the interval characteristic is writable. The new measurements are triggered by a timer (APP_HT_TIMER msg) in steady intervals. The specific timer is set when the user writes the interval characteristic. Upon writing a value between APP_HT_MEAS_INTV_MIN and APP_HT_MEAS_INTV_MAX you should be able to get notifications or indications. If you are not bonded the first time you will try to write to that characteristic, your command will be rejected with unsufficient authentication error (since the writable characteristic is requires authentication) and your android should initiate a bonding procedure (make sure that the CFG_APP_SECURITY is defined in the da1458x_config_basic.h file), after the bonding is completed you will be able to write to that characteristic. After the successfull write you should get notifications/indication depends on your configuration about the Temperature measurement or the Intermediate Temperature.

In case you dont have any data on your phone you can debug your issue using breakpoint, check that upon the write command you send a HTPT_MEAS_INTV_CHG_IND (from the gattc_write_cmd_ind_handler) and the appropriate handler is called htpt_meas_intv_chg_ind_handler(), then check in the handler the ke_timer_set(APP_HT_TIMER, ....) is reached. Also in the ke_timer_set(APP_HT_TIMER, dest_id, ) make sure that the task that will be notified when the timer elapses is the TASK_APP (id 0x32), and check if you get the handler of the timer when the time elapses.

Thanks MT_dialog

z20121202038
Offline
Last seen:3 years 11 months ago
Joined:2016-03-30 12:51
Hi,

Hi,
I want to know the main difference between the SDK 5.0.3 and SDK3 .
年代DK3 has more example about the measurement of the temperature, so is it neccessary to change to SDK 5 ?

MT_dialog
Offline
Last seen:2 months 1 week ago
年代taff
Joined:2015-06-08 11:34
Hi z20121202038,

Hi z20121202038,

The SDK5 has more apis and its more easy to get started with. Dialog recommend's it for new project development.

Thanks MT_dialog

Max44
Offline
Last seen:9 months 1 week ago
Joined:2016-02-08 15:58
I have some similar questions

I have some similar questions but relative to SDK5 that I'm using with a DA14580 Basic Kit. I'd like to add a Health Thermometer profile to the Device Information Service of the BLE barebones example and I'm finding it's not clear in the User Manuals UM-B-050 and -051 exactly how to configure this. From looking over the SDK files under profiles->htp it seems to be a Health Thermometer server you would need both the htpc and htpt tasks. Is this correct? If I just add includes for htpc,h and htpt.h to my user_profiles_config.h file I get build errors:

.\out_580\ble_app_bbt_580.axf: Error: L6218E: Undefined symbol htpc_init (referred from prf_utils.o).
.\out_580\ble_app_bbt_580.axf: Error: L6218E: Undefined symbol htpt_init (referred from prf_utils.o).
Not enough information to produce a SYMDEFs file.
Not enough information to produce a FEEDBACK file.
Not enough information to list image symbols.

年代o apparently there was still something missing. I wasn't sure what but guessed that from the diss files present I should add files relating to htp to the sdk_profiles folder: htpc.c, htpc_task.c, htpt.c, htpt_task.c. Now I at least get a build without errors. I'm wondering if there are some configuration parameters that need to be set in the user_profiles_config.h file such as were made for the diss? And do I also need to create an app_htpt.c, app_htpt_task.c,app_htpc.c, and app_htpc_task.c as mentioned above? Are there guidlines for this somewhere?

MT_dialog
Offline
Last seen:2 months 1 week ago
年代taff
Joined:2015-06-08 11:34
Hi Max44,

Hi Max44,

In the SDK5 the Health thermometer profile is not included, in the SDK3 those profiles were included but they were not fully operational and they needed some modifications in order to operate. In order to have the HTPT service in your project you need to have the htpc and htpc_task, since those are the files that will build the database and interact with your application. Please follow the above description on how to implement the HTPT profile.

Thanks MT_dialog

Max44
Offline
Last seen:9 months 1 week ago
Joined:2016-02-08 15:58
Thanks .... I think. This is

Thanks .... I think. This is bad news. The procedure above to implement the Health Thermometer profile looks ugly, but I'll try it.

Is there a fully operational and tested standard BLE profile (other than the Design Information Service) that I can use as a reference example? Primarily for setting up tasks, databases, and message handlers.

MT_dialog
Offline
Last seen:2 months 1 week ago
年代taff
Joined:2015-06-08 11:34
Hi Max44,

Hi Max44,

年代orry but there is no application implementation for the Health Thermometer, about the other profiles you can check the proximity, the battery, and the find me profile, those should provide enough guidance to implememnt the thermometer profile properly. You can find an implementation of those profiles in the prox_reporter project.

Thanks MT_dialog

Topic locked