Is pairing/encryption mandatory to allow a peer to write in GATT

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MiTo_1583836
Level 5
Level 5
50 likes received 25 likes received 10 likes received

I am playing with the GATT database and the read/write property.


I am currently not able to write to the GATT from a peer application running on iPhone (reference: BLE Explorer).


I am able to "read" all the characteristics defined in my custom GATT. I added the GATT callback in case a write is called via legattdb_regWriteHandleCb((LEGATTDB_WRITE_CB) cb). I see this callback being called when I do a write from the peer/iPhone device, but I don't see the value being modified in the peer device application (it keeps the initialization value).

I diffed my application with the hello_sensor.c and one of the main difference is the pairing. I decided not to encrypt the connection for now and test a write from the peer/iPhone device.

Is it mandatory to have a secure connection before initiating a write on SDK1.x TAG20732 from the peer device ?

0 Likes
1 Solution
MiTo_1583836
Level 5
Level 5
50 likes received 25 likes received 10 likes received

I have been able to test a write of a characteristic without pairing/encryption of the communication. I found one issue with the BCM20732TAG. It sounds that I need to recover the tag before loading my code in case I redefine/change the GATT table. I modified couple of times the GATT table yesterday and I never got the write working properly. The same code worked after a recovery of the TAG board.

To answer this question, I believe the encryption is not needed to do a write of the GATT from the peer device/iPhone. I commented a call to lesmp_sendSecurityRequest() when the link is UP and I also set the .encr_required to 0 in BLE_PROFILE_CFG structure. All the characteristics have the following parameters:

Properties:  LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE,

Permissions: LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ,

My code is very minimalist with handling of the advertisement at boot and when the connection is up.

View solution in original post

0 Likes
1 Reply
MiTo_1583836
Level 5
Level 5
50 likes received 25 likes received 10 likes received

I have been able to test a write of a characteristic without pairing/encryption of the communication. I found one issue with the BCM20732TAG. It sounds that I need to recover the tag before loading my code in case I redefine/change the GATT table. I modified couple of times the GATT table yesterday and I never got the write working properly. The same code worked after a recovery of the TAG board.

To answer this question, I believe the encryption is not needed to do a write of the GATT from the peer device/iPhone. I commented a call to lesmp_sendSecurityRequest() when the link is UP and I also set the .encr_required to 0 in BLE_PROFILE_CFG structure. All the characteristics have the following parameters:

Properties:  LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_WRITE,

Permissions: LEGATTDB_PERM_READABLE | LEGATTDB_PERM_WRITE_CMD | LEGATTDB_PERM_WRITE_REQ,

My code is very minimalist with handling of the advertisement at boot and when the connection is up.

0 Likes