Exemplo n.º 1
0
print "\nTrying to add back previously manualy found motes(this should FAIL)"
for port in ports:
    print "\tAdding mote on port {}, result: {}".format(
        port, "Success" if Motelist.addMote(port, "TestMote",
                                            "Test description") else "Failure")
readKey()

print "\nStarting periodic updates, press enter to stop!"
print "\nTry to attach and reattach motes, to see any changes!"

# Add our function to callbacks.
# Start periodic update, which checks for motelist changes
# each second and calls all callbacks only if motelist have changed.
# Note that this is not blocking, it runs on different thread.
Motelist.initialize(periodicUpdateCallback, True)

readKey()
print "\nMotelist once again:"

# Simple check, to see if no problems are caused by this.
Motelist.getMotelist(False)
Motelist.getMotelist(True)
Motelist.printMotelist()

# Clean up.
Motelist.removeUpdateCallback(periodicUpdateCallback)
Motelist.stopPeriodicUpdate()

# Cya.
print "\nThe end, to understand more, please look into the source of this test."
readKey()
Exemplo n.º 2
0
# Try to manually add previously found motes, should fail!
print "\nTrying to add back previously manualy found motes(this should FAIL)"
for port in ports:
    print "\tAdding mote on port {}, result: {}".format(
		port, "Success" if Motelist.addMote(port, "TestMote", "Test description") else "Failure")
readKey()

print "\nStarting periodic updates, press enter to stop!"
print "\nTry to attach and reattach motes, to see any changes!"

# Add our function to callbacks.
# Start periodic update, which checks for motelist changes
# each second and calls all callbacks only if motelist have changed.
# Note that this is not blocking, it runs on different thread.
Motelist.initialize(periodicUpdateCallback, True)

readKey()
print "\nMotelist once again:"

# Simple check, to see if no problems are caused by this.
Motelist.getMotelist(False)
Motelist.getMotelist(True)
Motelist.printMotelist()

# Clean up.
Motelist.removeUpdateCallback(periodicUpdateCallback)
Motelist.stopPeriodicUpdate()

# Cya.
print "\nThe end, to understand more, please look into the source of this test."
readKey()
Exemplo n.º 3
0
 def __del__(self):
     Motelist.removeUpdateCallback(self.updateMotelist)