63 lines
1.4 KiB
Dart
Executable File
63 lines
1.4 KiB
Dart
Executable File
import 'package:uuid/uuid.dart';
|
|
|
|
///发送数据类
|
|
enum DataChannel { ble, udp }
|
|
|
|
extension Extension on DataChannel {
|
|
bool get isBLE => this == DataChannel.ble;
|
|
|
|
bool get isUDP => this == DataChannel.udp;
|
|
}
|
|
|
|
class EventSendModel {
|
|
|
|
EventSendModel(
|
|
{required this.data,
|
|
this.topic,
|
|
this.sendChannel,
|
|
this.deviceId,
|
|
this.serviceId,
|
|
this.characteristicId,
|
|
this.allowLongWrite});
|
|
List<int> data = <int>[];
|
|
String? topic = '';
|
|
DataChannel? sendChannel;
|
|
|
|
String? deviceId;
|
|
Uuid? serviceId;
|
|
Uuid? characteristicId;
|
|
bool? allowLongWrite = false;
|
|
|
|
@override
|
|
String toString() {
|
|
return 'EventSendModel{data: $data, topic: $topic, sendChannel: $sendChannel, deviceId: $deviceId, serviceId: $serviceId, characteristicId: $characteristicId, allowLongWrite: $allowLongWrite}';
|
|
}
|
|
}
|
|
|
|
///接收数据类
|
|
class EventReceiveModel {
|
|
|
|
EventReceiveModel({required this.data, this.sendChannel, this.tag});
|
|
dynamic data;
|
|
String? tag = '';
|
|
DataChannel? sendChannel;
|
|
}
|
|
|
|
///解析数据域
|
|
class EventParseModel {
|
|
|
|
EventParseModel({required this.type, required this.data, this.commandIndex});
|
|
int? type;
|
|
int? commandIndex;
|
|
dynamic data;
|
|
}
|
|
|
|
///debug info model
|
|
class StateModel {
|
|
|
|
StateModel({this.title = '', this.subTitle = '', this.result = false});
|
|
final String title;
|
|
final String subTitle;
|
|
final bool result;
|
|
}
|