Reading of Battery Level (BASS) and Custom Service (CUSTS1) Characteristic (GTL over UART)

4 posts / 0 new
Last post
abremen
Offline
Last seen:4 years 5 months ago
加入:2015-02-10 17:44
Reading of Battery Level (BASS) and Custom Service (CUSTS1) Characteristic (GTL over UART)

Dear support,

I have ported over the prox_reporter_ext project (SDK 5.0.3) and I have added the Battery Service (as in project prox_reporter) and the Custom Service (as in project ble_app_profile). I am using GTL over UART for communication between our ext processor and the DA14580.

I would very much like to find what message I need to handle in our host code in order to respond to a 'Read' of the Battery Level and a 'Read' of a custom characteristic. I am for example using App LightBlue on iOS to read the Battery Level on request (by pressing 'Read again' while having selected the Battery Service). However none of the messages below (from the example project) is triggered so that I can actually update the Battery Level.

// Inform APP of database creation status
case BASS_CREATE_DB_CFM:

// Disable confirmation with configuration to save after profile disabled
case BASS_DISABLE_IND:

// Error indication to Host
case BASS_ERROR_IND:

// Inform APP if Battery Level value has been notified or not
case BASS_BATT_LEVEL_UPD_CFM:

// Inform APP that Battery Level Notification Configuration has been changed
case BASS_BATT_LEVEL_NTF_CFG_IND:

The same goes for the Custom Service that I've implemented. I am able to respond to the CUSTS1_VAL_WRITE_IND message (when a value is Written), but it is not yet clear how I can respond to a Read.

I am looking forward to your response.

Kind regards,
Arjan

Keywords:
Device:
MT_dialog
Offline
Last seen:2 months 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi abremen,

Hi abremen,

When you perform a read there is no indication to the application that a read has been performed.

Thanks MT_dialog

abremen
Offline
Last seen:4 years 5 months ago
加入:2015-02-10 17:44
Hi MT_dialog,

Hi MT_dialog,

So if I understand correctly, it is up to the Application (in our external processor) to keep the information (attribute values) in the database(s) on the DA14580 up to date? So that when a peer device performs a read, it will retrieve the most up to date value? And this is the only way for doing so? This is the same for both the BASS and for example custom characteristics in CUSTS1?

In case of the BASS, I thus need to send a BASS_BATT_LEVEL_UPD_REQ message (GTL over UART) to the DA14580 every time the battery level changes?

For a custom service, can you explain to me the message sequence? Currently the host sends a CUSTS1_CREATE_DB_REQ message to the DA14580, after which the DA14580 sends a CUSTS1_CREATE_DB_CFM message to the host in response (start-up sequence). On connect, the DA14580 sends a GAPC_CONNECTION_REQ_IND message to the host, after which the hosts sends a GAPC_CONNECTION_CFM and CUSTS1_ENABLE_REQ in response.

Where in this sequence should the value of custom characteristics be set? Which message(s) do I need to use and in what order?

Thanks,
Arjan

MT_dialog
Offline
Last seen:2 months 3 weeks ago
工作人员
加入:2015-06-08 11:34
Hi abremen,

Hi abremen,

When a host performs a read there is no way for the peer device to know that the specific characteristic has been read in all the profiles in the da14580. Its up to the slave device to update the values in the database. Yes every time you want to get an update for the battery status you have to update the value by issuing an BASS_BATT_LEVEL_UPD_REQ. You can check in the fully hosted proximity reporter example in the app_bass_task.c file, the app_bat_timer_handler() is called in order to poll the battery through the app_batt_lvl() function and the app_bat_set_level sends the BASS_BATT_LEVEL_UPD_REQ message. Also if the notifications are enabled the update triggers a notification.

About the custom service you can issue an update command to the characteristic you want to set. In order to do that you can try to use the CUSTS1_VAL_SET_REQ message right after enabling the profile.

Thanks MT_dialog