* Added Talker Client for Rx stream output.
      MS only - stream used by experimental text stream to ham
      speech being developed by KH6TY.
pull/2/head
David Freese 2009-10-14 15:56:11 -05:00
rodzic c574685a9e
commit 9d9d56b6e2
6 zmienionych plików z 139 dodań i 32 usunięć

Wyświetl plik

@ -2120,6 +2120,14 @@ static void cb_chkRxStream(Fl_Check_Button* o, void*) {
progdefaults.changed = true;
}
Fl_Group *grpTalker=(Fl_Group *)0;
Fl_Button *btnConnectTalker=(Fl_Button *)0;
static void cb_btnConnectTalker(Fl_Button*, void*) {
open_talker();
}
Fl_Group *tabQRZ=(Fl_Group *)0;
Fl_Round_Button *btnQRZcdrom=(Fl_Round_Button *)0;
@ -2241,7 +2249,6 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
{ tabOperator = new Fl_Group(0, 25, 500, 345, _("Operator"));
tabOperator->callback((Fl_Callback*)cb_tabOperator);
tabOperator->when(FL_WHEN_CHANGED);
tabOperator->hide();
{ Fl_Group* o = new Fl_Group(5, 35, 490, 165, _("Station"));
o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
@ -2831,7 +2838,6 @@ an merging"));
tabsModems->selection_color(FL_LIGHT1);
tabsModems->align(FL_ALIGN_TOP_RIGHT);
{ tabCW = new Fl_Group(0, 50, 500, 320, _("CW"));
tabCW->hide();
{ tabsCW = new Fl_Tabs(0, 50, 500, 320);
tabsCW->selection_color(FL_LIGHT1);
{ Fl_Group* o = new Fl_Group(0, 75, 500, 295, _("General"));
@ -3299,6 +3305,7 @@ an merging"));
tabOlivia->end();
} // Fl_Group* tabOlivia
{ tabPSK = new Fl_Group(0, 50, 517, 320, _("PSK"));
tabPSK->hide();
{ tabsPSK = new Fl_Tabs(0, 50, 517, 320);
tabsPSK->selection_color(FL_LIGHT1);
{ Fl_Group* o = new Fl_Group(0, 75, 500, 295, _("General"));
@ -3680,10 +3687,10 @@ an merging"));
tabModems->end();
} // Fl_Group* tabModems
{ tabRig = new Fl_Group(0, 25, 500, 345, _("Rig"));
tabRig->hide();
{ tabsRig = new Fl_Tabs(0, 25, 500, 345);
tabsRig->selection_color(FL_LIGHT1);
{ Fl_Group* o = new Fl_Group(0, 50, 500, 320, _("Hardware PTT"));
o->hide();
{ grpHWPTT = new Fl_Group(5, 100, 490, 265);
grpHWPTT->box(FL_ENGRAVED_FRAME);
{ inpTTYdev = new Fl_Input_Choice(200, 209, 160, 22, _("Device:"));
@ -3857,6 +3864,7 @@ an merging"));
o->end();
} // Fl_Group* o
{ tabHamlib = new Fl_Group(0, 50, 500, 320, _("Hamlib"));
tabHamlib->hide();
{ chkUSEHAMLIB = new Fl_Check_Button(195, 60, 100, 20, _("Use Hamlib"));
chkUSEHAMLIB->tooltip(_("Hamlib used for rig control"));
chkUSEHAMLIB->down_box(FL_DOWN_BOX);
@ -4517,36 +4525,47 @@ d frequency"));
} // Fl_Group* tabCPUspeed
{ tabFileExtraction = new Fl_Group(0, 50, 500, 320, _("Text Capture"));
tabFileExtraction->hide();
{ Fl_Group* o = new Fl_Group(5, 60, 490, 155, _("Auto Extract files from rx stream"));
{ Fl_Group* o = new Fl_Group(5, 60, 490, 119, _("Auto Extract files from rx stream"));
o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
{ Fl_Check_Button* o = chkAutoExtract = new Fl_Check_Button(136, 184, 227, 20, _("Enable detection && extraction"));
{ Fl_Check_Button* o = chkAutoExtract = new Fl_Check_Button(136, 141, 227, 20, _("Enable detection && extraction"));
chkAutoExtract->tooltip(_("Extract files for use with external \"wrap\" program"));
chkAutoExtract->down_box(FL_DOWN_BOX);
chkAutoExtract->callback((Fl_Callback*)cb_chkAutoExtract);
o->value(progdefaults.autoextract);
} // Fl_Check_Button* chkAutoExtract
{ Fl_Box* o = new Fl_Box(15, 85, 465, 92, _("0\n1\n2\n3\n4"));
{ Fl_Box* o = new Fl_Box(13, 85, 467, 62, _("0\n1\n2"));
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
o->label(txtWrapInfo);
} // Fl_Box* o
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(5, 218, 490, 144, _("Capture rx text to external file"));
{ Fl_Group* o = new Fl_Group(5, 180, 490, 109, _("Capture rx text to external file"));
o->box(FL_ENGRAVED_FRAME);
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
{ Fl_Check_Button* o = chkRxStream = new Fl_Check_Button(136, 330, 175, 20, _("Enable rx text stream"));
{ Fl_Check_Button* o = chkRxStream = new Fl_Check_Button(136, 260, 175, 20, _("Enable rx text stream"));
chkRxStream->tooltip(_("Send rx text to file: textout.txt"));
chkRxStream->down_box(FL_DOWN_BOX);
chkRxStream->callback((Fl_Callback*)cb_chkRxStream);
o->value(progdefaults.speak);
} // Fl_Check_Button* chkRxStream
{ Fl_Box* o = new Fl_Box(20, 241, 465, 69, _("0\n1\n2\n3"));
{ Fl_Box* o = new Fl_Box(20, 203, 465, 60, _("0\n1\n2"));
o->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
o->label(txtTalkInfo);
} // Fl_Box* o
o->end();
} // Fl_Group* o
{ grpTalker = new Fl_Group(5, 291, 490, 73, _("Talker Socket (MS only)"));
grpTalker->box(FL_ENGRAVED_FRAME);
grpTalker->align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE);
{ btnConnectTalker = new Fl_Button(30, 319, 70, 20, _("Connect"));
btnConnectTalker->callback((Fl_Callback*)cb_btnConnectTalker);
} // Fl_Button* btnConnectTalker
{ Fl_Box* o = new Fl_Box(109, 317, 368, 24, _("Connect to external Talker Program"));
o->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
} // Fl_Box* o
grpTalker->end();
} // Fl_Group* grpTalker
tabFileExtraction->end();
} // Fl_Group* tabFileExtraction
tabsMisc->end();

Wyświetl plik

@ -89,8 +89,8 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
} {
Fl_Group tabOperator {
label Operator
callback {progdefaults.changed = true;} open
xywh {0 25 500 345} when 1 hide
callback {progdefaults.changed = true;} open selected
xywh {0 25 500 345} when 1
} {
Fl_Group {} {
label Station open
@ -709,7 +709,7 @@ behaves inside the waterfall} xywh {15 196 150 22} down_box BORDER_BOX align 8
} {
Fl_Group tabCW {
label CW open
xywh {0 50 500 320} hide
xywh {0 50 500 320}
} {
Fl_Tabs tabsCW {open
xywh {0 50 500 320} selection_color 50
@ -1150,7 +1150,7 @@ progdefaults.changed = true;}
}
Fl_Group tabPSK {
label PSK open
xywh {0 50 517 320}
xywh {0 50 517 320} hide
} {
Fl_Tabs tabsPSK {open
xywh {0 50 517 320} selection_color 50
@ -1508,14 +1508,14 @@ progdefaults.changed = true;}
}
Fl_Group tabRig {
label Rig open
xywh {0 25 500 345}
xywh {0 25 500 345} hide
} {
Fl_Tabs tabsRig {open
xywh {0 25 500 345} selection_color 50
} {
Fl_Group {} {
label {Hardware PTT} open
xywh {0 50 500 320} hide
xywh {0 50 500 320}
} {
Fl_Group grpHWPTT {open
xywh {5 100 490 265} box ENGRAVED_FRAME
@ -1803,7 +1803,7 @@ progdefaults.changed = true;}
}
Fl_Group tabHamlib {
label Hamlib open
xywh {0 50 500 320}
xywh {0 50 500 320} hide
} {
Fl_Check_Button chkUSEHAMLIB {
label {Use Hamlib}
@ -1975,7 +1975,7 @@ btnInitHAMLIB->redraw_label();}
Fl_Value_Slider valHamRigStopbits {
label Stopbits
callback {progdefaults.HamRigStopbits = (int)o->value();
progdefaults.changed = true;} selected
progdefaults.changed = true;}
xywh {424 162 60 22} type Horizontal color 7 selection_color 40 align 4 minimum 1 maximum 2 step 1 value 2 textsize 14
code0 {o->value(progdefaults.HamRigStopbits);}
}
@ -2607,47 +2607,59 @@ progdefaults.changed = true;}
} {
Fl_Group {} {
label {Auto Extract files from rx stream} open
xywh {5 60 490 155} box ENGRAVED_FRAME align 21
xywh {5 60 490 119} box ENGRAVED_FRAME align 21
} {
Fl_Check_Button chkAutoExtract {
label {Enable detection && extraction}
callback {progdefaults.autoextract = o->value();
progdefaults.changed = true;}
tooltip {Extract files for use with external "wrap" program} xywh {136 184 227 20} down_box DOWN_BOX
tooltip {Extract files for use with external "wrap" program} xywh {136 141 227 20} down_box DOWN_BOX
code0 {o->value(progdefaults.autoextract);}
}
Fl_Box {} {
label {0
1
2
3
4}
xywh {15 85 465 92} align 21
2}
xywh {13 85 467 62} align 21
code0 {o->label(txtWrapInfo);}
code1 {\#include "rx_extract.h"}
}
}
Fl_Group {} {
label {Capture rx text to external file} open
xywh {5 218 490 144} box ENGRAVED_FRAME align 21
xywh {5 180 490 109} box ENGRAVED_FRAME align 21
} {
Fl_Check_Button chkRxStream {
label {Enable rx text stream}
callback {progdefaults.speak = o->value();
progdefaults.changed = true;}
tooltip {Send rx text to file: textout.txt} xywh {136 330 175 20} down_box DOWN_BOX
tooltip {Send rx text to file: textout.txt} xywh {136 260 175 20} down_box DOWN_BOX
code0 {o->value(progdefaults.speak);}
}
Fl_Box {} {
label {0
1
2
3}
xywh {20 241 465 69} align 21
2}
xywh {20 203 465 60} align 21
code0 {o->label(txtTalkInfo);}
code1 {\#include "speak.h"}
}
}
Fl_Group grpTalker {
label {Talker Socket (MS only)} open
xywh {5 291 490 73} box ENGRAVED_FRAME align 21
} {
Fl_Button btnConnectTalker {
label Connect
callback {open_talker();}
xywh {30 319 70 20}
code0 {extern void open_talker();}
}
Fl_Box {} {
label {Connect to external Talker Program}
xywh {109 317 368 24} align 20
}
}
}
}
}

Wyświetl plik

@ -3015,7 +3015,7 @@ static void put_rx_char_flmain(unsigned int data)
style = FTextBase::ALTR;
if (progdefaults.autoextract == true) rx_extract_add(data);
if (progdefaults.speak == true) speak(data);
speak(data);
switch (data) {
case '\n':

Wyświetl plik

@ -319,6 +319,9 @@ extern Fl_Check_Button *chkAutoExtract;
#include "rx_extract.h"
extern Fl_Check_Button *chkRxStream;
#include "speak.h"
extern Fl_Group *grpTalker;
extern void open_talker();
extern Fl_Button *btnConnectTalker;
extern Fl_Group *tabQRZ;
extern Fl_Round_Button *btnQRZcdrom;
extern Fl_Input2 *txtQRZpathname;

Wyświetl plik

@ -1,5 +1,6 @@
// ====================================================================
// speak.cxx rx text data stream to file
// rx text data stream to client socket on MS
//
// Copyright W1HKJ, Dave Freese 2006
//
@ -33,32 +34,99 @@
#include "status.h"
#include "fl_digi.h"
#include "configuration.h"
#include "debug.h"
#include "socket.h"
#include "icons.h"
using namespace std;
const char *txtTalkInfo = "\
Save all received text, one character at a time to the following file:\n\n\
fldigi.files\\talk\\textout.txt (Windows)\n\
~/.fldigi/talk/textout.txt (Linux, OS X, Free BSD)";
~/.fldigi/talk/textout.txt (Linux, OS X, Free BSD)";
string speakfname = "";
ofstream speakout;
string speakbuffer = "";
#ifndef __WIN32__
void open_talker()
{
}
#endif
#ifdef __WIN32__
#include "confdialog.h"
string talkbuffer = "";
Socket *talker_tcpip = 0;
string talker_address = "127.0.0.1";
string talker_port = "1111";
bool can_talk = true;
void open_talker()
{
try {
talker_tcpip = new Socket(Address(talker_address.c_str(), talker_port.c_str()));
talker_tcpip->set_timeout(0.01);
talker_tcpip->connect();
btnConnectTalker->labelcolor(FL_FOREGROUND_COLOR);
btnConnectTalker->redraw_label();
}
catch (const SocketException& e) {
LOG_INFO("Talker Server not available");
btnConnectTalker->labelcolor(FL_RED);
btnConnectTalker->redraw_label();
can_talk = false;
}
}
void close_talker()
{
talker_tcpip->close();
}
void speak(int c)
{
if (can_talk && !talker_tcpip) open_talker();
if (!talker_tcpip)
return;
if (c < ' ' || c > 'z') c = ',';
talkbuffer += c;
try {
talker_tcpip->send(talkbuffer);
}
catch (const SocketException& e) {
LOG_INFO("Talker server not available");
delete talker_tcpip;
talker_tcpip = 0;
btnConnectTalker->labelcolor(FL_RED);
btnConnectTalker->redraw_label();
can_talk = false;
}
talkbuffer.clear();
#else
void speak(int c)
{
#endif
if (!progdefaults.speak)
return;
if (speakfname.empty()) {
speakfname = TalkDir;
speakfname.append("textout.txt");
}
if (c < ' ' || c > 'z') c = ',';
speakbuffer += c;
speakout.open(speakfname.c_str(), ios::app | ios::binary);
if (!speakout) return;
for (size_t i = 0; i < speakbuffer.length(); i++)
speakout.put(speakbuffer[i]);
speakbuffer.clear();
speakout.flush();
speakout.close();
}

Wyświetl plik

@ -347,6 +347,11 @@ int main(int argc, char ** argv)
#endif
arq_init();
#ifdef __WIN32__
open_talker();
#else
grpTalker->hide();
#endif
#if USE_XMLRPC
XML_RPC_Server::start(progdefaults.xmlrpc_address.c_str(), progdefaults.xmlrpc_port.c_str());