Tags:
create new tag
, view all tags
The main program interfaces all the layers and components together. When running the testbed from the command line or script files, the user must call the wisenet.py file. It handles the command line input and argument parsing (see Appendix B for the various options available), and passes the appropriate variables to the various components of the testbed. The expected types of all the input arguments are defined within the argument parsing code. In addition, it provides a cleaning utility to delete all routing tables, logs, received files and *.pyc (compiled Python files) from the various WiSeNeT folders.

In addition, it provides a global handler to capture the keyboard interrupt (Control + C) in order to trigger graceful termination of the testbed. This is best done here at the main program (highest level) to eliminate the possible conflicts of capturing and managing it at the other layers.

The serial port (for the packet radio connection) is defined at the main program level in order to be passed to the link layer. No other layer or component requires the radio handler as it is the purpose of the link layer to interface to the physical layer (radio).

In order to facilitate modularity, inter-layer queues/interfaces are defined at the main program level. By creating the interfaces here, they can be passed to each layer’s instance – this eliminates the dependency between layers, and allows each layer to run concurrently and autonomously. The tokens for globally shared resources (stdout, runtime log file) are also defined here and passed to the relevant layers.

In addition, due to modularity, the layers are able to be started in any order, and terminated in any order. The start order is defined by the order that the layers are created, and the termination order is determined by the usage of the exit events. The purpose of these exit variables (thread safe events) is to notify the current layer to exit, and to further notify the next layer to begin its exit process. Within each layer are ThreadStart and ThreadExit functions in order to utilise these exit variables.

Topic revision: r2 - 2012-01-18 - XiaohongWu
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback