Add service to IoT sensor (SDK 5.160.1.19)

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
gme_johannes
Offline
Last seen:2 weeks 4 days ago
加入:2017-12-22 10:09
Add service to IoT sensor (SDK 5.160.1.19)

Hi,

I am working with the IoT firmware SDK 5.160.1.19.
I want to add an additional characteristic/service to read the battery voltage from the ADC.

I have followed Training_02_custom_profile_example_v1.0.pdf and was mostly able to find the corresponding definitions in the IoT project. However I'm struggling with the instructions on page 29 ("Add custom1 server function callback table.").

I have looked into "Training_03_custom_profile_gatt_cmd_example_v1 0.pdf" for further instructions, but I am not sure where to put the function as defined on page 26, moreover I am unable to find a handler in the code similar to what is described on page 27.

I figure that what I want is basically the custs1_adc_val_2_char from the ble_app_peripheral project, but again the structure seems too different in the IoT firmware.

你能提供帮助吗?

BR Johannes

Device:
PM_Dialog
Offline
Last seen:3 days 6 hours ago
工作人员
加入:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

Let me check how you can add an additional characteristic/service to read the battery voltage from the ADC and I will get back to you as soon as possible.

谢谢,PM_Dialog

gme_johannes
Offline
Last seen:2 weeks 4 days ago
加入:2017-12-22 10:09
Hi PM_Dialog,

Hi PM_Dialog,
any news? I have to finish the implementation during the next week.
BR Johannes

PM_Dialog
Offline
Last seen:3 days 6 hours ago
工作人员
加入:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

Apologies for the delay. You could use the Battery Service which is already implemented and included in the SDK. The prox_reporter example of the SDK includes the Battery Service. Please check this example

  1. Add the bass.c and bass_task.h files in sdk_profiles folder. Both of them are located under sdk\ble_stack\profiles\bas\bass\src SDK folder path
  2. Add the appropriate header files which are under sdk\ble_stack\profiles\bas\bass path.
  3. #define EXCLUDE_DLG_BASS (0) in user_modules_config.h
  4. 在prox_reporter项目中添加user_callback_config.h user_app_bass_cb。

谢谢,PM_Dialog

gme_johannes
Offline
Last seen:2 weeks 4 days ago
加入:2017-12-22 10:09
Hi PM_Dialog,

Hi PM_Dialog,

1. OK
2. OK

(I have also added battery.c, battery.h, app_bass.c, app_bass.h after investigating the prox_reporter project)

3. In user_modules_config.h from the IoT project I already have

#define EXCLUDE_DLG_BASS (0)

虽然这个项目中没有提到上述文件。

4.在da1458x_sdk \ 5.0.4 \ projects \ target_apps \ ble_examples \ prox_reporter \ src \ config \ user_callback_config.h我只有

static const struct profile_callbacks user_profile_callbacks = { #if (BLE_BAS_SERVER) .on_batt_level_upd_cfm = NULL, .on_batt_level_ntf_cfg_ind = NULL, #endif (...)

Questions:

1. What is user_app_bass_cb? I can not find it in the prox_reporter project nor the files mentioned in 1. and 2.
2.这一切如何匹配我在教程中关注的程序?
3.在IOT SDK(v5.160.1.19)中,似乎只有“对话佩戴服务”。无论dws_task.c发生什么都在我身边。电池服务究竟如何添加?我在user_dws_config.h中添加它吗?
4. I will soon switch to SDK6 with DA14585. I wonder if it's worth trying to add the service now, when it is so tedious and on top of that the procedure might be different in SDK 6. Has it changed?

谢谢,

Johannes

PM_Dialog
Offline
Last seen:3 days 6 hours ago
工作人员
加入:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

Could you please follow the procedure below in order to include the BASS profile?

  1. Comment out the #include "bass.h" in the user_profiles_config.h
  2. 加入面糊y driver in the sdk_driver project folder. The driver is located under sdk_580\sdk\platform\driver\battery\battery.c path
  3. Add bass.c and bass_task.c in the sdk_profiles. Located under sdk_580\sdk\ble_stack\profiles\bas\bass path.
  4. Add app_bass.c and app_bass_task.c in sdk_app flder. Located under sdk_580\sdk\app_modules\src\app_bass path.

I’ve just checked the IoT code and it has slightly different code architecture from the procedure described in the user manual. For new designs we strongly recommend the usage of MultiSensor kit which is based on the top of SDK6. The procedure might be slightly different, but I could check it if you are considering to move into SDK6 and DA14585 product. With the procedure I described, I am able to add the Battery service.

谢谢,PM_Dialog

gme_johannes
Offline
Last seen:2 weeks 4 days ago
加入:2017-12-22 10:09
Hi PM_Dialog,

Hi PM_Dialog,

It seems to work, however I ran into the 32kB limit of Keil.

We are working on a new prototype based on the DA14585 and will switch to SDK6 soon.

Thank you for your efforts,

Johannes

PM_Dialog
Offline
Last seen:3 days 6 hours ago
工作人员
加入:2018-02-08 11:03
Hi gme_johannes,

Hi gme_johannes,

Thanks for accepting my answer. For new designs we strongly recommend the usage of 585 Multi-sensor kit. Glad that you will move into DA14585 and SDK6. If you have any questions or issues regarding the SDK6, please create a new forum thread.

谢谢,PM_Dialog