Connects to an instrument profile URL and reads instrument profiles using Simple File Format with support of streaming live updates. Please see Instrument Profile Format documentation for complete description.
More...
|
delegate void | OnErrorEventHandler (object sender, ErrorEventArgs e) |
|
| InstrumentProfileConnection (string address) |
| Creates instrument profile connection with a specified address and Address may be just "<host>:<port>" of server, URL, or a file path. The "[update=<period>]" clause can be optionally added at the end of the address to specify an UpdatePeriod via an address string. Default update period is 1 minute. Connection needs to be started to begin an actual operation. More...
|
|
| InstrumentProfileConnection (string address, string login, string password) |
| Creates instrument profile connection with a specified address and basic user and password credentials Address may be just "<host>:<port>" of server, URL, or a file path. The "[update=<period>]" clause can be optionally added at the end of the address to specify an UpdatePeriod via an address string. Default update period is 1 minute. Connection needs to be started to begin an actual operation. More...
|
|
| InstrumentProfileConnection (string address, string token) |
| Creates instrument profile connection with a specified address and bearer token Address may be just "<host>:<port>" of server, URL, or a file path. The "[update=<period>]" clause can be optionally added at the end of the address to specify an UpdatePeriod via an address string. Default update period is 1 minute. Connection needs to be started to begin an actual operation. More...
|
|
void | Start () |
| Starts this instrument profile connection. This connection's state immediately changes to State.Connecting and the actual connection establishment proceeds in the background. More...
|
|
void | Close () |
| Closes this instrument profile connection. This connection's state immediately changes to State.Closed and the background update procedures are terminated. More...
|
|
void | AddUpdateListener (InstrumentProfileUpdateListener listener) |
| Adds listener that is notified about any updates in the set of instrument profiles. If a set of instrument profiles is not empty, then this listener is immediately notified right from inside this add method. More...
|
|
void | RemoveUpdateListener (InstrumentProfileUpdateListener listener) |
| Removes listener that is notified about any updates in the set of instrument profiles. More...
|
|
override string | ToString () |
| Returns a string representation of the object. More...
|
|
Connects to an instrument profile URL and reads instrument profiles using Simple File Format with support of streaming live updates. Please see Instrument Profile Format documentation for complete description.
The key different between this class and InstrumentProfileReader is that the later just reads a snapshot of a set of instrument profiles, while this classes allows to track live updates, e.g. addition and removal of instruments.
To use this class you need an address of the data source from you data provider. The name of the IPF file can also serve as an address for debugging purposes.
The recommended usage of this class to receive a live stream of instrument profile updates is:
class UpdateListener : InstrumentProfileUpdateListener {
public void InstrumentProfilesUpdated(ICollection<InstrumentProfile> instruments) {
foreach (InstrumentProfile ip in instruments) {
}
}
}
class Program {
static void Main(string[] args) {
string address = "<host>:<port>";
InstrumentProfileConnection connection = new InstrumentProfileConnection(path);
UpdateListener updateListener = new UpdateListener();
connection.AddUpdateListener(updateListener);
connection.Start();
}
}
If long-running processing of instrument profile is needed, then it is better to use InstrumentProfileUpdateListener.InstrumentProfilesUpdated notification to schedule processing task in a separate thread.
This class is thread-safe.