logic_sniffer.py
Data Analysis Tools

A data analyzer tool module can be imported by logic_sniffer.py based on command-line options, or entries in an initialization file. Imported analyzer tool modules can be run later from the main menu to give specific details about the data in a trace capture.

The analyzer module source code should include
import analyzer_tools
to bring in useful definitions. The source code must define
tool_menu_string = 'Menu Label'
to give the label for this tool in the Main Menu, and
tool_title_string = 'Title Label'
to give (when in doubt) a string to put in the title of this analyzer's windows.

The analyzer module source code must define
class AnalyzerDialog (wx.Dialog):
logic_sniffer.py will run this dialog before it runs the analyzer. The dialog will obtain or edit the option values that the analyzer will use.
The dialog must have these methods:

def GetValue (self):
return all the options in the form the analyzer will use them. A dict with key-strings and values is the best way to do this.
def SetValue (self, settings):
accept option values and set those values in the appropriate dialog fields. The argument is:
settings
None, or an object returned from GetValue giving option values. If settings is None, SetValue should set up default values.

The analyzer module source code must define
class AnalyzerFrame (analyzer_tools.AnalyzerFrame):
to create an independent window to hold the analysis report. After it obtains the analysis options from AnalyzerDialog, logic_sniffer.py creates this window to show the analysis. The frame object must have these methods, which are called by analyzer_tools.AnalyzerFrame to set up the analysis window:

def CreatePanel (self, settings, tracedata):
create the analysis report. The arguments are:
settings
the object returned by AnalyzerDialog.GetValue containing the analysis options.
tracedata
a logic_sniffer_classes.TraceData instance which contains all the information about the captured data.
def SettingsDescription (self, settings):
supplies a string describing the analysis options. The settings argument is the object returned from AnalyzerDialog.GetValue containing the analysis options.
def SetTitle (self, title):
supplies a title string for the analysis window.

Before AnalyzerFrame was invented, logic_sniffer.py would create an AnalyzerPanel object defined in the tool module, and put it in a page of the same notebook used for traces. This is deprecated, but the classes still exist as fossils in the three standard analyzers.

For study, the simplest analyzer of the three is probably analyzer_tool_spi.py . The major work of importing and running analyzers is in logic_sniffer.py in the methods _load_plugins and OnToolSelection.