8个版本

0.1.7 2022年11月18日
0.1.6 2022年11月10日

1382硬件支持

每月 30次下载

MITGPL-3.0-or-later

86KB
2K SLoC

bluerepl

bluerepl是一个用于与低功耗蓝牙(BLE)外围设备交互的命令行应用程序。

它支持 WindowsMac OSLinux

演示(无预设)

演示(有预设)

安装

使用crate.io

$ cargo install bluerepl

从源代码

$ git clone https://github.com/Yohannfra/bluerepl

$ cargo build

$ cargo install --path .

快速开始

使用bleurepl命令启动应用程序,启动后它会显示基本信息。

$ bluerepl
bleurepl Version: 0.1.2
Using BLE adapter: "CoreBluetooth"
>> ...

您可以输入help来查看所有可用命令及其用法,或查看特定命令的帮助文本。

>> help
COMMANDS:
    clear          Clear the terminal
    connect        Connect to a BLE peripheral
    disconnect     Disconnect from BLE peripheral
    help           Print this message or the help of the given subcommand(s)
    indicate       Subscribe to a characteristic indications and print it's value when it gets updated
    info           Print informations about a specified topic
    notify         Subscribe to a characteristic notifications and print it's value when it gets updated
    preset         Print preset informations or run preset commands/functions
    quit           Quit the REPL
    read           Read the value of a characteristic
    scan           Search for BLE devices around
    unsubscribe    Unsubscribe from the notifications or indications of a characteristic
    write          Write a value to a characteristic

>> help scan
Search for BLE devices around

USAGE:
    scan [OPTIONS] [timeout]

ARGS:
    <timeout>    Time to scan in seconds [default: 5]

OPTIONS:
    -a, --all     Show unnamed peripheral
    -h, --help    Print help information
    -l, --list    Show last scan list (doesn't run a new scan)
...

一个典型的工作流程如下

>> scan # search for peripherals 
Scanning for 5 seconds...
....

>> connect 12 # connect to peripheral with id 12 in scan list
Connected

>> info gatt # print all gatt, services and characteristics of the connected peripheral
...

>> read 0000180a-0000-1000-8000-00805f9b34fb 00002a24-0000-1000-8000-00805f9b34fb # read a characteristic value
[0xff, 0x32, 0x31 ...]

>> write 0000180a-0000-1000-8000-00805f9b34fb 00002a24-0000-1000-8000-00805f9b34fb "0x12 0x44" # write a characteristic value

>> disconnect # disconnect from device

>> quit # or CTRL+D

命令

所有命令的完整列表及其示例可以在 Commands.md 中找到

许可协议

LICENSE

依赖项

~13–48MB
~732K SLoC