Ejemplo n.º 1
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog OPTIONS\n' + __doc__)
    parser.add_option('-f', '--watchFilePattern',
                      action='append', default=[],
                      help='Watch for files matching the specified UNIX glob, like "somedir/*.jpg"')
    parser.add_option('-d', '--watchDirectory',
                      action='append', default=[],
                      help='Watch for files in the specified directory')
    parser.add_option('-s', '--watchSymlink',
                      action='append', default=[],
                      help='Watch for files pointed to by the specified symlink. This assumes a cooperative file writer that updates a symlink whenever it writes a new file. This may be more efficient than the other approaches when new files are appearing in a directory containing many files.')
    parser.add_option('-t', '--subtopic',
                      default='standard',
                      help='Subtopic to use when publishing zmq message [%default]')
    ZmqPublisher.addOptions(parser, 'filePublisher.{subtopic}')
    ZmqSubscriber.addOptions(parser, 'filePublisher.{subtopic}')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')

    logging.basicConfig(level=logging.DEBUG)

    p = FilePublisher(opts)
    p.start()
    zmqLoop()
Ejemplo n.º 2
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    ZmqPublisher.addOptions(parser, 'tracLinkListener')
    parser.add_option('-p',
                      '--port',
                      default=DEFAULT_PORT,
                      help='TCP port where TracLink server listens [%default]')
    parser.add_option('-o',
                      '--host',
                      default=DEFAULT_HOST,
                      help='TCP host where TracLink server listens [%default]')
    opts, _args = parser.parse_args()

    logging.basicConfig(level=logging.DEBUG)

    #     if ':' in opts.port:
    #         opts.host, opts.port = opts.port.split(':', 1)
    #         opts.port = int(opts.port)
    #     else:
    #         opts.host = '127.0.0.1'
    #         opts.port = int(opts.port)
    if not opts.host:
        opts.host = DEFAULT_HOST
        print 'host is %s' % opts.host
    if not opts.port:
        opts.port = DEFAULT_PORT
        print 'port is %d' % opts.port

    tracLinkListener(opts)
Ejemplo n.º 3
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    ZmqPublisher.addOptions(parser, 'zmqPublish')
    parser.add_option(
        '-p',
        '--prefix',
        default='',
        help=
        'Prefix to prepend to incoming lines before publishing them (DO include trailing "." if you want it)'
    )
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')
    logging.basicConfig(level=logging.DEBUG)

    # set up networking
    p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts))
    p.start()

    # start publishing an arbitrary message that central should forward
    pubTimer = ioloop.PeriodicCallback(lambda: pubMessage(opts.prefix, p), 0.1)
    pubTimer.start()

    zmqLoop()
Ejemplo n.º 4
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    ZmqSubscriber.addOptions(parser, 'tracLinkTelemetryCleanup')
    ZmqPublisher.addOptions(parser, 'tracLinkTelemetryCleanup')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')

    logging.basicConfig(level=logging.DEBUG)
    d = TracLinkTelemetryCleanup(opts)
    d.start()
    atexit.register(d.flush)
    zmqLoop()
Ejemplo n.º 5
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog <zmqCentral-messages-xxx.txt>')
    parser.add_option('-t', '--topic',
                      action='append',
                      help='Only print specified topics, can specify multiple times')
    ZmqPublisher.addOptions(parser, 'zmqPlayback')
    opts, args = parser.parse_args()
    if len(args) != 1:
        parser.error('expected exactly 1 arg')
    logging.basicConfig(level=logging.DEBUG)

    pb = ZmqPlayback(args[0], opts)
    pb.start()

    zmqLoop()
Ejemplo n.º 6
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: testLineSource.py testMessages.txt | %prog')
    ZmqPublisher.addOptions(parser, 'testPublisher')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')
    logging.basicConfig(level=logging.DEBUG)

    # set up networking
    publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(opts))
    publisher.start()

    ioloop.IOLoop.instance().add_handler(sys.stdin.fileno(),
                                         lambda fd, events: stdinHandler(publisher),
                                         ioloop.IOLoop.READ)
    zmqLoop()
