-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpioneerController.sh
executable file
·123 lines (102 loc) · 1.9 KB
/
pioneerController.sh
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
IP=192.168.1.106
PORT=23
sendCommand(){
printf '%s\r\n' $1 | nc $IP $PORT
}
volumeDown(){
sendCommand 'vd'
}
volumeUp(){
sendCommand 'vu'
}
powerOff(){
sendCommand 'pf'
}
powerOn(){
sendCommand 'po'
}
mute(){
sendCommand 'mz'
}
setBD(){
sendCommand '25fn'
}
setPC(){
sendCommand '23fn'
}
setSAT(){
sendCommand '06fn'
}
sleepCmd(){
sendCommand "$1sab"
}
manualCommand(){
clear
echo -n "Enter command: "
read CMD
sendCommand "$CMD"
}
sleepFunc(){
clear
echo "1: 30 Min 2: 60 Min"
echo "3: 90 Min 0: Off"
echo -n "Press any key to continue: "
read -n1 CMD
case $CMD in
1) sleepCmd 030 ;;
2) sleepCmd 060 ;;
3) sleepCmd 090 ;;
0) sleepCmd 000 ;;
esac
mainFunction
}
customVolume(){
echo
echo "-80.0 dB -50.0 dB +12.0 dB"
echo "----------------------------------------------------------------------------------------"
echo "000 061 185"
echo
echo -n "Enter volume: "
read VOL
while [ $(echo -n $VOL | wc -m) -lt "3" ]
do
VOL="0$VOL"
done
CMD=$VOL"VL"
sendCommand "$CMD"
}
mainFunction(){
clear
echo " ____ _ "
echo " / __ \\(_)___ ____ ___ ___ _____"
echo " / /_/ / / __ \\/ __ \\/ _ \\/ _ \\/ ___/"
echo " / ____/ / /_/ / / / / __/ __/ / "
echo " /_/ /_/\\____/_/ /_/\\___/\\___/_/ "
echo "L: Volume Up K: Volume Down"
echo "V: Volume M: Mute"
echo "I: Power On O: Power Down"
echo "S: Sleep"
echo ""
echo "1: PS4 2: PC 3: SAT"
echo ""
echo "W: Manual Command"
echo -n "Press any key to continue: "
read -n1 CMD
case $CMD in
[lL]) volumeUp ;;
[kK]) volumeDown ;;
[oO]) powerOff ;;
[iI]) powerOn ;;
[mM]) mute ;;
[sS]) sleepFunc ;;
[qQ]) clear; exit;;
[vV]) customVolume ;;
[wW]) manualCommand ;;
1) setBD ;;
2) setPC ;;
3) setSAT ;;
esac
mainFunction
}
mainFunction