no mod or gate for dash

pull/14/head
Tom Early 6 years ago
parent 6a1aad2567
commit 9bf224033f

@ -37,8 +37,6 @@ bool CQnetDB::Open(const char *name)
"mycall TEXT PRIMARY KEY, "
"sfx TEXT, "
"urcall TEXT, "
"module TEXT, "
"gateway TEXT, "
"lasttime INT NOT NULL"
") WITHOUT ROWID;";
@ -51,7 +49,7 @@ bool CQnetDB::Open(const char *name)
return false;
}
bool CQnetDB::Update(const char *mycall, const char *sfx, const char *urcall, const char *module, const char *gateway)
bool CQnetDB::Update(const char *mycall, const char *sfx, const char *urcall)
{
if (NULL == db)
return false;
@ -61,10 +59,6 @@ bool CQnetDB::Update(const char *mycall, const char *sfx, const char *urcall, co
sql.append(sfx);
sql.append("','");
sql.append(urcall);
sql.append("','");
sql.append(module);
sql.append("','");
sql.append(gateway);
sql.append("',");
sql.append("strftime('%s','now'));");

@ -25,7 +25,7 @@ public:
CQnetDB() : db(NULL) {}
~CQnetDB() { if (db) sqlite3_close(db); }
bool Open(const char *name);
bool Update(const char *mycall, const char *sfx, const char *urcall, const char *module, const char *gateway);
bool Update(const char *mycall, const char *sfx, const char *urcall);
private:
sqlite3 *db;

@ -1124,15 +1124,13 @@ void CQnetGateway::ProcessG2(const ssize_t g2buflen, const SDSVT &g2buf, const i
printf("UnixSock=%s\n", link2gate.c_str());
}
if (DASH_SHOW_LH && memcmp(g2buf.hdr.sfx, "RPTR", 4)) {
std::string mycall((const char *)g2buf.hdr.mycall, 8);
if (DASH_SHOW_LH && memcmp(g2buf.hdr.sfx, "RPTR", 4) && std::regex_match(mycall.c_str(), preg)) {
std::string sfx((const char *)g2buf.hdr.sfx, 4);
std::string urcall((const char *)g2buf.hdr.urcall, 8);
std::string module((const char *)g2buf.hdr.rpt1, 8);
std::string gateway((const char *)g2buf.hdr.rpt2, 8);
rtrim(mycall);
rtrim(sfx);
qnDB.Update(mycall.c_str(), sfx.c_str(), urcall.c_str(), module.c_str(), gateway.c_str());
qnDB.Update(mycall.c_str(), sfx.c_str(), urcall.c_str());
}
Gate2Modem[i].Write(g2buf.title, 56);

@ -93,16 +93,6 @@ function SecToString(int $sec) {
return sprintf("%2d sec", $sec);
}
function RptrToAprs(string $rptr)
{
if (8==strlen($rptr) && 8==strlen(trim($rptr)) && strpos($rptr, ' ')) {
$link = strstr($rptr, ' ', true).'-'.$rptr[7];
return '<a*target="_blank"*href="https://aprs.fi/'.$link.'">'.$rptr.'</a>';
}
return $rptr;
}
function MyAndSfxToQrz(string $my, string $sfx)
{
$my = trim($my);
@ -145,15 +135,16 @@ if ('true' == GetCFGValue('dash_show_ps') && `ps -aux | grep -e qn -e MMDVMHost
if ('true' == GetCFGValue('dash_show_lh')) {
echo 'Last Heard:<br><code>', "\n";
$rstr = 'MyCall/Sfx URCall Module Gateway Last Time<br>';
$rstr = 'MyCall/Sfx Source Last Time<br>';
echo str_replace(' ', '&nbsp;', $rstr), "\n";
$dbname = $cfgdir.'/'.GetCFGValue('dash_sql_filename');
$db = new SQLite3($dbname, SQLITE3_OPEN_READONLY);
$ss = 'SELECT mycall,sfx,urcall,module,gateway,strftime("%s","now")-lasttime FROM LHEARD ORDER BY 6 LIMIT '.GetCFGValue('dash_lastheard_count').' ';
$ss = 'SELECT mycall,sfx,urcall,strftime("%s","now")-lasttime FROM LHEARD ORDER BY 4 LIMIT '.GetCFGValue('dash_lastheard_count').' ';
if ($stmnt = $db->prepare($ss)) {
if ($result = $stmnt->execute()) {
while ($row = $result->FetchArray(SQLITE3_NUM)) {
$rstr = MyAndSfxToQrz($row[0], $row[1]).' '.$row[2].' '.RptrToAprs($row[3]).' '.$row[4].' '.SecToString(intval($row[5])).'<br>';
$source = ("CQCQCQ " == $row[2]) ? "Linking" : "Routing";
$rstr = MyAndSfxToQrz($row[0], $row[1]).' '.$source.' '.SecToString(intval($row[3])).'<br>';
echo str_replace('*', ' ', str_replace(' ', '&nbsp;', $rstr)), "\n";
}
$result->finalize();

Loading…
Cancel
Save

Powered by TurnKey Linux.