@@ -85,7 +85,8 @@ type serialhub struct {
85
85
}
86
86
87
87
type SpPortList struct {
88
- SerialPorts []SpPortItem
88
+ SerialPorts []SpPortItem
89
+ NetworkPorts []SpPortItem
89
90
}
90
91
91
92
type SpPortItem struct {
@@ -452,7 +453,13 @@ func spListDual(network bool) {
452
453
// to append the open/close state, baud rates, etc to make
453
454
// a super clean nice list to send back to browser
454
455
n := len (list )
455
- spl := SpPortList {make ([]SpPortItem , n , n )}
456
+ spl := SpPortList {make ([]SpPortItem , n , n ), make ([]SpPortItem , n , n )}
457
+
458
+ ports := spl .SerialPorts
459
+
460
+ if network {
461
+ ports = spl .NetworkPorts
462
+ }
456
463
457
464
ctr := 0
458
465
for _ , item := range list {
@@ -470,7 +477,7 @@ func spListDual(network bool) {
470
477
AvailableBufferAlgorithms []string
471
478
Ver float32
472
479
*/
473
- spl . SerialPorts [ctr ] = SpPortItem {
480
+ ports [ctr ] = SpPortItem {
474
481
Name : item .Name ,
475
482
Friendly : item .FriendlyName ,
476
483
SerialNumber : item .SerialNumber ,
@@ -486,15 +493,15 @@ func spListDual(network bool) {
486
493
}
487
494
488
495
// figure out if port is open
489
- //spl.SerialPorts [ctr].IsOpen = false
496
+ //ports [ctr].IsOpen = false
490
497
myport , isFound := findPortByName (item .Name )
491
498
492
499
if isFound {
493
500
// we found our port
494
- spl . SerialPorts [ctr ].IsOpen = true
495
- spl . SerialPorts [ctr ].Baud = myport .portConf .Baud
496
- spl . SerialPorts [ctr ].BufferAlgorithm = myport .BufferType
497
- spl . SerialPorts [ctr ].IsPrimary = myport .IsPrimary
501
+ ports [ctr ].IsOpen = true
502
+ ports [ctr ].Baud = myport .portConf .Baud
503
+ ports [ctr ].BufferAlgorithm = myport .BufferType
504
+ ports [ctr ].IsPrimary = myport .IsPrimary
498
505
}
499
506
//ls += "{ \"name\" : \"" + item.Name + "\", \"friendly\" : \"" + item.FriendlyName + "\" },\n"
500
507
ctr ++
0 commit comments