Browse Source

修改会议助手ble获取ftp

newdev_shunjiawei
tanlongsheng 1 year ago
parent
commit
b6fc6ec4a2
  1. 60
      lib/modules/meeting/controllers/meeting_connect_controller.dart

60
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<int> data) {
final passwordData = data.sublist(3, data.length - 2);

Loading…
Cancel
Save