LoPy4 BLE GATTS Write only



  • Hi, I`m trying to enhance my connection with android by adding some security.
    Now I have GATT Service running on lopy4 and GATT client app on android.

    My idea is to send command code on first byte, and bytes 2 & 3 reserved for security key.
    Command run only when security code bytes are the same that defined on lopy.

    The problem is that anybody can see this key by reading characteristic, so disable read for this characteristic is required.

    I found topic https://forum.pycom.io/topic/2953/bluetooth-gattscharacteristic-set-permissions/2
    where is the line

    'The below characteristic supports only READ and NOTIFY:
    service.characteristic(uuid=0x2001, permissions=(1<<0), properties=(1 << 1) | (1 << 4), value=0)'

    I was trying to make write only in a similar way but, it doesn't work, is possible to make write only characteristic? Or any other way to verify the characteristic writer?



  • write only finally done with code:

    chr2 = srv2.characteristic(uuid=1234,permissions=0x02 | 0x10,properties=0x08 | 0x04, value=11)


Log in to reply
 

Pycom on Twitter