From de187d9049ac4300624c954427cdd71a049882fc Mon Sep 17 00:00:00 2001 From: David Freese Date: Wed, 15 Jun 2016 09:20:55 -0500 Subject: [PATCH] FSQ IFKP heard lists * Correct FSQ rxtext parsing for heard discovery * Change management of heard list for both FSQ and IFKP --- src/dialogs/fl_digi.cxx | 40 ++++++++++++++++++++++++++-------------- src/fsq/fsq.cxx | 21 +++++++++++++-------- 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/src/dialogs/fl_digi.cxx b/src/dialogs/fl_digi.cxx index 0f14c199..36b95086 100644 --- a/src/dialogs/fl_digi.cxx +++ b/src/dialogs/fl_digi.cxx @@ -6826,13 +6826,16 @@ cout << "main_hmin " << main_hmin << endl; fsq_left->w(), Y, 180, fsq_left->h()); fsq_right->box(FL_FLAT_BOX); + int bh = 20; + int qh = bh + bh + 1 + 8 + image_s2n.h(); + static int heard_widths[] = { 40*fsq_right->w()/100, 30*fsq_right->w()/100, 0 }; fsq_heard = new Fl_Browser( fsq_right->x(), fsq_right->y(), - fsq_right->w(), fsq_right->h() - minhtext); + fsq_right->w(), fsq_right->h() - qh);//minhtext); fsq_heard->column_widths(heard_widths); fsq_heard->column_char(','); fsq_heard->tooltip(_("Select FSQ station")); @@ -6851,13 +6854,14 @@ cout << "main_hmin " << main_hmin << endl; #endif int qw = fsq_right->w(); - int gh = fsq_right->h() - fsq_heard->h(); +// int gh = fsq_right->h() - fsq_heard->h(); + int bw2 = qw / 2; int bw4 = qw / 4; - int bh = 20; + fsq_lower_right = new Fl_Group( fsq_right->x(), fsq_heard->y() + fsq_heard->h(), - qw, gh); + qw, qh); fsq_lower_right->box(FL_FLAT_BOX); fsq_lower_right->color(FL_WHITE); @@ -9666,6 +9670,10 @@ void age_heard_list() void add_to_heard_list(string szcall, string szdb) { + int found = 0; + size_t pos_comma; + std::string testcall; + std::string line; std::string time = inpTimeOff->value(); std::string str = szcall; @@ -9677,13 +9685,15 @@ void add_to_heard_list(string szcall, string szdb) if (fsq_heard->size() < 2) { fsq_heard->add(str.c_str()); } else { - int found = 0; - std::string line; for (int i = 2; i <= fsq_heard->size(); i++) { line = fsq_heard->text(i); - if (line.find(szcall) == 0) { - found = i; - break; + pos_comma = line.find(","); + if (pos_comma != std::string::npos) { + testcall = line.substr(0, pos_comma); + if (testcall == szcall) { + found = i; + break; + } } } if (found) @@ -9695,13 +9705,15 @@ void add_to_heard_list(string szcall, string szdb) if (ifkp_heard->size() == 0) { ifkp_heard->add(str.c_str()); } else { - int found = 0; - std::string line; for (int i = 1; i <= ifkp_heard->size(); i++) { line = ifkp_heard->text(i); - if (line.find(szcall) == 0) { - found = i; - break; + pos_comma = line.find(","); + if (pos_comma != std::string::npos) { + testcall = line.substr(0, pos_comma); + if (testcall == szcall) { + found = i; + break; + } } } if (found) diff --git a/src/fsq/fsq.cxx b/src/fsq/fsq.cxx index 52c57968..29498313 100644 --- a/src/fsq/fsq.cxx +++ b/src/fsq/fsq.cxx @@ -341,7 +341,7 @@ bool fsq::fsq_squelch_open() return ch_sqlch_open || metric >= progStatus.sldrSquelchValue; } -static string triggers = " !#$%&'()*+,-.;<=>?@[\\]^_`{|}~"; +static string triggers = " !#$%&'()*+,-.;<=>?@[\\]^_{|}~"; static string allcall = "allcall"; static string cqcqcq = "cqcqcq"; @@ -392,10 +392,12 @@ void fsq::parse_rx_text() state = TEXT; size_t p = rx_text.find(':'); + if (p == 0) { + rx_text.erase(0,1); + return; + } if (p == std::string::npos || - p == 0 || rx_text.length() < p + 2) { - rx_text.clear(); return; } @@ -404,10 +406,11 @@ void fsq::parse_rx_text() station_calling.clear(); int max = p+1; + if (max > 20) max = 20; std::string substr; - for (int i = 1; (i < 10) && (i < max); i++) { + for (int i = 1; i < max; i++) { if (rx_text[p-i] <= ' ' || rx_text[p-i] > 'z') { - rx_text.clear(); + rx_text.erase(0, p+1); return; } substr = rx_text.substr(p-i, i); @@ -419,10 +422,10 @@ void fsq::parse_rx_text() if (station_calling == mycall) { // do not display any of own rx stream LOG_ERROR("Station calling is mycall: %s", station_calling.c_str()); - rx_text.clear(); + rx_text.erase(0, p+3); +// rx_text.clear(); return; } - if (!station_calling.empty()) { REQ(add_to_heard_list, station_calling, szestimate); std::string sheard = ztbuf; @@ -933,7 +936,8 @@ void fsq::lf_check(int ch) static char lfpair[3] = "01"; static char bstrng[4] = "012"; - lfpair[0] = lfpair[1]; lfpair[1] = 0xFF & ch; + lfpair[0] = lfpair[1]; + lfpair[1] = 0xFF & ch; bstrng[0] = bstrng[1]; bstrng[1] = bstrng[2]; @@ -991,6 +995,7 @@ void fsq::process_symbol(int sym) double val = snfilt->value(); for (int i = 0; i < SQLFILT_SIZE; i++) snfilt->run(val); ch_sqlch_open = true; + rx_text.clear(); } if (fsq_squelch_open()) {