【问题标题】:Interpret AVRCP packets解释 AVRCP 数据包
【发布时间】:2018-12-29 23:44:04
【问题描述】:

经过一番折腾,我得到了一个 pybluez 脚本,可以连接到各种设备上的 AVRCP 配置文件,并读取响应。

代码sn-p:

addr="e2:8b:8e:89:6c:07"  #S530 white
port=23
if (port>0):
    print("Attempting to connect to L2CAP port ",port)
    socket=bluetooth.BluetoothSocket(bluetooth.L2CAP);
    socket.connect((addr,port))
    print("Connected.")
    while True:
      print("Waiting on read:")
      data=socket.recv(1024)
      for b in data:
         print("%02x"%b,end=" ")
      print() 
    socket.close()

我按听筒上的按钮得到的结果如下:

Attempting to connect to L2CAP port  23
Connected.
Waiting on read:
10 11 0e 01 48 00 00 19 58 10 00 00 01 03 
Waiting on read:
20 11 0e 00 48 7c 44 00 
Waiting on read:
30 11 0e 00 48 7c 46 00 
Waiting on read:
40 11 0e 00 48 7c 44 00 

仔细阅读规范后,我似乎看到了 PASSTHROUGH 命令,其中 44 是“PLAY”操作命令,而 46 是“PAUSE”(我认为) 我不知道 10 11 0e 是什么意思,除了第一个字节似乎是某种序列号这一事实。 我的问题有三个:

  1. 我不知道在哪里可以找到有效 operation_id 的列表。它是 规范中提到但除了一些随机的之外没有定义 示例。
  2. 规范引用了子单元类型和 ID,(这将是 48 在上面的例子中)再次没有定义它们 AFAICT。
  3. 没有提到前三个字节是什么。他们可能会 甚至成为 L2CAP 的一部分,与 AVRCP 没有直接关系,我不是 对 pybluez 足够熟悉。

上述任何一点的任何帮助都会有所帮助。 编辑:作为参考,AVRCP 规范的详细信息似乎在这里:https://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=119996

【问题讨论】:

标签: bluetooth pybluez avrcp l2cap


【解决方案1】:

真正的答案是规范文档假定您已阅读其他规范文档。

三个头字节是 AVCTP 传输层的一部分: http://www.cs.bilkent.edu.tr/~korpe/lab/resources/AVCTP%20Spec%20v1_0.pdf

简而言之:

0: 7..4: Incrementing transaction id. 0x01 to 0x0f
   3..2: Packet type 00 = self contained packet
     1 : 0=request 1=response
     0 : 0=PID recognized 1: PID error
1-2: 2 byte bigendian profile id (in this case 110e, AVRCP)

其余部分在 AVRCP 配置文件文档中进行了描述,https://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=119996

我觉得文档不是很清楚。

我提供了一个示例应用程序,它似乎适用于我能够测试的大多数 AVRCP 设备:

https://github.com/rjmatthews62/BtAVRCP

【讨论】:

    猜你喜欢
    • 2013-02-08
    • 2015-07-14
    • 2011-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-02
    • 2014-12-14
    相关资源
    最近更新 更多