|
|
|
@ -137,18 +137,28 @@ def receive_data():
|
|
|
|
print()
|
|
|
|
print()
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
|
|
|
|
|
|
|
|
result = 0
|
|
|
|
result = 0
|
|
|
|
if (int(freq) == 2400 and (prediction_list[0] in ['drone', 'drone_noise'] or (prediction_list[0] == 'wifi' and float(probability) >= 0.95))) or (int(freq) == 1200 and (prediction_list[0] in ['drone'] and float(probability) >= 0.95)):
|
|
|
|
freq_int = int(freq)
|
|
|
|
|
|
|
|
prediction = prediction_list[0]
|
|
|
|
|
|
|
|
prob = float(probability)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if freq_int == 2400:
|
|
|
|
|
|
|
|
if prediction in ["drone", "drone_noise"]:
|
|
|
|
result += 0
|
|
|
|
result += 0
|
|
|
|
if int(freq) in [915]:
|
|
|
|
elif prediction == "wifi" and prob >= 0.95:
|
|
|
|
result = 0
|
|
|
|
result += 0
|
|
|
|
if int(freq) in []:
|
|
|
|
|
|
|
|
|
|
|
|
elif freq_int == 1200:
|
|
|
|
|
|
|
|
if prediction == "drone" and prob >= 0.95:
|
|
|
|
|
|
|
|
result += 8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elif freq_int == 915:
|
|
|
|
result = 0
|
|
|
|
result = 0
|
|
|
|
|
|
|
|
|
|
|
|
data_to_send = {
|
|
|
|
data_to_send = {
|
|
|
|
'freq': str(freq),
|
|
|
|
"freq": str(freq),
|
|
|
|
'amplitude': result
|
|
|
|
"amplitude": result,
|
|
|
|
#'triggered': False if result < 7 else True,
|
|
|
|
|
|
|
|
#'light_len': result
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
response = requests.post("http://{0}:{1}/process_data".format(gen_server_ip, gen_server_port), json=data_to_send)
|
|
|
|
response = requests.post("http://{0}:{1}/process_data".format(gen_server_ip, gen_server_port), json=data_to_send)
|
|
|
|
if response.status_code == 200:
|
|
|
|
if response.status_code == 200:
|
|
|
|
|