cancel
Showing results for 
Search instead for 
Did you mean: 

Hi. I'm trying to make a very slight modification to the SensorTile_ALLMEMS1 project. I want to be able to read the ACC_GYRO_MAG char value over BLE.

MCoop.1
Associate

In the sensor_service.c source file, I add the char_prop_read flag in the below, but now the SensorTile does not even start BLE properly. Any help is appreciated.

starting at line 1074,

 COPY_ACC_GYRO_MAG_W2ST_CHAR_UUID(uuid);

 ret = aci_gatt_add_char(HWServW2STHandle, UUID_TYPE_128, uuid, 2+3*3*2,

CHAR_PROP_NOTIFY|CHAR_PROP_READ,

              ATTR_PERMISSION_NONE,

              GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP,

              16, 0, &AccGyroMagCharHandle);

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @MCoop.1​ ,

Welcome to ST Community. I checked with our experts, and they confirmed me that is is not enough to add the CHAR_PROP_READ, but it is necessary to add a section of code in order to enable the BLE feature in reading.

The suggestion is to reply what implemented for the environmental, and in particular check the “EnvironmentalCharHandle�? handle throughout the code.

You will see some "if function" as follow, that have to be completed with the code to be executed when they are called:

if(handle == EnvironmentalCharHandle + 1)
{
… //code to be executed when the feature is in the reading phase
}
 
if(handle == EnvironmentalCharHandle + 2)
{
… //code to be executed when the feature is in the notification phase
}

On the other side, for the “AccGyroMagCharHandle�? handle you'll find only the function managing the notification phase:

if(attr_handle == AccGyroMagCharHandle + 2)
{
… //code to be executed when the feature is in the notification phase
}

Basically, the code to be executed when the feature is in reading phase is missing.

Writing only "CHAR_PROP_READ" statement you are just adding a feature that can also be read in addition to the notification.

If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.

-Eleon

View solution in original post

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @MCoop.1​ ,

Welcome to ST Community. I checked with our experts, and they confirmed me that is is not enough to add the CHAR_PROP_READ, but it is necessary to add a section of code in order to enable the BLE feature in reading.

The suggestion is to reply what implemented for the environmental, and in particular check the “EnvironmentalCharHandle�? handle throughout the code.

You will see some "if function" as follow, that have to be completed with the code to be executed when they are called:

if(handle == EnvironmentalCharHandle + 1)
{
… //code to be executed when the feature is in the reading phase
}
 
if(handle == EnvironmentalCharHandle + 2)
{
… //code to be executed when the feature is in the notification phase
}

On the other side, for the “AccGyroMagCharHandle�? handle you'll find only the function managing the notification phase:

if(attr_handle == AccGyroMagCharHandle + 2)
{
… //code to be executed when the feature is in the notification phase
}

Basically, the code to be executed when the feature is in reading phase is missing.

Writing only "CHAR_PROP_READ" statement you are just adding a feature that can also be read in addition to the notification.

If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.

-Eleon