예제 #1
0
def main():

    (options, args) = parseArgs()

    factory = InputServiceFactory()
    factory.protocol = InputServiceProtocol
    reactor.listenTCP(11000,factory)

    wiiSender = WiiSender(factory, loopFreq=options.loopFreq)

    moteDetector = MoteDetector(numToConnect=1, detectedCallback=wiiSender.newMote, getAlreadyConnectedIdsCallback=wiiSender.getAlreadyConnectedIds);
    moteDetector.keepFirstConnection=True
    moteDetector.startInThread()

    wiiSender.setMoteDetector(moteDetector)

    reactor.callLater(0.0, wiiSender.loop)

    reactor.run()
예제 #2
0
def main():

    (options, args) = parseArgs()

    f = WiiSenderClientFactory()
    f.setVerbose(options.verbose)
    f.setLoopFreq(options.loopFreq)

    # create a wii sender
    wiiSender = WiiSender(f, loopFreq=options.loopFreq)
    f.setWiiSender(wiiSender)

    # start a mote detector.  It hands new mote to the wii sender
    moteDetector = MoteDetector(numToConnect=1, detectedCallback=wiiSender.newMote, getAlreadyConnectedIdsCallback=wiiSender.getAlreadyConnectedIds);
    moteDetector.keepFirstConnection=True
    moteDetector.startInThread()

    wiiSender.setMoteDetector(moteDetector)

    print "Connecting to:", options.host, options.port
    reactor.connectTCP(options.host, options.port, f)

    reactor.run()
예제 #3
0
def main():

    (options, args) = parseArgs()

    factory = InputServiceFactory()
    factory.protocol = InputServiceProtocol
    reactor.listenTCP(11000, factory)

    wiiSender = WiiSender(factory, loopFreq=options.loopFreq)

    moteDetector = MoteDetector(
        numToConnect=1,
        detectedCallback=wiiSender.newMote,
        getAlreadyConnectedIdsCallback=wiiSender.getAlreadyConnectedIds,
    )
    moteDetector.keepFirstConnection = True
    moteDetector.startInThread()

    wiiSender.setMoteDetector(moteDetector)

    reactor.callLater(0.0, wiiSender.loop)

    reactor.run()
예제 #4
0
                # FIXME: organize better so not so many arguements are needed
                mote, moteMouse, tileMote = SetupMoteControl(masterCursor, app, fullRect.width, fullRect.height, moteId=moteIds[0], leds=(1,0,0,0), renderers=renderers, configUI=configUI, masterObjects=masterObjects, moteManager=moteManager)
            if "wii2" == arg.lower():
                #mote2, moteMouse2, tileMote2 = SetupMoteControl(masterCursor2, app, fullRect.width, fullRect.height, moteId="00:19:1D:79:93:E0", leds=(0,1,0,0), renderers=renderers, configUI=configUI, cursorListList=cursorListList)
                mote2, moteMouse2, tileMote2 = SetupMoteControl(masterCursor2, app, fullRect.width, fullRect.height, moteId=moteIds[1], leds=(0,1,0,0), renderers=renderers, configUI=configUI, masterObjects=masterObjects, cursorListList=cursorListList, moteManager=moteManager)
            if "wii3" == arg.lower():
                mote3, moteMouse3, tileMote3 = SetupMoteControl(masterCursor3, app, fullRect.width, fullRect.height, moteId=moteIds[2], leds=(0,0,1,0), renderers=renderers, configUI=configUI, masterObjects=masterObjects, cursorListList=cursorListList, moteManager=moteManager)
            if "wii4" == arg.lower():
                mote4, moteMouse4, tileMote4 = SetupMoteControl(masterCursor4, app, fullRect.width, fullRect.height, moteId=moteIds[3], leds=(0,0,0,1), renderers=renderers, configUI=configUI, masterObjects=masterObjects, cursorListList=cursorListList, moteManager=moteManager)


        if gWiiSupported == True and "wii" not in sys.argv:
            cursors=[masterCursor, masterCursor2, masterCursor3, masterCursor4]
            # FIXME: organize better so not so many arguements are needed
            moteManager = MoteManager(app, fullRect, cursors, renderers=renderers, configUI=configUI, masterObjects=masterObjects, cursorListList=cursorListList)
            moteDetector = MoteDetector(numToConnect=1, detectedCallback=moteManager.newMoteDetected, getAlreadyConnectedIdsCallback=moteManager.getAlreadyConnectedIds)
            moteManager.setMoteDetector(moteDetector)
            moteDetector.startInThread()
            app.addDynamicObject(moteManager, addToRenderer=False)

    visualsManager.setObjectListListByRef(objectsListList)
    visualsManager.setMasterObjectListByRef(masterObjects)
    visualsManager.setCursorListList_tmpFunc(cursorListList)

    if mpi.procs > 1:
        mpi.barrier()

        if 0 == mpi.rank:
            print "******** simple position syncer, cursor objects:", syncer.cursors, "data objects", syncer.dataObjList
            print "******** GenericSyncer example sync dict:", genSyncer.getSyncExampleDict()