-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathset.php
60 lines (49 loc) · 1.22 KB
/
set.php
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
include ('config.php');
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
//Set rig
$freq = test_input($_GET["freq"]);
$mod = test_input($_GET["mod"]);
$mem = test_input($_GET["mem"]);
$move = test_input($_GET["move"]);
if ($mem) {
$row = 1;
if (($handle = fopen("memory.csv", "r")) !== FALSE) {
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
if ($mem==$data[0]) {
//Freq
$run = exec('rigctl -m 2 -r '.HOST.' F '.$data[2]*1000000);
//Modulation
If ($data[10]=="NFM") {$data[10]="FM";}
$run = exec('rigctl -m 2 -r '.HOST.' M '.$data[10].' 0');
//Shift
$run = exec('rigctl -m 2 -r '.HOST.' O '.$data[4]*1000000);
//-+Shift
if ($data[3]) {$run = exec('rigctl -m 2 -r '.HOST.' R '.$data[3]);}
//Tone
if ($data[5]=="Tone") {$run = exec('rigctl -m 2 -r '.HOST.' C '.$data[6]);}
}
$row++;
}
fclose($handle);
}
} else {
if ($freq) {
$run = exec('rigctl -m 2 -r '.HOST.' F '.$freq);
}
if ($mod) {
$run = exec('rigctl -m 2 -r '.HOST.' M '.$mod." 0");
}
if (!empty($move)) {
$freq = (exec('rigctl -m 2 -r '.HOST.' f'));
$freq=$freq+($move*1000);
$run = exec('rigctl -m 2 -r '.HOST.' F '.$freq);
}
}
echo "SET";
?>