|
|
|
@ -18,6 +18,9 @@ class MeetingConnectController extends GetxController { |
|
|
|
late BluetoothCharacteristic? _writeCharacteristic; |
|
|
|
late StreamSubscription<List<int>>? _valueReceivedSubscription; |
|
|
|
|
|
|
|
String _wifiSSID = ''; |
|
|
|
String _wifiPassword = ''; |
|
|
|
|
|
|
|
@override |
|
|
|
void onInit() { |
|
|
|
super.onInit(); |
|
|
|
@ -135,9 +138,32 @@ class MeetingConnectController extends GetxController { |
|
|
|
} |
|
|
|
break; |
|
|
|
case 0x87: // Wi-Fi 开启/关闭 |
|
|
|
if (value[2] == 0x01) {} |
|
|
|
if (value[3] == 0x01 && value[4] == 0x01) { |
|
|
|
sendData([0x5a, 0x01, 0x0b]); |
|
|
|
sendData([0x5a, 0x01, 0x0c]); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 0x0b: // WiFi 热点 SSID |
|
|
|
_wifiSSID = String.fromCharCodes(value.sublist(3, value.length - 2)); |
|
|
|
if (_wifiSSID.isNotEmpty && _wifiPassword.isNotEmpty) { |
|
|
|
_connectWifi(); |
|
|
|
} |
|
|
|
break; |
|
|
|
case 0x0c: // WiFi 热点密码 |
|
|
|
_wifiPassword = _decodePassword(value); |
|
|
|
if (_wifiSSID.isNotEmpty && _wifiPassword.isNotEmpty) { |
|
|
|
_connectWifi(); |
|
|
|
} |
|
|
|
break; |
|
|
|
default: |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void _connectWifi() {} |
|
|
|
|
|
|
|
String _decodePassword(List<int> data) { |
|
|
|
final passwordData = data.sublist(3, data.length - 2); |
|
|
|
final decodedBytes = passwordData.map((byte) => byte ^ 0xFF).toList(); |
|
|
|
return String.fromCharCodes(decodedBytes); |
|
|
|
} |
|
|
|
} |
|
|
|
|