如何使用dbus / bluez获取python中的当前MTU

时间:2017-12-06 06:28:25

标签: python dbus bluez

有没有办法使用dbus bluez在python中获得当前客户端连接的MTU?

如果我看btmon,我可以在连接后看到值(503):

# btmon | grep MTU
  ATT: Exchange MTU Request (0x02) len 2
    Client RX MTU: 517
  ATT: Exchange MTU Response (0x03) len 2
    Server RX MTU: 517
  ATT: Exchange MTU Request (0x02) len 2
    Client RX MTU: 503
  ATT: Exchange MTU Response (0x03) len 2
    Server RX MTU: 517

但是在dbus.bluez api

中似乎没有这个值的句柄

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

Bluez不在dbus api上公开MTU大小。但是,此信息在options参数的Read,Write等回调中给出。

        Methods     array{byte} ReadValue(dict options)

        Issues a request to read the value of the
        characteristic and returns the value if the
        operation was successful.

        Possible options: "offset": uint16 offset
                  "mtu": Exchanged MTU (Server only)
                  "device": Object Device (Server only)