美文网首页
蓝牙笔记 | hci工具使用

蓝牙笔记 | hci工具使用

作者: 力卉编程 | 来源:发表于2020-01-12 20:46 被阅读0次

1、工具命令

# hcitool                                                      
hcitool - HCI Tool ver 4.93
Usage:
        hcitool [options] <command> [command parameters]
Options:
        --help  Display help
        -i dev  HCI device
Commands:
        dev     Display local devices
        inq     Inquire remote devices
        scan    Scan for remote devices
        name    Get name from remote device 
        info    Get information from remote device
        spinq   Start periodic inquiry
        epinq   Exit periodic inquiry
        cmd     Submit arbitrary HCI commands
        con     Display active connections
        cc      Create connection to remote device
        dc      Disconnect from remote device
        sr      Switch master/slave role
        cpt     Change connection packet type
        rssi    Display connection RSSI
        lq      Display link quality
        tpl     Display transmit power level
        afh     Display AFH channel map
        lp      Set/display link policy settings
        lst     Set/display link supervision timeout
        auth    Request authentication
        enc     Set connection encryption
        key     Change connection link key
        clkoff  Read clock offset
        clock   Read local or remote clock
        lescan  Start LE scan
        lewladd Add device to LE White List
        lewlrm  Remove device from LE White List
        lewlsz  Read size of LE White List
        lewlclr Clear LE White list
        lecc    Create a LE Connection
        ledc    Disconnect a LE Connection
        lecup   LE Connection Update
 
For more information on the usage of each command use:
        hcitool <command> --help

2、实例:

获取本地设备接口和MAC地址:
hcitool dev

获取远程设备mac地址clock offset以及class
hcitool inq

扫描远程设备
hcitool scan

获取指定MAC地址远程设备的名字
hcitool name 00:00:46:65:82:01

获取远程设备的详情
hcitool info 00:00:46:65:82:01

向蓝牙设备输入命令
cmd 0x03 0x0013

查看当前连接信息
hcitool cc 00:00:46:65:82:01
hcitool con

查看远程设备的信号增益(强度)
hcitool cc 00:00:46:65:82:01
hcitool rssi 00:00:46:65:82:01

查看支持的POLICY
hcitool cc 00:00:46:65:82:01
hcitool lp 00:00:46:65:82:01

远程设备的xxx等级
hcitool cc 00:00:46:65:82:01
hcitool tpl 00:00:46:65:82:01

待了解功能
hcitool cc 00:00:46:65:82:01
hcitool afh 00:00:46:65:82:01

待了解功能
hcitool cc 00:00:46:65:82:01
hcitool enc 00:00:46:65:82:01

其它功能
hcitool eping
hcitool sping
hcitool dc 00:00:46:65:82:01
hcitool sr 00:00:46:65:82:01
hcitool cpt 00:00:46:65:82:01

完~~~

文 | 力卉编程

相关文章

网友评论

      本文标题:蓝牙笔记 | hci工具使用

      本文链接:https://www.haomeiwen.com/subject/zgswactx.html