[英]Interpret AVRCP packets
經過一番摸索之后,我得到了一個pybluez腳本,可以連接到各種設備上的AVRCP配置文件,並讀取響應。
程式碼片段:
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是什么意思,除了因為第一個字節似乎是某種序列號。 我的問題有三點:
以上任何方面的任何幫助都將有所幫助。 編輯:供參考,AVRCP規范的詳細信息似乎在這里: https ://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=119996
真正的答案是,規范文檔假定您已閱讀其他規范文檔。
這三個標頭字節是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配置文件doc, https: //www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id = 119996中進行了描述
我認為文檔並不十分清楚。
我提供了一個示例應用程序,該應用程序似乎適用於我能夠測試的大多數AVRCP設備:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.