Android 平台开发 (#1)
* 修复 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 拆分
This commit is contained in:
@ -1,34 +1,126 @@
|
||||
syntax = "proto3";
|
||||
package dev.yanshouwang.bluetooth_low_energy;
|
||||
|
||||
message Message {
|
||||
MessageCategory category = 1;
|
||||
oneof value {
|
||||
BluetoothManagerState state = 2;
|
||||
bool state = 2;
|
||||
Discovery discovery = 3;
|
||||
bool scanning = 4;
|
||||
ConnectionLost connectionLost = 5;
|
||||
GattCharacteristicValue characteristicValue = 6;
|
||||
}
|
||||
}
|
||||
|
||||
message Discovery {
|
||||
Peripheral peripheral = 1;
|
||||
sint32 rssi = 2;
|
||||
map<uint32, bytes> advertisements = 3;
|
||||
message StartDiscoveryArguments {
|
||||
repeated string services = 1;
|
||||
}
|
||||
|
||||
message Peripheral {
|
||||
bytes address = 1;
|
||||
message Discovery {
|
||||
string address = 1;
|
||||
sint32 rssi = 2;
|
||||
bytes advertisements = 3;
|
||||
}
|
||||
|
||||
message ConnectArguments {
|
||||
string address = 1;
|
||||
}
|
||||
|
||||
message GATT {
|
||||
int32 id = 1;
|
||||
int32 mtu = 2;
|
||||
repeated GattService services = 3;
|
||||
}
|
||||
|
||||
message GattDisconnectArguments{
|
||||
string address = 1;
|
||||
int32 id = 2;
|
||||
}
|
||||
|
||||
message GattService {
|
||||
int32 id = 1;
|
||||
string uuid = 2;
|
||||
repeated GattCharacteristic characteristics = 3;
|
||||
}
|
||||
|
||||
message GattCharacteristic {
|
||||
int32 id = 1;
|
||||
string uuid = 2;
|
||||
repeated GattDescriptor descriptors = 3;
|
||||
bool canRead = 4;
|
||||
bool canWrite = 5;
|
||||
bool canWriteWithoutResponse = 6;
|
||||
bool canNotify = 7;
|
||||
}
|
||||
|
||||
message GattDescriptor {
|
||||
int32 id = 1;
|
||||
string uuid = 2;
|
||||
}
|
||||
|
||||
message ConnectionLost {
|
||||
int32 id = 1;
|
||||
int32 error_code = 2;
|
||||
}
|
||||
|
||||
message GattCharacteristicReadArguments {
|
||||
string address = 1;
|
||||
string service_uuid = 2;
|
||||
string uuid = 3;
|
||||
int32 id = 4;
|
||||
}
|
||||
|
||||
message GattCharacteristicWriteArguments {
|
||||
string address = 1;
|
||||
string service_uuid = 2;
|
||||
string uuid = 3;
|
||||
int32 id = 4;
|
||||
bytes value = 5;
|
||||
bool withoutResponse = 6;
|
||||
}
|
||||
|
||||
message GattCharacteristicNotifyArguments{
|
||||
string address = 1;
|
||||
string service_uuid = 2;
|
||||
string uuid = 3;
|
||||
int32 id = 4;
|
||||
bool state = 5;
|
||||
}
|
||||
|
||||
message GattCharacteristicValue {
|
||||
int32 id = 3;
|
||||
bytes value = 4;
|
||||
}
|
||||
|
||||
message GattDescriptorReadArguments {
|
||||
string address = 1;
|
||||
string service_uuid = 2;
|
||||
string characteristic_uuid = 3;
|
||||
string uuid = 4;
|
||||
int32 id = 5;
|
||||
}
|
||||
|
||||
message GattDescriptorWriteArguments {
|
||||
string address = 1;
|
||||
string service_uuid = 2;
|
||||
string characteristic_uuid = 3;
|
||||
string uuid = 4;
|
||||
int32 id = 5;
|
||||
bytes value = 6;
|
||||
}
|
||||
|
||||
enum MessageCategory {
|
||||
BLUETOOTH_MANAGER_STATE = 0;
|
||||
CENTRAL_MANAGER_START_DISCOVERY = 1;
|
||||
CENTRAL_MANAGER_STOP_DISCOVERY = 2;
|
||||
CENTRAL_MANAGER_DISCOVERED = 3;
|
||||
}
|
||||
|
||||
enum BluetoothManagerState {
|
||||
UNKNOWN = 0;
|
||||
RESETTING = 1;
|
||||
UNSUPPORTED = 2;
|
||||
UNAUTHORIZED = 3;
|
||||
POWERED_OFF = 4;
|
||||
POWERED_ON = 5;
|
||||
BLUETOOTH_AVAILABLE =0;
|
||||
BLUETOOTH_STATE = 1;
|
||||
CENTRAL_START_DISCOVERY = 2;
|
||||
CENTRAL_STOP_DISCOVERY = 3;
|
||||
CENTRAL_DISCOVERED = 4;
|
||||
CENTRAL_CONNECT = 5;
|
||||
GATT_DISCONNECT = 6;
|
||||
GATT_CONNECTION_LOST = 7;
|
||||
GATT_CHARACTERISTIC_READ = 8;
|
||||
GATT_CHARACTERISTIC_WRITE = 9;
|
||||
GATT_CHARACTERISTIC_NOTIFY = 10;
|
||||
GATT_DESCRIPTOR_READ = 11;
|
||||
GATT_DESCRIPTOR_WRITE = 12;
|
||||
}
|
Reference in New Issue
Block a user