Airspy HF+とtelnet

あなたは、Gqrxをtelnetで制御することができます。

import numpy as numpy
import matplotlib.pyplot as plt
import telnetlib
HOST = "127.0.0.1"
EXPECTED =b"dummy"
TOUT = 0.1

tn = telnetlib.Telnet(HOST, 7356)
xvalue = []
yvalue = []

tn.write(b"M CW 1000\n")
print(tn.read_until(EXPECTED, timeout=TOUT).decode('ascii'), end="")

for freq_hz in range(79000000, 81000000, 1000):
	freq=b"F "+str(freq_hz).encode('ascii')+b"\n"
	tn.write(freq)
	tn.read_until(EXPECTED, timeout=TOUT)

	tn.write(b"f\n")
	f = int(tn.read_until(EXPECTED, timeout=TOUT).decode('ascii'))
	xvalue.append(f)
	print(f)

	tn.write(b"l\n")
	l = float(tn.read_until(EXPECTED, timeout=TOUT).decode('ascii'))
	yvalue.append(l)
	print(l)

plt.figure(1, figsize=(8,8))
plt.subplot(111)
plt.title('Airspy HF+')
plt.xlabel('Freq [Hz]')
plt.ylabel('Signal Strength [dBm]')
plt.grid(True)
plt.plot(xvalue, yvalue, color='blue', linewidth=1)
plt.show()

このプログラムは、FM帯をスキャンして信号強度をプロットします。

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.