Apache-2.0 · オープンソース

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の上に階層化されたプロトコルスタックを提供する:

  1. コマンド層 — Protocol Buffersペイロードをコマンドメタデータ(名前、タイプ、データ長)でカプセル化する
  2. 暗号化層(オプション) — 4ステップの鍵交換後、シリアライズされたコマンドをAES-128-GCMで暗号化する
  3. コンテナ層 — ペイロードをMTUサイズのコンテナに分割してBLE経由で送信し、受信側でリアセンブル(再構築)する

すべての通信は単一のGATT Characteristicを使用する。CentralはWrite Without Responseでリクエストを書き込み、Notifyでレスポンスを受信する。

プロトコル仕様の全文を読む →

Benchmarks

実測スループット

nRF54L15 DK ペリフェラルでE2E暗号化(AES-128-GCM)を有効化、MTU 247 — フラッシュ読み込みスループットの実測値です。

Android
59.0 KB/s
iOS
32.1 KB/s
Python
30.3 KB/s

ベンチマークの詳細を見る →

Ecosystem

対応プラットフォーム

Central(クライアント)

プラットフォーム言語BLEスタックステータス
iOSSwiftCoreBluetooth安定版
AndroidKotlinAndroid BLE安定版
iOS / AndroidDart (Flutter)flutter_blue_plus安定版
iOS / AndroidTypeScript (React Native)react-native-ble-plx安定版
macOS / LinuxPythonbleak安定版
Zephyr (nRF54L15)CZephyr BLE安定版

Peripheral(サーバー)

プラットフォーム言語BLEスタックステータス
Zephyr (nRF54L15)CZephyr BLE安定版
Zephyr (EFR32xG22E)CZephyr BLE + SiLabs HCI安定版
macOSPythonbless安定版

プロトコルライブラリ

言語パッケージ依存関係
Swiftblerpc-protocol-swiftFoundation + CryptoKit
Kotlinblerpc-protocol-ktProtobuf JavaLite
Dartblerpc-protocol-dartcryptography
Pythonblerpc-protocolcryptography
TypeScriptblerpc-protocol-rn@noble/ciphers + @noble/curves + @noble/hashes
Cblerpc-protocol/cなし(ZephyrではPSA Crypto)

今すぐデバイスAPIを実装

プロトコル仕様を読んでクライアントを接続すれば、数分でハードウェアと通信できます