Modules are a collection of functions and global data dedicated to decoding a certain type of transaction. Each module consists of one primary file (.dec), and possibly several included files (.inc).
Module Functions
Three functions are used as entry points into a decoding module. They are called by the application and are used both in the initial transaction decoding phase, and each time that a transaction needs to be displayed.
ProcessData()
Called repeatedly with input contexts representing transactions of the specified input types. Decides if input transaction is a member of this transaction, or if it begins a new transaction. This function will be called first using incomplete output transactions. If the input transaction is not accepted into any of the pending transactions, it will be called with an empty output transaction to see if it starts a new transaction.
CollectData()
Called with each input transaction that was previously accepted by the function ProcessData. Generates all output context data that would be required for input into a higher level transaction.
BuildCellList()
Called with the output context generated by the call to CollectData, and no input context. This function is responsible for adding display cells based on the data collected by CollectData.
Note that there is some flexibility in the use of these functions. For example, if it is easier for a particular protocol to build cells in CollectData, cells could be generated there, and BuildCellList could be left empty. Another approach would be to have ProcessData do everything (generate output data, and build cell lists) and then implement CollectData as a pass-through to ProcessData. This will be less efficient in the decoding phase but may reduce some repetition of code. These decisions are dependent on the protocol to be decoded.
Module Data
There are several standard global variables that should be defined in a module which are queried by the application to figure out what the module is supposed to do.
ModuleType
Required. A string describing the role of the script. Currently, only Transaction Decoder and DataBlock Decoder are valid.
Example
set ModuleType = "Transaction Decoder";
Transaction Decoder uses ProcessData(). DataBlock Decoder does not.
OutputType
Required. A string label describing the output of the script.
Example
set OutputType = "AV/C Transaction";
InputType
Required. A string label describing the input to the script. Input and output types should be matched by the application in order to decide which modules to invoke on which contexts.
Example
set InputType = "1394 Transaction";
LevelName
Optional. A string that names this decoder.
Example
set LevelName = "AV/C Test Transactions";
DecoderDesc
Optional. A string that describes this decoder. Displays as a toolbar icon tool tip.
Example
set DecoderDesc = "View test transactions";
Icon
Optional. File name of an icon to display on the toolbar. Must be a 19x19 pixel bitmap file.
Example
set Icon = "bitmap.bmp";