浏览网络发现在宝岛台湾的一些网站有很多有趣而且质量高的博客,特意搬过来和大家一起分享学习下。





这次我们介绍下QUALCOMM QCC300X 蓝牙名称存储结构与QCC512x_302X存储结构异同,

针对蓝牙名称,之前我们提到 QCC512x_302X 设备信息修改中,有QCC512x_302X的蓝牙名称,详见QUALCOMM QCC512x 与302X 蓝牙系列量产必备:设备信息修改 https://www.wpgdadatong.com/getBlogDetail?BID=B0232

可以知道QCC512x_302X 的蓝牙存储方式在qcc512x_qcc302x\common\subsys1_config2.htf中
  1. <div>file=bt2
# Change bluetooth address and device name to appropriate values

# using variable markers from the template.xml file.

pskey_device_name="QCC512X-AA_L"

这个pskey_device_name的读取与写入方式,要以如下方式
写入:teConfigCacheWriteItem(iHandle, "bt2:PSKEY_DEVICE_NAME", _devicename_);
读取:teConfigCacheReadItem(iHandle, "bt2:PSKEY_DEVICE_NAME", value, &maxLen);

QCC300X 的存储结构又是怎样的呢?
1、QCC300X的蓝牙名称
QCC300X蓝牙名称修改要用 PSkey,而QCC512x_302X 没有明显的PSkey可供修改,这是其不同点。
Bluecore内部有些配置寄存器,称为PSKEY,这些寄存器不可随意更改,当然也有些是可以自定义修改的。量产时经常在ADK 与 Application 中修改,用Pstool 可以查看到名称值

2 、QCC300X蓝牙名称的PSkey
image.png
  1. Local device's "user friendly" name
  2. This PSKey holds the local device's default "user friendly" name, used by the HCI Read_Local_Name and Change_Local_Name commands and by LMP_name_req/LMP_name_res transactions.
  3. When the firmware is booted, the device's name is taken from this PSKey. However, if the local host alters the local device's name, by calling the HCI Change_Local_Name command, then the new name is held in RAM. Subsequent requests to read the device's name take from the RAM store, not from this PSKey. The PSKey's value only becomes visible again after the firmware reboots.
  4. The Bluetooth v1.1 HCI specification requires the device's default name to be ""; an empty string. The default (psrom) value of this PSKey is "CSR - bc3" or similar. Therefore, the psrom value does not meet the HCI specification. If this PSKey is set to hold nothing, i.e., no uint16s are stored under the PSKey, then the HCI default value is obtained.
  5. Over HCI and LMP the name is passed as a sequence of UTF-8 octets. Because the PS stores data in arrays of uint16s, the name is packed in this PSKey, two octets per uint16. This packing is important when the PS store is small, notably where the PS is held in EEPROM.
  6. Working from the start of the device's name, the first character is stored in the lower octet of the PSKey's first uint16, the second character in the upper octet of the first uint16, etc. If the name is an odd number of characters then the upper octet of the last uint16 is '\0'.
  7. This PSKey can hold a maximum of 20 uint16s, limiting the default device name to 40 octets. The behaviour is undefined in this PSKey holds more than 20 uint16s. (This size constraint does not apply to a name written via the HCI Change_Local_Name command.)
  8. The default name for BlueCore3 chips is "CSR - bc3"; when packed this becomes {0x5343, 0x2052, 0x202d, 0x6362, 0x0033}.
  9. This PSKey is used from (HCI) 18.X builds. HCI 17.X and earlier builds use PSKEY_LOCAL_NAME0 -> PSKEY_LOCAL_NAME17 and PSKEY_LOCAL_NAME_LENGTH.

如果把pskey_device_name="QCC300X-AA_L" 转成PSkey 的参数uint16数组,也可以实现

QCC300X也可以用Pstool 查询蓝牙名称 ,并且可以修改。