Browse Source

Final push before adding serial R/W code

Toby Chui 2 years ago
parent
commit
682211d9b2
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/pm25go/lib/scan.dart

+ 7 - 1
src/pm25go/lib/scan.dart

@@ -146,7 +146,7 @@ class _ConnectionPage extends State<ConnectionPage> {
                             });
                           });
                         },
-                        child: const Text('載入藍牙裝置列表'),
+                        child: const Text('重新載入列表'),
                       )),
                   Container(
                       padding: EdgeInsets.symmetric(horizontal: 2),
@@ -161,6 +161,9 @@ class _ConnectionPage extends State<ConnectionPage> {
                         onPressed: () async {
                           if (operatingDevice.deviceSelected &&
                               !operatingDevice.deviceConnected) {
+                            setState(() {
+                              _statusText = "正在建立連接…";
+                            });
                             //Not connected yet. Establish connection
                             try {
                               operatingDevice.connection =
@@ -181,6 +184,9 @@ class _ConnectionPage extends State<ConnectionPage> {
                               });
                             } catch (ex) {
                               print(ex);
+                              setState(() {
+                                _statusText = "無法連接到選定的裝置 (查看偵錯主控台以了解更多)";
+                              });
                             }
                           } else {
                             if (!operatingDevice.deviceSelected) {