This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Weird definition of access_opcode_t?

When reading about access_opcode_t struct on its infocenter page it stumbled upon this table i don't understand.

access_opcode_t is defined as:

Data Fields
-------------------
uint16_t opcode
uint16_t company_id

And the table i don't understand looks like this:

+-----------+-----------+-----------+-----------------------------------------------------------------+
| Byte 0 	| Byte 1 	| Byte 2 	| Description													  |
+-----------+-----------+-----------+-----------------------------------------------------------------+
|0xxxxxxx 	| 			|			| "1-octet Bluetooth SIG Opcodes (excluding 01111111)"			  |
|01111111 	| 			|			| "Reserved for Future Use"										  |
|10xxxxxx 	| xxxxxxxx 	|			| "2-octet Bluetooth SIG Opcodes"								  |
|11xxxxxx 	| zzzzzzzz	| zzzzzzzz 	| "3-octet Vendor Specific Opcodes. z denotes company identifier" |
+-----------+-----------+-----------+-----------------------------------------------------------------+

I read this table as the company_d value is saved in the opcode attribute. Is this correct? It seems wrong to save a value like this when there is a perfectly fine variable that could be used.

If this is true, why should I do it this way, and not just save the company id in the defined attribute?

Related