adding debug tools
This commit is contained in:
parent
1cd4a74979
commit
7ffe408d44
|
@ -41,6 +41,7 @@ class _BluetoothScreen extends State<BluetoothScreen> {
|
|||
bool isDisconnecting = false;
|
||||
bool isConnected = false;
|
||||
String textInput = "0123456789 abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
String textOuput = "";
|
||||
|
||||
ButtonStyle buttonStyle = ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.black,
|
||||
|
@ -115,6 +116,9 @@ class _BluetoothScreen extends State<BluetoothScreen> {
|
|||
void _connectionOnListen(Uint8List data) {
|
||||
debugPrint("received: $data");
|
||||
debugPrint("received decoded: ${const Utf8Decoder().convert(data)}");
|
||||
setState(() {
|
||||
textOuput += const Utf8Decoder().convert(data);
|
||||
});
|
||||
// Allocate buffer for parsed data
|
||||
int backspacesCounter = 0;
|
||||
for (var byte in data) {
|
||||
|
@ -250,6 +254,7 @@ class _BluetoothScreen extends State<BluetoothScreen> {
|
|||
],
|
||||
),
|
||||
const Divider(),
|
||||
Text(textOuput),
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: "BluetoothText"
|
||||
|
@ -273,6 +278,16 @@ class _BluetoothScreen extends State<BluetoothScreen> {
|
|||
},
|
||||
style: buttonStyle,
|
||||
child: const Text("Request Permissions"),
|
||||
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
setState(() {
|
||||
textOuput = "";
|
||||
});
|
||||
},
|
||||
style: buttonStyle,
|
||||
child: const Text("Clear Output"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
|
|
Loading…
Reference in New Issue