Adding a Console Menu

You can add a console menu to your application using the FrameworkMenu class. You can use the console menu to add a console interface with the following commands to your application when it is run in interactive mode:

 

Command Description
stat Display application statistics.
help Display the available commands.
extend <id> Extend enrollment for assembly id.
eval <stmnts> Evaluate the Python statements specified by stmnts.
cancel Cancel any pending enrollment.
open <id> Open enrollment for assembly id.
service Send Service and DRUM messages. Service messages are used for discovery in managed networks, and DRUM messages are used for discovery in ISI networks.
create <id> Create enrollment for assembly id.
list List name and index for all device datapoints.
factory Reset ISI configuration to the factory default.
leave <id> Leave the enrollment for assembly id.
wink Simulate the receipt of a Wink message.
exit Exit the application.
is_connected <id> Evaluate if assembly id is connected.

 

To add a console menu to an IzoT Python application, create an instance of the FrameworkMenu() class, passing in the framework parameter, and then invoke the execute() method when a keyboard input is detected. The execute() method returns True if an Exit command is detected.

Example

# Add a default menu
framework_menu = FrameworkMenu(framework)
 :
  
# Run the application
try:
    done = False
    while not done:
        app.service(0.100)    # Allow the IzoT stack time to service its events
 
    if kbhit(0.0):            # Test for user input
        done = framework_menu.execute()
 
finally:
    app.stop()                # Stop the IzoT application