Ejemplo n.º 1
0
def get_connection(name):
    if name not in conns.keys():
        info = rpc.get_station_info(s, src, name)
        con = rpc.RPCCon(info)
        con.connect(src)
        conns[name] = (info, con)
    return conns[name]
Ejemplo n.º 2
0
def get_connection(name):
    if name not in conns.keys():
        info = rpc.get_station_info(s, src, name)
        con = rpc.RPCCon(info)
        con.connect(src)
        conns[name] = (info, con)
    return conns[name]
Ejemplo n.º 3
0
args = parser.parse_args()


s = ethernet_socket(args.i, 3)
src = get_mac(args.i)

if args.action == "discover":
    dcp.send_discover(s, src)
    dcp.read_response(s, src, debug=True)
elif args.action == "get-param":
    dcp.get_param(s, src, args.target, args.param)
elif args.action == "set-param":
    dcp.set_param(s, src, args.target, args.param, args.value)
elif args.action.startswith("read") or args.action.startswith("write"):
    print("Getting station info ...")
    info = rpc.get_station_info(s, src, args.target)
    con = rpc.RPCCon(info)

    print("Connecting to device ...")
    con.connect(src)
    
    if args.action == "read":
        print(con.read(api=int(args.param), slot=int(args.value), subslot=int(args.additional1), idx=int(args.additional2, 16)).payload)
        
    if args.action[5:] == "inm0-filter":

        data = con.read_inm0filter()
        for api in data.keys():
            for slot_number, (module_ident_number, subslots) in data[api].items():
                print("Slot %d has module 0x%04X" % (slot_number, module_ident_number))
                for subslot_number, submodule_ident_number in subslots.items():
Ejemplo n.º 4
0
args = parser.parse_args()

s = ethernet_socket(args.i, 3)
src = get_mac(args.i)

if args.action == "discover":
    dcp.send_discover(s, src)
    dcp.read_response(s, src, debug=True)
elif args.action == "get-param":
    dcp.get_param(s, src, args.target, args.param)
elif args.action == "set-param":
    dcp.set_param(s, src, args.target, args.param, args.value)
elif args.action.startswith("read") or args.action.startswith("write"):
    print("Getting station info ...")
    info = rpc.get_station_info(s, src, args.target)
    con = rpc.RPCCon(info)

    print("Connecting to device ...")
    con.connect(src)

    if args.action == "read":
        print(
            con.read(api=int(args.param),
                     slot=int(args.value),
                     subslot=int(args.additional1),
                     idx=int(args.additional2, 16)).payload)

    if args.action[5:] == "inm0-filter":

        data = con.read_inm0filter()