identical log_debug output

pull/12/head
Tom Early 7 years ago
parent fa59fa5990
commit 6937f3962b

@ -64,6 +64,8 @@ extern int dstar_dv_decode(const unsigned char *d, int data[3]);
static std::atomic<bool> keep_running(true); static std::atomic<bool> keep_running(true);
/* signal catching function */ /* signal catching function */
static void sigCatch(int signum) static void sigCatch(int signum)
{ {
@ -74,6 +76,10 @@ static void sigCatch(int signum)
return; return;
} }
bool CQnetGateway::VoicePacketIsSync(const unsigned char *text)
{
return *text==0x55U && *(text+1)==0x2DU && *(text+2)==0x16U;
}
void CQnetGateway::UnpackCallsigns(const std::string &str, std::set<std::string> &set, const std::string &delimiters) void CQnetGateway::UnpackCallsigns(const std::string &str, std::set<std::string> &set, const std::string &delimiters)
{ {
@ -1095,17 +1101,16 @@ void CQnetGateway::ProcessG2(const ssize_t g2buflen, const SDSVT &g2buf, const b
if (match) { if (match) {
if (LOG_DEBUG) { if (LOG_DEBUG) {
const unsigned int ctrl = g2buf.ctrl & 0x3FU; const unsigned int ctrl = g2buf.ctrl & 0x3FU;
const unsigned char sync_data[3] = { 0x55U, 0x2DU, 0x16U }; if (VoicePacketIsSync(g2buf.vasd.text)) {
if (memcmp(sync_data, g2buf.vasd.text, 3U)) { if (superframe[i].size() > 65U) {
const char *ch = "!1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"; printf("Frame[%c]: %s\n", 'A'+i, superframe[i].c_str());
superframe[i].append(1, (ctrl<37U) ? ch[ctrl] : '*' ); superframe[i].clear();
} else { }
const char *ch = "#abcdefghijklmnopqrstuvwxyz"; const char *ch = "#abcdefghijklmnopqrstuvwxyz";
superframe[i].append(1, (ctrl<27U) ? ch[ctrl] : '%' ); superframe[i].append(1, (ctrl<27U) ? ch[ctrl] : '%' );
} } else {
if (superframe[i].size() > 65U && ctrl == 20U) { const char *ch = "!1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
printf("Frame[%c]: %s\n", 'A'+i, superframe[i].c_str()); superframe[i].append(1, (ctrl<37U) ? ch[ctrl] : '*' );
superframe[i].clear();
} }
} }
Gate2Modem[i].Write(g2buf.title, 27); Gate2Modem[i].Write(g2buf.title, 27);

@ -158,6 +158,7 @@ private:
int dtmf_last_frame[3]; int dtmf_last_frame[3];
unsigned int dtmf_counter[3]; unsigned int dtmf_counter[3];
bool VoicePacketIsSync(const unsigned char *text);
void AddFDSet(int &max, int newfd, fd_set *set); void AddFDSet(int &max, int newfd, fd_set *set);
int open_port(const SPORTIP &pip); int open_port(const SPORTIP &pip);
void calcPFCS(unsigned char *packet, int len); void calcPFCS(unsigned char *packet, int len);

Loading…
Cancel
Save

Powered by TurnKey Linux.