Cannot update characteristic value if connection is not made

6 posts / 0 new
Last post
ankitdaf
Offline
Last seen:2 years 9 months ago
Joined:2015-09-03 20:14
Cannot update characteristic value if connection is not made

Hi

I am using the ble_app_profile as a base, and I am trying to write a value to a characteristic based on UART. I am able to do a ke_msg_send from the UART callback to set the value, but the value is only changed when there is a central connected to the 580. If there is no central connected to the 580, the updates are all discarded.

How can I ensure that the values received over UART are reflected in the characteristic, irrespective of whether a central is connected to the 580 or not ?

Thanks,

Keywords:
Device:
LT_Dialog(未验证)
Hi,

Hi,
Profiles will be disabled if there's no valid connections. If you'd like to update values to characteristics in a given profile, the profile needs to be enabled. You could search for CUSTS1_ENABLE_REQ as an example of how-to-enable-profile since your project is based on ble_app_profile.

ankitdaf
Offline
Last seen:2 years 9 months ago
Joined:2015-09-03 20:14
Thanks for the quick reply, I

Thanks for the quick reply, I'll try that.

1. If I want to store the value in a global variable and load the value when the profile is enabled instead, is that possible ? What method can let me do that ? Where should I be calling such a method ?

2. Does keeping the profile enabled have any power consumption implications ?

ankitdaf
Offline
Last seen:2 years 9 months ago
Joined:2015-09-03 20:14
Also, calling

Also, calling
"
app_custs1_enable( (uint16_t) app_env->conhdl);
"
in user_app_init did not make any difference. What is the right place to put this ?

Thanks

LT_Dialog(未验证)
Hi,

Hi,
I tried to reproduce your case. The value of the characteristic is still updatable even without connections. Here's what I did:
In the project ble_app_profile, update the value of CUST1_IDX_BUTTON_STATE_VAL in the end of the function custs1_disable() which is called when the profile cust1 receives a GAPC_DISCONNECT_IND message.

Could you also check the correctness of input arguments and maybe the error code from attmdb_att_set_value()? I supposed you using the same function.

void custs1_disable(uint16_t conhdl)
{
...
//Go to idle state
ke_state_set (TASK_CUSTS1CUSTS1_IDLE);

static uint8_t s_value = 0x03;
attmdb_att_set_value(custs1_env.shdl+CUST1_IDX_BUTTON_STATE_VAL, 1, &s_value);
s_value++;
}

ankitdaf
Offline
Last seen:2 years 9 months ago
Joined:2015-09-03 20:14
Oh, I was trying to enable

Oh, I was trying to enable the profile as suggested by you earlier, but that did not work.

attmdb_att_set_value worked, thanks !

Topic locked