Index: Configuration.cpp
===================================================================
--- Configuration.cpp	(revision 5070)
+++ Configuration.cpp	(working copy)
@@ -383,6 +383,7 @@
   Q_SLOT void done (int) override;
 
 
+
 private:
   typedef QList<QAudioDeviceInfo> AudioDevices;
 
@@ -441,6 +442,11 @@
   Q_SLOT void on_pbTxMsg_clicked();
   Q_SLOT void on_pbNewDXCC_clicked();
   Q_SLOT void on_pbNewCall_clicked();
+  Q_SLOT void on_network_udpServer_toggled(bool checked);
+  Q_SLOT void on_network_udpBroadcast_toggled(bool checked);
+  Q_SLOT void on_network_udpWindowToFront_toggled(bool checked);
+  Q_SLOT void on_m_udpPortRx_editingFinished();
+  Q_SLOT void on_m_udpPortTx_editingFinished();
 
   // typenames used as arguments must match registered type names :(
   Q_SIGNAL void stop_transceiver () const;
@@ -536,6 +542,8 @@
   QColor color_NewCall_;
   QColor next_color_NewCall_;
   qint32 id_interval_;
+  qint32 udpPortRx_;
+  qint32 udpPortTx_;
   bool id_after_73_;
   bool tx_QSY_allowed_;
   bool spot_to_psk_reporter_;
@@ -552,6 +560,9 @@
   bool disable_TX_on_73_;
   bool watchdog_;
   bool TX_messages_;
+  bool udpServerEnabled_;
+  bool udpBroadcast_;
+  bool udpWindowToFront_;
   DataMode data_mode_;
 
   QAudioDeviceInfo audio_input_device_;
@@ -621,6 +632,11 @@
 {
   return !m_->rig_is_dummy_ && m_->rig_params_.split_mode_ != TransceiverFactory::split_mode_none;
 }
+qint32 Configuration::udpPortRx() const {return m_->udpPortRx_;}
+qint32 Configuration::udpPortTx() const {return m_->udpPortTx_;}
+bool Configuration::udpServerEnabled () const {return m_->udpServerEnabled_;}
+bool Configuration::udpBroadcast () const {return m_->udpBroadcast_;}
+bool Configuration::udpWindowToFront () const {return m_->udpWindowToFront_;}
 Bands * Configuration::bands () {return &m_->bands_;}
 StationList * Configuration::stations () {return &m_->stations_;}
 FrequencyList * Configuration::frequencies () {return &m_->frequencies_;}
@@ -1060,6 +1076,13 @@
   next_stations_ = stations_.stations ();
 
   set_rig_invariants ();
+
+  ui_->network_udpPortRx->setText(QString::number(udpPortRx_));
+  ui_->network_udpPortTx->setText(QString::number(udpPortTx_));
+  ui_->network_udpServerEnabled->setChecked(udpServerEnabled_);
+  ui_->network_udpBroadcast->setChecked(udpBroadcast_);
+  ui_->network_udpWindowToFront->setChecked(udpWindowToFront_);
+
 }
 
 void Configuration::impl::done (int r)
@@ -1217,7 +1240,11 @@
   TX_messages_ = settings_->value ("Tx2QSO", false).toBool ();
   rig_params_.CAT_poll_interval_ = settings_->value ("Polling", 0).toInt ();
   rig_params_.split_mode_ = settings_->value ("SplitMode", QVariant::fromValue (TransceiverFactory::split_mode_none)).value<TransceiverFactory::SplitMode> ();
-}
+  udpPortRx_ = settings_->value ("udpPortRx",2237).toInt ();
+  udpPortTx_ = settings_->value ("udpPortTx",2238).toInt ();
+  udpServerEnabled_ = settings_->value ("udpServerEnabled",true).toBool ();
+  udpBroadcast_ = settings_->value ("udpBroadcast",false).toBool ();
+  udpWindowToFront_ = settings_->value ("udpWindowToFront",true).toBool ();}
 
 void Configuration::impl::write_settings ()
 {
@@ -1293,6 +1320,11 @@
   settings_->setValue ("TXAudioSource", QVariant::fromValue (rig_params_.TX_audio_source_));
   settings_->setValue ("Polling", rig_params_.CAT_poll_interval_);
   settings_->setValue ("SplitMode", QVariant::fromValue (rig_params_.split_mode_));
+  settings_->setValue ("udpServerEnabled", udpServerEnabled_);
+  settings_->setValue ("udpPortRx", udpPortRx_);
+  settings_->setValue ("udpPortTx", udpPortTx_);
+  settings_->setValue ("udpBroadcast", udpBroadcast_);
+  settings_->setValue ("udpWindowToFront", udpWindowToFront_);
 }
 
 void Configuration::impl::set_rig_invariants ()
