-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
47 lines (36 loc) · 1.35 KB
/
main.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
def main():
from IcomRadioDetector import IcomRadioDetector
from RadioController import RadioController
print("Detecting Icom radios...")
detector = IcomRadioDetector()
radios = detector.detect_radios()
if not radios:
print("No Icom radios detected.")
return
print("Found Icom radios:")
for i, port in enumerate(radios, 1):
print(f"{i}. {port}")
selected_index = (
int(input("Enter the index of the Icom radio you want to use: ")) - 1
)
if selected_index < 0 or selected_index >= len(radios):
print("Invalid index.")
return
selected_port = radios[selected_index]
print(f"Selected port: {selected_port}")
radio_controller = RadioController(selected_port)
try:
while True:
packet_data = input("Enter packet data to send: ")
radio_controller.send_packet_data(packet_data)
received_data = radio_controller.receive_packet_data()
print(f"Received packet data: {received_data}")
more_data = input("Do you want to send more packet data? (y/n): ")
if more_data.lower() != "y":
break
except KeyboardInterrupt:
print("Exiting...")
finally:
radio_controller.close()
if __name__ == "__main__":
main()