-
Notifications
You must be signed in to change notification settings - Fork 0
/
rdaudp.py
71 lines (59 loc) · 1.47 KB
/
rdaudp.py
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
###=====================================================================###
###========================= UDP>><<RDA5807M =========================###
###=====================================================================###
import rda, socket
from network import WLAN
udp = socket.socket(2, 2)
fpss = bytearray(4)
fpss[0] = 88
frq = int(str(fpss[0]) + str(fpss[1]))
udp.bind((WLAN(0).ifconfig()[0], 10894))
while True:
cmd, ips = udp.recvfrom(1024)
if cmd:
if cmd == b'oi':
if not(fpss[2]):
fpss[2] = 1
rda.urip()
else:
fpss[2] = 0
rda.mati()
if cmd == b'sm':
if fpss[3]:
fpss[3] = 0
rda.loro()
else:
fpss[3] = 1
rda.siji()
if cmd == b'mt':
rda.mute()
if cmd == b'v+':
rda.volU()
if cmd == b'v-':
rda.volD()
if cmd == b'bs':
rda.bass()
if cmd == b'rt':
rda.rata()
if cmd[0] == 61:
rda.freq(int(cmd[1:].decode()))
udp.sendto(cmd[1:], (ips[0], 10894))
if cmd[0] == 99:
fpss[0] = int(cmd[1:].decode())
frq = int(str(fpss[0]) + str(fpss[1]))
rda.freq(frq)
if cmd[0] == 112:
fpss[1] = int(cmd[1:].decode())
frq = int(str(fpss[0]) + str(fpss[1]))
rda.freq(frq)
if cmd[0] == 120:
rda.volN(int(cmd[1:].decode()))
if cmd == b'f+':
frq += 1
rda.freq(frq)
udp.sendto(str(frq).encode(), (ips[0], 10894))
if cmd == b'f-':
frq -= 1
rda.freq(frq)
udp.sendto(str(frq).encode(), (ips[0], 10894))
###===©=========================================================ls.18===###