Python:
class AXHandshake:
def __init__(self):
self.__trgTime: TrgTime = TrgTime()
self.__trgTolerance: TrgTolerance = TrgTolerance(10)
self.__shoutout: AXShoutOut = AXShoutOut()
# default handshakes (valid reply to shout out)
self.__shoutout.handshake = Responder("what", "yes", "i am here")
self.__user_name: str = ""
self.__dripper: PercentDripper = PercentDripper()
# setters
def setTimeStamp(self, time_stamp: str) -> AXHandshake:
# when will the shout out happen?
# example time stamp: 9:15
self.__trgTime.setTime(time_stamp)
return self
def setShoutOutLim(self, lim: int) -> AXHandshake:
# how many times should user be called for, per shout out?
self.__trgTolerance.setMaxRepeats(lim)
return self
def setHandShake(self, responder: Responder) -> AXHandshake:
# which responses would acknowledge the shout-out?
# such as *see default handshakes for examples suggestions
self.__shoutout.handshake = responder
return self
def setDripperPercent(self, n: int) -> AXHandshake:
# hen shout out to user how frequent will it be?
self.__dripper.setLimit(n)
return self
def setUser_name(self, user_name: str) -> AXHandshake:
self.__user_name = user_name
return self
# getters
def getUser_name(self) -> str:
return self.__user_name
def engage(self, ear: str) -> bool:
if self.__trgTime.alarm():
self.__trgTolerance.reset()
# stop shout out
if self.__shoutout.engage(ear):
self.__trgTolerance.disable()
return True
return False
def trigger(self) -> bool:
if self.__trgTolerance.trigger():
if self.__dripper.drip():
self.__shoutout.activate()
return True
return False