DA14531 Name Change Service/Characteristic

I was curious if there's a characteristic to change the GAP device name.

I know there's one to see the name, but I didn't see one to change the name. Is this one I'd have to manually create or is there a simple way to do so?

Thanks!

EDIT:

For those reading this in the future, I verified 3 answers for this. 1 is for a service and characteristic. The other 2 are for AT commands to accomplish the same task, 1 with persistent data and the other without.

Parents
  • Hi There,

    Thank you for posting your question online.
    Yes, it is possible to change the Device Name. 
    I worked on the ble_app_peripheral example with SDK v6.0.18.
    I created a custom characteristic for the Custom Service 1.
    On user_custs1_impl.c file:

    void user_svc1_dev_name_wr_ind_handler (ke_msg_id_t const msgid,
                                          struct custs1_val_write_ind const *param,
                                          ke_task_id_t const dest_id,
                                          ke_task_id_t const src_id)
    {
    
    	char new_device_name[NEW_DEVICE_NAME_LENGTH] = "\0";
    
    	memcpy(&new_device_name, &param->value, param->length);
    
    	device_info.dev_name.length = (strlen(new_device_name) <= GAP_MAX_NAME_SIZE) ?strlen(new_device_name) : GAP_MAX_NAME_SIZE;
    
    	memcpy(device_info.dev_name.name, new_device_name, device_info.dev_name.length);
    
    	
    }

    On user_peripheral.c file:
    void user_catch_rest_hndl(ke_msg_id_t const msgid,
                              void const *param,
                              ke_task_id_t const dest_id,
                              ke_task_id_t const src_id)
    {
        switch(msgid)
        {
            case CUSTS1_VAL_WRITE_IND:
            {
                struct custs1_val_write_ind const *msg_param = (struct custs1_val_write_ind const *)(param);
    
                switch (msg_param->handle)
                {
                    case SVC1_IDX_CONTROL_POINT_VAL:
                        user_svc1_ctrl_wr_ind_handler(msgid, msg_param, dest_id, src_id);
                        break;
    								
                    case SVC1_IDX_DEV_NAME_VAL:
                        user_svc1_dev_name_wr_ind_handler(msgid, msg_param, dest_id, src_id);
                        break;
                        .
                        .
                        .

    With the SmartBond App I connect into my device and I can change the Device name like this:


    ble_app_peripheral_dev_name.zip

    Kind Regards,
    OV_Renesas


  • Ah, so there is no existing characteristic to change the name? Just wanted to see if there was a way to do it without code.

  • Hi There,

    Thank you for the reply.
    There is not a dedicated characteristic to change the device name. 
    You will have to create a custom characteristic as shown in the previous answer.

    Kind Regards,
    OV_Renesas

Reply Children