Ejemplo n.º 1
0
def rename():
    mac = request.values.get('mac')
    name = request.values.get('name')
    
    old_name = dcp.get_param(s, src, mac, "name").decode()
    
    # delete connection
    if old_name in conns.keys():
        del conns[old_name]
    
    dcp.set_param(s, src, mac, "name", name)
    
    return redirect(url_for("device", name=name))
Ejemplo n.º 2
0
def rename():
    mac = request.values.get('mac')
    name = request.values.get('name')

    old_name = dcp.get_param(s, src, mac, "name").decode()

    # delete connection
    if old_name in conns.keys():
        del conns[old_name]

    dcp.set_param(s, src, mac, "name", name)

    return redirect(url_for("device", name=name))
Ejemplo n.º 3
0
parser.add_argument("additional1",  nargs='?', help="additional parameters")
parser.add_argument("additional2",  nargs='?', help="additional parameters")

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():
Ejemplo n.º 4
0
parser.add_argument("value", nargs='?', help="value to write")
parser.add_argument("additional1", nargs='?', help="additional parameters")
parser.add_argument("additional2", nargs='?', help="additional parameters")

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)