Skip to content

Commit 580e68b

Browse files
author
3aa49ec6bfc910647fa1c5a013e48eef
committed
Added framework for hotspot mode
1 parent 7c04042 commit 580e68b

File tree

3 files changed

+73
-6
lines changed

3 files changed

+73
-6
lines changed

worker/src/modules/config.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,33 @@ import path from 'path';
33

44
export interface NodeTeslaUsbConfig {
55
archive: {
6-
rcloneConfig: String,
7-
destinationPath: String
6+
rcloneConfig: string,
7+
destinationPath: string
88
},
99
paths: {
10-
sentryClips: String,
11-
savedClips: String,
10+
sentryClips: string,
11+
savedClips: string,
1212
},
13-
delayBetweenCopyRetryInSeconds: Number,
14-
mainLoopIntervalInSeconds: Number,
13+
delayBetweenCopyRetryInSeconds: number,
14+
mainLoopIntervalInSeconds: number,
15+
autoUpdate: { // add to default config
16+
enabled: boolean,
17+
checkInterval: number
18+
},
19+
wireless: { // add to default config
20+
hotspot: {
21+
enabled: boolean,
22+
ssid: string,
23+
password: string,
24+
},
25+
networks: {
26+
ssid: string,
27+
password: string,
28+
priority: number,
29+
hidden: boolean //todo: add functionality to handle hidden networks
30+
}[],
31+
refreshInterval: number
32+
}
1533
}
1634

1735
export const readConfigFile = async (filePath: string): Promise<NodeTeslaUsbConfig> => {

worker/src/modules/update.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export const checkForUpdate = async (interval: number): Promise<boolean> => {
2+
return false
3+
}
4+
5+
export const installUpdate = async (): Promise<boolean> => {
6+
return false
7+
}

worker/src/modules/wireless.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
interface WirelessNetwork { // some default values, to be refined
2+
ssid: string
3+
bssid: string
4+
channel: number
5+
frequency: number
6+
signalLevel: number
7+
security: string
8+
securityFlags: string
9+
}
10+
11+
/*
12+
// Behaviour:
13+
2) scan wifi networks every wireless.refreshInterval minutes
14+
3) if a network is found in wireless.networks networks, connect to it based upon priority
15+
4) if no networks are found, enable hotspot mode as per wireless.networks.hotspot
16+
5) every wireless.refreshInterval, if no clients are connected to the hotspot, go to step 2
17+
*/
18+
19+
20+
export const scanWirelessNetworks = async (): Promise<WirelessNetwork[]> => {
21+
return []
22+
}
23+
24+
export const connectToWirelessNetwork = async (ssid: string, password: string): Promise<boolean> => {
25+
return false
26+
}
27+
28+
export const disconnectFromWirelessNetwork = async (): Promise<boolean> => {
29+
return false
30+
}
31+
32+
export const getWirelessHotspotStatus = async (): Promise<boolean> => {
33+
return false
34+
}
35+
36+
export const enableWirelessHotspot = async (ssid: string, password: string): Promise<boolean> => {
37+
return false
38+
}
39+
40+
export const disableWirelessHotspot = async (): Promise<boolean> => {
41+
return false
42+
}

0 commit comments

Comments
 (0)