After some communication with Laurie on JTAlert we have started down the
path of integrating WSJT-X a bit more.

The idea is that WSJT-X should have a UDPServer that can receive commands to
do things so, for example, one could double-click on a JTAlert entry and it
could command WSJT-X to do its thing.

To this end I started coding one but am having QT class problems that are
befuddling me and was hoping someone (Bill?) could assist.
So far this implementation is intended to just take a "CQ" decoded message
and put it in the "Rx Frequency" window.  Then I was going to add the
double-click action once the first was working and stable.

I got this somewhat working but debugging complained about sending signals
when I just threaded a function inside then mainwindow.cpp plus gui stuff
isn't thread safe.
So I made the udp server a separate class and started trying slots/signals.
But now connecting the slot/signal burps on compiling and I can't quite
figure out the magic incantation to make it happy.

This is the line it complains about on MainWindow::doCall
  connect(m_UDPServer,&UDPServer::on_doCall,this,&MainWindow::doCall);
doCall is declared as a public slot in mainwindow.h and defined in
mainwindow.cpp


C:/JTSDK/qt5/5.2.1/mingw48_32/include/QtCore/qobject.h: In instantiation of
'static QMetaObject::Connection QObject::connect(const type
name QtPrivate::FunctionPointer<Func>::Object*, Func1, const typename
QtPrivate::FunctionPointer<Func2>::Object*, Func2, Qt::Connection
Type) [with Func1 = void (UDPServer::*)(DecodedText); Func2 = void
(MainWindow::*)(DecodedText); typename QtPrivate::FunctionPointer<Fu
nc>::Object = UDPServer; typename QtPrivate::FunctionPointer<Func2>::Object
= MainWindow]':
C:\JTSDK\src\wsjtx\mainwindow.cpp:461:69:   required from here
C:/JTSDK/qt5/5.2.1/mingw48_32/include/QtCore/qobject.h:222:9: error: static
assertion failed: No Q_OBJECT in the class with the signal
         Q_STATIC_ASSERT_X(QtPrivate::HasQ_OBJECT_Macro<typename
SignalType::Object>::Value,
         ^

Here's a UDP client to work with it that just cycles through a few CQ
messages.  All being done on port 5001 right now.
https://www.dropbox.com/s/pp5z7nqrtdeug9a/UDPClient.exe?dl=0

Mike W9MDB
#include <QUdpSocket>
#include <QHostInfo>
#include "UDPServer.h"

UDPServer::UDPServer() {
  m_kill = false;
}

UDPServer::~UDPServer() {
  m_kill = true;
}

void UDPServer::stop() {
  m_kill = true;
}

void UDPServer::start() 
{
  udpSocket = new QUdpSocket(this);
  udpSocket->bind(QHostAddress::Any,5001);
  while(!m_kill) {
    while(udpSocket->hasPendingDatagrams()) {
      QByteArray datagram;
      datagram.resize(udpSocket->pendingDatagramSize());
      QHostAddress sender;
      quint16 senderPort;
      
udpSocket->readDatagram(datagram.data(),datagram.size(),&sender,&senderPort);
      QString calltext(datagram);
      //doubleClickOnCall(false,false,calltext);
      DecodedText decodedtext;
      decodedtext = calltext;
      emit on_doCall(decodedtext);
    }
  }
  QThread::msleep(100);
}

#ifndef UDPSERVER_h
#define UDPSERVER_h
#include <QTWidgets>
#include "decodedtext.h"

class UDPServer: public QObject
{
private:
  QUdpSocket *udpSocket;
  int m_kill;

public:
  UDPServer();
  ~UDPServer();
  void start();

signals:
  void on_doCall(DecodedText decodedtext);

public slots:
  void stop();


};

#endif // UDPSERVER_H

Attachment: udpserver.diff
Description: Binary data

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
wsjt-devel mailing list
wsjt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wsjt-devel

Reply via email to