@@ -19,6 +19,8 @@ use constant printerinfomation => net_peripheral . '.4.2.1.5.5' ;
19
19
use constant brInfoSerialNumber => printerinfomation . ' .1.0' ;
20
20
use constant brScanCountCounter => printerinfomation . ' .54.2.2.1.3.3' ;
21
21
22
+ use constant brpsWLanName => brother . ' .2.4.3.100.11.1.3' ;
23
+
22
24
# Brother NetConfig
23
25
use constant brnetconfig => brother . ' .2.4.3.1240' ;
24
26
use constant brconfig => brnetconfig . ' .1' ;
@@ -77,6 +79,40 @@ sub getModel {
77
79
return $model ;
78
80
}
79
81
82
+ sub getWlanPorts {
83
+ my ($self ) = @_ ;
84
+
85
+ my $device = $self -> device
86
+ or return ;
87
+
88
+ # Get list of device ports
89
+ my %ports = %{$device -> {PORTS }-> {PORT }}; # Shallow copy
90
+ foreach my $key (keys %ports ) {
91
+ $ports {$key } = {%{$ports {$key }}}; # Deep copy for one level deep hash
92
+ }
93
+
94
+ foreach my $port (keys %ports ) {
95
+ # Loopback or DOWN interfaces
96
+ if ($ports {$port }-> {IFTYPE } == 24 || $ports {$port }-> {IFTYPE } == 2) {
97
+ delete $ports {$port };
98
+ }
99
+ }
100
+
101
+ # Only one interface remaining and actually connected to a WLAN network
102
+ my $brpsWLanName = $self -> walk(brpsWLanName);
103
+ if (scalar (keys %ports ) == 1 && $brpsWLanName ) {
104
+ foreach my $port (keys %ports ) {
105
+ # Replaces the port ifType from "Ethernet" to "WiFi" (71)
106
+ if ($ports {$port }-> {IFTYPE } == 6 || $ports {$port }-> {IFTYPE } == 7) {
107
+ # WLAN network name strlen is greather than zero
108
+ if (length ((keys %{$brpsWLanName })[0]) gt 0) {
109
+ $device -> {PORTS }-> {PORT }-> {$port }-> {IFTYPE } = 71;
110
+ }
111
+ };
112
+ }
113
+ }
114
+ }
115
+
80
116
sub run {
81
117
my ($self ) = @_ ;
82
118
@@ -92,6 +128,8 @@ sub run {
92
128
or next ;
93
129
$device -> {PAGECOUNTERS }-> {$counter } = $count ;
94
130
}
131
+
132
+ $self -> getWlanPorts();
95
133
}
96
134
97
135
1;
0 commit comments