網頁

2020年6月10日 星期三

Bluetooth tools bluetoothctl

nano@nano-desktop:~$ bluetoothctl
[NEW] Controller 5C:87:9C:1D:A8:7F nano-desktop [default]
[NEW] Device 00:1C:BE:B7:E0:9D Nintendo RVL-WBC-01
[NEW] Device EA:40:D8:89:24:66 BBC micro:bit
[NEW] Device 30:23:63:70:8E:22 E-books E-EPA173
[NEW] Device C4:4F:33:54:B5:3B ESP32
[NEW] Primary Service
        /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0028
        4fafc201-1fb5-459e-8fcc-c5c9c331914b
        Vendor specific
[NEW] Characteristic
        /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0028/char0029
        beb5483e-36e1-4688-b7f5-ea07361b26a8
        Vendor specific

[NEW] Primary Service
        /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0001
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
[NEW] Characteristic
        /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0001/char0002
        00002a05-0000-1000-8000-00805f9b34fb
        Service Changed
[NEW] Descriptor
        /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0001/char0002/desc0004
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[NEW] Device FF:06:9C:77:46:E9 BBC micro:bit
Agent registered
[bluetooth]# connect C4:4F:33:54:B5:3B
Attempting to connect to C4:4F:33:54:B5:3B
[CHG] Device C4:4F:33:54:B5:3B Connected: yes
Connection successful
[CHG] Device C4:4F:33:54:B5:3B ServicesResolved: yes
[ESP32]# list-attributes C4:4F:33:54:B5:3B
Invalid command
[ESP32]# menu gatt
Menu gatt:
Available commands:
-------------------
list-attributes [dev]                             List attributes
select-attribute <attribute/UUID>                 Select attribute
attribute-info [attribute/UUID]                   Select attribute
read                                              Read attribute value
write <data=xx xx ...>                            Write attribute value
acquire-write                                     Acquire Write file descriptor
release-write                                     Release Write file descriptor
acquire-notify                                    Acquire Notify file descriptor
release-notify                                    Release Notify file descriptor
notify <on/off>                                   Notify attribute value
register-application [UUID ...]                   Register profile to connect
unregister-application                            Unregister profile
register-service <UUID>                           Register application service.
unregister-service <UUID/object>                  Unregister application service
register-characteristic <UUID> <Flags=read,write,notify...> Register application characteristic
unregister-characteristic <UUID/object>           Unregister application characteristic
register-descriptor <UUID> <Flags=read,write...>  Register application descriptor
unregister-descriptor <UUID/object>               Unregister application descriptor
back                                              Return to main menu
version                                           Display version
quit                                              Quit program
exit                                              Quit program
help                                              Display help about this program
[ESP32]# list-attributes C4:4F:33:54:B5:3B
Primary Service
        /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0028
        4fafc201-1fb5-459e-8fcc-c5c9c331914b
        Vendor specific
Characteristic
        /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0028/char0029
        beb5483e-36e1-4688-b7f5-ea07361b26a8
        Vendor specific
Primary Service
        /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0001
        00001801-0000-1000-8000-00805f9b34fb
        Generic Attribute Profile
Characteristic
        /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0001/char0002
        00002a05-0000-1000-8000-00805f9b34fb
        Service Changed
Descriptor
        /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0001/char0002/desc0004
        00002902-0000-1000-8000-00805f9b34fb
        Client Characteristic Configuration
[ESP32]# select-attribute /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0028/char0029
[ESP32:/service0028/char0029]# attribute-info
Characteristic - Vendor specific
        UUID: beb5483e-36e1-4688-b7f5-ea07361b26a8
        Service: /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0028
        Flags: read
        Flags: write
[ESP32:/service0028/char0029]# read
Attempting to read /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0028/char0029
[CHG] Attribute /org/bluez/hci0/dev_C4_4F_33_54_B5_3B/service0028/char0029 Value:
  d8 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  d8 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
[ESP32:/service0028/char0029]# back
[ESP32:/service0028/char0029]# disconnect C4:4F:33:54:B5:3B


沒有留言:

張貼留言