Ejemplo n.º 7
0
def main():
    import optparse
    parser = optparse.OptionParser(
        'usage: testLineSource.py testMessages.txt | %prog')
    ZmqPublisher.addOptions(parser, 'testPublisher')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')
    logging.basicConfig(level=logging.DEBUG)

    # set up networking
    publisher = ZmqPublisher(**ZmqPublisher.getOptionValues(opts))
    publisher.start()

    ioloop.IOLoop.instance().add_handler(
        sys.stdin.fileno(), lambda fd, events: stdinHandler(publisher),
        ioloop.IOLoop.READ)
    zmqLoop()
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    ZmqPublisher.addOptions(parser, 'testPublishAttachments')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')
    logging.basicConfig(level=logging.DEBUG)

    # set up networking
    p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts))
    p.start()

    # start publishing an arbitrary message that central should forward
    pubTimer = ioloop.PeriodicCallback(lambda: pubMessage(p), 1000)
    pubTimer.start()

    zmqLoop()
Ejemplo n.º 9
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    ZmqPublisher.addOptions(parser, 'testPublishAttachments')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')
    logging.basicConfig(level=logging.DEBUG)

    # set up networking
    p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts))
    p.start()

    # start publishing an arbitrary message that central should forward
    pubTimer = ioloop.PeriodicCallback(lambda: pubMessage(p), 1000)
    pubTimer.start()

    zmqLoop()
Ejemplo n.º 10
0
def main():
    import optparse
    parser = optparse.OptionParser(
        'usage: %prog <zmqCentral-messages-xxx.txt>')
    parser.add_option(
        '-t',
        '--topic',
        action='append',
        help='Only print specified topics, can specify multiple times')
    ZmqPublisher.addOptions(parser, 'zmqPlayback')
    opts, args = parser.parse_args()
    if len(args) != 1:
        parser.error('expected exactly 1 arg')
    logging.basicConfig(level=logging.DEBUG)

    pb = ZmqPlayback(args[0], opts)
    pb.start()

    zmqLoop()
Ejemplo n.º 11
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    ZmqPublisher.addOptions(parser, 'tracLinkListener')
    parser.add_option(
        '-p',
        '--port',
        default=DEFAULT_PORT,
        help='TCP or UDP port where EVA track server listens [%default]')
    parser.add_option(
        '-o',
        '--host',
        default=DEFAULT_HOST,
        help='TCP host where EVA track server listens [%default]')
    parser.add_option(
        '--proto',
        default=DATA_DELIVERY_PROTOCOL,
        help='UDP or TCP. Use default of UDP in field. [%default]')
    parser.add_option('-n', '--evaNumber',
                      default=1,
                      help=\
                      'EVA identifier for multi-EVA ops. e.g. 1,2... [%default]')
    parser.add_option('-t', '--trackName',
                      default="",
                      help=\
                'Track name to store GPS points. If blank will use active flight then EVA #')
    parser.add_option('-d', '--dataTopic',
                      default="gpsposition",
                      help=\
                'ZMQ topic to publish data record under.  Compass and GPS are on separate topics')
    opts, _args = parser.parse_args()

    logging.basicConfig(level=logging.DEBUG)

    if not opts.host:
        opts.host = DEFAULT_HOST
        print 'host is %s' % opts.host
    if not opts.port:
        opts.port = DEFAULT_PORT
        print 'port is %d' % opts.port

    evaTrackListener(opts)
