Skip to content

Commit 1da807d

Browse files
authored
Rework fldigixmlrpc code (Tlf#467)
* reset connerr in fldigi_toggle() after a toggle we shall start from a fresh state no extra method is needed as this is done implicitly in changepars refreshbp can be dropped, it's done later in the code * wait a bit after :FLDigi in changepars.c in order to see the current setting * move 'xmlrpc_env env' to fldigi_xmlrpc_init() it is used there locally for error reporting * use xmlrpc_release() for both failed init and cleanup * extend xmlrpc_res_init() and use it in fldigi_xmlrpc_query() * earlier exit from fldigi_xmlrpc_query() if not use_fldigi * extract build_param_array() from fldigi_xmlrpc_query() in order to reduce complexity also check DECREFs * use constant from xmlrpc lib * take early exit on connerr to reduce indentation * use own xmlrpc_env in fldigi_xmlrpc_query() used for internal error reporting anyway, no need to pass it by the caller * return error on failed init * allow void call for fldigi_xmlrpc_query() and use xmlrpc_res_free() to free result * reduce indent in fldigi_get_log_call() and fldigi_get_log_serial_number() * extract parse_call_result() * switch to "private" xmlrpc client mode The problem is that the xmlrpc_client_call_server_params() or other function using the "global" client mode return a non-initialized result pointer (a local variable containing garbage) in case of some error situations. This makes impossible to decide whether the result should be free'd or not. The xmlrpc documentation contains no hint on this. The "private" functions on the other can use a pointer passed by the caller, so in this case if the initial NULL is untouched then it hasn't been allocated yet, hence no free'ing is needed. * switch to standard XML-RPC format specification * make mutexes static * fldigi: set rig mode/freq only if needed * define xmlrpc_res only if xmlrpc is in use * fldigixmlrpc.c: make locals static and protect them with #if HAVE_LIBXMLRPC * poll Fldigi less frequently (10 times per sec) * rework fldigi_get_log_call - optimize fldigi polling - reuse valid_call_char() from callinput.c * move UI code out of fldigi_get_log_call() * change thiscall to a boolean flag * rework fldigi_get_log_serial_number() - it now allows slash (/) also; this can be fixed later if it makes problems * change fldigi_set_callfield to bool * clarify :miniterm feature in man page
1 parent 2af6a5f commit 1da807d

6 files changed

Lines changed: 368 additions & 283 deletions

File tree

src/background_process.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ void *background_process(void *ptr) {
110110
* this function helps to show the correct freq of the RIG: reads
111111
* the carrier value from Fldigi, and stores in a variable; then
112112
* it readable by fldigi_get_carrier()
113-
* only need at every 2nd cycle
114113
* see fldigixmlrpc.[ch]
115114
*
116115
* There are two addition routines
@@ -123,7 +122,7 @@ void *background_process(void *ptr) {
123122
fldigi_get_log_call();
124123
fldigi_get_log_serial_number();
125124
}
126-
fldigi_rpc_cnt = 1 - fldigi_rpc_cnt;
125+
fldigi_rpc_cnt = (fldigi_rpc_cnt + 1) % 10;
127126
}
128127

129128
if (!pause_backgrnd_process) {

src/callinput.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,12 @@ int callinput(void) {
143143
show_rtty();
144144
}
145145

146-
if (digikeyer == FLDIGI && fldigi_set_callfield == 1
146+
if (digikeyer == FLDIGI && fldigi_set_callfield
147147
&& current_qso.call[0] != '\0') {
148148
freqstore = freq;
149-
fldigi_set_callfield = 0;
149+
fldigi_set_callfield = false;
150+
// call has been just set, restart outer loop to update display
151+
break;
150152
}
151153

152154
/* if BMAUTOADD is active and user has input a call sign

src/changepars.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,12 +652,12 @@ int changepars(void) {
652652
case 51: { /* FLDIGI - turn on/off */
653653
if (digikeyer == FLDIGI) {
654654
if (fldigi_toggle()) {
655-
fldigi_clear_connerr();
656655
mvaddstr(13, 29, "FLDIGI ON");
657656
} else {
658657
mvaddstr(13, 29, "FLDIGI OFF");
659658
}
660659
refreshp();
660+
sleep(1);
661661
}
662662
break;
663663
}

0 commit comments

Comments
 (0)