kopia lustrzana https://github.com/jamescoxon/dl-fldigi
Serial i/o Stopbits
Added stopbits configuration for hamlib and rigcat serial i/opull/2/head
rodzic
765c6d91b2
commit
f9423b45b4
|
@ -1445,6 +1445,13 @@ btnInitRIGCAT->redraw_label();
|
|||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Value_Slider *valRigCatStopbits=(Fl_Value_Slider *)0;
|
||||
|
||||
static void cb_valRigCatStopbits(Fl_Value_Slider* o, void*) {
|
||||
progdefaults.RigCatStopbits = (int)o->value();
|
||||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Group *tabHamlib=(Fl_Group *)0;
|
||||
|
||||
Fl_Check_Button *chkUSEHAMLIB=(Fl_Check_Button *)0;
|
||||
|
@ -1609,6 +1616,13 @@ btnInitHAMLIB->labelcolor(FL_RED);
|
|||
btnInitHAMLIB->redraw_label();
|
||||
}
|
||||
|
||||
Fl_Value_Slider *valHamRigStopbits=(Fl_Value_Slider *)0;
|
||||
|
||||
static void cb_valHamRigStopbits(Fl_Value_Slider* o, void*) {
|
||||
progdefaults.HamRigStopbits = (int)o->value();
|
||||
progdefaults.changed = true;
|
||||
}
|
||||
|
||||
Fl_Group *grpMemmap=(Fl_Group *)0;
|
||||
|
||||
Fl_Check_Button *chkUSEMEMMAP=(Fl_Check_Button *)0;
|
||||
|
@ -2227,6 +2241,7 @@ 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);
|
||||
|
@ -3665,7 +3680,6 @@ 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"));
|
||||
|
@ -3731,6 +3745,7 @@ an merging"));
|
|||
} // Fl_Group* o
|
||||
{ Fl_Group* o = new Fl_Group(0, 50, 500, 320, _("RigCAT"));
|
||||
o->tooltip(_("Rig Control using xml spec file"));
|
||||
o->hide();
|
||||
{ chkUSERIGCAT = new Fl_Check_Button(195, 60, 110, 20, _("Use RigCAT"));
|
||||
chkUSERIGCAT->tooltip(_("RigCAT used for rig control"));
|
||||
chkUSERIGCAT->down_box(FL_DOWN_BOX);
|
||||
|
@ -3770,7 +3785,7 @@ an merging"));
|
|||
cntRigCatWait->align(FL_ALIGN_TOP_LEFT);
|
||||
o->value(progdefaults.RigCatWait);
|
||||
} // Fl_Value_Input* cntRigCatWait
|
||||
{ Fl_Choice* o = mnuXmlRigBaudrate = new Fl_Choice(386, 154, 99, 22, _("Baud rate:"));
|
||||
{ Fl_Choice* o = mnuXmlRigBaudrate = new Fl_Choice(386, 150, 99, 22, _("Baud rate:"));
|
||||
mnuXmlRigBaudrate->tooltip(_("Pick baud rate from list"));
|
||||
mnuXmlRigBaudrate->down_box(FL_BORDER_BOX);
|
||||
mnuXmlRigBaudrate->callback((Fl_Callback*)cb_mnuXmlRigBaudrate);
|
||||
|
@ -3824,12 +3839,24 @@ an merging"));
|
|||
chkRigCatRTSCTSflow->callback((Fl_Callback*)cb_chkRigCatRTSCTSflow);
|
||||
o->value(progdefaults.RigCatRTSCTSflow);
|
||||
} // Fl_Check_Button* chkRigCatRTSCTSflow
|
||||
{ Fl_Value_Slider* o = valRigCatStopbits = new Fl_Value_Slider(425, 190, 60, 22, _("Stopbits"));
|
||||
valRigCatStopbits->type(1);
|
||||
valRigCatStopbits->color(FL_BACKGROUND2_COLOR);
|
||||
valRigCatStopbits->selection_color((Fl_Color)40);
|
||||
valRigCatStopbits->minimum(1);
|
||||
valRigCatStopbits->maximum(2);
|
||||
valRigCatStopbits->step(1);
|
||||
valRigCatStopbits->value(2);
|
||||
valRigCatStopbits->textsize(14);
|
||||
valRigCatStopbits->callback((Fl_Callback*)cb_valRigCatStopbits);
|
||||
valRigCatStopbits->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.RigCatStopbits);
|
||||
} // Fl_Value_Slider* valRigCatStopbits
|
||||
grpRigCAT->end();
|
||||
} // Fl_Group* grpRigCAT
|
||||
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);
|
||||
|
@ -3857,35 +3884,34 @@ an merging"));
|
|||
inpRIGdev->callback((Fl_Callback*)cb_inpRIGdev);
|
||||
o->value(progdefaults.HamRigDevice.c_str());
|
||||
} // Fl_Input_Choice* inpRIGdev
|
||||
{ Fl_Value_Input* o = cntHamlibRetries = new Fl_Value_Input(30, 137, 70, 24, _("Retries"));
|
||||
{ Fl_Value_Input* o = cntHamlibRetries = new Fl_Value_Input(30, 133, 70, 24, _("Retries"));
|
||||
cntHamlibRetries->tooltip(_("# times to resend command before giving up"));
|
||||
cntHamlibRetries->callback((Fl_Callback*)cb_cntHamlibRetries);
|
||||
cntHamlibRetries->align(FL_ALIGN_TOP_LEFT);
|
||||
o->value(progdefaults.HamlibRetries);
|
||||
} // Fl_Value_Input* cntHamlibRetries
|
||||
{ Fl_Value_Input* o = cntHamlibTimeout = new Fl_Value_Input(155, 137, 70, 24, _("Retry Interval (ms)"));
|
||||
{ Fl_Value_Input* o = cntHamlibTimeout = new Fl_Value_Input(155, 133, 70, 24, _("Retry Interval (ms)"));
|
||||
cntHamlibTimeout->tooltip(_("Msec\'s between retries"));
|
||||
cntHamlibTimeout->callback((Fl_Callback*)cb_cntHamlibTimeout);
|
||||
cntHamlibTimeout->align(FL_ALIGN_TOP_LEFT);
|
||||
o->value(progdefaults.HamlibTimeout);
|
||||
} // Fl_Value_Input* cntHamlibTimeout
|
||||
{ Fl_Value_Input* o = cntHamlibWriteDelay = new Fl_Value_Input(30, 183, 70, 24, _("Write delay (ms)"));
|
||||
{ Fl_Value_Input* o = cntHamlibWriteDelay = new Fl_Value_Input(30, 176, 70, 24, _("Write delay (ms)"));
|
||||
cntHamlibWriteDelay->tooltip(_("Msec\'s between sequential commands"));
|
||||
cntHamlibWriteDelay->callback((Fl_Callback*)cb_cntHamlibWriteDelay);
|
||||
cntHamlibWriteDelay->align(FL_ALIGN_TOP_LEFT);
|
||||
o->value(progdefaults.HamlibWriteDelay);
|
||||
} // Fl_Value_Input* cntHamlibWriteDelay
|
||||
{ Fl_Value_Input* o = cntHamlibWait = new Fl_Value_Input(156, 182, 70, 24, _("Post write delay (ms)"));
|
||||
{ Fl_Value_Input* o = cntHamlibWait = new Fl_Value_Input(156, 176, 70, 24, _("Post write delay (ms)"));
|
||||
cntHamlibWait->tooltip(_("Wait interval (msecs) before reading response"));
|
||||
cntHamlibWait->callback((Fl_Callback*)cb_cntHamlibWait);
|
||||
cntHamlibWait->align(FL_ALIGN_TOP_LEFT);
|
||||
o->value(progdefaults.HamlibWait);
|
||||
} // Fl_Value_Input* cntHamlibWait
|
||||
{ Fl_Choice* o = mnuBaudRate = new Fl_Choice(385, 138, 99, 22, _("Baud rate:"));
|
||||
{ Fl_Choice* o = mnuBaudRate = new Fl_Choice(385, 127, 99, 22, _("Baud rate:"));
|
||||
mnuBaudRate->tooltip(_("Serial port baud rate"));
|
||||
mnuBaudRate->down_box(FL_BORDER_BOX);
|
||||
mnuBaudRate->callback((Fl_Callback*)cb_mnuBaudRate);
|
||||
mnuBaudRate->align(FL_ALIGN_TOP_LEFT);
|
||||
o->add(szBaudRates);
|
||||
o->value(progdefaults.HamRigBaudrate);
|
||||
} // Fl_Choice* mnuBaudRate
|
||||
|
@ -3957,6 +3983,19 @@ an merging"));
|
|||
chkHamlibXONXOFFflow->callback((Fl_Callback*)cb_chkHamlibXONXOFFflow);
|
||||
o->value(progdefaults.HamlibXONXOFFflow);
|
||||
} // Fl_Check_Button* chkHamlibXONXOFFflow
|
||||
{ Fl_Value_Slider* o = valHamRigStopbits = new Fl_Value_Slider(424, 162, 60, 22, _("Stopbits"));
|
||||
valHamRigStopbits->type(1);
|
||||
valHamRigStopbits->color(FL_BACKGROUND2_COLOR);
|
||||
valHamRigStopbits->selection_color((Fl_Color)40);
|
||||
valHamRigStopbits->minimum(1);
|
||||
valHamRigStopbits->maximum(2);
|
||||
valHamRigStopbits->step(1);
|
||||
valHamRigStopbits->value(2);
|
||||
valHamRigStopbits->textsize(14);
|
||||
valHamRigStopbits->callback((Fl_Callback*)cb_valHamRigStopbits);
|
||||
valHamRigStopbits->align(FL_ALIGN_LEFT);
|
||||
o->value(progdefaults.HamRigStopbits);
|
||||
} // Fl_Value_Slider* valHamRigStopbits
|
||||
grpHamlib->end();
|
||||
} // Fl_Group* grpHamlib
|
||||
tabHamlib->end();
|
||||
|
|
|
@ -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 selected
|
||||
xywh {0 25 500 345} when 1
|
||||
callback {progdefaults.changed = true;} open
|
||||
xywh {0 25 500 345} when 1 hide
|
||||
} {
|
||||
Fl_Group {} {
|
||||
label Station open
|
||||
|
@ -1508,7 +1508,7 @@ progdefaults.changed = true;}
|
|||
}
|
||||
Fl_Group tabRig {
|
||||
label Rig open
|
||||
xywh {0 25 500 345} hide
|
||||
xywh {0 25 500 345}
|
||||
} {
|
||||
Fl_Tabs tabsRig {open
|
||||
xywh {0 25 500 345} selection_color 50
|
||||
|
@ -1620,7 +1620,7 @@ progdefaults.changed = true;}
|
|||
}
|
||||
Fl_Group {} {
|
||||
label RigCAT open
|
||||
tooltip {Rig Control using xml spec file} xywh {0 50 500 320}
|
||||
tooltip {Rig Control using xml spec file} xywh {0 50 500 320} hide
|
||||
} {
|
||||
Fl_Check_Button chkUSERIGCAT {
|
||||
label {Use RigCAT}
|
||||
|
@ -1697,7 +1697,7 @@ progdefaults.changed = true;}
|
|||
btnInitRIGCAT->labelcolor(FL_RED);
|
||||
btnInitRIGCAT->redraw_label();
|
||||
progdefaults.changed = true;} open
|
||||
tooltip {Pick baud rate from list} xywh {386 154 99 22} down_box BORDER_BOX
|
||||
tooltip {Pick baud rate from list} xywh {386 150 99 22} down_box BORDER_BOX
|
||||
code0 {o->add(szBaudRates);}
|
||||
code1 {o->value(progdefaults.XmlRigBaudrate);}
|
||||
} {}
|
||||
|
@ -1792,11 +1792,18 @@ progdefaults.changed = true;}
|
|||
tooltip {Rig uses RTS/CTS handshake} xywh {50 320 170 20} down_box DOWN_BOX
|
||||
code0 {o->value(progdefaults.RigCatRTSCTSflow);}
|
||||
}
|
||||
Fl_Value_Slider valRigCatStopbits {
|
||||
label Stopbits
|
||||
callback {progdefaults.RigCatStopbits = (int)o->value();
|
||||
progdefaults.changed = true;}
|
||||
xywh {425 190 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.RigCatStopbits);}
|
||||
}
|
||||
}
|
||||
}
|
||||
Fl_Group tabHamlib {
|
||||
label Hamlib open
|
||||
xywh {0 50 500 320} hide
|
||||
xywh {0 50 500 320}
|
||||
} {
|
||||
Fl_Check_Button chkUSEHAMLIB {
|
||||
label {Use Hamlib}
|
||||
|
@ -1843,7 +1850,7 @@ btnInitHAMLIB->redraw_label();} open
|
|||
callback {progdefaults.HamlibRetries = (int)o->value();
|
||||
btnInitHAMLIB->labelcolor(FL_RED);
|
||||
btnInitHAMLIB->redraw_label();}
|
||||
tooltip {\# times to resend command before giving up} xywh {30 137 70 24} align 5
|
||||
tooltip {\# times to resend command before giving up} xywh {30 133 70 24} align 5
|
||||
code0 {o->value(progdefaults.HamlibRetries);}
|
||||
}
|
||||
Fl_Value_Input cntHamlibTimeout {
|
||||
|
@ -1851,7 +1858,7 @@ btnInitHAMLIB->redraw_label();}
|
|||
callback {progdefaults.HamlibTimeout = (int)o->value();
|
||||
btnInitHAMLIB->labelcolor(FL_RED);
|
||||
btnInitHAMLIB->redraw_label();}
|
||||
tooltip {Msec's between retries} xywh {155 137 70 24} align 5
|
||||
tooltip {Msec's between retries} xywh {155 133 70 24} align 5
|
||||
code0 {o->value(progdefaults.HamlibTimeout);}
|
||||
}
|
||||
Fl_Value_Input cntHamlibWriteDelay {
|
||||
|
@ -1859,7 +1866,7 @@ btnInitHAMLIB->redraw_label();}
|
|||
callback {progdefaults.HamlibWriteDelay = (int)o->value();
|
||||
btnInitHAMLIB->labelcolor(FL_RED);
|
||||
btnInitHAMLIB->redraw_label();}
|
||||
tooltip {Msec's between sequential commands} xywh {30 183 70 24} align 5
|
||||
tooltip {Msec's between sequential commands} xywh {30 176 70 24} align 5
|
||||
code0 {o->value(progdefaults.HamlibWriteDelay);}
|
||||
}
|
||||
Fl_Value_Input cntHamlibWait {
|
||||
|
@ -1867,7 +1874,7 @@ btnInitHAMLIB->redraw_label();}
|
|||
callback {progdefaults.HamlibWait = (int)o->value();
|
||||
btnInitHAMLIB->labelcolor(FL_RED);
|
||||
btnInitHAMLIB->redraw_label();}
|
||||
tooltip {Wait interval (msecs) before reading response} xywh {156 182 70 24} align 5
|
||||
tooltip {Wait interval (msecs) before reading response} xywh {156 176 70 24} align 5
|
||||
code0 {o->value(progdefaults.HamlibWait);}
|
||||
}
|
||||
Fl_Choice mnuBaudRate {
|
||||
|
@ -1875,7 +1882,7 @@ btnInitHAMLIB->redraw_label();}
|
|||
callback {progdefaults.HamRigBaudrate = o->value();
|
||||
btnInitHAMLIB->labelcolor(FL_RED);
|
||||
btnInitHAMLIB->redraw_label();} open
|
||||
tooltip {Serial port baud rate} xywh {385 138 99 22} down_box BORDER_BOX align 5
|
||||
tooltip {Serial port baud rate} xywh {385 127 99 22} down_box BORDER_BOX
|
||||
code0 {o->add(szBaudRates);}
|
||||
code1 {o->value(progdefaults.HamRigBaudrate);}
|
||||
} {}
|
||||
|
@ -1965,6 +1972,13 @@ btnInitHAMLIB->redraw_label();}
|
|||
tooltip {Rig requires Xon/Xoff flow control} xywh {269 281 185 20} down_box DOWN_BOX
|
||||
code0 {o->value(progdefaults.HamlibXONXOFFflow);}
|
||||
}
|
||||
Fl_Value_Slider valHamRigStopbits {
|
||||
label Stopbits
|
||||
callback {progdefaults.HamRigStopbits = (int)o->value();
|
||||
progdefaults.changed = true;} selected
|
||||
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);}
|
||||
}
|
||||
}
|
||||
}
|
||||
Fl_Group {} {
|
||||
|
|
|
@ -220,6 +220,7 @@ extern Fl_Round_Button *btnRigCatDTRptt;
|
|||
extern Fl_Check_Button *btnRigCatRTSplus;
|
||||
extern Fl_Check_Button *btnRigCatDTRplus;
|
||||
extern Fl_Check_Button *chkRigCatRTSCTSflow;
|
||||
extern Fl_Value_Slider *valRigCatStopbits;
|
||||
extern Fl_Group *tabHamlib;
|
||||
extern Fl_Check_Button *chkUSEHAMLIB;
|
||||
extern Fl_Group *grpHamlib;
|
||||
|
@ -239,6 +240,7 @@ extern Fl_Check_Button *btnHamlibDTRplus;
|
|||
extern Fl_Check_Button *chkHamlibRTSplus;
|
||||
extern Fl_Check_Button *chkHamlibRTSCTSflow;
|
||||
extern Fl_Check_Button *chkHamlibXONXOFFflow;
|
||||
extern Fl_Value_Slider *valHamRigStopbits;
|
||||
extern Fl_Group *grpMemmap;
|
||||
extern Fl_Check_Button *chkUSEMEMMAP;
|
||||
extern Fl_Round_Button *btnMEMMAPptt;
|
||||
|
|
|
@ -539,6 +539,9 @@
|
|||
" 0: 300; 1: 600; 2: 1200; 3: 2400; 4: 4800; 5: 9600; 6: 19200;\n" \
|
||||
" 7: 38400; 8: 57600; 9: 115200; 10: 230400; 11: 460800.", \
|
||||
1) /* 600 baud */ \
|
||||
ELEM_(int, HamRigStopbits, "HAMRIGSTOPBITS", \
|
||||
"Hamlib stopbits <1/2>.", \
|
||||
2) /* 600 baud */ \
|
||||
ELEM_(std::string, XmlRigFilename, "XMLRIGFILENAME", \
|
||||
"RigCAT XML file name", \
|
||||
"") \
|
||||
|
@ -548,6 +551,9 @@
|
|||
ELEM_(int, XmlRigBaudrate, "XMLRIGBAUDRATE", \
|
||||
"RigCAT rig baud rate. See HAMRIGBAUDRATE.", \
|
||||
1) /* 600 baud */ \
|
||||
ELEM_(int, RigCatStopbits, "RIGCATSTOPBITS", \
|
||||
"RigCAT stopbits. <1/2>", \
|
||||
2) /* 600 baud */ \
|
||||
ELEM_(bool, TTYptt, "TTYPTT", \
|
||||
"Use separate device for PTT", \
|
||||
false) \
|
||||
|
|
|
@ -20,43 +20,46 @@ public:
|
|||
|
||||
//Methods
|
||||
bool OpenPort();
|
||||
|
||||
|
||||
bool IsOpen() { return fd < 0 ? 0 : 1; };
|
||||
void ClosePort();
|
||||
|
||||
void Device (std::string dev) { device = dev;};
|
||||
std::string Device() { return device;};
|
||||
|
||||
|
||||
void Baud(int b) { baud = b;};
|
||||
int Baud() { return baud;};
|
||||
|
||||
|
||||
void Timeout(int tm) { timeout = tm;}
|
||||
int Timeout() { return timeout; }
|
||||
|
||||
|
||||
void Retries(int r) { retries = r;}
|
||||
int Retries() { return retries;}
|
||||
|
||||
|
||||
void RTS(bool r){rts = r;}
|
||||
bool RTS(){return rts;}
|
||||
|
||||
|
||||
void RTSptt(bool b){rtsptt = b;}
|
||||
bool RTSptt(){return rtsptt;}
|
||||
|
||||
|
||||
void DTR(bool d){dtr = d;}
|
||||
bool DTR(){return dtr;}
|
||||
|
||||
|
||||
void DTRptt(bool b){dtrptt = b;}
|
||||
bool DTRptt(){return dtrptt;}
|
||||
|
||||
|
||||
void RTSCTS(bool b){rtscts = b;}
|
||||
bool RTSCTS(){return rtscts;}
|
||||
void SetPTT(bool b);
|
||||
|
||||
|
||||
void Stopbits(int n) {stopbits = (n == 1 ? 1 : 2);}
|
||||
int Stopbits() { return stopbits;}
|
||||
|
||||
int ReadBuffer (unsigned char *b, int nbr);
|
||||
int WriteBuffer(unsigned char *str, int nbr);
|
||||
void FlushBuffer();
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
//Members
|
||||
std::string device;
|
||||
|
@ -72,6 +75,7 @@ private:
|
|||
bool rts;
|
||||
bool rtsptt;
|
||||
bool rtscts;
|
||||
int stopbits;
|
||||
char bfr[2048];
|
||||
//Methods
|
||||
bool IOselect();
|
||||
|
@ -88,6 +92,7 @@ public:
|
|||
rtsptt = dtrptt = false;
|
||||
rtscts = false;
|
||||
baud = CBR_9600;
|
||||
stopbits = 2;
|
||||
};
|
||||
Cserial( std::string portname) {
|
||||
device = portname;
|
||||
|
@ -125,29 +130,32 @@ public:
|
|||
|
||||
void Device (std::string dev) { device = dev;};
|
||||
std::string Device() { return device;};
|
||||
|
||||
|
||||
void Baud(int b) { baud = b;};
|
||||
int Baud() { return baud;};
|
||||
|
||||
|
||||
void Retries(int r) { retries = r;}
|
||||
int Retries() { return retries;}
|
||||
|
||||
|
||||
void RTS(bool r){rts = r;}
|
||||
bool RTS(){return rts;}
|
||||
|
||||
|
||||
void RTSptt(bool b){rtsptt = b;}
|
||||
bool RTSptt(){return rtsptt;}
|
||||
|
||||
|
||||
void DTR(bool d){dtr = d;}
|
||||
bool DTR(){return dtr;}
|
||||
|
||||
|
||||
void DTRptt(bool b){dtrptt = b;}
|
||||
bool DTRptt(){return dtrptt;}
|
||||
|
||||
|
||||
void RTSCTS(bool b){rtscts = b;}
|
||||
bool RTSCTS(){return rtscts;}
|
||||
void SetPTT(bool b);
|
||||
|
||||
void Stopbits(int n) {stopbits = (n == 1 ? 1 : 2);}
|
||||
int Stopbits() { return stopbits;}
|
||||
|
||||
//Members
|
||||
private:
|
||||
std::string device;
|
||||
|
@ -161,7 +169,7 @@ private:
|
|||
|
||||
//Is the Port Ready?
|
||||
BOOL bPortReady;
|
||||
|
||||
|
||||
//Number of Bytes Written to port
|
||||
DWORD nBytesWritten;
|
||||
|
||||
|
@ -176,13 +184,13 @@ private:
|
|||
|
||||
int baud;
|
||||
int retries;
|
||||
|
||||
|
||||
bool dtr;
|
||||
bool dtrptt;
|
||||
bool rts;
|
||||
bool rtsptt;
|
||||
bool rtscts;
|
||||
|
||||
int stopbits;
|
||||
};
|
||||
|
||||
#endif // __MINGW32__
|
||||
|
|
|
@ -69,60 +69,65 @@ void show_error(const char* msg1, const char* msg2 = 0)
|
|||
|
||||
void hamlib_get_defaults()
|
||||
{
|
||||
char szParam[40];
|
||||
char szParam[40];
|
||||
|
||||
progdefaults.HamRigModel = hamlib_get_rig_model(cboHamlibRig->index());
|
||||
|
||||
xcvr->init(progdefaults.HamRigModel);
|
||||
|
||||
if (xcvr->getCaps()->port_type != RIG_PORT_SERIAL) {
|
||||
xcvr->close();
|
||||
return;
|
||||
}
|
||||
|
||||
xcvr->getConf("serial_speed", szParam);
|
||||
progdefaults.HamRigBaudrate = progdefaults.nBaudRate(szParam);
|
||||
mnuBaudRate->value(progdefaults.HamRigBaudrate);
|
||||
progdefaults.HamRigModel = hamlib_get_rig_model(cboHamlibRig->index());
|
||||
|
||||
xcvr->getConf("post_write_delay", szParam);
|
||||
sscanf(szParam, "%d", &progdefaults.HamlibWait);
|
||||
cntHamlibWait->value(progdefaults.HamlibWait);
|
||||
|
||||
xcvr->getConf("write_delay", szParam);
|
||||
sscanf(szParam, "%d", &progdefaults.HamlibWriteDelay);
|
||||
cntHamlibWriteDelay->value(progdefaults.HamlibWriteDelay);
|
||||
|
||||
xcvr->getConf("timeout", szParam);
|
||||
sscanf(szParam, "%d", &progdefaults.HamlibTimeout);
|
||||
cntHamlibTimeout->value(progdefaults.HamlibTimeout);
|
||||
|
||||
xcvr->getConf("retry", szParam);
|
||||
sscanf(szParam, "%d", &progdefaults.HamlibRetries);
|
||||
cntHamlibRetries->value(progdefaults.HamlibRetries);
|
||||
xcvr->init(progdefaults.HamRigModel);
|
||||
|
||||
xcvr->getConf("rts_state", szParam);
|
||||
if (strcmp(szParam, "ON") == 0)
|
||||
progdefaults.HamlibRTSplus = true;
|
||||
else
|
||||
progdefaults.HamlibRTSplus = false;
|
||||
chkHamlibRTSplus->value(progdefaults.HamlibRTSplus);
|
||||
if (xcvr->getCaps()->port_type != RIG_PORT_SERIAL) {
|
||||
xcvr->close();
|
||||
return;
|
||||
}
|
||||
|
||||
xcvr->getConf("dtr_state", szParam);
|
||||
if (strcmp(szParam, "ON") == 0)
|
||||
progdefaults.HamlibDTRplus = true;
|
||||
else
|
||||
progdefaults.HamlibDTRplus = false;
|
||||
btnHamlibDTRplus->value(progdefaults.HamlibDTRplus);
|
||||
|
||||
progdefaults.HamlibRTSCTSflow = false;
|
||||
progdefaults.HamlibXONXOFFflow = false;
|
||||
xcvr->getConf("serial_handshake", szParam);
|
||||
if (strcmp(szParam, "Hardware") == 0) progdefaults.HamlibRTSCTSflow = true;
|
||||
if (strcmp(szParam, "XONXOFF") == 0) progdefaults.HamlibXONXOFFflow = true;
|
||||
chkHamlibRTSCTSflow->value(progdefaults.HamlibRTSCTSflow);
|
||||
chkHamlibXONXOFFflow->value(progdefaults.HamlibXONXOFFflow);
|
||||
xcvr->getConf("serial_speed", szParam);
|
||||
progdefaults.HamRigBaudrate = progdefaults.nBaudRate(szParam);
|
||||
mnuBaudRate->value(progdefaults.HamRigBaudrate);
|
||||
|
||||
xcvr->close();
|
||||
xcvr->getConf("post_write_delay", szParam);
|
||||
sscanf(szParam, "%d", &progdefaults.HamlibWait);
|
||||
cntHamlibWait->value(progdefaults.HamlibWait);
|
||||
|
||||
xcvr->getConf("write_delay", szParam);
|
||||
sscanf(szParam, "%d", &progdefaults.HamlibWriteDelay);
|
||||
cntHamlibWriteDelay->value(progdefaults.HamlibWriteDelay);
|
||||
|
||||
xcvr->getConf("timeout", szParam);
|
||||
sscanf(szParam, "%d", &progdefaults.HamlibTimeout);
|
||||
cntHamlibTimeout->value(progdefaults.HamlibTimeout);
|
||||
|
||||
xcvr->getConf("retry", szParam);
|
||||
sscanf(szParam, "%d", &progdefaults.HamlibRetries);
|
||||
cntHamlibRetries->value(progdefaults.HamlibRetries);
|
||||
|
||||
xcvr->getConf("rts_state", szParam);
|
||||
if (strcmp(szParam, "ON") == 0)
|
||||
progdefaults.HamlibRTSplus = true;
|
||||
else
|
||||
progdefaults.HamlibRTSplus = false;
|
||||
chkHamlibRTSplus->value(progdefaults.HamlibRTSplus);
|
||||
|
||||
xcvr->getConf("dtr_state", szParam);
|
||||
if (strcmp(szParam, "ON") == 0)
|
||||
progdefaults.HamlibDTRplus = true;
|
||||
else
|
||||
progdefaults.HamlibDTRplus = false;
|
||||
btnHamlibDTRplus->value(progdefaults.HamlibDTRplus);
|
||||
|
||||
progdefaults.HamlibRTSCTSflow = false;
|
||||
progdefaults.HamlibXONXOFFflow = false;
|
||||
xcvr->getConf("serial_handshake", szParam);
|
||||
if (strcmp(szParam, "Hardware") == 0) progdefaults.HamlibRTSCTSflow = true;
|
||||
if (strcmp(szParam, "XONXOFF") == 0) progdefaults.HamlibXONXOFFflow = true;
|
||||
chkHamlibRTSCTSflow->value(progdefaults.HamlibRTSCTSflow);
|
||||
chkHamlibXONXOFFflow->value(progdefaults.HamlibXONXOFFflow);
|
||||
|
||||
xcvr->getConf("stop_bits", szParam);
|
||||
progdefaults.HamRigStopbits = 2;
|
||||
if (strcmp(szParam, "1") == 0) progdefaults.HamRigStopbits = 1;
|
||||
valHamRigStopbits->value(progdefaults.HamRigStopbits);
|
||||
|
||||
xcvr->close();
|
||||
}
|
||||
|
||||
bool hamlib_init(bool bPtt)
|
||||
|
@ -171,13 +176,13 @@ bool hamlib_init(bool bPtt)
|
|||
|
||||
if (progdefaults.HamlibRTSplus)
|
||||
xcvr->setConf("rts_state", "ON");
|
||||
else
|
||||
xcvr->setConf("rts_state", "OFF");
|
||||
else
|
||||
xcvr->setConf("rts_state", "OFF");
|
||||
|
||||
if (progdefaults.HamlibDTRplus)
|
||||
xcvr->setConf("dtr_state", "ON");
|
||||
else
|
||||
xcvr->setConf("dtr_state", "OFF");
|
||||
else
|
||||
xcvr->setConf("dtr_state", "OFF");
|
||||
|
||||
if (progdefaults.HamlibRTSCTSflow)
|
||||
xcvr->setConf("serial_handshake", "Hardware");
|
||||
|
@ -186,6 +191,7 @@ bool hamlib_init(bool bPtt)
|
|||
else
|
||||
xcvr->setConf("serial_handshake", "None");
|
||||
}
|
||||
xcvr->setConf("stop_bits", progdefaults.HamRigStopbits == 1 ? "1" : "2");
|
||||
|
||||
string::size_type c = progdefaults.HamConfig.find('#');
|
||||
if (c != string::npos)
|
||||
|
@ -200,7 +206,6 @@ bool hamlib_init(bool bPtt)
|
|||
conf += end;
|
||||
}
|
||||
}
|
||||
|
||||
xcvr->open();
|
||||
}
|
||||
catch (const RigException& Ex) {
|
||||
|
@ -211,7 +216,7 @@ bool hamlib_init(bool bPtt)
|
|||
|
||||
MilliSleep(500);
|
||||
|
||||
LOG_INFO("trying frequency request");
|
||||
LOG_INFO("trying frequency request");
|
||||
try {
|
||||
need_freq = true;
|
||||
freq = xcvr->getFreq();
|
||||
|
@ -234,12 +239,12 @@ bool hamlib_init(bool bPtt)
|
|||
show_error("Get Mode", Ex.what());
|
||||
need_mode = false;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
if (hamlib_ptt == true) {
|
||||
LOG_INFO("trying PTT");
|
||||
xcvr->setPTT(RIG_PTT_OFF);
|
||||
}
|
||||
LOG_INFO("trying PTT");
|
||||
xcvr->setPTT(RIG_PTT_OFF);
|
||||
}
|
||||
}
|
||||
catch (const RigException& Ex) {
|
||||
show_error("Set Ptt", Ex.what());
|
||||
|
@ -257,15 +262,15 @@ bool hamlib_init(bool bPtt)
|
|||
|
||||
hamlib_exit = false;
|
||||
hamlib_bypass = false;
|
||||
|
||||
|
||||
if (pthread_create(&hamlib_thread, NULL, hamlib_loop, NULL) < 0) {
|
||||
show_error(__func__, "pthread_create failed");
|
||||
xcvr->close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
init_Hamlib_RigDialog();
|
||||
|
||||
|
||||
hamlib_closed = false;
|
||||
return true;
|
||||
}
|
||||
|
@ -302,7 +307,7 @@ bool hamlib_active(void)
|
|||
|
||||
void hamlib_set_ptt(int ptt)
|
||||
{
|
||||
if (xcvr->isOnLine() == false)
|
||||
if (xcvr->isOnLine() == false)
|
||||
return;
|
||||
if (!hamlib_ptt)
|
||||
return;
|
||||
|
@ -320,7 +325,7 @@ void hamlib_set_ptt(int ptt)
|
|||
|
||||
void hamlib_set_qsy(long long f, long long fmid)
|
||||
{
|
||||
if (xcvr->isOnLine() == false)
|
||||
if (xcvr->isOnLine() == false)
|
||||
return;
|
||||
pthread_mutex_lock(&hamlib_mutex);
|
||||
double fdbl = f;
|
||||
|
@ -416,7 +421,7 @@ static void *hamlib_loop(void *args)
|
|||
long int freq = 0L;
|
||||
rmode_t numode = RIG_MODE_NONE;
|
||||
bool freqok = false, modeok = false;
|
||||
|
||||
|
||||
for (;;) {
|
||||
MilliSleep(100);
|
||||
if (hamlib_exit)
|
||||
|
@ -425,7 +430,7 @@ static void *hamlib_loop(void *args)
|
|||
continue;
|
||||
// hamlib locked while accessing hamlib serial i/o
|
||||
pthread_mutex_lock(&hamlib_mutex);
|
||||
|
||||
|
||||
if (need_freq) {
|
||||
freq_t f;
|
||||
try {
|
||||
|
@ -444,7 +449,7 @@ static void *hamlib_loop(void *args)
|
|||
}
|
||||
if (hamlib_exit)
|
||||
break;
|
||||
|
||||
|
||||
if (need_mode && hamlib_rmode == numode) {
|
||||
try {
|
||||
numode = xcvr->getMode(hamlib_pbwidth);
|
||||
|
@ -467,7 +472,7 @@ static void *hamlib_loop(void *args)
|
|||
show_frequency(hamlib_freq);
|
||||
wf->rfcarrier(hamlib_freq);
|
||||
}
|
||||
|
||||
|
||||
if (modeok && (hamlib_rmode != numode)) {
|
||||
hamlib_rmode = numode;
|
||||
show_mode(modeString(hamlib_rmode));
|
||||
|
@ -480,7 +485,7 @@ static void *hamlib_loop(void *args)
|
|||
hamlib_rmode == RIG_MODE_ECSSLSB ||
|
||||
hamlib_rmode == RIG_MODE_RTTY));
|
||||
}
|
||||
|
||||
|
||||
if (hamlib_exit)
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@ const struct rig_caps* Rig::getCaps(void)
|
|||
|
||||
void Rig::open(void)
|
||||
{
|
||||
int err;
|
||||
if ((err = rig_open(rig)) != RIG_OK)
|
||||
int err = rig_open(rig);
|
||||
if (err != RIG_OK)
|
||||
throw RigException(err);
|
||||
}
|
||||
|
||||
|
|
Plik diff jest za duży
Load Diff
|
@ -38,6 +38,7 @@ Cserial::Cserial() {
|
|||
rtsptt = dtrptt = false;
|
||||
rtscts = false;
|
||||
status = 0;
|
||||
stopbits = 2;
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
|
@ -69,7 +70,7 @@ bool Cserial::OpenPort() {
|
|||
|
||||
newtio.c_cflag &= ~PARENB;
|
||||
|
||||
if (0)
|
||||
if (stopbits == 1)
|
||||
newtio.c_cflag &= ~CSTOPB; // 1 stop bit
|
||||
else
|
||||
newtio.c_cflag |= CSTOPB; // 2 stop bit
|
||||
|
@ -284,7 +285,7 @@ BOOL Cserial::OpenPort()
|
|||
if(hComm == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
ConfigurePort( baud, 8, FALSE, NOPARITY, ONESTOPBIT);
|
||||
ConfigurePort( baud, 8, FALSE, NOPARITY, stopbits);
|
||||
|
||||
FlushBuffer();
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue