代码仓库

bleRPC 由一个主 monorepo 和多个针对各支持语言的协议库包组成。

仓库关系

单一共享的 .proto 定义为每种语言提供一个协议库,由各 central 应用和固件使用。

blerpc.proto
共享的 Protocol Buffers 定义
per language

架构概览

tdaira/blerpc

包含固件、central 客户端、代码生成器和测试的主 monorepo。

peripheral_fw/Zephyr peripheral 固件 (C) — nRF54L15 & EFR32xG22EC
peripheral_py/Python peripheral (bless) 用于角色反转测试Python
central_py/Python central 客户端 (bleak) + 集成测试Python
central_fw/Zephyr central 固件 (C) 用于设备间通信C
central_android/Android central 应用 (Kotlin) 含测试运行器Kotlin
central_ios/iOS central 应用 (Swift) 含测试运行器Swift
central_flutter/Flutter central 应用 (Dart) 含测试运行器Dart
central_rn/React Native central 应用 (TypeScript) 含测试运行器TypeScript
proto/Protocol Buffers 定义(blerpc.proto
tools/generate-handlers/代码生成器 (Go) — 为所有语言生成处理器和客户端Go
boards/自定义板卡定义 (EFR32xG22E)
docs/附加文档(固件指南)

协议库

平台无关的协议编码/解码库,以各语言的独立包发布。

blerpc-protocol

Python C

容器分割/重组、命令编码/解码,以及端到端加密(密钥交换 + AES-128-GCM)。Python 包可通过 pip 安装。C 实现(c/src/ + c/include/)用于嵌入式场景

pip install git+https://github.com/tdaira/blerpc-protocol.git

blerpc-protocol-swift

Swift

适用于 iOS 和 macOS 的 Swift Package。使用 Foundation 和 CryptoKit(Apple 平台框架)。支持 iOS 16+ 和 macOS 13+

// Swift Package Manager
.package(url: "https://github.com/tdaira/blerpc-protocol-swift", from: "0.7.0")

blerpc-protocol-kt

Kotlin

适用于 Android 的 Kotlin 库。发布到 GitHub Packages (Maven)

implementation("com.blerpc:blerpc-protocol-kt:0.7.0")

blerpc-protocol-dart

Dart

适用于 Flutter 的纯 Dart 库。发布到 pub.dev。使用 cryptography 包进行加密

blerpc_protocol: ^0.7.0

blerpc-protocol-rn

TypeScript

适用于 React Native 的 TypeScript 库。使用 @noble/ciphers@noble/curves@noble/hashes 进行加密(纯 JS,无原生依赖)

"@blerpc/protocol-rn": "github:tdaira/blerpc-protocol-rn"

CI / CD

每个仓库都配有 GitHub Actions CI:

仓库CI 检查项
blerpcPython 测试 + ruff lint,C lint (clang-format),Go lint + build,iOS build,Android build,Flutter build,React Native build
blerpc-protocolPython 测试 + lint,C lint + 测试
blerpc-protocol-swiftswift build,swift test,SwiftLint
blerpc-protocol-ktGradle test,ktlint
blerpc-protocol-dartdart analyze,dart test,自动发布到 pub.dev
blerpc-protocol-rneslint,prettier check,jest test,npm publish

许可证

所有 bleRPC 仓库均以 Apache License 2.0 发布,您可在开源或闭源项目(包括嵌入式固件)中自由使用。