如何配置蓝牙广告包中的设备类型?

huangapple go评论54阅读模式
英文:

How to configure device type in bluethooth advertising package?

问题

I'm developing a custom bluetooth keyboard. It works now smoothly, but there's one thing I can't figure out. In macOS bluetooth settings page, the icon doesn't properly imply its device type. AirPods Pro and Logitech M590 mouse do the job well.

Going through the system information, both AirPods Pro and Logitech M590 have a minor type field in its device information. I believe it's sent to Macbook via the device bluetooth advertising.

My keyboard is developed on top of an nRF52832 module. I'm not very familiar with NRF SDK, this is my first attempt. How can I add such information to my device? Any links to the doc or sample code would help.

英文:

I'm developing a custom bluetooth keyboard. It works now smoothly, but there's one thing I can't figure out. In macOS bluetooth settings page, the icon doesn't properly imply its device type. AirPods Pro and Logitech M590 mouse do the job well.

如何配置蓝牙广告包中的设备类型?

Going through the system information, both AirPods Pro and Logitech M590 have a minor type field in its device information. I believe it's sent to Macbook via the device bluetooth advertising.

如何配置蓝牙广告包中的设备类型?

My keyboard is developed on top of an nRF52832 module. I'm not very familiar with NRF SDK, this is my first attempt. How can I add such information to my device? Any links to the doc or sample code would help.

答案1

得分: 3

感谢@MichaelKotzjan提供的有用信息。

答案很简单(是的,我对nRF是新手)。只需在GAP初始化中调用sd_ble_gap_appearance_set方法,将BLE_APPEARANCE_HID_KEYBOARD作为参数传递。

这里有一个示例。根据您正在开发的设备,您肯定可以传递另一个宏。

static void gap_params_init(void)
{
    // 一些代码

    err_code = sd_ble_gap_appearance_set(BLE_APPEARANCE_HID_KEYBOARD);
    APP_ERROR_CHECK(err_code);

    // 一些代码
}

现在我得到了正确的图标。

如何配置蓝牙广告包中的设备类型?

英文:

Great thanks to @MichaelKotzjan who provides the helpful information.

The answer is kinda simple (yeah I'm a newbie for nRF). Just call sd_ble_gap_appearance_set method in your GAP initialization, passing BLE_APPEARANCE_HID_KEYBOARD as the argument.

Here's a sample. You can definitely pass another macro depending on the device you're developing.

static void gap_params_init(void)
{
    // some code

    err_code = sd_ble_gap_appearance_set(BLE_APPEARANCE_HID_KEYBOARD);
    APP_ERROR_CHECK(err_code);

    // some code
}

Now I get the proper icon

如何配置蓝牙广告包中的设备类型?

huangapple
  • 本文由 发表于 2023年4月17日 11:38:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76031566.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定