Exemple #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)
Exemple #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)
Exemple #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)
Exemple #4
0
def gateAction(id):
    if id < 0 or id > 3:
        return
    req = jsonrpc.JsonRpcRequest(method="gateAction", params=[id])
    sendToServer(req)
Exemple #5
0
def ping():
    req = jsonrpc.JsonRpcRequest(method="ping", id=0)
    print(sendToServer(req).result)