From cadc0cb8d18c848cb56dae897c0c536312e3351a Mon Sep 17 00:00:00 2001 From: YamiDoesDev Date: Sat, 17 Dec 2022 13:56:59 +0100 Subject: [PATCH] changed utf8 to ascii and added testing environment --- lib/screens/bluetooth_screen.dart | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/screens/bluetooth_screen.dart b/lib/screens/bluetooth_screen.dart index 1d8541b..22c0c4d 100644 --- a/lib/screens/bluetooth_screen.dart +++ b/lib/screens/bluetooth_screen.dart @@ -40,6 +40,7 @@ class _BluetoothScreen extends State { bool isConnecting = false; bool isDisconnecting = false; bool isConnected = false; + String textInput = "0123456789 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ButtonStyle buttonStyle = ElevatedButton.styleFrom( foregroundColor: Colors.black, @@ -193,10 +194,10 @@ class _BluetoothScreen extends State { } Future _sendData() async { - String output = "0123456789 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ !§%&()=?#!?"; - _bluetoothConnection!.output - .add(Uint8List.fromList(const Utf8Encoder().convert("$output \r\n"))); - await _bluetoothConnection!.output.allSent; + //String output = "0123456789 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";// !§%&()=?#!?"; + String output = textInput; + //_bluetoothConnection!.output.add(Uint8List.fromList(const AsciiEncoder().convert("$output \r\n"))); + //await _bluetoothConnection!.output.allSent; debugPrint("sent: $output"); } @@ -249,6 +250,16 @@ class _BluetoothScreen extends State { ], ), const Divider(), + TextFormField( + decoration: const InputDecoration( + labelText: "BluetoothText" + ), + initialValue: textInput, + keyboardType: TextInputType.text, + onChanged: (String newValue) { + textInput = newValue; + }, + ), ElevatedButton( onPressed: () async { await Permission.bluetoothConnect.request();