-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWireless.fs
More file actions
33 lines (25 loc) · 962 Bytes
/
Wireless.fs
File metadata and controls
33 lines (25 loc) · 962 Bytes
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
namespace reMarkable.fs.Wireless
open System
open System.IO
open System.Text.RegularExpressions
/// Contains data related to wireless network quality
type WirelessQuality =
{ /// The signal gain
Gain: int
/// The link quality
Link: float32
/// The signal noise baseline
Noise: int }
/// Provides a set of methods to monitor the installed wireless networking hardware
type HardwareWirelessMonitor() =
/// Parses the wireless network status file
member _.GetQuality(): WirelessQuality =
let lines = File.ReadAllLines("/proc/net/wireless")
let wlan0 = lines.[2]
let columns = Regex.Split(wlan0.Trim(), "\\s+")
let qualityLink = Int32.Parse(columns.[2].Trim('.'))
let qualityLevel = Int32.Parse(columns.[3].Trim('.'))
let qualityNoise = Int32.Parse(columns.[4])
{ Link = (qualityLink |> float32) / 70f
Gain = qualityLevel
Noise = qualityNoise }