def __init__(self, radio, timerMux, schedule, id): """ @param schedule: L{Schedule} object giving transmission scheduling. @param id: The device ID of this node. """ MAC.__init__(self, radio, timerMux) self.schedule = schedule self.id = id self.dataTxSlot = self.schedule.dataTxSlot(self.id) self.slotTimer = VirtualTimer(timerMux, self._slotTimerHandler) self.slot = len(self.schedule.dataSlots) self.txPacket = None
def __init__(self, radio, timerMux, schedule, frameHandler=None): """ @param schedule: L{Schedule} object giving transmission scheduling. @param frameHandler: Handler function to call at the end of each frame. The packets received in that frame will be passed as a list. """ MAC.__init__(self, radio, timerMux) self.schedule = schedule self.frameHandler = frameHandler self.frameTimer = VirtualTimer(timerMux, self._frameTimerHandler) self.packets = [] self.frameTimer.start(self.schedule.framePeriod, repeat=True)