Quantcast

Order of execution for addTimerTickSubscriber?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Order of execution for addTimerTickSubscriber?

Matthew Miller

Is there any way to modify the order that addTimerTickSubscriber things execute such that they are run prior to the “identification” announcement?

My goal is to have my node play “announcements” of my choosing once an hour on certain hours – but to only play the identification callsign the minimum number of times required.

 

Currently, with the code below in my local/Logic.tcl, if it needs to identify from previous TX I get the following:

-Identify for pending 10-minute timer

-Read announcement

-ID for end of announcement

 

What I would LIKE to achieve would be the combined minimum

-Read announcement

-ID for end of announcement (and this also covers the pending 10-minute timer too)

 

 

 

 

#

# Executed when the SvxLink software is started

#

proc startup {} {

  #playMsg "Core" "online"

  #send_short_ident

  addTimerTickSubscriber announceEcholink

}

 

#

# My custom announcement, played “certain hours at 1 minute past the hour”

#

proc announceEcholink {} {

  variable prev_ident;

  variable need_ident;

 

  set now [clock seconds];

  set hour [clock format $now -format "%k"];

  regexp {([1-5]?\d)$} [clock format $now -format "%M"] -> minute;

 

  if {$hour > 8 && $hour < 24 && $minute == 1} {

    puts "Playing announceEcholink."

    #playMsg "Core" "online"

    playMsg "EchoLink" "name"

 

                puts "announceEcholink: Sending short identification...";

                send_short_ident $hour $minute;

                set prev_ident $now;

                set need_ident 0;

  }

}

 

 

#

#Modified identification check – IDs at the 1’s so as not to “step on” repeater announcements and IDing at :00

#

# Should be executed once every whole minute to check if it is time to

# identify. Not exactly an event function. This function handle the

# identification logic and call the send_short_ident or send_long_ident

# functions when it is time to identify.

#

proc checkPeriodicIdentify {} {

  variable prev_ident;

  variable short_ident_interval;

  variable long_ident_interval;

  variable min_time_between_ident;

  variable ident_only_after_tx;

  variable need_ident;

  global logic_name;

 

  if {$short_ident_interval == 0} {

    return;

  }

 

  set now [clock seconds];

  set hour [clock format $now -format "%k"];

  regexp {([1-5]?\d)$} [clock format $now -format "%M"] -> minute;

 

  set short_ident_now \

            [expr {($hour * 60 + $minute) % $short_ident_interval == 1}];

  set long_ident_now 0;

  if {$long_ident_interval != 0} {

    set long_ident_now \

            [expr {($hour * 60 + $minute) % $long_ident_interval == 1}];

  }

  if {$long_ident_now} {

    puts "$logic_name: Sending long identification...";

    send_long_ident $hour $minute;

    set prev_ident $now;

    set need_ident 0;

  } else {

    if {$now - $prev_ident < $min_time_between_ident} {

      return;

    }

    if {$ident_only_after_tx && !$need_ident} {

      return;

    }

 

    if {$short_ident_now} {

      puts "$logic_name: Sending short identification...";

      send_short_ident $hour $minute;

      set prev_ident $now;

      set need_ident 0;

    }

  }

}

 


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Order of execution for addTimerTickSubscriber?

Rob Janssen
On Wed, Aug 10, 2016 at 07:01:21AM -0400, Matthew Miller wrote:
> Is there any way to modify the order that addTimerTickSubscriber things
> execute such that they are run prior to the "identification" announcement?
>
> My goal is to have my node play "announcements" of my choosing once an hour
> on certain hours - but to only play the identification callsign the minimum
> number of times required.

The addTimerTickSubscriber adds the routine add the end of a list,
I think it means that the routines are always called in the order
they were added.

The startup function of RepeaterLogic first adds the checkPeriodicIdentify
routine from Logic that manages the periodic identification, then it
calls the startup routine from Logic.  So anything you add from there
is always running after the identification, when it goes out in the same
minute.

To change that you would need to modify the startup routine in
RepeaterLogic.tcl, e.g. move the addTimerTickSubscriber of the
checkPeriodicIdentify routine below the call of Logic::startup.

Make sure you test well, there may be a reason why this sequence
is used, e.g. the expansion of current time into a string on which
other timer routines my depend (I always do that locally in each
routine, even though it is less efficient)

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. http://sdm.link/zohodev2dev
_______________________________________________
Svxlink-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/svxlink-devel
Loading...