This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Device Name bug

The standard BLE UUID for device name is 0x2A00. The read and write callbacks and the Set/Get functions are all contained within the stack. Application code may interact with this characteristic using GGS_GetParameter and GGS_SetParameter.

The problem is that  GGS_GetParameter( GGS_DEVICE_NAME_ATT, pValue ); may return more than reading UUID 0x2A00. 

To recreate the problem, set GGS_DEVICE_NAME_ATT to 'a' 'b' 'c' 'd' '\0'.
Write  ''x' 'y' '\0' to UUID 0x2A00. 
GGS_GetParameter( GGS_DEVICE_NAME_ATT, pValue ) will now set pValue to  ''x' 'y' '\0' 'd' '\0'.
Reading UUID 0x2A00 only returns ''x' 'y' '\0'

The root of this problem is that iOS cannot write to 0x2A00. Android can. I need this functionality so i made a dummy UUID that simply transmits whatever GGS_GetParameter(GGS_DEVICE_NAME_ATT, pValue )  returns.

Proposed solution: Set the device name characteristic to all zero (or '\0') whenever a write command is issued

  • Thank you for the feedback. We will investigate this and see if we can fix it on our next release.

  • Hi Peter,

    By default in our projects, the device name
    characteristic is GATT_PROP_READ.

    Did you change the properties to GATT_PROP_WRITE as well?

     

  • Yes. I was able to add the write property with 

     	uint8 devNamePermission = GATT_PERMIT_READ | GATT_PERMIT_WRITE;
    	GGS_SetParameter( GGS_W_PERMIT_DEVICE_NAME_ATT, sizeof ( uint8 ), &devNamePermission ); 

  • Hi Peter,

    Thank you for confirming the property permission.

    I’m sorry that you see the extra bytes after calling GGS_GetParameter. I did confirm that the NULL terminator is correctly inserted when the GGS_DEVICE_NAME_ATT attribute is written via UUID 0x2A00, thus the output is a valid UTF-8 null-terminated string. Any bytes after the NULL terminator can be safely ignored.

    To prevent the extra bytes after the NULL terminator from interfering with your custom UUID, there are a couple of options available. After calling GGS_GetParameter, you can call osal_strlen to get the length of the valid string (i.e., all bytes up to the first NULL terminator) and copy only the valid bytes to a new device name buffer. Or, you can use osal_memset to clear the extra bytes (after the first NULL terminator) in the buffer returned by GGS_GetParameter. Note that the size of the buffer is ‘GAP_DEVICE_NAME_LEN+1’ bytes.