Esempio n. 1
0
def readMemory(type, id):
    if type < 0 or type > 1 or id < 0 or id > 9:
        return

    req = jsonrpc.JsonRpcRequest(method="readMemory", params=[type, id], id=0)
    resp = sendToServer(req).result
    if resp[0:2] == 'ok':
        print(resp[3:])
    else:
        print(resp)
Esempio n. 2
0
def writeMemory(type, id, data):
    if type < 0 or type > 1 or id < 0 or id > 9:
        return
    if data < 0 or data > 0xFFFFFFFF:
        return

    hex_data = str.format('{:08X}', data)

    req = jsonrpc.JsonRpcRequest(method="writeMemory",
                                 params=[type, id, hex_data])
    sendToServer(req)
Esempio n. 3
0
def shutterAction(id, action):
    if id < 0 or id > 8 or action < 0 or action > 2:
        return
    req = jsonrpc.JsonRpcRequest(method="shutterAction", params=[id, action])
    sendToServer(req)
Esempio n. 4
0
def gateAction(id):
    if id < 0 or id > 3:
        return
    req = jsonrpc.JsonRpcRequest(method="gateAction", params=[id])
    sendToServer(req)
Esempio n. 5
0
def ping():
    req = jsonrpc.JsonRpcRequest(method="ping", id=0)
    print(sendToServer(req).result)