59 lines
1.3 KiB
Dart
59 lines
1.3 KiB
Dart
|
|
|
|
import 'dart:convert';
|
|
|
|
import '../io_tool/io_tool.dart';
|
|
import 'io_reply.dart';
|
|
import 'io_sender.dart';
|
|
import 'io_type.dart';
|
|
|
|
//TODO:开门
|
|
class OpenDoorCommand extends SenderProtocol {
|
|
|
|
int? cmdID;
|
|
String? keyID;
|
|
String? userID;
|
|
int? openMode;
|
|
int? openTime;
|
|
int? token;
|
|
int? authCodeLen;
|
|
String? authCode;
|
|
OpenDoorCommand({
|
|
this.cmdID,
|
|
this.keyID,
|
|
this.userID,
|
|
this.openMode,
|
|
this.openTime,
|
|
this.token,
|
|
this.authCodeLen,
|
|
this.authCode,
|
|
}) : super(CommandType.openDoor);
|
|
|
|
@override
|
|
List<int> messageDetail() {
|
|
List<int> data = [];
|
|
data.addAll(intToInt8List(cmdID!));
|
|
data.addAll(utf8.encode(keyID!));
|
|
data.addAll(utf8.encode(userID!));
|
|
data.addAll(intToInt8List(openMode!));
|
|
data.addAll(intToInt8List(openTime!));
|
|
data.addAll(intToInt8List(token!));
|
|
data.addAll(intToInt8List(authCodeLen!));
|
|
data.addAll(utf8.encode(authCode!));
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class RemoteControlReply extends Reply {
|
|
RemoteControlReply.parseData(CommandType commandType, List<int> dataDetail, int endIndex)
|
|
: super.parseData(commandType, dataDetail, endIndex) {
|
|
int index = 0;
|
|
while(index < endIndex){
|
|
commandKey = byteUInt8(dataDetail, index);
|
|
index += offset_1!;
|
|
switch(commandKey){
|
|
|
|
}
|
|
}
|
|
}
|
|
} |