Printable slow data

pull/14/head
Tom Early 6 years ago
parent 4bd83b02ae
commit 2a6141383d

@ -54,7 +54,7 @@
#define CFG_DIR "/usr/local/etc" #define CFG_DIR "/usr/local/etc"
#endif #endif
const std::string GW_VERSION("QnetGateway-613"); const std::string GW_VERSION("QnetGateway-614");
int CQnetGateway::FindIndex(const int i) const int CQnetGateway::FindIndex(const int i) const
{ {
@ -71,6 +71,18 @@ int CQnetGateway::FindIndex(const int i) const
return index; return index;
} }
bool CQnetGateway::Printable(unsigned char *s)
{
bool rval = false;
for (unsigned i=0; s[i]; i++) {
if (0 == isprint(s[i])) {
rval = true;
s[i] = '?';
}
}
return rval;
}
bool CQnetGateway::VoicePacketIsSync(const unsigned char *text) const bool CQnetGateway::VoicePacketIsSync(const unsigned char *text) const
{ {
return *text==0x55U && *(text+1)==0x2DU && *(text+2)==0x16U; return *text==0x55U && *(text+1)==0x2DU && *(text+2)==0x16U;
@ -1003,6 +1015,7 @@ void CQnetGateway::ProcessIncomingSD(const SDSVT &dsvt)
if (c[1]=='\r' || c[2]=='\r') { if (c[1]=='\r' || c[2]=='\r') {
sd.gps[sd.ig + ((c[1] == '\r') ? 0 : 1)] = '\0'; sd.gps[sd.ig + ((c[1] == '\r') ? 0 : 1)] = '\0';
if (i < 3) { if (i < 3) {
Printable(sd.gps);
if (showLastHeard && gps.Parse((const char *)&sd.gps)) { if (showLastHeard && gps.Parse((const char *)&sd.gps)) {
char call[CALL_SIZE+1]; char call[CALL_SIZE+1];
memcpy(call, toRptr[i].saved_hdr.hdr.mycall, CALL_SIZE); memcpy(call, toRptr[i].saved_hdr.hdr.mycall, CALL_SIZE);
@ -1087,6 +1100,7 @@ void CQnetGateway::ProcessIncomingSD(const SDSVT &dsvt)
else else
sd.gps[sd.ig+2] = '\0'; sd.gps[sd.ig+2] = '\0';
if (i < 3) { if (i < 3) {
Printable(sd.gps);
if (showLastHeard && gps.Parse((const char *)&sd.gps)) { if (showLastHeard && gps.Parse((const char *)&sd.gps)) {
char call[CALL_SIZE+1]; char call[CALL_SIZE+1];
memcpy(call, toRptr[i].saved_hdr.hdr.mycall, CALL_SIZE); memcpy(call, toRptr[i].saved_hdr.hdr.mycall, CALL_SIZE);
@ -1105,6 +1119,7 @@ void CQnetGateway::ProcessIncomingSD(const SDSVT &dsvt)
sd.im += 3; sd.im += 3;
if (sd.im >= 20) { if (sd.im >= 20) {
sd.message[20] = '\0'; sd.message[20] = '\0';
Printable(sd.message);
if (showLastHeard && (i < 3) && memcmp(toRptr[i].saved_hdr.hdr.sfx, "RPTR", 4) && memcmp(sd.message, "VIA SMARTGP", 11)) { if (showLastHeard && (i < 3) && memcmp(toRptr[i].saved_hdr.hdr.sfx, "RPTR", 4) && memcmp(sd.message, "VIA SMARTGP", 11)) {
char call[CALL_SIZE+1]; char call[CALL_SIZE+1];
memcpy(call, toRptr[i].saved_hdr.hdr.mycall, CALL_SIZE); memcpy(call, toRptr[i].saved_hdr.hdr.mycall, CALL_SIZE);

@ -187,6 +187,7 @@ private:
void PlayFileThread(SECHO &edata); void PlayFileThread(SECHO &edata);
void compute_aprs_hash(); void compute_aprs_hash();
void APRSBeaconThread(); void APRSBeaconThread();
bool Printable(unsigned char *string);
void ProcessTimeouts(); void ProcessTimeouts();
void ProcessSlowData(unsigned char *data, const unsigned short sid); void ProcessSlowData(unsigned char *data, const unsigned short sid);
void ProcessIncomingSD(const SDSVT &dsvt); void ProcessIncomingSD(const SDSVT &dsvt);

Loading…
Cancel
Save

Powered by TurnKey Linux.