2.5.3 <value>
特性のデータ・
タイプと長さは、XML 属性 <value> およびそのパラメータで定義されます。これらは、<characteristic> XML 属性タ
グ内で使用する必要があります。
以下の表に、関連する値を定義するために使用できるパラメータを示します。
Parameter Description
length Defines a fixed length for the characteristic or the maximum length if variable_length is true. If
length is not defined and there is a value (e.g. data exists inside <value></value>), then the value
length is used to define the length.
If both length and value are defined, then the following rules apply:
1. If variable_length
is false and length is bigger than the value's length, then the value will be
padded with 0's at the end to match the attribute's length.
2. If length is smaller than the value's length, then the value will be clipped to match length,
regardless of whether variable_length is true or false.
Range:
0 – 255: Length in bytes if type is 'hex' or 'utf-8'
0 – 512: Length in bytes if type is 'user'
Default: 0
variable_length Defines that the value is of variable length. The maximum length must also be defined with the
length
attribute or by defining a value. If both length
and value are defined, then the rules decribed
in length apply.
Values:
true: Value is of variable length
false: Value has a fixed length
Default: false
type Defines the data type.
Values:
hex: Value type is hex
utf-8: Value is a string
user: When the characteristic type is marked as type="user", the application is responsible for
initializing the characteristic value and also providing it, for example, when read operation occurs.
The Bluetooth stack does not initialize the value or automatically provide the value when it is being
read. When this is set, the Bluetooth stack generates gatt_server_user_read_request or
gatt_server_user_write_request, which must be handled by the application.
Default: utf-8
例:notify プロパティと 2 バイトの固定長を持つ心拍数測定特性。
<!-- Heart Rate Measurement -->
<characteristic uuid="180D">
<properties notify="true" />
<value length="2" type="hex" />
…
</characteristic>
例:最大長が 20 バイトの可変長のベンダー固有特性。
<!-- My proprietary data -->
<characteristic uuid="59cd69c0-2043-11e5-a717-0002a5d5c51b" id="mydata”>
<properties notify="true" />
UG118:Blue Gecko Bluetooth
®
Profile Toolkit 開発者ガイド
Profile Toolkit を使用して GATT データベースを構築する
silabs.com | Building a more connected world. Rev. 2.1 | 16