User`s manual

Writing Custom Applications
//
// Member Data
Innovative::X5_400M Module;
IUserInterface * UI;
Innovative::PacketStream Stream;
IntArray _Rx;
unsigned int Cursor;
ii64 BlocksToLog;
bool Opened;
bool Stopped;
bool StreamConnected;
Innovative::StopWatch Clock;
Innovative::DataLogger Logger;
IntArray DataRead;
Innovative::BinView Graph;
Innovative::Scripter Script;
float ActualSampleRate;
std::string Root;
Innovative::AveragedRate Time;
double FBlockRate;
std::string FVersion;
Innovative::SoftwareTimer Timer;
...
In Malibu, objects are defined to represent units of hardware as well as software units. The X5_400M object represents the
board. The PacketStream object encapsulates supported, board-specific operations related to I/O Streaming. A Scripter object
can be used to add a simple scripting language to the application, for the purposes of performing hardware initialization
during FPGA firmware development. The Buffer class object is used to access buffer contents.
When the Open button is pressed, the application io object begins the process of setting up the board for a run. The first thing
done is to link Malibu software events to callback functions in the applications by setting the handler functions:
// Hook script event handlers.
Script.OnCommand.SetEvent(this, &ApplicationIo::HandleScriptCommand);
Script.OnMessage.SetEvent(this, &ApplicationIo::HandleScriptMessage);
This code attaches script event handlers to their corresponding events. Malibu has a method where functions can be 'plugged
into' the library to be called at certain times or in response to certain events detected. Events allow a tight integration between
an application and the library. These events are informational messages issued by the scripting and logic loader feature of the
module. They display feedback during the loading of the user logic and when script is used.
//
// Configure Module Event Handlers
Module.OnBeforeStreamStart.SetEvent(this, &ApplicationIo::HandleBeforeStreamStart);
Module.OnBeforeStreamStart.Synchronize();
Module.OnAfterStreamStart.SetEvent(this, &ApplicationIo::HandleAfterStreamStart);
Module.OnAfterStreamStart.Synchronize();
Module.OnAfterStreamStop.SetEvent(this, &ApplicationIo::HandleAfterStreamStop);
Module.OnAfterStreamStop.Synchronize();
Similarly, HandleBeforeStreamStart, HandleAfterStreamStart and HandleAfterStreamStop handle events issued on before
stream start, after stream start and after stream stop respectively. These handlers could be designed to perform multiple tasks
as event occurs including displaying messages for user. These events are tagged as Synchronized, so Malibu will marshal the
execution of the handlers for these events into the main thread context, allowing the handlers to perform user-interface
operations.
//
X5-GSPS User's Manual 49