⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 event-mask-example.py

📁 无线通信的主要编程软件,是无线通信工作人员的必备工具,关天相关教程我会在后续传上.
💻 PY
字号:
# This script is in the public domain and has no copyright## This is a simple example script to demonstrate the use of event# masks to limit the communication between TOSSIM and Tython to# improve the execution time of the tools.#import timefrom simcore import *from simutil import *from net.tinyos.sim.msg import *def handler(event):    print "got event", eventinterp.addEventHandler(handler)sim.exec("apps/SenseToRfm/build/pc/main.exe", 2, "-b=1")print "Running for two seconds with all events except DebugMsgEvent"sim.resume()comm.setEventMask(~ DebugMsgEvent.AM_TYPE)comm.waitFor(2 * simtime.onesec)print "Masking all events except InterruptEvent"comm.setEventMask(InterruptEvent.AM_TYPE)comm.waitFor(2 * simtime.onesec)print "Masking all events except InterruptEvent and RadioMsgSentEvent"comm.setEventMask(InterruptEvent.AM_TYPE | RadioMsgSentEvent.AM_TYPE)comm.waitFor(2 * simtime.onesec)print "Unmasking all events for a two seconds (of real time)"comm.setEventMask(~0)time.sleep(2)print "Done."sim.exit()

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -