static void printServiceLine( char c, AVAHI_GCC_UNUSED AvahiIfIndex iface, AvahiProtocol proto, const char* name, const char* type, const char* domain) { char label[AVAHI_LABEL_MAX]; const char* protoStr; UNUSED(); makePrintable(name, label); switch (proto) { case AVAHI_PROTO_INET: protoStr = "IPv4"; break; case AVAHI_PROTO_INET6: protoStr = "IPv6"; break; case AVAHI_PROTO_UNSPEC: default: protoStr = "Unknown"; break; } LOG(Network, "%c (%s) %-60s %-20s %s\n", c, protoStr, label, type, domain); }
// Simply test creating a DwMessage and then calling AsString on it. // Then the same with Parse+Assemble void MimeLibTester::test_dwMessage_AsString( const DwString& text ) { QVERIFY( text.size() > 0 ); // First without Parse + Assemble { DwMessage* msg = new DwMessage( text, 0 ); QCOMPARE( makePrintable( msg->AsString() ), makePrintable( text ) ); delete msg; } // Then with Parse + Assemble { DwMessage* msg = new DwMessage( text, 0 ); msg->Parse(); msg->Assemble(); QCOMPARE( makePrintable( msg->AsString() ), makePrintable( text ) ); delete msg; } }
// // Note that the length of "gps_line_data" can be up to // MAX_DEVICE_BUFFER, which is currently set to 4096. // int gps_data_find(char *gps_line_data, int port) { char long_pos[20],lat_pos[20],aunit[2]; time_t t; char temp_str[MAX_GPS_STRING+1]; int have_valid_string = 0; #ifndef __CYGWIN__ struct timeval tv; struct timezone tz; #endif // __CYGWIN__ if (strncmp(gps_line_data,"$GPRMC,",7)==0) { if (debug_level & 128) { char filtered_data[MAX_LINE_SIZE+1]; xastir_snprintf(filtered_data, sizeof(filtered_data), "%s", gps_line_data); makePrintable(filtered_data); fprintf(stderr,"Got RMC %s\n", filtered_data); } if (debug_level & 128) { // Got GPS RMC String statusline(langcode("BBARSTA015"),0); } xastir_snprintf(gps_gprmc, sizeof(gps_gprmc), "%s", gps_line_data); xastir_snprintf(temp_str, sizeof(temp_str), "%s", gps_gprmc); // decode_gps_rmc is destructive to its first parameter if (decode_gps_rmc( temp_str, long_pos, sizeof(long_pos), lat_pos, sizeof(lat_pos), gps_spd, gps_sunit, sizeof(gps_sunit), gps_cse, &t, &gps_valid ) == 1) { // mod station data // got GPS data have_valid_string++; if (debug_level & 128) fprintf(stderr,"RMC <%s> <%s><%s> %c <%s>\n", long_pos,lat_pos,gps_spd,gps_sunit[0],gps_cse); if (debug_level & 128) { fprintf(stderr,"Checking for Time Set on %d (%d)\n", port, devices[port].set_time); } // Don't set the time if it's a Cygwin system. Causes problems with // date, plus time can be an hour off if daylight savings time is // enabled on Windows. // #ifndef __CYGWIN__ if (devices[port].set_time) { tv.tv_sec=t; tv.tv_usec=0; tz.tz_minuteswest=0; tz.tz_dsttime=0; if (debug_level & 128) { fprintf(stderr,"Setting Time %ld EUID: %d, RUID: %d\n", (long)t, (int)getuid(), (int)getuid()); } #ifdef HAVE_SETTIMEOFDAY ENABLE_SETUID_PRIVILEGE; settimeofday(&tv, &tz); DISABLE_SETUID_PRIVILEGE; #endif // HAVE_SETTIMEOFDAY } #endif // __CYGWIN__ } } else { if (debug_level & 128) { int i; fprintf(stderr,"Not $GPRMC: "); for (i = 0; i<7; i++) fprintf(stderr,"%c", gps_line_data[i]); fprintf(stderr,"\n"); } } if (strncmp(gps_line_data,"$GPGGA,",7)==0) { if (debug_level & 128) { char filtered_data[MAX_LINE_SIZE+1]; xastir_snprintf(filtered_data, sizeof(filtered_data), "%s", gps_line_data); makePrintable(filtered_data); fprintf(stderr,"Got GGA %s\n", filtered_data); } if (debug_level & 128) { // Got GPS GGA String statusline(langcode("BBARSTA016"),0); } xastir_snprintf(gps_gpgga, sizeof(gps_gpgga), "%s", gps_line_data); xastir_snprintf(temp_str, sizeof(temp_str), "%s", gps_gpgga); // decode_gps_gga is destructive to its first parameter if ( decode_gps_gga( temp_str, long_pos, sizeof(long_pos), lat_pos, sizeof(lat_pos), gps_sats, gps_alt, aunit, &gps_valid ) == 1) { // mod station data // got GPS data have_valid_string++; if (debug_level & 128) fprintf(stderr,"GGA <%s> <%s> <%s> <%s> %c\n", long_pos,lat_pos,gps_sats,gps_alt,aunit[0]); } } else { if (debug_level & 128) { int i; fprintf(stderr,"Not $GPGGA: "); for (i = 0; i<7; i++) fprintf(stderr,"%c",gps_line_data[i]); fprintf(stderr,"\n"); } } if (have_valid_string) { if (debug_level & 128) { statusline(langcode("BBARSTA037"),0); } // Go update my screen position my_station_gps_change(long_pos,lat_pos,gps_cse,gps_spd, gps_sunit[0],gps_alt,gps_sats); // gps_stop_now is how we tell main.c that we've got a valid GPS string. // Only useful for HSP mode? if (!gps_stop_now) gps_stop_now=1; // If HSP port, shutdown gps for timed interval if (port_data[port].device_type == DEVICE_SERIAL_TNC_HSP_GPS) { // return dtr to normal port_dtr(port,0); } } return(have_valid_string); }