app-starlock/lib/talk/udp/io_udpSender.dart
魏少阳 15af50d951 1、完善星锁APP国际化 36种语言。
2、修复国际化问题
2024-10-15 18:32:11 +08:00

40 lines
995 B
Dart
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'dart:convert';
import '../../blue/io_tool/io_tool.dart';
import 'io_udpType.dart';
abstract class IOData {
List<int> messageDetail();
}
abstract class UDPSenderProtocol extends IOData {
// var uint8View1 = Uint8List(300);
CommandUDPType? commandType; //指令类型
// final List<int> header = [0XEF, 0X01, 0XEE, 0X02]; //帧头 固定取值 0XEF01EE02长度 4 字节
// final int ask = 0X01 ; // 包类型0X01 表示请求包0X11 表示应答包,长度 1 字节
List<int>? commandData = []; //数据块
UDPSenderProtocol(this.commandType) {
}
// 拼装数据
List<int> packageData() {
commandData = messageDetail();
List<int> commandList = [];
var cID = "XXXCID";
commandList.addAll(utf8.encode(cID));
commandList = getFixedLengthList(commandList, 6 - utf8.encode(cID).length);
// 数据块
commandList.addAll(commandData!); //数据块
// AppLog.log("commandList:$commandList");
return commandList;
}
}