7 posts / 0 new
Last post
Cosmin
Offline
Last seen:5年4天前
加入:2015-12-14 08:35
client BLE app

Hello Dialog,

I am currently working on a BLE application using the dialog chips da14581 and the sdk 5.

我设法用之一the chips as a battery server, using the profile from the sdk. So I can connect to it using a mobile application (BlueLoupe from android) and read the battery level. There is no problem in this part.
However, I have difficulties in configuring the other chip as a battery client. I can scan and connect to the server chip, but I didn’t manage to start the basc profile. I figured out that only basc_init is called, but no other functions from the basc.c or basc_task.c.
I’ve defined the BLE_BAS_CLIENT as 1 and I’ve included basc.h in the user_profiles_config.h

Can you please help?

Thank you,
Cosmin

Device:
MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi Cosmin,

Hi Cosmin,

You have to add the app_basc.c and app_basc_task.c and the additional header files. By including the basc.h file in the user_profiles_config.h you will set the BLE_BAS_CLIENT definition. After that try to compile and change the TASK_APP_BASC to TASK_APP since the compiler will complain about the non-existing definition. After you 've succesfully added the client profile you must call the app_basc_init() to initialize the application profile and start scanning. When your device founds the advertiser and connects to it, after the connection is completed you should invoke the app_basc_enable_prf() function in order to enable the profile and your device to start looking for the services it wants.

Thanks MT_dialog

Cosmin
Offline
Last seen:5年4天前
加入:2015-12-14 08:35
Hello MT,

Hello MT,

I've done what you told me, but if I use TASK_APP instead of TASK_APP_BASC my device won't jump to the callback function for scanning (.app_on_set_dev_config_complete), so I cannot connect to the device anymore. The app_basc_init is called upon device initialization.

Any ideas?

Thank you,
Cosmin

Cosmin
Offline
Last seen:5年4天前
加入:2015-12-14 08:35
Ok... I got it to work.

Ok... I got it to work. Partially.
I created the TASK_APP_BASC in the KE_TASK_TYPE enum, with the value 54. Now I got the connection up and going without modifing the TASK_APP_BASC to TASK_APP. But there still is a problem.
It doesn't go into Normal connection. Shouldn't be basc_enable_req_handler called a second time with the PRF_CON_NORMAL? If so, where should I make the call? I can see where it goes to the connected state, but the functions for receiving battery value aren't called.

Thanks.

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi Cosmin,

Hi Cosmin,

The app_basc_init() should be called in the default_app_on_init(). Please try that. The task for the battery client is TASK_BASC use this and dont place another task in the KE_TASK_TYPE. I dont think that you should re-enable the battery profile for a second time, the normal connection should be issued when the client has allready discovered the characteristics of the device in the first connection and has already bonded with the device. Since you are staying connected the PRF_CON_NORMAL is sufficient (this is also what the allready implemented profiles are doing in the external applications in the monitor of the proximity example - app_proxm_enale, app_disc_enable). Also you can check the RW-BLE_PRF-BAS_IS.pdf for more info about the basc profile. If you want to receive the values from the battery service you have to enable to notifications from to your device.

Thanks MT_dialog

Cosmin
Offline
Last seen:5年4天前
加入:2015-12-14 08:35
Hello MT,

Hello MT,

I've managed to get it working. I've decided not to use the app_basc and app_basc_task. I created the TASK_BASC with the tasks description TASK_DESC_BASC from the basc.c
After connection I called basc_enable_req and set de task state to BASC_DISCOVERING. I've even managed to read the battery level after sending a request.

Soo, everything is working fine,
Thank you for your help.
Cosmin

MT_dialog
Offline
Last seen:2 months 3 weeks ago
Staff
加入:2015-06-08 11:34
Hi Cosmin,

Hi Cosmin,

Glad it worked, and thanks for the indication.

BR MT_dialog