edl/Example/tcpclient.py

37 lines
815 B
Python
Raw Normal View History

2019-11-20 12:40:37 +01:00
#!/usr/bin/env python3
from edl.Library.tcpclient import tcpclient
2024-06-10 01:06:20 +08:00
class client:
def __init__(self):
2024-06-10 01:06:20 +08:00
self.commands = []
def send(self):
2020-11-14 17:28:32 +01:00
self.tcp = tcpclient(1340)
self.tcp.sendcommands(self.commands)
2024-06-10 01:06:20 +08:00
def read(self, src):
self.commands.append(f"peekqword:{hex(src)}")
2024-06-10 01:06:20 +08:00
def write(self, dest, value):
self.commands.append(f"pokeqword:{hex(dest)},{hex(value)}")
2024-06-10 01:06:20 +08:00
def memcpy(self, dest, src, size):
self.commands.append(f"memcpy:{hex(dest)},{hex(src)},{hex(size)}")
2024-06-10 01:06:20 +08:00
def main():
2024-06-10 01:06:20 +08:00
exp = client()
exp.commands = [
2020-12-22 22:19:37 +01:00
"send:nop",
"r:boot,boot.img",
"peek:0x00100000,0x8,qfp.bin"
2020-11-14 17:28:32 +01:00
#"pokehex:0x1402C2CC,1f2003d5",
#"peek:0x14084840,0xC00,uart.bin"
]
exp.send()
2024-06-10 01:06:20 +08:00
if __name__ == "__main__":
main()