Practical Linux Bluetooth programming (8) class of Device

Source: Internet
Author: User

The author's blog address: http://blog.sina.com.cn/samzhen1977
By Sam (zhufeng)
Sam_code@hotmail.com

 

 

In the device discovery phase, the class of device of the device is provided. Specifies the type of the device and the services it supports.

 

Recall the information about the device, including bdaddr, that was found in inquiry. The dev_class field is the class
Of device.

 

Typedef struct {
 Bdaddr_t bdaddr;

Uint8_t pscan_rep_mode;

Uint8_t pscan_period_mode;

Uint8_t pscan_mode;

 Uint8_t dev_class [3];

Uint16_t clock_offset;
} _ Attribute _ (packed) inquiry_info;

 

Class of device parameter includes:

Bluetooth device class: Main class and secondary class
Bluetooth service type.

 

For the meanings of the class of device bits, you can find detailed descriptions on the following webpage:

Https://www.bluetooth.org/Technical/AssignedNumbers/baseband.htm

 

The following are four typical examples:

Dev_class [0]: octer1. (this item is doubtful)

Dev_class [1]: octer2

Dev_class [2]: octer3.

 

Example 1:

Class [0] = 4

Class [1] = 1

Class [2] = 3E

 

Class [1] = 1 indicates that the 8th-bit value is 1. Check the web page, indicating that it is (desktop, notebook, PDA, organizer
....))

Class [0] = 4 indicates that 2nd bits are 1. Indicates: desktop workstation

Class [2] = 3E. It indicates that the 17-21 bits are 1.

 

17 Network (LAN, ad hoc ...)
18 Rendering (print, speaker ...)
19 Capture (scanner, microphone ...)
20 Object transmission (V-inbox, V-folder ...)
21 Audio (speaker, microphone, headset service ...)

 

It indicates that this is a desktop and supports the above services.

 

 

Example 2:

Class [0] = 4

Class [1] = 1

Class [2] = 0

Class [1] = 1 indicates that the 8th-bit value is 1. Check the web page, indicating that it is (desktop, notebook, PDA, organizer
....))

Class [0] = 4 indicates that 2nd bits are 1. Indicates: desktop workstation

Indicates that this is a desktop. But nothing is supported.

 

Example 3:

Class [0] = 80

Class [1] = 25

Class [2] = 0

 

First look at the main device: class [1] = 25, indicating 8, 10, 13 is 1.

8, 10 bits indicate that they are accessories (mouse, game lever, keyboard .....)

13-bit: 1: limited discoverable mode (SAM: not always visible, but only visible after pressing the button)

Secondary device: class [0] = 80, indicating that 7th bits are 1. Indicates pointing to the device. Oh, it's just the mouse.

 

 

Example 4:

Class [0] = 4

Class [1] = 25

Class [2] = 0

 

First look at the main device: class [1] = 25, indicating 8, 10, 13 is 1.

8, 10 bits indicate that they are accessories (mouse, game lever, keyboard .....)

13-bit: 1: limited discoverable mode (SAM: not always visible, but only visible after pressing the button)

Secondary device: class [0] = 4, indicating that 3rd bits are 1. Indicates the game lever

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.