Added additional way to reset running timers
Added a list of RESET TGIDs used, additionally, to reset running timers. All previous actions still work the same way, this is only ANOTHER way to reset timers.
This commit is contained in:
parent
ae9f71d715
commit
c16d549e94
@ -385,31 +385,33 @@ class confbridgeIPSC(IPSC):
|
|||||||
if _system['SYSTEM'] == self._system:
|
if _system['SYSTEM'] == self._system:
|
||||||
|
|
||||||
# TGID matches an ACTIVATION trigger
|
# TGID matches an ACTIVATION trigger
|
||||||
if _dst_group in _system['ON'] and _ts == _system['TS']:
|
if (_dst_group in _system['ON'] or _dst_group in _system['RESET']) and _ts == _system['TS']:
|
||||||
# Set the matching rule as ACTIVE
|
# Set the matching rule as ACTIVE
|
||||||
if _system['ACTIVE'] == False:
|
if _dst_group in _system['ON']:
|
||||||
_system['ACTIVE'] = True
|
if _system['ACTIVE'] == False:
|
||||||
self._logger.info('(%s) Bridge: %s, connection changed to state: %s', self._system, _bridge, _system['ACTIVE'])
|
_system['ACTIVE'] = True
|
||||||
# Cancel the timer if we've enabled an "OFF" type timeout
|
self._logger.info('(%s) Bridge: %s, connection changed to state: %s', self._system, _bridge, _system['ACTIVE'])
|
||||||
if _system['TO_TYPE'] == 'OFF':
|
# Cancel the timer if we've enabled an "OFF" type timeout
|
||||||
_system['TIMER'] = now
|
if _system['TO_TYPE'] == 'OFF':
|
||||||
self._logger.info('(%s) Bridge: %s set to "OFF" with an on timer rule: timeout timer cancelled', self._system, _bridge)
|
_system['TIMER'] = now
|
||||||
|
self._logger.info('(%s) Bridge: %s set to "OFF" with an on timer rule: timeout timer cancelled', self._system, _bridge)
|
||||||
# Reset the timer for the rule
|
# Reset the timer for the rule
|
||||||
if _system['ACTIVE'] == True and _system['TO_TYPE'] == 'ON':
|
if _system['ACTIVE'] == True and _system['TO_TYPE'] == 'ON':
|
||||||
_system['TIMER'] = now + _system['TIMEOUT']
|
_system['TIMER'] = now + _system['TIMEOUT']
|
||||||
self._logger.info('(%s) Bridge: %s, timeout timer reset to: %s', self._system, _bridge, _system['TIMER'] - now)
|
self._logger.info('(%s) Bridge: %s, timeout timer reset to: %s', self._system, _bridge, _system['TIMER'] - now)
|
||||||
|
|
||||||
# TGID matches an DE-ACTIVATION trigger
|
# TGID matches an DE-ACTIVATION trigger
|
||||||
if _dst_group in _system['OFF'] and _ts == _system['TS']:
|
if (_dst_group in _system['OFF'] or _dst_group in _system['RESET']) and _ts == _system['TS']:
|
||||||
# Set the matching rule as ACTIVE
|
# Set the matching rule as ACTIVE
|
||||||
if _system['ACTIVE'] == True:
|
if _dst_group in _system['OFF']:
|
||||||
_system['ACTIVE'] = False
|
if _system['ACTIVE'] == True:
|
||||||
self._logger.info('(%s) Bridge: %s, connection changed to state: %s', self._system, _bridge, _system['ACTIVE'])
|
_system['ACTIVE'] = False
|
||||||
# Cancel the timer if we've enabled an "ON" type timeout
|
self._logger.info('(%s) Bridge: %s, connection changed to state: %s', self._system, _bridge, _system['ACTIVE'])
|
||||||
if _system['TO_TYPE'] == 'ON':
|
# Cancel the timer if we've enabled an "ON" type timeout
|
||||||
_system['TIMER'] = now
|
if _system['TO_TYPE'] == 'ON':
|
||||||
self._logger.info('(%s) Bridge: %s set to ON with and "OFF" timer rule: timeout timer cancelled', self._system, _bridge)
|
_system['TIMER'] = now
|
||||||
# Reset tge timer for the rule
|
self._logger.info('(%s) Bridge: %s set to ON with and "OFF" timer rule: timeout timer cancelled', self._system, _bridge)
|
||||||
|
# Reset the timer for the rule
|
||||||
if _system['ACTIVE'] == False and _system['TO_TYPE'] == 'OFF':
|
if _system['ACTIVE'] == False and _system['TO_TYPE'] == 'OFF':
|
||||||
_system['TIMER'] = now + _system['TIMEOUT']
|
_system['TIMER'] = now + _system['TIMEOUT']
|
||||||
self._logger.info('(%s) Bridge: %s, timeout timer reset to: %s', self._system, _bridge, _system['TIMER'] - now)
|
self._logger.info('(%s) Bridge: %s, timeout timer reset to: %s', self._system, _bridge, _system['TIMER'] - now)
|
||||||
|
@ -19,6 +19,9 @@ configuration file.
|
|||||||
* ON and OFF are LISTS of Talkgroup IDs used to trigger this system off and on. Even if you
|
* ON and OFF are LISTS of Talkgroup IDs used to trigger this system off and on. Even if you
|
||||||
only want one (as shown in the ON example), it has to be in list format. None can be
|
only want one (as shown in the ON example), it has to be in list format. None can be
|
||||||
handled with an empty list, such as " 'ON': [] ".
|
handled with an empty list, such as " 'ON': [] ".
|
||||||
|
* RESET is a list of Talkgroup IDs that, in addition to the ON and OFF lists will cause a running
|
||||||
|
timer to be reset. This is useful if you are using different TGIDs for voice traffic than
|
||||||
|
triggering. If you are not, there is NO NEED to use this feature.
|
||||||
* TO_TYPE is timeout type. If you want to use timers, ON means when it's turned on, it will
|
* TO_TYPE is timeout type. If you want to use timers, ON means when it's turned on, it will
|
||||||
turn off afer the timout period and OFF means it will turn back on after the timout
|
turn off afer the timout period and OFF means it will turn back on after the timout
|
||||||
period. If you don't want to use timers, set it to anything else, but 'NONE' might be
|
period. If you don't want to use timers, set it to anything else, but 'NONE' might be
|
||||||
@ -40,16 +43,16 @@ BRIDGE_CONF = {
|
|||||||
|
|
||||||
BRIDGES = {
|
BRIDGES = {
|
||||||
'WORLDWIDE': [
|
'WORLDWIDE': [
|
||||||
{'SYSTEM': 'MASTER-1', 'TS': 1, 'TGID': 1, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [2,], 'OFF': [9,10]},
|
{'SYSTEM': 'MASTER-1', 'TS': 1, 'TGID': 1, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [2,], 'OFF': [9,10], 'RESET': []},
|
||||||
{'SYSTEM': 'CLIENT-1', 'TS': 1, 'TGID': 3100, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [2,], 'OFF': [9,10]},
|
{'SYSTEM': 'CLIENT-1', 'TS': 1, 'TGID': 3100, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'ON', 'ON': [2,], 'OFF': [9,10], 'RESET': []}
|
||||||
],
|
],
|
||||||
'ENGLISH': [
|
'ENGLISH': [
|
||||||
{'SYSTEM': 'MASTER-1', 'TS': 1, 'TGID': 13, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8,10]},
|
{'SYSTEM': 'MASTER-1', 'TS': 1, 'TGID': 13, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8,10], 'RESET': []},
|
||||||
{'SYSTEM': 'CLIENT-2', 'TS': 1, 'TGID': 13, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8,10]},
|
{'SYSTEM': 'CLIENT-2', 'TS': 1, 'TGID': 13, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [3,], 'OFF': [8,10], 'RESET': []}
|
||||||
],
|
],
|
||||||
'STATEWIDE': [
|
'STATEWIDE': [
|
||||||
{'SYSTEM': 'MASTER-1', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10]},
|
{'SYSTEM': 'MASTER-1', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10], 'RESET': []},
|
||||||
{'SYSTEM': 'CLIENT-2', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10]},
|
{'SYSTEM': 'CLIENT-2', 'TS': 2, 'TGID': 3129, 'ACTIVE': True, 'TIMEOUT': 2, 'TO_TYPE': 'NONE', 'ON': [4,], 'OFF': [7,10], 'RESET': []}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user