예제 #1
0
파일: motes.py 프로젝트: KuanYuChen/mansos
 def addAll(self):
     cfgMotes = configuration.c.getCfgValueAsList("motes")
     for portName in cfgMotes:
         Motelist.addMote(portName, "A statically added mote", "")
     Motelist.initialize(self.motesUpdated, startPeriodicUpdate = True)
     self.refreshMotes(Motelist.getMotelist(False))
     self.retrieveSelected()
예제 #2
0
파일: motes.py 프로젝트: zxpower/MansOS
 def addAll(self):
     cfgMotes = configuration.c.getCfgValueAsList("motes")
     for portName in cfgMotes:
         Motelist.addMote(portName, "A statically added mote", "")
     Motelist.initialize(self.motesUpdated, False, False)
     Motelist.startPeriodicUpdate()
     self.refreshMotes(Motelist.getMotelist(False))
예제 #3
0
파일: api_core.py 프로젝트: atiselsts/osw
    def loadUserMotes(self):
        # Read motelist from config file
        if os.path.exists(".motelist") and os.path.isfile(".motelist"):
            f = open(".motelist", 'r')

            lines = f.readlines()

            for x in lines:
                if x != '':
                    if x.find("->") != -1:
                        name, port = x.strip().split("->")
                        Motelist.addMote(port, name, localize("User defined"))
예제 #4
0
    def loadUserMotes(self):
        # Read motelist from config file
        if os.path.exists(".motelist") and os.path.isfile(".motelist"):
            f = open(".motelist", 'r')

            lines = f.readlines()

            for x in lines:
                if x != '':
                    if x.find("->") != -1:
                        name, port = x.strip().split("->")
                        Motelist.addMote(port, name, localize("User defined"))
예제 #5
0
def manualyScanForMotes(prefix):
    prefix = str(prefix)
    retVal = list()
    
    print "Manualy scaning for motes with prefix: {}".format(prefix)
    for portNumber in range(20):
        if Motelist.addMote(prefix + str(portNumber), "TestMote", "Test description"):
            print "\tFound mote on port:", prefix + str(portNumber)
            retVal.append(prefix + str(portNumber))
            
    print "Founded  mote count: {}".format(len(retVal))
    
    return retVal
예제 #6
0
def manualyScanForMotes(prefix):
    prefix = str(prefix)
    retVal = list()

    print "Manualy scaning for motes with prefix: {}".format(prefix)
    for portNumber in range(20):
        if Motelist.addMote(prefix + str(portNumber), "TestMote",
                            "Test description"):
            print "\tFound mote on port:", prefix + str(portNumber)
            retVal.append(prefix + str(portNumber))

    print "Founded  mote count: {}".format(len(retVal))

    return retVal
예제 #7
0
    def addNewMote(self, event):
        if not Motelist.portExists(self.port.GetValue()):
            self.portError.SetLabel(localize("No device found on this port") + "!")

            self.SetSizerAndFit(self.main)
            self.SetAutoLayout(1)

            self.Show()
        else:
            if Motelist.addMote(self.port.GetValue(), self.name.GetValue(), "User defined"):
                self.API.updateUserMotes()
                self.Close()
            else:
                self.portError.SetLabel(localize("There already is device on that port in list") + "!")

                self.SetSizerAndFit(self.main)
                self.SetAutoLayout(1)

                self.Show()
예제 #8
0
파일: newMote.py 프로젝트: ssureshkumar/osw
    def addNewMote(self, event):
        if not Motelist.portExists(self.port.GetValue()):
            self.portError.SetLabel(
                localize("No device found on this port") + "!")

            self.SetSizerAndFit(self.main)
            self.SetAutoLayout(1)

            self.Show()
        else:
            if Motelist.addMote(self.port.GetValue(), self.name.GetValue(),
                                "User defined"):
                self.API.updateUserMotes()
                self.Close()
            else:
                self.portError.SetLabel(
                    localize("There already is device on that port in list") +
                    "!")

                self.SetSizerAndFit(self.main)
                self.SetAutoLayout(1)

                self.Show()
예제 #9
0
# Clear stored motelist, to automatically detect conected motes.
print "\nClearing motelist from manually found motes."
Motelist.motes = list()
readKey()

# Automatically detect and print all connected motes.
print "\nRunning automatic mote detection and printing motelist\n"
Motelist.printMotelist()
readKey()

# 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.
예제 #10
0
# Clear stored motelist, to automatically detect conected motes.
print "\nClearing motelist from manually found motes."
Motelist.motes = list()
readKey()

# Automatically detect and print all connected motes.
print "\nRunning automatic mote detection and printing motelist\n"
Motelist.printMotelist()
readKey()

# 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.