From b6fc6ec4a2765ea3862695e17b20234eda1e66ff Mon Sep 17 00:00:00 2001 From: tanlongsheng <252620078@qq.com> Date: Sat, 5 Jul 2025 11:30:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=9A=E8=AE=AE=E5=8A=A9?= =?UTF-8?q?=E6=89=8Bble=E8=8E=B7=E5=8F=96ftp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../meeting_connect_controller.dart | 60 ++++++++++++++++--- 1 file changed, 51 insertions(+), 9 deletions(-) diff --git a/lib/modules/meeting/controllers/meeting_connect_controller.dart b/lib/modules/meeting/controllers/meeting_connect_controller.dart index f6d16e214..cceb82ddf 100644 --- a/lib/modules/meeting/controllers/meeting_connect_controller.dart +++ b/lib/modules/meeting/controllers/meeting_connect_controller.dart @@ -20,6 +20,12 @@ class MeetingConnectController extends GetxController { String _wifiSSID = ''; String _wifiPassword = ''; + String _ftpAddress = ''; + String _ftpPort = ''; + String _ftpAccount = ''; + String _ftpPassword = ''; + + bool _isConnectWifi = false; @override void onInit() { @@ -139,27 +145,63 @@ class MeetingConnectController extends GetxController { break; case 0x87: // Wi-Fi 开启/关闭 if (value[3] == 0x01 && value[4] == 0x01) { - sendData([0x5a, 0x01, 0x0b]); - sendData([0x5a, 0x01, 0x0c]); + _getWifi(); } break; case 0x0b: // WiFi 热点 SSID _wifiSSID = String.fromCharCodes(value.sublist(3, value.length - 2)); - if (_wifiSSID.isNotEmpty && _wifiPassword.isNotEmpty) { - _connectWifi(); - } + _connectWifi(); break; case 0x0c: // WiFi 热点密码 _wifiPassword = _decodePassword(value); - if (_wifiSSID.isNotEmpty && _wifiPassword.isNotEmpty) { - _connectWifi(); - } + _connectWifi(); + break; + case 0x03: // FTP 地址 + _ftpAddress = String.fromCharCodes(value.sublist(3, value.length - 2)); + _connectFtp(); + break; + case 0x04: // FTP 端口 + _ftpPort = String.fromCharCodes(value.sublist(3, value.length - 2)); + _connectFtp(); + break; + case 0x05: // FTP 账号 + _ftpAccount = String.fromCharCodes(value.sublist(3, value.length - 2)); + _connectFtp(); + break; + case 0x06: // FTP 密码 + _ftpPassword = _decodePassword(value); + _connectFtp(); break; default: } } - void _connectWifi() {} + void _getWifi() async { + await sendData([0x5a, 0x01, 0x0b]); + await sendData([0x5a, 0x01, 0x0c]); + } + + void _getFtp() async { + await sendData([0x5a, 0x01, 0x03]); + await sendData([0x5a, 0x01, 0x04]); + await sendData([0x5a, 0x01, 0x05]); + await sendData([0x5a, 0x01, 0x06]); + } + + void _connectWifi() { + if (_wifiSSID.isNotEmpty && _wifiPassword.isNotEmpty) { + _getFtp(); + } + _connectFtp(); + } + + void _connectFtp() { + if (_isConnectWifi && + _ftpAddress.isNotEmpty && + _ftpPort.isNotEmpty && + _ftpAccount.isNotEmpty && + _ftpPassword.isNotEmpty) {} + } String _decodePassword(List data) { final passwordData = data.sublist(3, data.length - 2);