cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 6 MCU

zhch_4550981
New Contributor II

APP sends “SN+123456789012345678901234567890”,I use the customServiceData to change the device name

Set BLE name2.png

0 Likes
1 Solution
Owen_Zhang123
Moderator
Moderator

The local name set in the application code is limitted by the initiated name length in the component.

For example, if you set the name "1234567890" in the component, then the maximum length you can set in the application code is 10 bytes. So please set a name long enough in the BLE component. You may use space to extend the length, such as "Find Me                      ".

Besides, the name length in the component is also restricted by the advertising packet or scan response packet if you add the device name to the packet. The two packets can have 31 bytes as most. I suggest to use the short name in these packet if you want to set a name longer than 31 byts.

View solution in original post

0 Likes
3 Replies
LiDo_2439176
Contributor II

Your TX buffer has only 20 bytes.

tx_len.png

Len_CONSULTRON
Honored Contributor II

zhch,

I found the function description for Cy_BLE_SetLocalName().  See lines 11-13

/******************************************************************************

* Function Name: Cy_BLE_SetLocalName

***************************************************************************//**

*  This function is used to set the local device name - a Characteristic of the

*  GAP Service. If the characteristic length entered in the Component customizer

*  is shorter than the string specified by the "name" parameter, the local device

*  name will be cut to the length specified in the customizer.

*

*  \param name: The local device name string. The name string to be written as

*              the local device name. It represents a UTF-8 encoded User

*              Friendly Descriptive Name for the device. The length of the local

*              device string is entered into the Component customizer and it can

*              be set to a value from 0 to 248 bytes. If the name contained in

*              the parameter is shorter than the length from the customizer, the

*              end of the name is indicated by a NULL octet (0x00).

*

*  \return

*  \ref cy_en_ble_api_result_t : Return value indicates if the function succeeded or

*  failed. The following are possible error codes.

*

*  Error Codes                        | Description

*  ------------                        | -----------

*  CY_BLE_SUCCESS                      | The function completed successfully.

*  CY_BLE_ERROR_INVALID_PARAMETER      | On specifying NULL as input parameter.

*

*******************************************************************************/

The only place I found to set the LocalName in the BLE  customizer is on the "Gap Settings" tab:

pastedImage_5.png

Try setting "Device Name:" to a name with the maximum size desired like:  "123456789012345678901234567890".

I believe the structure created will be large enough for your serial number when you change it in the code.

I suspect the current name in "Device Name:" is the reason for the limit of the LocalName.

Len

Len
"Engineering is an Art. The Art of Compromise."
Owen_Zhang123
Moderator
Moderator

The local name set in the application code is limitted by the initiated name length in the component.

For example, if you set the name "1234567890" in the component, then the maximum length you can set in the application code is 10 bytes. So please set a name long enough in the BLE component. You may use space to extend the length, such as "Find Me                      ".

Besides, the name length in the component is also restricted by the advertising packet or scan response packet if you add the device name to the packet. The two packets can have 31 bytes as most. I suggest to use the short name in these packet if you want to set a name longer than 31 byts.

View solution in original post

0 Likes
Top labels