QN9080 - How to set Bluetooth Device Name

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

QN9080 - How to set Bluetooth Device Name

Jump to solution
2,585 Views
rickdickerson
Contributor III

Is there any way to change the Bluetooth device name at run time? I have a fixed string string defined in gatt_db.h with the gBleSig_GapDeviceName_d characteristic, but I would like to use a portion of the Bluetooth address in the device name. The address changes for each device, so a fixed string won't work for my application.

I tried writing the NVDS_TAG_DEVICE_NAME to NVDS, but the nvds_put function is returning a NVDS_NO_BACKUP_SPACE_AVAILABLE result. The device name has to be written in flash somewhere, but I am not sure where so I can't modify it.

My device name characteristic is marked as writable so I have also tried writing the device name using LightBlue Explorer. The written device name is persistent between connections, but not between power cycles. 

Can anyone provide some guidance on how to customize the Bluetooth device name for each device?

Labels (2)
0 Kudos
Reply
1 Solution
2,168 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Yes, in the post I mentioned there is this API   called, GattDb_WriteAttribute, by any chance, he you tried using it? 

Regards, 
Estephania

View solution in original post

0 Kudos
Reply
6 Replies
2,168 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

By any chance, have you tried using ControllerSetBD_ADDR() ? If you haven't could you please try it ? 

Regards

0 Kudos
Reply
2,168 Views
rickdickerson
Contributor III

Estephania,

The ControllerSetBD_ADDR() function sets the Bluetooth address. I am trying to set the Bluetooth device name.

Rick

0 Kudos
Reply
2,168 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Sorry for the late reply and the confusion .

You can check here

https://community.nxp.com/docs/DOC-332703 

And there you will find how to change teh characteristic and the service name. 

Regards

0 Kudos
Reply
2,168 Views
rickdickerson
Contributor III

Estephania,

Unfortunately, that does link does not answer my question. I probably should have been more explicit in my original post, so I will elaborate now. 

The glucose monitor example has this in gatt_db.h: 

PRIMARY_SERVICE(service_gap, gBleSig_GenericAccessProfile_d)
 CHARACTERISTIC(char_device_name, gBleSig_GapDeviceName_d, (gGattCharPropRead_c | gGattCharPropWrite_c) )
 VALUE(value_device_name, gBleSig_GapDeviceName_d, (gPermissionFlagReadable_c | gPermissionFlagWritable_c), 11, "FSL_BLE_GLS")
 CHARACTERISTIC(char_appearance, gBleSig_GapAppearance_d, (gGattCharPropRead_c) )
 VALUE(value_appearance, gBleSig_GapAppearance_d, (gPermissionFlagReadable_c), 2, UuidArray(gGenericGlucoseMeter_c))
 CHARACTERISTIC(char_ppcp, gBleSig_GapPpcp_d, (gGattCharPropRead_c) )
 VALUE(value_ppcp, gBleSig_GapPpcp_d, (gPermissionFlagReadable_c), 8, 0x0A, 0x00, 0x10, 0x00, 0x64, 0x00, 0xE2, 0x04)

I would like to change the value of the char_device_name dynamically at runtime. It is currently "FSL_BLE_GLS". 

I tried using a variable as the last argument in the VALUE macro, but that gives me an error that says "initializer element is not computable at load time".

Is there any way to change that characteristic value at run time?

Thanks,
Rick
0 Kudos
Reply
2,169 Views
estephania_mart
NXP TechSupport
NXP TechSupport

Hello, 

Yes, in the post I mentioned there is this API   called, GattDb_WriteAttribute, by any chance, he you tried using it? 

Regards, 
Estephania

0 Kudos
Reply
2,168 Views
rickdickerson
Contributor III

Estephania,

I did try the GattDb_WriteAttribute function but it wasn't working. After I your latest post I looked at it again and found that I was writing a different length than what was initialized in gatt_db.h. It started working when I started using the same length.

Thanks for your help.


Rick

0 Kudos
Reply