changed utf8 to ascii and added testing environment
This commit is contained in:
parent
d1c5bb164f
commit
cadc0cb8d1
|
@ -40,6 +40,7 @@ class _BluetoothScreen extends State<BluetoothScreen> {
|
||||||
bool isConnecting = false;
|
bool isConnecting = false;
|
||||||
bool isDisconnecting = false;
|
bool isDisconnecting = false;
|
||||||
bool isConnected = false;
|
bool isConnected = false;
|
||||||
|
String textInput = "0123456789 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
ButtonStyle buttonStyle = ElevatedButton.styleFrom(
|
ButtonStyle buttonStyle = ElevatedButton.styleFrom(
|
||||||
foregroundColor: Colors.black,
|
foregroundColor: Colors.black,
|
||||||
|
@ -193,10 +194,10 @@ class _BluetoothScreen extends State<BluetoothScreen> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _sendData() async {
|
Future<void> _sendData() async {
|
||||||
String output = "0123456789 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ !§%&()=?#!?";
|
//String output = "0123456789 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";// !§%&()=?#!?";
|
||||||
_bluetoothConnection!.output
|
String output = textInput;
|
||||||
.add(Uint8List.fromList(const Utf8Encoder().convert("$output \r\n")));
|
//_bluetoothConnection!.output.add(Uint8List.fromList(const AsciiEncoder().convert("$output \r\n")));
|
||||||
await _bluetoothConnection!.output.allSent;
|
//await _bluetoothConnection!.output.allSent;
|
||||||
debugPrint("sent: $output");
|
debugPrint("sent: $output");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,6 +250,16 @@ class _BluetoothScreen extends State<BluetoothScreen> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
TextFormField(
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: "BluetoothText"
|
||||||
|
),
|
||||||
|
initialValue: textInput,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
onChanged: (String newValue) {
|
||||||
|
textInput = newValue;
|
||||||
|
},
|
||||||
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Permission.bluetoothConnect.request();
|
await Permission.bluetoothConnect.request();
|
||||||
|
|
Loading…
Reference in New Issue