Type-safe, high-performance, secure RPC over Bluetooth Low Energy.
Protocol Buffers
.protoファイルでBLE通信を定義。型安全で言語に依存しないシリアライゼーションを曖昧さなく実現
高性能
MTU対応のフラグメンテーションとゼロコピー最適化により、BLEの最大スループット(約30 KB/s)に迫る性能を実現
エンドツーエンド暗号化
オプションのE2E暗号化。X25519鍵交換、Ed25519署名、AES-128-GCMセッション暗号化に対応
仕組み
bleRPCはBLE GATTの上に階層化されたプロトコルスタックを提供します:
- コマンド層 — Protocol Buffersペイロードをコマンドメタデータ(名前、タイプ、データ長)で包みます
- 暗号化層(オプション) — 4ステップの鍵交換後、シリアライズされたコマンドをAES-128-GCMで暗号化します
- コンテナ層 — ペイロードをMTUサイズのコンテナに分割してBLE伝送し、受信側で再組み立てします
すべての通信は単一のGATT Characteristicを使用します。CentralはWrite Without Responseでリクエストを書き込み、Notifyでレスポンスを受信します。
sequenceDiagram
participant C as Central<br/>(iOS / Android / Flutter / RN / Python)
participant P as Peripheral<br/>(Zephyr / Python)
Note over C: Protobuf encode + Command wrap
Note over C: Encrypt (if enabled)
Note over C: Split into MTU containers
C->>+P: Write Without Response (containers)
Note over P: Reassemble containers
Note over P: Decrypt (if enabled)
Note over P: Decode command + Protobuf
Note over P: Execute handler
Note over P: Encode response + Encrypt + Split
P->>-C: Notify (containers)
Note over C: Reassemble + Decrypt + Decode
対応プラットフォーム
Central(クライアント)
| プラットフォーム | 言語 | BLEスタック | ステータス |
|---|---|---|---|
| iOS | Swift | CoreBluetooth | 安定版 |
| Android | Kotlin | Android BLE | 安定版 |
| iOS / Android | Dart (Flutter) | flutter_blue_plus | 安定版 |
| iOS / Android | TypeScript (React Native) | react-native-ble-plx | 安定版 |
| macOS / Linux | Python | bleak | 安定版 |
| Zephyr (nRF54L15) | C | Zephyr BLE | 安定版 |
Peripheral(サーバー)
| プラットフォーム | 言語 | BLEスタック | ステータス |
|---|---|---|---|
| Zephyr (nRF54L15) | C | Zephyr BLE | 安定版 |
| Zephyr (EFR32xG22E) | C | Zephyr BLE + SiLabs HCI | 安定版 |
| macOS | Python | bless | 安定版 |
プロトコルライブラリ
| 言語 | パッケージ | 依存関係 |
|---|---|---|
| Swift | blerpc-protocol-swift | Foundation + CryptoKit |
| Kotlin | blerpc-protocol-kt | Protobuf JavaLite |
| Dart | blerpc-protocol-dart | cryptography |
| Python | blerpc-protocol | cryptography |
| TypeScript | blerpc-protocol-rn | @noble/ciphers + @noble/curves + @noble/hashes |
| C | blerpc-protocol/c | なし(ZephyrではPSA Crypto) |