we have classes to schedule events. here is an example:
in the c'tor: set the initial cron activation(time stamp) and minute interval between activations.
when the time comes the trigger() method will return true.
this works cross platform and no external installations are needed.
Last edited by Moti Barski on Mon Aug 28, 2023 11:51 am; edited 2 times in total
Code:
class TrgEveryNMinutes(TrGEV3):
# trigger returns true every minutes interval, post start time
def __init__(self, startTime: str, minutes: int):
self._playGround: PlayGround = PlayGround()
self._minutes:int = minutes # minute interval between triggerings
self._timeStamp = startTime
self._trgTime: TrgTime = TrgTime()
self._trgTime.setTime(startTime)
def setMinutes(self, minutes: int):
if minutes > -1:
self._minutes = minutes
# override
def trigger(self) -> bool:
if self._trgTime.alarm():
self._timeStamp = self._playGround.getFutureInXMin(self._minutes)
self._trgTime.setTime(self._timeStamp)
return True
return False
# override
def reset(self):
self._timeStamp = self._playGround.getCurrentTimeStamp()
in the c'tor: set the initial cron activation(time stamp) and minute interval between activations.
when the time comes the trigger() method will return true.
this works cross platform and no external installations are needed.
Last edited by Moti Barski on Mon Aug 28, 2023 11:51 am; edited 2 times in total