コード例 #1
0
    def selectChannel(self):
        channels = yield self.protocol.sendCommand('get-channels')
        channel = yield selectFromList(channels, 'select channel')
        returnValue(channel)

    @inlineCallbacks
    def selectParameter(self):
        paramIndex = yield getListIndex(
            zip(*AI.PARAMETERS)[1], 'select parameter')
        param = zip(*AI.PARAMETERS)[0][paramIndex]
        returnValue(param)

    @inlineCallbacks
    def initializeConsoleClient(self):
        url = VM_SERVER_CONFIG['url'] if not DEBUG else VM_DEBUG_SERVER_CONFIG[
            'url']
        self.protocol = yield getProtocol(url)

        def onMessage(d):
            print 'message: %s' % d

        self.protocol.messageSubscribe('channel-parameter-changed', onMessage)

    def onVoltagesMeasured(self, voltages):
        print clock()


if __name__ == '__main__':
    runConsoleClient(VoltMeterClient)
    reactor.run()
コード例 #2
0
def main():
    protocol = yield getProtocol(WAVELENGTH_SERVER)
    runConsoleClient(TrackingConsoleClient, protocol)
コード例 #3
0
    @inlineCallbacks
    def selectChannel(self):
        channels = yield self.protocol.sendCommand("get-channels")
        channel = yield selectFromList(channels, "select channel")
        returnValue(channel)

    @inlineCallbacks
    def selectParameter(self):
        paramIndex = yield getListIndex(zip(*AI.PARAMETERS)[1], "select parameter")
        param = zip(*AI.PARAMETERS)[0][paramIndex]
        returnValue(param)

    @inlineCallbacks
    def initializeConsoleClient(self):
        url = VM_SERVER_CONFIG["url"] if not DEBUG else VM_DEBUG_SERVER_CONFIG["url"]
        self.protocol = yield getProtocol(url)

        def onMessage(d):
            print "message: %s" % d

        self.protocol.messageSubscribe("channel-parameter-changed", onMessage)

    def onVoltagesMeasured(self, voltages):
        print clock()


if __name__ == "__main__":
    runConsoleClient(VoltMeterClient)
    reactor.run()
コード例 #4
0
def main():
    protocol = yield getProtocol(WAVELENGTH_SERVER)
    runConsoleClient(TrackingConsoleClient,protocol)