示例#1
0
 def __uart__(self, device):
     """ initialize uart interface """
     libcsp.kiss_init(device, 9600, 512, 'uart')
     libcsp.rtable_load('1 uart, 4 uart 1')
                        help="Server address")
    parser.add_argument("-R", "--routing-table", help="Routing table")
    return parser.parse_args(sys.argv[1:])


if __name__ == "__main__":

    options = getOptions()

    libcsp.init(options.address, "host", "model", "1.2.3", 10, 300)

    if options.can:
        libcsp.can_socketcan_init(options.can)
    if options.zmq:
        libcsp.zmqhub_init(options.address, options.zmq)
        libcsp.rtable_load("0/0 ZMQHUB")
    if options.routing_table:
        libcsp.rtable_load(options.routing_table)

    libcsp.route_start_task()
    time.sleep(0.2)  # allow router task startup

    print("Connections:")
    libcsp.print_connections()

    print("Routes:")
    libcsp.print_routes()

    print("CMP ident:", libcsp.cmp_ident(options.server_address))

    print("Ping: %d mS" % libcsp.ping(options.server_address))
示例#3
0
 def __zmq__(self, addr):
     """ initialize ZMQ interface """
     libcsp.zmqhub_init(addr, 'localhost')
     libcsp.rtable_load('0/0 ZMQHUB')