Fixed network message ids to be properly passed between server requests and client responses
This commit is contained in:
parent
fab53920b9
commit
3ce2ceba34
@ -11048,6 +11048,8 @@ void MainWindow::networkMessage(Message const &message)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qDebug() << "try processing network message" << type;
|
||||||
|
|
||||||
auto params = message.params();
|
auto params = message.params();
|
||||||
auto id = params.value("_ID", QVariant(0));
|
auto id = params.value("_ID", QVariant(0));
|
||||||
|
|
||||||
@ -11230,6 +11232,7 @@ void MainWindow::networkMessage(Message const &message)
|
|||||||
if(type == "WINDOW.RAISE"){
|
if(type == "WINDOW.RAISE"){
|
||||||
setWindowState(Qt::WindowActive);
|
setWindowState(Qt::WindowActive);
|
||||||
activateWindow();
|
activateWindow();
|
||||||
|
raise();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
18
udp.py
18
udp.py
@ -1,7 +1,8 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import json
|
|
||||||
from socket import socket, AF_INET, SOCK_DGRAM
|
from socket import socket, AF_INET, SOCK_DGRAM
|
||||||
|
|
||||||
|
import json
|
||||||
import time
|
import time
|
||||||
|
|
||||||
listen = ('127.0.0.1', 2237)
|
listen = ('127.0.0.1', 2237)
|
||||||
@ -37,13 +38,10 @@ class Server(object):
|
|||||||
if params:
|
if params:
|
||||||
print('-> params: ', params)
|
print('-> params: ', params)
|
||||||
|
|
||||||
#### if typ == 'PING':
|
if typ == 'PING':
|
||||||
#### if self.first:
|
if self.first:
|
||||||
#### self.send('RX.GET_BAND_ACTIVITY')
|
self.send('STATION.GET_CALLSIGN')
|
||||||
#### self.send('TX.SET_TEXT', 'HERE WE GO')
|
self.first = False
|
||||||
#### time.sleep(1)
|
|
||||||
#### self.send('WINDOW.RAISE')
|
|
||||||
#### self.first = False
|
|
||||||
|
|
||||||
#### if typ == 'PING':
|
#### if typ == 'PING':
|
||||||
#### self.send('STATION.GET_GRID')
|
#### self.send('STATION.GET_GRID')
|
||||||
@ -64,6 +62,10 @@ class Server(object):
|
|||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def send(self, *args, **kwargs):
|
def send(self, *args, **kwargs):
|
||||||
|
params = kwargs.get('params', {})
|
||||||
|
if '_ID' not in params:
|
||||||
|
params['_ID'] = int(time.time()*1000)
|
||||||
|
kwargs['params'] = params
|
||||||
message = to_message(*args, **kwargs)
|
message = to_message(*args, **kwargs)
|
||||||
print('outgoing message:', message)
|
print('outgoing message:', message)
|
||||||
self.sock.sendto(message, self.reply_to)
|
self.sock.sendto(message, self.reply_to)
|
||||||
|
Loading…
Reference in New Issue
Block a user