Apache-2.0 · オープンソース
Type-safe RPC over
Type-safe RPC over
Bluetooth Low Energy
デバイスAPIをProtocol Buffersで一度定義するだけ。bleRPCが6つのプラットフォーム向けに型安全なクライアントとハンドラを生成します。MTU対応のフラグメンテーションとオプションのエンドツーエンド暗号化を標準搭載。
blerpc.proto
message EchoRequest { string message = 1; }
message EchoResponse { string message = 1; }
↓ echo コマンドを自動検出
let client = BlerpcClient()
try await client.connect(device: devices[0])
let res = try await client.echo(message: "hello")
print(res.message) // "hello"val client = BlerpcClient(context)
client.connect(devices[0])
val res = client.echo(message = "hello")
println(res.message) // "hello"final client = BlerpcClient();
await client.connect(devices[0]);
final res = await client.echo(message: 'hello');
print(res.message); // "hello"const client = new BlerpcClient()
await client.connect(devices[0])
const res = await client.echo({ message: 'hello' })
console.log(res.message) // "hello"client = BlerpcClient()
await client.connect(devices[0])
resp = await client.echo(message="hello")
print(resp.message) # "hello"blerpc_EchoResponse resp;
int ret = blerpc_echo("hello", &resp);
if (ret == 0)
printk("%s\n", resp.message); // "hello"6
プラットフォーム
59 KB/s
スループット
20 B
暗号化オーバーヘッド
AES-128-GCM
E2E暗号化
Features
Protocol Buffers
.protoファイルでBLE通信を定義。型安全で言語に依存しない厳密なシリアライゼーションを実現
高性能
MTU対応のフラグメンテーションとゼロコピー最適化により、BLEの帯域を最大限に活用。実測で最大約59 KB/s(Android)を達成
エンドツーエンド暗号化
オプションのE2E暗号化。X25519鍵交換、Ed25519署名、AES-128-GCMセッション暗号化に対応
Architecture
仕組み
bleRPCはBLE GATTの上に階層化されたプロトコルスタックを提供する:
- コマンド層 — Protocol Buffersペイロードをコマンドメタデータ(名前、タイプ、データ長)でカプセル化する
- 暗号化層(オプション) — 4ステップの鍵交換後、シリアライズされたコマンドをAES-128-GCMで暗号化する
- コンテナ層 — ペイロードをMTUサイズのコンテナに分割してBLE経由で送信し、受信側でリアセンブル(再構築)する
すべての通信は単一のGATT Characteristicを使用する。CentralはWrite Without Responseでリクエストを書き込み、Notifyでレスポンスを受信する。
Benchmarks
実測スループット
nRF54L15 DK ペリフェラルでE2E暗号化(AES-128-GCM)を有効化、MTU 247 — フラッシュ読み込みスループットの実測値です。
Ecosystem
対応プラットフォーム
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) |
今すぐデバイスAPIを実装
プロトコル仕様を読んでクライアントを接続すれば、数分でハードウェアと通信できます