65 lines
1.5 KiB
Dart
65 lines
1.5 KiB
Dart
import 'dart:convert';
|
|
|
|
// import 'package:crypto/crypto.dart' as crypto;
|
|
|
|
import '../../app_settings/app_settings.dart';
|
|
import '../io_reply.dart';
|
|
import '../io_sender.dart';
|
|
import '../io_tool/io_tool.dart';
|
|
import '../io_type.dart';
|
|
|
|
class GatewayGetWifiCommand extends SenderProtocol {
|
|
GatewayGetWifiCommand({
|
|
this.userID,
|
|
}) : super(CommandType.gatewayGetWifiList);
|
|
|
|
String? userID;
|
|
|
|
@override
|
|
String toString() {
|
|
return 'SenderGetWifiCommand{userID: $userID}';
|
|
}
|
|
|
|
@override
|
|
List<int> messageDetail() {
|
|
final List<int> data = [];
|
|
List<int> subData = [];
|
|
|
|
// 指令类型
|
|
final int type = commandType!.typeValue;
|
|
final double typeDouble = type / 256;
|
|
final int type1 = typeDouble.toInt();
|
|
final int type2 = type % 256;
|
|
data.add(type1);
|
|
data.add(type2);
|
|
|
|
//userID 20
|
|
final int userIDLength = utf8.encode(userID!).length;
|
|
subData.addAll(utf8.encode(userID!));
|
|
subData = getFixedLengthList(subData, 20 - userIDLength);
|
|
AppLog.log('ebcData: $subData');
|
|
|
|
data.addAll(subData);
|
|
|
|
printLog(data);
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class GatewayGetWifiReply extends Reply {
|
|
GatewayGetWifiReply.parseData(CommandType commandType, List<int> dataDetail)
|
|
: super.parseData(commandType, dataDetail) {
|
|
data = dataDetail;
|
|
final int status = data[2];
|
|
errorWithStstus(status);
|
|
}
|
|
}
|
|
|
|
class GatewayGetWifiListReply extends Reply {
|
|
GatewayGetWifiListReply.parseData(
|
|
CommandType commandType, List<int> dataDetail)
|
|
: super.parseData(commandType, dataDetail) {
|
|
data = dataDetail;
|
|
}
|
|
}
|