@@ -2406,7 +2438,33 @@
   cb->setEditText (current_text);
 }
 
+void Configuration::impl::on_network_udpServer_toggled(bool /* checked */)
+{
+    udpServerEnabled_ = ui_->network_udpServerEnabled->isChecked();
+}
 
+void Configuration::impl::on_network_udpBroadcast_toggled(bool /* checked */)
+{
+    udpBroadcast_ = ui_->network_udpBroadcast->isChecked();;
+}
+
+void Configuration::impl::on_network_udpWindowToFront_toggled(bool /* checked */)
+{
+    udpWindowToFront_ = ui_->network_udpWindowToFront->isChecked();;
+}
+
+void Configuration::impl::on_m_udpPortRx_editingFinished()
+{
+    QString port = ui_->network_udpPortRx->text();
+    udpPortRx_ = port.toInt();
+}
+
+void Configuration::impl::on_m_udpPortTx_editingFinished()
+{
+    QString port = ui_->network_udpPortTx->text();
+    udpPortTx_ = port.toInt();
+}
+
 inline
 bool operator != (RigParams const& lhs, RigParams const& rhs)
 {
Index: Configuration.hpp
===================================================================
--- Configuration.hpp	(revision 5070)
+++ Configuration.hpp	(working copy)
@@ -88,6 +88,8 @@
   QString my_grid () const;
   QFont decoded_text_font () const;
   qint32 id_interval () const;
+  qint32 udpPortRx () const;
+  qint32 udpPortTx () const;
   bool id_after_73 () const;
   bool tx_QSY_allowed () const;
   bool spot_to_psk_reporter () const;
@@ -105,6 +107,9 @@
   bool watchdog () const;
   bool TX_messages () const;
   bool split_mode () const;
+  bool udpServerEnabled () const;
+  bool udpBroadcast () const;
+  bool udpWindowToFront () const;
   Bands * bands ();
   FrequencyList * frequencies ();
   StationList * stations ();
Index: Configuration.ui
===================================================================
--- Configuration.ui	(revision 5070)
+++ Configuration.ui	(working copy)
@@ -21,7 +21,7 @@
   </property>
   <layout class="QVBoxLayout" name="verticalLayout_2">
    <item>
-    <widget class="QTabWidget" name="configuration_tabs">
+    <widget class="QTabWidget" name="m_udpServerEnabled">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
        <horstretch>0</horstretch>
@@ -38,7 +38,7 @@
       <string>Select tab to change configuration parameters.</string>
      </property>
      <property name="currentIndex">
-      <number>0</number>
+      <number>7</number>
      </property>
      <widget class="QWidget" name="general_tab">
       <attribute name="title">
@@ -1971,6 +1971,145 @@
        </layout>
       </widget>
      </widget>
+     <widget class="QWidget" name="tab_2">
+      <attribute name="title">
+       <string>Network</string>
+      </attribute>
+      <widget class="QLineEdit" name="network_udpPortRx">
+       <property name="geometry">
+        <rect>
+         <x>64</x>
+         <y>160</y>
+         <width>71</width>
+         <height>20</height>
+        </rect>
+       </property>
+       <property name="toolTip">
+        <string>UDP Port to receive WSJT-X lines of decodes</string>
+       </property>
+       <property name="inputMethodHints">
+        <set>Qt::ImhDigitsOnly</set>
+       </property>
+      </widget>
+      <widget class="QLabel" name="network_label_rxport">
+       <property name="geometry">
+        <rect>
+         <x>20</x>
+         <y>160</y>
+         <width>38</width>
+         <height>20</height>
+        </rect>
+       </property>
+       <property name="toolTip">
+        <string>UDP Port to receive WSJT-X lines of decodes</string>
+       </property>
+       <property name="text">
+        <string>Rx Port</string>
+       </property>
+       <property name="buddy">
+        <cstring>callsign_line_edit</cstring>
+       </property>
+      </widget>
+      <widget class="QLineEdit" name="network_udpPortTx">
+       <property name="geometry">
+        <rect>
+         <x>64</x>
+         <y>190</y>
+         <width>71</width>
+         <height>20</height>
+        </rect>
+       </property>
+       <property name="toolTip">
+        <string>UDP Port to transmit decoded lines to  WSJT-X for processing</string>
+       </property>
+       <property name="inputMethodHints">
+        <set>Qt::ImhDigitsOnly</set>
+       </property>
+      </widget>
+      <widget class="QLabel" name="network_label_txport">
+       <property name="geometry">
+        <rect>
+         <x>20</x>
+         <y>190</y>
+         <width>38</width>
+         <height>20</height>
+        </rect>
+       </property>
+       <property name="toolTip">
+        <string>UDP Port to transmit decoded lines to  WSJT-X for processing</string>
+       </property>
+       <property name="text">
+        <string>Tx Port</string>
+       </property>
+       <property name="buddy">
+        <cstring>callsign_line_edit</cstring>
+       </property>
+      </widget>
+      <widget class="QCheckBox" name="network_udpServerEnabled">
+       <property name="geometry">
+        <rect>
+         <x>20</x>
+         <y>30</y>
+         <width>123</width>
+         <height>17</height>
+        </rect>
+       </property>
+       <property name="toolTip">
+        <string>Allow WSJT-X to send decodes over the network</string>
+       </property>
+       <property name="text">
+        <string>Enable UDP Server</string>
+       </property>
+       <property name="checked">
+        <bool>false</bool>
+       </property>
+      </widget>
+      <widget class="QCheckBox" name="network_udpBroadcast">
+       <property name="geometry">
+        <rect>
+         <x>20</x>
+         <y>60</y>
+         <width>123</width>
+         <height>17</height>
+        </rect>
+       </property>
+       <property name="toolTip">
+        <string>Send decodes to other computers on the network</string>
+       </property>
+       <property name="text">
+        <string>Enable UDP broadcast -- to send to other computers on the network</string>
+       </property>
+      </widget>
+      <widget class="QCheckBox" name="network_udpWindowToFront">
+       <property name="geometry">
+        <rect>
+         <x>20</x>
+         <y>90</y>
+         <width>241</width>
+         <height>17</height>
+        </rect>
+       </property>
+       <property name="toolTip">
+        <string>Will restore triggered WSJT-X window and bring to front</string>
+       </property>
+       <property name="text">
+        <string>Restore WSJT-X window and bring to front</string>
+       </property>
+      </widget>
+      <widget class="Line" name="line_9">
+       <property name="geometry">
+        <rect>
+         <x>10</x>
+         <y>130</y>
+         <width>638</width>
+         <height>3</height>
+        </rect>
+       </property>
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+      </widget>
+     </widget>
     </widget>
    </item>
    <item>
@@ -1991,7 +2130,6 @@
   </layout>
  </widget>
  <tabstops>
-  <tabstop>configuration_tabs</tabstop>
   <tabstop>callsign_line_edit</tabstop>
   <tabstop>grid_line_edit</tabstop>
   <tabstop>type_2_msg_gen_combo_box</tabstop>
@@ -2132,11 +2270,11 @@
  </connections>
  <buttongroups>
   <buttongroup name="TX_audio_source_button_group"/>
-  <buttongroup name="TX_mode_button_group"/>
   <buttongroup name="CAT_stop_bits_button_group"/>
-  <buttongroup name="PTT_method_button_group"/>
   <buttongroup name="CAT_data_bits_button_group"/>
+  <buttongroup name="CAT_handshake_button_group"/>
+  <buttongroup name="TX_mode_button_group"/>
   <buttongroup name="split_mode_button_group"/>
-  <buttongroup name="CAT_handshake_button_group"/>
+  <buttongroup name="PTT_method_button_group"/>
  </buttongroups>
 </ui>
Index: mainwindow.cpp
===================================================================
--- mainwindow.cpp	(revision 5070)
+++ mainwindow.cpp	(working copy)
@@ -346,7 +346,11 @@
   m_secBandChanged=0;
   m_lockTxFreq=false;
   m_baseCall = Radio::base_callsign (m_config.my_callsign ());
-
+  m_udpPortRx = 2237; // Needs to be from the configuration -- default to Log4OM+1
+  m_udpPortTx = 2238; // Our outgoing decoded text lines and any other info
+  m_udpServerEnabled = true;
+  m_udpBroadcast = false; // defaults to LocalHost only
+  m_udpWindowToFront = true; // bring WSJT-X to front when UDP CQ is received
   ui->readFreq->setEnabled(false);
   m_QSOText.clear();
   decodeBusy(false);
@@ -463,7 +467,7 @@
 
   m_config.transceiver_online (true);
   on_monitorButton_clicked (!m_config.monitor_off_at_startup ());
-
+  udpServer();
 #if !WSJT_ENABLE_EXPERIMENTAL_FEATURES
   ui->actionJT9W_1->setEnabled (false);
 #endif
@@ -674,6 +678,12 @@
 
   auto callsign = m_config.my_callsign ();
 
+  m_udpPortRx = m_config.udpPortRx ();
+  m_udpPortTx = m_config.udpPortTx ();
+  m_udpServerEnabled = m_config.udpServerEnabled ();
+  m_udpBroadcast = m_config.udpBroadcast ();
+  m_udpWindowToFront = m_config.udpWindowToFront ();
+
   if (QDialog::Accepted == m_config.exec ())
     {
       if (m_config.my_callsign () != callsign)
@@ -1346,6 +1356,8 @@
 
 void MainWindow::readFromStdout()                             //readFromStdout
 {
+  QString band = m_config.bands ()->data (m_config.bands ()->find (m_dialFreq)).toString();
+
   while(proc_jt9.canReadLine())
     {
       QByteArray t=proc_jt9.readLine();
@@ -1390,7 +1402,7 @@
 
         DecodedText decodedtext;
         decodedtext = t.replace("\n",""); //t.replace("\n","").mid(0,t.length()-4);
-
+        udpSend("@"+band+","+t);
         // the left band display
         ui->decodedTextBrowser->displayDecodedText (decodedtext
                                                     , m_baseCall
@@ -1932,14 +1944,16 @@
   m_decodedText2=false;
 }
 
-void MainWindow::doubleClickOnCall(bool shift, bool ctrl)
+void MainWindow::doubleClickOnCall(bool shift, bool ctrl, int i2)
 {
-  QTextCursor cursor;
-  if(!m_decodedText2) cursor=ui->decodedTextBrowser2->textCursor();
-  if(m_decodedText2) cursor=ui->decodedTextBrowser->textCursor();
-  cursor.select(QTextCursor::LineUnderCursor);
-  int i2=cursor.position();
-  if(shift and i2==-9999) return;        //Silence compiler warning
+  if (i2 < 0) { // i2 default is < 0
+    QTextCursor cursor;
+    if(!m_decodedText2) cursor=ui->decodedTextBrowser2->textCursor();
+    if(m_decodedText2) cursor=ui->decodedTextBrowser->textCursor();
+    cursor.select(QTextCursor::LineUnderCursor);
+    i2=cursor.position();
+    if(shift and i2==-9999) return;        //Silence compiler warning
+  }
 
   QString t;
   if(!m_decodedText2) t= ui->decodedTextBrowser2->toPlainText(); //Full contents
@@ -3248,3 +3262,80 @@
         }
     }
 }
+
+// Takes a decoded CQ line and sets it up for reply
+void MainWindow::doCallCQ(QString cqtext)
+{
+  DecodedText decodedtext;
+  decodedtext = cqtext.replace("\n","");
+  auto my_call = m_config.my_callsign ();
+  ui->decodedTextBrowser2->displayDecodedText(decodedtext
+                                              , my_call
+                                              , false
+                                              , m_logBook
+                                              , m_config.color_CQ()
+                                              , m_config.color_MyCall()
+                                              , m_config.color_DXCC()
+                                              , m_config.color_NewCall());
+  m_QSOText=decodedtext;
+  int i2 = ui->decodedTextBrowser->toPlainText().lastIndexOf(cqtext);
+  if (i2 >= 0) { // then find the linefeed at the end of the line
+    i2 = ui->decodedTextBrowser->toPlainText().indexOf("\n",i2);
+    this->setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
+    this->raise();
+    this->activateWindow();
+  }
+  if (i2 < 0) { // not in this windows Band Activity so ignore
+    return;
+  }
+  else {
+    m_decodedText2=true;
+    doubleClickOnCall(false,false,i2); // add 35 to get into next line a bit
+    m_decodedText2=false;
+  }
+}
+
+// udpServer async datagram reader
+// Can be extended to do other commands
+// Commands recognized:
+//   {decoded text} - a text string from the Band Activity window to reply to
+// We can add commands, say starting with "!" to separate them from CQ lines
+// like "!EnableTx"
+void MainWindow::udpPendingDatagrams()
+{
+  while (udpSocketRx->hasPendingDatagrams()) {
+    QByteArray datagram;
+    datagram.resize(udpSocketRx->pendingDatagramSize());
+    QHostAddress sender;
+    quint16 senderPort;
+    udpSocketRx->readDatagram(datagram.data(),datagram.size(),&sender,&senderPort);
+    // Our first example -- take in a decoded CQ message and post for processing
+    QString cqtext(datagram);
+    doCallCQ(cqtext);
+  }
+}
+
+// Send a line to the UDP broadcast address
+void MainWindow::udpSend(QString line)
+{
+  if (m_udpServerEnabled) {
+    QByteArray datagram = line.trimmed().toUtf8();
+    if (m_udpBroadcast) {
+      udpSocketTx->writeDatagram(datagram.data(), datagram.size(), QHostAddress::Broadcast, m_udpPortTx);
+    }
+    else {
+      udpSocketTx->writeDatagram(datagram.data(), datagram.size(), QHostAddress::LocalHost, m_udpPortTx);
+    }
+  }
+}
+
+// Simple udpServer sets up async read
+void MainWindow::udpServer()
+{
+  if (m_udpServerEnabled) {
+    udpSocketRx = new QUdpSocket(this);
+    udpSocketTx = new QUdpSocket(this);
+    udpSocketRx->bind(QHostAddress::Any,m_udpPortRx);
+    connect(udpSocketRx, SIGNAL(readyRead()), this, SLOT(udpPendingDatagrams()));
+  }
+}
Index: mainwindow.h
===================================================================
--- mainwindow.h	(revision 5070)
+++ mainwindow.h	(working copy)
@@ -73,7 +73,7 @@
   void diskWriteFinished();
   void freezeDecode(int n);
   void guiUpdate();
-  void doubleClickOnCall(bool shift, bool ctrl);
+  void doubleClickOnCall(bool shift, bool ctrl, int i2=-1);
   void doubleClickOnCall2(bool shift, bool ctrl);
   void readFromStdout();
   void readFromStderr();
@@ -178,7 +178,8 @@
   void monitor (bool);
   void stop_tuning ();
   void auto_tx_mode (bool);
-
+  void doCallCQ(QString cqtext);
+  void udpPendingDatagrams();
 private:
   void enable_DXCC_entity (bool on);
 
@@ -251,6 +252,8 @@
   qint32  m_repeatMsg;
   qint32  m_watchdogLimit;
   qint32  m_astroFont;
+  qint32  m_udpPortRx;
+  qint32  m_udpPortTx;
 
   bool    m_btxok;		//True if OK to transmit
   bool    m_diskData;
@@ -294,6 +297,9 @@
   bool    m_CATerror;
   bool    m_plus2kHz;
   bool    m_bAstroData;
+  bool    m_udpServerEnabled;
+  bool    m_udpBroadcast;
+  bool    m_udpWindowToFront;
 
   float   m_pctZap;
 
@@ -373,6 +379,8 @@
   double m_toneSpacing;
   int m_firstDecode;
   QProgressDialog m_optimizingProgress;
+  QUdpSocket *udpSocketRx;
+  QUdpSocket *udpSocketTx;
 
   //---------------------------------------------------- private functions
   void readSettings();
@@ -395,6 +403,8 @@
   void pskSetLocal ();
   void displayDialFrequency ();
   void transmitDisplay (bool);
+  void udpServer();
+  void udpSend(QString line);
 };
 
 extern void getfile(QString fname, int ntrperiod);
