cancel
Showing results for 
Search instead for 
Did you mean: 

Updating values

jampino
Associate II
Posted on March 08, 2018 at 17:26

Hello all, 

I am having a problems to update some values on the master, I am using bluenrg-1 I have one device working as a master and other as a slave. The slave has a button, I have both connected and every time I press the button on the slave  the function aci_gatt_update_char_value() is called containing a value, I have on the slave that configuration:

aci_gatt_add_char( Service_Handle,

UUID_TYPE_128,

&char_uuid,

CHAR_VALUE_LENGTH,

CHAR_PROP_READ|CHAR_PROP_NOTIFY,

ATTR_PERMISSION_NONE,

GATT_DONT_NOTIFY_EVENTS,

ENCRYPTION_KEY_SIZE,

ATT_HAS_FIXED_LENGTH,

&CharHandle);

the master is discovering the service and characteristic from the slave. Do I need to do something more or in a different manner? Which event function will be call on the master?

I can read the values from the master  requesting the value every x time once both are connected but I would like to received the value on the master just the button is pressed. 

Thank you

16 REPLIES 16
Posted on March 13, 2018 at 11:29

Hi Jamp,

just to clarify, the arguments for the aci_gatt_write_char_desc() are:

ConnectionHandle - Length: 2 bytes (Connection handle for which the command is given)

AttrHandle - Length: 2 bytes (Handle of the attribute to be written)

ValLen - Length: 1 byte (Length of the value to be written)

AttrVal (Value to be written)

Kind regards

Andrea

Posted on March 13, 2018 at 11:40

Hello Andrea,

Yes those are the arguments I am using. Not sure what the AttrVal should be. Should be always 

AttrVal = 

{0x01,0x00}

I don't know if there is any difference as I am using the master as a coprocess

If I just declare one of the characteristics, it does not matter which one, I will receive always an update on the master, every time the value is changed. 

Thank you

Posted on March 13, 2018 at 13:40

Doing more tests, I can see that the only characteristic that is received to the master is the first characteristic added on the slave, it does not matter the characteristic is first added, it is the only one received on the master.

jampino
Associate II
Posted on March 15, 2018 at 16:52

Hello,

I have checked that when I am calling the function with:

aci_gatt_write_char_desc(

Connectionhandle, handle+2, length, Value) with length different to 1 I get the error 0x41(Failed) some idea why is that error.

Thank you

Posted on March 22, 2018 at 15:36

Hi Jamp,

It is strange, because the length should be always 0x02. Is it happening for any char?

Regards

Andrea

Posted on March 22, 2018 at 16:07

Hi Jamp,

please, note also that before calling

succeeding aci_gatt_write_char_desc() you should wait for the previous action to complete (i.e., for the aci_gatt_proc_complete_event event to be generated).

Hope that can help.

Andrea

jampino
Associate II
Posted on March 26, 2018 at 09:58

Yes I have it working thanks, I added a waiting time between the calling functions