1

Problem with writing value to gatt attribute in connection.

Martin gravatar image

asked 2013-11-28 17:32:08 +0100

updated 2013-12-06 14:45:16 +0100

Hi. I have a problem with writing value to gatts attribute when device is in connection mode. In my application I want to check if the parameter writing by the client to server's attribute has a proper value and if not, I want to set there my own value. I am using "on_ble_evt(ble_evt_t * p_ble_evt)" function and BLE_GATTS_EVT_WRITE to detect writing event and I am checking the value - this part works fine. But when incorrect value is detected I cant write my own value with "sd_ble_gatts_value_set" - it works only after disconnection. I would like to ask is it possible to set attribute's value in connection mode?

Best regards, Martin

edit retag flag offensive close delete report spam

1 answer

Sort by ยป oldest newest most voted
1
olha gravatar image

answered 2013-11-28 17:36:48 +0100

updated 2013-12-06 14:45:16 +0100

In this case, I'd suggest that you instead use the Write Command property, and authorization. In that way, you can simply deny the write in the first place. Take a look at this MSC to show the sequence of events this would cause. You get this behavior by enabling the wr_auth field when adding the characteristic.

If you absolutely don't want to do this, could you please include what error code you get back from sd_ble_gatts_value_set()?

edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

Stats

Asked: 2013-11-28 17:32:08 +0100

Seen: 1,165 times

Last updated: des. 06 '13