-
Notifications
You must be signed in to change notification settings - Fork 1
/
WLANUserDeviceStat.ts
38 lines (33 loc) · 1.13 KB
/
WLANUserDeviceStat.ts
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
28
29
30
31
32
33
34
35
36
37
38
import { User80211Device } from '../../driver/efm/User80211Device';
import { WLANUserDeviceStat } from '../../driver/generic/WLANUserDeviceStat';
import { RPCProvider } from '../jsonrpcv2';
export class RPCWLANUserDeviceStat extends WLANUserDeviceStat {
private rpc: RPCProvider;
private targetId: string;
constructor(rpc: RPCProvider, targetId: string) {
super();
this.rpc = rpc;
this.targetId = targetId;
}
/**
* Get STAs connected to given WLAN interface
*
* @param devname - WLAN device name
* @param ifname - WLAN interface name
* @returns List of currently connected STAs
*/
public async getUserDevices(devname: string, ifname: string): Promise<User80211Device[]> {
const res = await this.rpc.remoteCall({
jsonrpc: '2.0',
target: this.targetId,
class: 'WLANUserDeviceStat',
method: 'getUserDevices',
params: [devname, ifname],
});
return (res as any[]).map((elem) => {
const ud = new User80211Device();
ud.restore(elem);
return ud;
});
}
}