def main():

    message_handler1 = MessageHandler()
    message_handler1.read_message(SLAVE_PORT)
    time.sleep(1)
    broadcast.send('hei, dette er heis1', SLAVE_PORT)
    broadcast.send('heis1 er sulten', SLAVE_PORT)
    time.sleep(1)
    print message_handler1.read_message(SLAVE_PORT)
    print message_handler1.read_message(SLAVE_PORT)
def main():

	message_handler1 = MessageHandler()
	message_handler1.read_message(SLAVE_PORT)
	time.sleep(1)
	broadcast.send('hei, dette er heis1',SLAVE_PORT)
	broadcast.send('heis1 er sulten',SLAVE_PORT)
	time.sleep(1)
	print message_handler1.read_message(SLAVE_PORT)
	print message_handler1.read_message(SLAVE_PORT)
Beispiel #3
0
def main():
    message_handler = MessageHandler()
    old_message = "this message will never be sent"
    while True:
        (floor, button) = message_handler.read_message(SLAVE_TO_MASTER_PORT)

        time.sleep(0.01)
        '''
		Do some massive shit and calculations

		'''

        if (floor and button) is not None:
            message = "%s,%s" % (floor, button)
            if message != old_message:
                broadcast.send(message, MASTER_TO_SLAVE_PORT)
Beispiel #4
0
def main():
	message_handler = MessageHandler()
	old_message = "this message will never be sent"
	while True:
		(floor,button) = message_handler.read_message(SLAVE_TO_MASTER_PORT)

		time.sleep(0.01) 
		'''
		Do some massive shit and calculations

		'''

		if (floor and button) is not None:
			message = "%s,%s" % (floor,button) 
			if message != old_message:
				broadcast.send(message,MASTER_TO_SLAVE_PORT)
Beispiel #5
0
def main():
	message_handler = MessageHandler()
	elevator_driver = ElevatorDriver()
	elevator_driver.start()
	old_message = 12345678
	while True:

		(master_floor, master_button) = elevator_driver.pop_button_queue()
		if (master_floor and master_button) is not None:
			message = "%i,%i" % (master_floor,master_button)
			if message != old_message:
				broadcast.send(message,SLAVE_TO_MASTER_PORT)
			time.sleep(0.001)

		(floor, button) = message_handler.read_message(MASTER_TO_SLAVE_PORT)
		if (floor and button) is not None:
			floor = int(floor)
			button = int(button)
			elevator_driver.queue_floor_button_run(floor, button)
Beispiel #6
0
def main():
    message_handler = MessageHandler()
    elevator_driver = ElevatorDriver()
    elevator_driver.start()
    old_message = 12345678
    while True:

        (master_floor, master_button) = elevator_driver.pop_button_queue()
        if (master_floor and master_button) is not None:
            message = "%i,%i" % (master_floor, master_button)
            if message != old_message:
                broadcast.send(message, SLAVE_TO_MASTER_PORT)
            time.sleep(0.001)

        (floor, button) = message_handler.read_message(MASTER_TO_SLAVE_PORT)
        if (floor and button) is not None:
            floor = int(floor)
            button = int(button)
            elevator_driver.queue_floor_button_run(floor, button)