* 修复 UUID 创建失败的问题 * 移除 scanning 属性 * 临时提交 * CentralManager 开发 & 示例项目开发 * CentralManager 开发 & 示例项目开发 * android 插件生命周期监听 * 修改 API * 示例程序开发 * 修改字体,添加 API,解决后台问题 * Central#connect API * 蓝牙连接部分开发 * 蓝牙连接部分开发 * 解决一些问题 * 解决一些问题 * Connect API 优化 * 添加 API * example 开发 * API 基本完成 * 消息重命名 * API 修改,Android 实现 * 删除多余代码 * 删除多余文件 * 解决 descriptor 自动生成报错的问题 * 还原 Kotlin 版本,广播处理代码迁移至 dart 端 * Kotlin 版本升至 1.5.20 * 解决特征值通知没有在主线程触发的问题,优化代码 * 引入哈希值,避免对象销毁后继续使用 * 使用下拉刷新代替搜索按钮 * 解决由于热重载和蓝牙关闭产生的问题 * 更新插件信息 * 更新 README 和 CHANGELOG * 更新许可证 * 添加注释 * 添加注释,central 拆分 * dartfmt -w . * flutter build ios --no-codesign * API 重构 * 添加 connectable 属性 * Android 8.0 之前无法获取 connectable 属性 * 解决合并错误 * 解决连接时可能引发异常的一个问题,iOS 开发 * API 修改,TODO: iOS 哈希值为 64 位无法用 Int32 表示 * iOS 开发 * iOS 开发完成,使用 UUID 实现对象映射 * 更新版本记录和文档
135 lines
2.8 KiB
Protocol Buffer
135 lines
2.8 KiB
Protocol Buffer
syntax = "proto3";
|
|
package dev.yanshouwang.bluetooth_low_energy;
|
|
|
|
message Message {
|
|
MessageCategory category = 1;
|
|
oneof value {
|
|
BluetoothState state = 2;
|
|
StartDiscoveryArguments startDiscoveryArguments = 3;
|
|
Discovery discovery = 4;
|
|
ConnectArguments connectArguments = 5;
|
|
GattDisconnectArguments disconnectArguments = 6;
|
|
GattConnectionLost connectionLost = 7;
|
|
GattCharacteristicReadArguments characteristicReadArguments = 8;
|
|
GattCharacteristicWriteArguments characteristicWriteArguments = 9;
|
|
GattCharacteristicNotifyArguments characteristicNotifyArguments = 10;
|
|
GattCharacteristicValue characteristicValue = 11;
|
|
GattDescriptorReadArguments descriptorReadArguments = 12;
|
|
GattDescriptorWriteArguments descriptorWriteArguments = 13;
|
|
}
|
|
}
|
|
|
|
message StartDiscoveryArguments {
|
|
repeated string services = 1;
|
|
}
|
|
|
|
message Discovery {
|
|
string uuid = 1;
|
|
sint32 rssi = 2;
|
|
bytes advertisements = 3;
|
|
bool connectable = 4;
|
|
}
|
|
|
|
message ConnectArguments {
|
|
string uuid = 1;
|
|
}
|
|
|
|
message GATT {
|
|
string key = 1;
|
|
int32 maximumWriteLength = 2;
|
|
repeated GattService services = 3;
|
|
}
|
|
|
|
message GattService {
|
|
string key = 1;
|
|
string uuid = 2;
|
|
repeated GattCharacteristic characteristics = 3;
|
|
}
|
|
|
|
message GattCharacteristic {
|
|
string key = 1;
|
|
string uuid = 2;
|
|
bool canRead = 3;
|
|
bool canWrite = 4;
|
|
bool canWriteWithoutResponse = 5;
|
|
bool canNotify = 6;
|
|
repeated GattDescriptor descriptors = 7;
|
|
}
|
|
|
|
message GattDescriptor {
|
|
string key = 1;
|
|
string uuid = 2;
|
|
}
|
|
|
|
message GattDisconnectArguments{
|
|
string key = 1;
|
|
}
|
|
|
|
message GattConnectionLost {
|
|
string key = 1;
|
|
string error = 2;
|
|
}
|
|
|
|
message GattCharacteristicReadArguments {
|
|
string gatt_key = 1;
|
|
string service_key = 2;
|
|
string key = 3;
|
|
}
|
|
|
|
message GattCharacteristicWriteArguments {
|
|
string gatt_key = 1;
|
|
string service_key = 2;
|
|
string key = 3;
|
|
bytes value = 4;
|
|
bool withoutResponse = 5;
|
|
}
|
|
|
|
message GattCharacteristicNotifyArguments{
|
|
string gatt_key = 1;
|
|
string service_key = 2;
|
|
string key = 3;
|
|
bool state = 4;
|
|
}
|
|
|
|
message GattCharacteristicValue {
|
|
string gatt_key = 1;
|
|
string service_key = 2;
|
|
string key = 3;
|
|
bytes value = 4;
|
|
}
|
|
|
|
message GattDescriptorReadArguments {
|
|
string gatt_key = 1;
|
|
string service_key = 2;
|
|
string characteristic_key = 3;
|
|
string key = 4;
|
|
}
|
|
|
|
message GattDescriptorWriteArguments {
|
|
string gatt_key = 1;
|
|
string service_key = 2;
|
|
string characteristic_key = 3;
|
|
string key = 4;
|
|
bytes value = 5;
|
|
}
|
|
|
|
enum MessageCategory {
|
|
BLUETOOTH_STATE = 0;
|
|
CENTRAL_START_DISCOVERY = 1;
|
|
CENTRAL_STOP_DISCOVERY = 2;
|
|
CENTRAL_DISCOVERED = 3;
|
|
CENTRAL_CONNECT = 4;
|
|
GATT_DISCONNECT = 5;
|
|
GATT_CONNECTION_LOST = 6;
|
|
GATT_CHARACTERISTIC_READ = 7;
|
|
GATT_CHARACTERISTIC_WRITE = 8;
|
|
GATT_CHARACTERISTIC_NOTIFY = 9;
|
|
GATT_DESCRIPTOR_READ = 10;
|
|
GATT_DESCRIPTOR_WRITE = 11;
|
|
}
|
|
|
|
enum BluetoothState {
|
|
UNSUPPORTED = 0;
|
|
POWERED_OFF = 1;
|
|
POWERED_ON = 2;
|
|
} |