-// Called once per second
-gboolean timer_callback (gpointer data) {
-
-#ifdef INCLUDE_APRS
- static int inet_beacon_count = 0;
- static int inet_aprs_filter = 0;
- static int tty_beacon_count = 0;
-
- if(_aprs_enable)
- {
- // Check if we need to resent the filter every 5 minutes
- // Note - this should really be dependent on speed and/or range
- if(_aprs_inet_enable && inet_aprs_filter > (60*5))
- {
- // Currently this only needs to be sent on connection
- //update_aprs_inet_options(FALSE);
- inet_aprs_filter = 0;
- }
-
- if(_aprs_inet_enable && _aprs_enable_inet_tx && _aprs_inet_beacon_interval > 0 && _aprs_inet_state == RCVR_UP)
- {
-
-
- if(inet_beacon_count >= _aprs_inet_beacon_interval)
- {
- // Send inet APRS beacon
- aprs_send_beacon(APRS_PORT_INET);
- //g_idle_add((GSourceFunc)aprs_send_beacon, APRS_PORT_INET);
- //fprintf(stderr, "timer %u, %u\n", inet_beacon_count, _aprs_inet_beacon_interval);
- inet_beacon_count = 0;
- }
-
- }
-
- if(_aprs_tty_enable && _aprs_enable_tty_tx )
- {
- // Send tty APRS beacon
-
- if(tty_beacon_count >= _aprs_tty_beacon_interval && _aprs_tty_beacon_interval > 0)
- {
- // Send inet APRS beacon
- aprs_send_beacon(APRS_PORT_TTY);
-
- //g_idle_add((GSourceFunc)aprs_send_beacon_inet, NULL);
-
- tty_beacon_count = 0;
- }
-
- }
-
-
- inet_aprs_filter++;
- inet_beacon_count++;
- tty_beacon_count++;
- }
-#endif //INCLUDE_APRS
-
- return TRUE; // Continue timer
-}
-
-// Start a one second timer - this can be used to execute any periodic tasks
-void timer_init()
-{
- g_timeout_add(1000 , timer_callback, NULL);
-}
-