日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > Android >内容正文

Android

Android Bluetooth hci 命令分析

發(fā)布時(shí)間:2025/6/17 Android 59 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Android Bluetooth hci 命令分析 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Android在連接BLE設(shè)備的時(shí)候,遇到連接沒多久就自動(dòng)斷開的情況。通過HCI來分析一下。

BLE設(shè)備發(fā)送連接參數(shù)更新請求 3909 15:53:01.224737 TexasIns_f0:d3:41 (Hon-RFID3) HandHeld_e0:e5:4f (EDA) L2CAP 21 Rcvd Connection Parameter Update Request 回復(fù)BLE發(fā)送過來的請求 3910 15:53:01.225744 HandHeld_e0:e5:4f (EDA) TexasIns_f0:d3:41 (Hon-RFID3) L2CAP 15 Sent Connection Parameter Update Response (Accepted) 發(fā)送連接更新請求,host通過hci發(fā)給controller 3911 15:53:01.227044 host controller HCI_CMD 18 Sent LE Connection Update 更新參數(shù)操作執(zhí)行成功。controller發(fā)給host。這條命令之后,協(xié)議棧會(huì)發(fā)送命令給出去,給對面的BLE設(shè)備。 3963 15:53:01.566723 controller host HCI_EVT 13 Rcvd LE Meta (LE Connection Update Complete) 這邊在等待BLE設(shè)備的回復(fù),等待超時(shí)了。后面就斷開。 5410 15:53:12.491452 controller host HCI_EVT 7 Rcvd Disconnect Complete

最后一個(gè)幀的內(nèi)容,顯示連接超時(shí)。

Frame 5410: 7 bytes on wire (56 bits), 7 bytes captured (56 bits)Encapsulation type: Bluetooth H4 with linux header (99)Arrival Time: Apr 25, 2019 23:53:12.491452000 China Standard Time[Time shift for this packet: 0.000000000 seconds]Epoch Time: 1556207592.491452000 seconds[Time delta from previous captured frame: 0.001655000 seconds][Time delta from previous displayed frame: 0.001655000 seconds][Time since reference or first frame: 86.503400000 seconds]Frame Number: 5410Frame Length: 7 bytes (56 bits)Capture Length: 7 bytes (56 bits)[Frame is marked: False][Frame is ignored: False]Point-to-Point Direction: Received (1)[Protocols in frame: bluetooth:hci_h4:bthci_evt] Bluetooth[Source: controller][Destination: host] Bluetooth HCI H4[Direction: Rcvd (0x01)]HCI Packet Type: HCI Event (0x04) Bluetooth HCI Event - Disconnect CompleteEvent Code: Disconnect Complete (0x05)Parameter Total Length: 4Status: Success (0x00)Connection Handle: 0x0002Reason: Connection Timeout (0x08)

而另外一個(gè)臺(tái)設(shè)備, 卻不會(huì)斷開,第一個(gè)幀顯示對面LE設(shè)備所能支持結(jié)構(gòu),其中Connection Parameters Request Procedure: False,表示不支持更新參數(shù)請求。

第一個(gè)幀: 1408 15:57:13.490071 controller host HCI_EVT 15 Rcvd LE Meta (LE Read Remote Used Features Complete) 第一個(gè)幀的內(nèi)容: Frame 1408: 15 bytes on wire (120 bits), 15 bytes captured (120 bits)Encapsulation type: Bluetooth H4 with linux header (99)Arrival Time: Apr 25, 2019 23:57:13.490071000 China Standard Time[Time shift for this packet: 0.000000000 seconds]Epoch Time: 1556207833.490071000 seconds[Time delta from previous captured frame: 0.002823000 seconds][Time delta from previous displayed frame: 0.002823000 seconds][Time since reference or first frame: 39.218678000 seconds]Frame Number: 1408Frame Length: 15 bytes (120 bits)Capture Length: 15 bytes (120 bits)[Frame is marked: False][Frame is ignored: False]Point-to-Point Direction: Received (1)[Protocols in frame: bluetooth:hci_h4:bthci_evt] Bluetooth[Source: controller][Destination: host] Bluetooth HCI H4[Direction: Rcvd (0x01)]HCI Packet Type: HCI Event (0x04) Bluetooth HCI Event - LE MetaEvent Code: LE Meta (0x3e)Parameter Total Length: 12Sub Event: LE Read Remote Used Features Complete (0x04)Status: Success (0x00)Connection Handle: 0x0002Supported LE Features: 0x0000000000000001, LE Encryption.... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ...1 = LE Encryption: True.... .... .... .... .... .... .... .... .... .... .... .... .... .... .... ..0. = Connection Parameters Request Procedure: False.... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .0.. = Extended Reject Indication: False.... .... .... .... .... .... .... .... .... .... .... .... .... .... .... 0... = Slave-Initiated Features Exchange: False.... .... .... .... .... .... .... .... .... .... .... .... .... .... ...0 .... = Ping: False.... .... .... .... .... .... .... .... .... .... .... .... .... .... ..0. .... = Data Packet Length Extension: False.... .... .... .... .... .... .... .... .... .... .... .... .... .... .0.. .... = LL Privacy: False.... .... .... .... .... .... .... .... .... .... .... .... .... .... 0... .... = Extended Scanner Filter Policies: False.... .... .... .... .... .... .... .... .... .... .... .... .... ...0 .... .... = LE 2M PHY: False.... .... .... .... .... .... .... .... .... .... .... .... .... ..0. .... .... = Stable Modulation Index - Tx: False.... .... .... .... .... .... .... .... .... .... .... .... .... .0.. .... .... = Stable Modulation Index - Rx: False.... .... .... .... .... .... .... .... .... .... .... .... .... 0... .... .... = LE Coded PHY: False.... .... .... .... .... .... .... .... .... .... .... .... ...0 .... .... .... = LE Extended Advertising: False.... .... .... .... .... .... .... .... .... .... .... .... ..0. .... .... .... = LE Periodic Advertising: False.... .... .... .... .... .... .... .... .... .... .... .... .0.. .... .... .... = Channel Selection Algorithm #2: False.... .... .... .... .... .... .... .... .... .... .... .... 0... .... .... .... = Power Class 1: False.... .... .... .... .... .... .... .... .... .... .... ...0 .... .... .... .... = Minimum Number of Used Channels Procedure: False0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 000. .... .... .... .... = Reserved: 0x000000000000[Command in frame: 1393][Pending in frame: 1398][Pending-Response Delta: 54.527ms][Command-Response Delta: 57.991ms]

雖然不支持更新參數(shù)請求,但是卻發(fā)了更新參數(shù)請求過來,這個(gè)現(xiàn)象比較奇怪。

參數(shù)更新請求。 2698 15:57:19.440508 TexasIns_f0:d3:41 (Hon-RFID3) localhost () L2CAP 21 Rcvd Connection Parameter Update Request 請求回復(fù)。 2702 15:57:19.441762 localhost () TexasIns_f0:d3:41 (Hon-RFID3) L2CAP 15 Sent Connection Parameter Update Response (Accepted) 發(fā)送更新過去。 2705 15:57:19.442326 host controller HCI_CMD 18 Sent LE Connection Update 這條命令沒有處理,應(yīng)為沒有controller通過hci發(fā)給host的命令回復(fù),所以沒有處理。就不會(huì)存在后面的等待超時(shí)。

轉(zhuǎn)載于:https://www.cnblogs.com/helloworldtoyou/p/10775106.html

總結(jié)

以上是生活随笔為你收集整理的Android Bluetooth hci 命令分析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。