📄 eventgen.py
字号:
#!/usr/bin/python# This file is part of MANTIS OS, Operating System# See http://mantis.cs.colorado.edu/## Copyright (C) 2003-2005 University of Colorado, Boulder## This program is free software; you can redistribute it and/or# modify it under the terms of the mos license (see file LICENSE)import socket, struct, syssys.path.append('modules')import eventssys.path.pop()PORT = 1521HOST = '' # empty string meanslocalhost s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)def start_node(binary, id, x, y): packstr = "!5i" + str(len(binary)) + "s" data_size = 12 + len(binary) pkt = struct.pack(packstr, data_size, events.NEW_NODE_EVENT, id, x, y, binary) s.sendto(pkt, (HOST, PORT))id = 0x = 10y = 10for i in range(0, 3): start_node('binaries/sense_forward_recv.elf', id, x, y) id += 1 x += 1 y += 1start_node('binaries/sense_forward_send.elf', id, x, y)while 1: time.sleep(1)s.close()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -