Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

addListener

Add event handling listener to FIX Flyer connection

Syntax

lh = addListener(c,listener)

Description

example

lh = addListener(c,listener) adds the event handling listener listener to the FIX Flyer™ Engine connection c. Use the sample event handling listener fixExampleListener or write a custom event handling listener function.

Examples

collapse all

First, create a FIX Flyer Engine connection. Then, add a FIX Flyer event listener to the FIX Flyer Engine connection, and listen for and display the event data in the Workspace browser.

Create the FIX Flyer Engine connection c using these arguments:

  • User name username

  • Password password

  • IP address ipaddress

  • Port number port

username = 'user';
password = 'pwd';
ipaddress = '127.0.0.1';
port = 7002;

c = fixflyer(username,password,ipaddress,port);

Add the FIX Flyer event listener to the FIX Flyer Engine connection. Use the sample event handling listener fixExampleListener to listen for and display the FIX Flyer Engine event data in the Workspace browser. To access the code for the listener, enter edit fixExampleListener.m. Or, to process the event data in another way, you can write a custom event handling listener function. For details, see Create Functions in Files (MATLAB).

Process the FIX Flyer Engine events e using the sample event handling listener fixExampleListener. Specify e as any letter. fixExampleListener returns a handle to the listener lh.

lh = addListener(c,@(~,e)fixExampleListener(e,c));

When events occur, fixExampleListener returns event data to objects in the MATLAB® Workspace. To view event data, double-click the object. The Variables dialog box displays the data in the object.

Close the FIX Flyer Engine connection.

close(c)

Input Arguments

collapse all

FIX Flyer Engine connection, specified as a fixflyer object.

Listener event handler, specified as a function handle to listen for FIX Flyer Engine event data. You can modify the existing listener function or define your own. The code for the existing listener function is in the fixExampleListener.m file.

Data Types: function_handle

Output Arguments

collapse all

Listener handle, returned as a handle to a FIX Flyer listener object.

Introduced in R2015b

Was this topic helpful?