zoukankan      html  css  js  c++  java
  • 蓝牙学习 (8)配对raspberryPi和SensorTag CC2650

    在上一篇中,用raspberryPi能够扫描到Ti SensorTag. 但是没有获得更多的数据,并且发现sensor Tag并没有回复scan request。
    https://blog.csdn.net/feiwatson/article/details/82946621

    这里我们利用gatttool来配对。

    pi@raspberrypi:~ $ gatttool --help
    Usage:
      gatttool [OPTION...]
    
    Application Options:
      -i, --adapter=hciX                        Specify local adapter interface
      -b, --device=MAC                          Specify remote Bluetooth address
      -t, --addr-type=[public | random]         Set LE address type. Default: public
      -m, --mtu=MTU                             Specify the MTU size
      -p, --psm=PSM                             Specify the PSM for GATT/ATT over BR/EDR
      -l, --sec-level=[low | medium | high]     Set security level. Default: low
      -I, --interactive                         Use interactive mode
    
    pi@raspberrypi:~ $ sudo gatttool -b 54:6C:0E:80:B4:86 --interactive 
    [54:6C:0E:80:B4:86][LE]> help
    help                                           Show this help
    exit                                           Exit interactive mode
    quit                                           Exit interactive mode
    connect         [address [address type]]       Connect to a remote device
    disconnect                                     Disconnect from a remote device
    primary         [UUID]                         Primary Service Discovery
    included        [start hnd [end hnd]]          Find Included Services
    characteristics [start hnd [end hnd [UUID]]]   Characteristics Discovery
    char-desc       [start hnd] [end hnd]          Characteristics Descriptor Discovery
    char-read-hnd   <handle>                       Characteristics Value/Descriptor Read by handle
    char-read-uuid  <UUID> [start hnd] [end hnd]   Characteristics Value/Descriptor Read by UUID
    char-write-req  <handle> <new value>           Characteristic Value Write (Write Request)
    char-write-cmd  <handle> <new value>           Characteristic Value Write (No response)
    sec-level       [low | medium | high]          Set security level. Default: low
    mtu             <value>                        Exchange MTU for GATT/ATT
    [54:6C:0E:80:B4:86][LE]> 
    
    

    建立Interactive Session, 读取温度值

    [54:6C:0E:80:B4:86][LE]> connect
    Attempting to connect to 54:6C:0E:80:B4:86
    Connection successful
    [54:6C:0E:80:B4:86][LE]> char-read-hnd 0x21
    Characteristic value/descriptor: 04 00 ad 27 01 11 31 
    [54:6C:0E:80:B4:86][LE]> disconnect
    
  • 相关阅读:
    flask和tornado的区别
    tornado1
    人脸识别
    ocr:img转成pdf,pdf转成pdf
    flask2
    《个人-GIT使用方法》
    课后作业-阅读任务-阅读笔记
    课后作业-阅读任务-阅读提问
    结对-四则运算生成器-设计文档
    团队-手机备忘录-开发环境搭建过程
  • 原文地址:https://www.cnblogs.com/feiwatson/p/9787869.html
Copyright © 2011-2022 走看看