Skip to content

Commit cba7ea9

Browse files
committed
250427
1 parent f421eec commit cba7ea9

File tree

5 files changed

+54
-151
lines changed

5 files changed

+54
-151
lines changed

config.ecs

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
pushbutton RelayOffButton
3232
pushbutton RelayOnButton
3333
pushbutton SaveWidgetDataButton
34-
pushbutton SelectHostButton
3534
pushbutton OKButton
3635
pushbutton CancelButton
3736
lineinput LineInput
@@ -67,7 +66,7 @@
6766
add ClearSystemButton to LeftPanel
6867

6968
create ScanDevicesButton text `Scan for devices`
70-
on click ScanDevicesButton go to ScanNetworkClick
69+
on click ScanDevicesButton go to ScanForDevicesClick
7170
add ScanDevicesButton to LeftPanel
7271

7372
create UpdateDeviceButton text `Update device`
@@ -275,8 +274,11 @@ Start:
275274
begin
276275
clear RBRFlag
277276
gosub to GetAccessPoints
277+
put `Select SSID` into Title
278278
put `Select the home router for this system` into Prompt
279279
gosub to SelectSSIDFromList
280+
if Item is empty go to Start
281+
set property `host-ssid` of Config to Item
280282
if Config does not have property `host-password` gosub to GetHostPassword
281283
set property `host-password` of Config to ReturnValue
282284
end
@@ -372,8 +374,37 @@ ClearSystemClick:
372374
end
373375
stop
374376

375-
ScanNetworkClick:
376-
log `Scan the network for new devices`
377+
ScanForDevicesClick:
378+
put system `nmcli device wifi list` into SystemCallResult
379+
log SystemCallResult
380+
split SystemCallResult
381+
put json `[]` into List
382+
put 1 into N
383+
while N is less than the elements of SystemCallResult
384+
begin
385+
index SystemCallResult to N
386+
put SystemCallResult into SSID
387+
if left 1 of SSID is `*` begin end
388+
else
389+
begin
390+
put trim SSID into SSID
391+
put the position of ` ` in SSID into P
392+
put from P of SSID into SSID
393+
put trim SSID into SSID
394+
put the position of ` ` in SSID into P
395+
put left P of SSID into SSID
396+
if left 7 of SSID is `RBR-Now`
397+
begin
398+
append SSID to List
399+
end
400+
end
401+
increment N
402+
end
403+
! log `SSIDs: ` cat List
404+
put `Select Device` into Title
405+
put `Select the new device` into Prompt
406+
gosub to SelectSSIDFromList
407+
log `Selected ` cat Item
377408
stop
378409

379410
MasterDeviceClick:
@@ -514,20 +545,27 @@ SelectSSIDFromList:
514545
add element N of List to ListBox
515546
increment N
516547
end
517-
add ListBox to Layout
518-
on select ListBox put the current item in ListBox into Item
519-
create SelectHostButton text `Select`
520-
on click SelectHostButton
548+
on select ListBox
521549
begin
522-
set property `host-ssid` of Config to Item
550+
put the current item in ListBox into Item
523551
put Item cat ` Selected ` into StatusMessage
524552
gosub to Idle
525553
close Dialog
526554
return
527555
end
556+
add ListBox to Layout
528557
add stretch to Layout
529-
add SelectHostButton to Layout
530-
create Dialog title `Host SSID` layout Layout size 250 200
558+
create HLayout type QHBoxLayout
559+
create CancelButton text `Cancel`
560+
on click CancelButton
561+
begin
562+
put empty into Item
563+
close Dialog
564+
return
565+
end
566+
add CancelButton to HLayout
567+
add HLayout to Layout
568+
create Dialog title Title layout Layout size 250 200
531569
center Dialog on Window
532570
show Dialog
533571
stop
@@ -584,8 +622,11 @@ ConnectToHost:
584622
gosub to Working
585623
put system `nmcli dev wifi connect ` cat SSID cat ` password ` cat Password into SystemCallResult
586624
split SystemCallResult on ` `
587-
index SystemCallResult to 2
588-
if SystemCallResult is `successfully` go to OK
625+
if the elements of SystemCallResult is greater than 2
626+
begin
627+
index SystemCallResult to 2
628+
if SystemCallResult is `successfully` go to OK
629+
end
589630
put `Failed to connect to ` cat SSID into StatusMessage
590631
gosub to Idle
591632
log StatusMessage

test.ecg

Lines changed: 0 additions & 17 deletions
This file was deleted.

test.ecs

Lines changed: 0 additions & 119 deletions
This file was deleted.

test.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

test.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)