Bluetooth: Classic: Add support for class of device
Add `CONFIG_BT_COD` for class of device. < HCI Command: Write Class of Device (0x03|0x0024) plen 3 Class: 0x200408 Major class: Audio/Video (headset, speaker, stereo, video, vcr) Minor class: Hands-free Device Audio (Speaker, Microphone, Headset) > HCI Event: Command Complete (0x0e) plen 4 Write Class of Device (0x03|0x0024) ncmd 1 Status: Success (0x00) Signed-off-by: Hang Fan <fanhang8@gmail.com>
This commit is contained in:
parent
73396f9f86
commit
b3d2891e16
3 changed files with 23 additions and 0 deletions
|
@ -4,3 +4,4 @@ CONFIG_BT_RFCOMM=y
|
|||
CONFIG_BT_HFP_HF=y
|
||||
CONFIG_BT_PERIPHERAL=y
|
||||
CONFIG_BT_DEVICE_NAME="test-Handsfree"
|
||||
CONFIG_BT_COD=0x200408
|
||||
|
|
|
@ -1089,6 +1089,14 @@ config BT_PAGE_TIMEOUT
|
|||
This option sets the page timeout value. Value is selected as
|
||||
(N * 0.625) ms.
|
||||
|
||||
config BT_COD
|
||||
hex "Bluetooth Class of Device(CoD)"
|
||||
default 0
|
||||
help
|
||||
This option sets the class of device.For the list of possible values please
|
||||
consult the following link:
|
||||
https://www.bluetooth.com/specifications/assigned-numbers
|
||||
|
||||
endif # BT_BREDR
|
||||
|
||||
config BT_HCI_VS_EVT_USER
|
||||
|
|
|
@ -806,6 +806,7 @@ int bt_br_init(void)
|
|||
struct bt_hci_cp_write_ssp_mode *ssp_cp;
|
||||
struct bt_hci_cp_write_inquiry_mode *inq_cp;
|
||||
struct bt_hci_write_local_name *name_cp;
|
||||
struct bt_hci_cp_write_class_of_device *cod;
|
||||
int err;
|
||||
|
||||
/* Read extended local features */
|
||||
|
@ -869,6 +870,19 @@ int bt_br_init(void)
|
|||
return err;
|
||||
}
|
||||
|
||||
/* Set Class of device */
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_CLASS_OF_DEVICE, sizeof(*cod));
|
||||
if (!buf) {
|
||||
return -ENOBUFS;
|
||||
}
|
||||
|
||||
net_buf_add_le24(buf, CONFIG_BT_COD);
|
||||
|
||||
err = bt_hci_cmd_send_sync(BT_HCI_OP_WRITE_CLASS_OF_DEVICE, buf, NULL);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Set page timeout*/
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_WRITE_PAGE_TIMEOUT, sizeof(uint16_t));
|
||||
if (!buf) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue