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