DokiDoki CLI
Use doki to control interactive BLE devices from the terminal.
Quick Start
- -
doki scan - Scan for BLE devices (auto-starts daemon) - INLINECODE2 - Connect to device (auto-starts daemon)
Common Tasks
Daemon Management
- -
doki start - Start background daemon - INLINECODE4 - Stop background daemon
- INLINECODE5 - Check daemon and connection status
Device Connection
- -
doki scan - Scan for BLE devices - INLINECODE7 - Connect to device (default: DK-META2)
- INLINECODE8 - Disconnect from device
Timeline Playback
- -
doki player play [audio] <timeline.json> - Play timeline with optional audio sync - INLINECODE10 - Pause playback (stops device)
- INLINECODE11 - Resume playback
Direct Device Control
- -
doki action linear 50 - Set linear to 50% - INLINECODE13 - Set rotary to -30 (reverse)
- INLINECODE14 - Set vibration to 80%
- INLINECODE15 - Immediately stop all device actions
Timeline Format
Timeline files are JSON files defining device actions at specific timestamps:
CODEBLOCK0
Action Types
| Type | Value Range | Description |
|---|
| INLINECODE16 | 0-100 | Linear/stroke motion intensity |
| INLINECODE17 |
-100 to 100 | Rotation speed (negative=reverse) |
|
VIBRATION | 0-100 | Vibration intensity |
Notes
- - Requires Node.js 18+ and Bluetooth Low Energy (BLE) support
- Supported audio formats: MP3, AAC/M4A, WAV, FLAC, OGG, AIFF
- Audio playback requires
ffplay (Linux/Windows) or afplay (macOS) - Logs are written to INLINECODE21
DokiDoki CLI
使用 doki 从终端控制交互式 BLE 设备。
快速开始
- - doki scan - 扫描 BLE 设备(自动启动守护进程)
- doki connect DK-META2 - 连接设备(自动启动守护进程)
常见任务
守护进程管理
- - doki start - 启动后台守护进程
- doki stop - 停止后台守护进程
- doki status - 检查守护进程和连接状态
设备连接
- - doki scan - 扫描 BLE 设备
- doki connect [名称] - 连接设备(默认:DK-META2)
- doki disconnect - 断开设备连接
时间线播放
- - doki player play [音频] - 播放时间线(可选音频同步)
- doki player pause - 暂停播放(停止设备)
- doki player resume - 恢复播放
直接设备控制
- - doki action linear 50 - 设置线性动作为 50%
- doki action rotary -30 - 设置旋转动作为 -30(反向)
- doki action vibration 80 - 设置振动为 80%
- doki action pause - 立即停止所有设备动作
时间线格式
时间线文件是定义特定时间戳设备动作的 JSON 文件:
json
{
duration: 180.5,
actions: [
{timestamp: 0.0, type: VIBRATION, value: 50},
{timestamp: 5.5, type: LINEAR, value: 30},
{timestamp: 10.0, type: ROTARY, value: -50}
]
}
动作类型
| 类型 | 值范围 | 描述 |
|---|
| LINEAR | 0-100 | 线性/行程运动强度 |
| ROTARY |
-100 到 100 | 旋转速度(负值=反向) |
| VIBRATION | 0-100 | 振动强度 |
注意事项
- - 需要 Node.js 18+ 和低功耗蓝牙(BLE)支持
- 支持的音频格式:MP3、AAC/M4A、WAV、FLAC、OGG、AIFF
- 音频播放需要 ffplay(Linux/Windows)或 afplay(macOS)
- 日志写入 /tmp/dokidoki.log