Ejemplo n.º 12
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog')
    ZmqPublisher.addOptions(parser, 'zmqPublish')
    parser.add_option('-p', '--prefix',
                      default='',
                      help='Prefix to prepend to incoming lines before publishing them (DO include trailing "." if you want it)')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')
    logging.basicConfig(level=logging.DEBUG)

    # set up networking
    p = ZmqPublisher(**ZmqPublisher.getOptionValues(opts))
    p.start()

    # start publishing an arbitrary message that central should forward
    pubTimer = ioloop.PeriodicCallback(lambda: pubMessage(opts.prefix, p), 0.1)
    pubTimer.start()

    zmqLoop()
Ejemplo n.º 13
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog OPTIONS\n' + __doc__)
    parser.add_option('-o', '--output',
                      default='.',
                      help='Directory to write received files to [%default]')
    parser.add_option('-p', '--pollPeriod',
                      type='float', default=1.0,
                      help='Period between checks for a new latest file (seconds) [%default]')
    parser.add_option('-s', '--timestampSpacing',
                      type='float', default=5.0,
                      help='Ignore latest file unless it is this much newer than the last file sent (seconds) [%default]')
    parser.add_option('--timeout',
                      type='float', default=30.0,
                      help='Keep publishing files for this long after each request from fileReceiver (seconds) [%default]')
    parser.add_option('-r', '--imageResize',
                      help='Subsample any images to specified size (e.g. "640x480")')
    parser.add_option('-c', '--imageCrop',
                      help='Crop any images to specified size and location (e.g. "100x100+300+400")')
    parser.add_option('-f', '--imageFormat',
                      help='Output any images in the specified format (e.g. "jpg")')
    parser.add_option('-t', '--subtopic',
                      default='standard',
                      help='Subtopic to use when receiving zmq message [%default]')
    parser.add_option('-n', '--noRequest',
                      action='store_true', default=False,
                      help='Do not request any files from filePublisher, but write any files that are received, for example because they are requested by other receivers. May be useful for debugging.')
    ZmqPublisher.addOptions(parser, 'fileReceiver.{subtopic}')
    ZmqSubscriber.addOptions(parser, 'fileReceiver.{subtopic}')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')

    logging.basicConfig(level=logging.DEBUG)

    p = FileReceiver(opts)
    p.start()
    zmqLoop()
Ejemplo n.º 14
0
def main():
    import optparse
    parser = optparse.OptionParser('usage: %prog OPTIONS\n' + __doc__)
    parser.add_option('-o', '--output',
                      default='.',
                      help='Directory to write received files to [%default]')
    parser.add_option('-p', '--pollPeriod',
                      type='float', default=1.0,
                      help='Period between checks for a new latest file (seconds) [%default]')
    parser.add_option('-s', '--timestampSpacing',
                      type='float', default=5.0,
                      help='Ignore latest file unless it is this much newer than the last file sent (seconds) [%default]')
    parser.add_option('--timeout',
                      type='float', default=30.0,
                      help='Keep publishing files for this long after each request from fileReceiver (seconds) [%default]')
    parser.add_option('-r', '--imageResize',
                      help='Subsample any images to specified size (e.g. "640x480")')
    parser.add_option('-c', '--imageCrop',
                      help='Crop any images to specified size and location (e.g. "100x100+300+400")')
    parser.add_option('-f', '--imageFormat',
                      help='Output any images in the specified format (e.g. "jpg")')
    parser.add_option('-t', '--subtopic',
                      default='standard',
                      help='Subtopic to use when receiving zmq message [%default]')
    parser.add_option('-n', '--noRequest',
                      action='store_true', default=False,
                      help='Do not request any files from filePublisher, but write any files that are received, for example because they are requested by other receivers. May be useful for debugging.')
    ZmqPublisher.addOptions(parser, 'fileReceiver.{subtopic}')
    ZmqSubscriber.addOptions(parser, 'fileReceiver.{subtopic}')
    opts, args = parser.parse_args()
    if args:
        parser.error('expected no args')

    logging.basicConfig(level=logging.DEBUG)

    p = FileReceiver(opts)
    p.start()
    zmqLoop()