最終更新:2026-02-03 (火) 07:41:44 (15d)  

ATT_MTU
Top / ATT_MTU

BR/EDR

  • The minimum ATT_MTU for BR/EDR is 48 octets

BLE

属性の最大長 (ATT)

  • Bluetooth Core Specification/Volume 3/Part F > 3.2.9 Long attribute values
  • The maximum length of an attribute value shall be 512 octets.
  • ATTでは、属性値がATT_MTU-3より長いかどうかを判別することはできない。
  • ある属性がATT_MTU-3を超える最大長を持ち得るかどうかは、上位レイヤの仕様により規定される。

GATT/Exchange MTU (GATT)

  • used by the client to set the ATT_MTU to the maximum
  • possible value that can be supported by both devices when the client supports a value greater than the default ATT_MTU for the Attribute protocol.
  • This subprocedure shall only be initiated once during a connection.

AndroidでMTUが517に設定される理由

  • ATT_PREPARE_WRITE_REQのPDUがヘッダ5バイト+ATTの属性の最大長(512)=517
  • https://issuetracker.google.com/issues/307234027#comment4
    515 ではなく 517 が選ばれた理由について、もう少し詳しく説明させていただきます。517 が
    選ばれたのは、2012 年に Android Bluetooth スタックが初めてリリースされて以来、GATT_MAX_MTU_SIZE 定数が 517 に設定されていたためです。
    さらに深い理由としては、Bluetooth 仕様では ATT 属性の最大サイズが 512 バイトまでとされており、
    最大コマンド ATT_PREPARE_WRITE_REQ のヘッダーは 5 バイトであるということです。
    つまり、512 + 5 = 517 となります。Bluetooth仕様では、パケットデータ自体は 512 を超えることはできません。
  • メモ
    • 実際にはATT_SIGNED_WRITE_CMD?のほうがヘッダ分は大きい(7バイト)が、ほとんど使われないため

参考