Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 828a551

Browse files
author
Ihor Savchenko
committed
add channel and band properties to network manager dbus
1 parent bd21ded commit 828a551

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
// defaults
1111
const AP_SSID = process.env.AP_SSID || `WiFi Repeater`;
1212
const AP_PASSWORD = process.env.AP_PASSWORD || '';
13+
const AP_CHANNEL = process.env.AP_CHANNEL || 1;
14+
const AP_BAND = process.env.AP_PASSWORD || 'bg';
1315
const WIFI_SSID = process.env.WIFI_SSID;
1416
const WIFI_PASSWORD = process.env.WIFI_PASSWORD;
1517

@@ -47,8 +49,8 @@ const LED_ERROR_PATTERNS = {
4749
return;
4850
}
4951

50-
console.log(`Creating WiFi AP on ${accessPoint.iface} with SSID "${AP_SSID}" and password "${AP_PASSWORD}"...`);
51-
await createAccessPoint({ iface: accessPoint.iface, ssid: AP_SSID, password: AP_PASSWORD });
52+
console.log(`Creating WiFi AP on ${accessPoint.iface} with SSID "${AP_SSID}", CHANNEL "${AP_CHANNEL}", BAND "${AP_BAND}"...`);
53+
await createAccessPoint({ iface: accessPoint.iface, ssid: AP_SSID, password: AP_PASSWORD, channel: AP_CHANNEL, band: AP_BAND });
5254

5355
// Use secondary wireless device for internet if ethernet doesn't do the job.
5456
if (!ethernet) {

src/nm.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export interface WirelessNetwork {
2424
iface: string;
2525
ssid: string;
2626
password?: string;
27+
channel: number;
28+
band: string;
2729
}
2830

2931
const nm: string = 'org.freedesktop.NetworkManager';
@@ -47,6 +49,8 @@ export const createAccessPoint = async (device: WirelessNetwork): Promise<any> =
4749
['802-11-wireless', [
4850
['ssid', ['ay', stringToArrayOfBytes(device.ssid)]],
4951
['mode', ['s', 'ap']],
52+
['channel', ['u'], device.channel],
53+
['band', ['s', device.band]],
5054
]],
5155
['ipv4', [
5256
['method', ['s', 'shared']],

0 commit comments

Comments
 (0)