An item is piece of information about the device. All items have a one-byte prefix that contains the item tag, item type, and item size.

一个“项”是描述设备的一段信息。所有项都有一个字节的前缀,其中包含项标签 (item tag)、项类型 (item type)​ 和 项长度(单位:字节数) (item size)。

前缀字节 格式定义:

5.3 Generic Item Format - 图1

  • bSize 项长度(单位:字节数)
    bit[1,0] 后续字节数范围[0,3]
  • bType 项类型
    bit[3,2]
  • bTag 项标签
    bit[7,4]

An item may include optional item data. The size of the data portion of an item is determined by its fundamental type. There are two basic types of items: short items and long items. If the item is a short item, its optional data size may be 0, 1, 2, or 4 bytes. If the item is a long item, its bSize value is always 2. The following example illustrates possible values within the 1-byte prefix for a long item.

一个“项”可以包含可选的项数据 (item data)。项的数据部分的大小由其基本类型决定。项有两种基本类型:短项 (short items)​ 和长项 (long items)。如果项是短项,其可选数据的大小可以是 0、1、2 或 4 个字节。如果项是长项,其 bSize值始终为 2。以下示例说明了一个长项的单字节前缀中可能包含的值。

5.3 Generic Item Format - 图2

长项格式定义

关于短项和长项格式如何定义的,详见后续章节。

笔记

无论短项还是长项,一般格式如下图所示:

5.3 Generic Item Format - 图3

  • 第0字节 叫 前缀字节 或 先导字节
    必须有,因为它规定了后续字节有1,2,…,n个。
  • 第1字节
    在短项中,此属于数据
    在长项中,此属于 bDataSize
  • 第2字节
    在短项中,此属于数据
    在长项中,此属于 bLongItemTag
  • 第3字节
    在短项中,此属于数据
    在长项中,此属于数据
    …以此类推。