Пример #1
0
def main(sys_argv):

    for arg in sys_argv:
        if arg in ["-h", "--help"]:
            print usage()
            return

    if not vscpdif.open():
        print "vscpdif.open failed"
        return

    if sys.argv[1] == "perf":
        node = int(sys.argv[2])
        performance_test(node)
        return

    if len(sys.argv) == 3:
        # Read one register
        node = int(sys.argv[1])
        reg = int(sys.argv[2])
        val = read_register(node, reg)
        if val != None:
            print "read_register node: %d register: %d ==> val: %s" % (node, reg, val)
        else:
            print "read_register failed"
        return
Пример #2
0
def main():
    global options, args

    parser = OptionParser()
    parser.add_option("-i",
                      "--init",
                      action="store_true",
                      dest="init",
                      help="Initialize all registers with 0 (zero).")
    parser.add_option("-n",
                      "--no_store",
                      action="store_true",
                      dest="no_store",
                      help="Don't store changed register values on disk.")
    options, args = parser.parse_args()

    init_logger()

    if options.init:
        registers_init()
        registers_write()
    else:
        registers_read()

    if not vscpdif.open():
        logger.error("vscpdif.open failed")
        return

    logger.info("Connected to vscpd.")
    run()
Пример #3
0
def main():
    global options, args

    parser = OptionParser()
    parser.add_option("-i", "--init",
                        action="store_true", dest="init",
                        help="Initialize all registers with 0 (zero).")
    parser.add_option("-n", "--no_store",
                        action="store_true", dest="no_store",
                        help="Don't store changed register values on disk.")
    options, args = parser.parse_args()

    init_logger()

    if options.init:
        registers_init()
        registers_write()
    else:
        registers_read()

    if not vscpdif.open():
        logger.error("vscpdif.open failed")
        return

    logger.info("Connected to vscpd.")
    run()
Пример #4
0
def main(sys_argv):

    for arg in sys_argv:
        if arg in ["-h", "--help"]:
            print usage()
            return

    if not vscpdif.open():
        print "vscpdif.open failed"
        return

    if len(sys.argv) == 4:
        node = int(sys.argv[1])
        reg = int(sys.argv[2])
        val = int(sys.argv[3])
        val = read_register.write_register(node, reg, val)
        return
Пример #5
0
def main():

    parser = OptionParser()
    parser.add_option("-p", "--probe",
                        action="store_true", dest="probe",
                        help="Send probe events")
    options, args = parser.parse_args()


    if not vscpdif.open():
        print "vscpdif.open failed"
        return

    if options.probe:
        probe_all()
    else:
        whoisthere()
Пример #6
0
def main(sys_argv):

    for arg in sys_argv:
        if arg in ["-h", "--help"]:
            print usage()
            return

    if not vscpdif.open():
        print "vscpdif.open failed"
        return

    if len(sys.argv) == 4:
        node = int(sys.argv[1])
        reg = int(sys.argv[2])
        val = int(sys.argv[3])
        val = read_register.write_register(node, reg, val)
        return
Пример #7
0
def main(sys_argv):

    for arg in sys_argv:
        if arg in ["-h", "--help"]:
            print usage()
            return

    if not vscpdif.open():
        print "vscpdif.open failed"
        return

    if len(sys.argv) == 4:
        node = int(sys.argv[1])
        page = int(sys.argv[2])
        num = int(sys.argv[3])
        val = read_register.page_read(node, page, num)
        return
Пример #8
0
def main():

    parser = OptionParser()
    parser.add_option("-p",
                      "--probe",
                      action="store_true",
                      dest="probe",
                      help="Send probe events")
    options, args = parser.parse_args()

    if not vscpdif.open():
        print "vscpdif.open failed"
        return

    if options.probe:
        probe_all()
    else:
        whoisthere()
Пример #9
0
def main(sys_argv):

    for arg in sys_argv:
        if arg in ["-h", "--help"]:
            print usage()
            return

    if not vscpdif.open():
        print "vscpdif.open failed"
        return


    if len(sys.argv) == 4:
        node = int(sys.argv[1])
        page = int(sys.argv[2])
        num = int(sys.argv[3])
        val = read_register.page_read(node, page, num)
        return