summaryrefslogtreecommitdiffstats
path: root/perl-install/network/monitor.pm
blob: 91289e93acffba9b42649df34e5df212b1af7458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package network::monitor;

use dbus_object;

our @ISA = qw(dbus_object);

sub new {
    my ($type, $bus) = @_;
    dbus_object::new($type,
		       $bus,
		       "com.mandriva.monitoring",
		       "/com/mandriva/monitoring/network",
		       "com.mandriva.monitoring.network");
}

sub list_wireless {
    my ($o) = @_;
    my $networks;
    eval { $networks = $o->call_method('ListWireless') };
    my %networks;
    while ($networks =~ /^((?:[0-9a-f]{2}:){5}[0-9a-f]{2})\t(\d+)\t(\d+)\t(.*?)\t(.*)$/mg) {
        $networks{$1} = { frequency => $2, signal_level => $3, flags => $4, ssid => $5 };
    }
    \%networks;
}

1;