OptoMMP2
Opto22.StreamsHelper.OptoStrategyStream Class Reference

Encapsulation class for embedded strategy oriented streaming (for streaming features not supported by OptoMMPStream). More...

Public Member Functions

DateTime GetLastMessageTimeStamp ()
 Returns the last time any message was received from the device. More...
 
DateTime GetLastHeartbeatTimeStamp ()
 Returns the last time a heartbeat message was received. More...
 
DateTime Get64DigitalStatesAndLatches (out long i64DigitalStates, out long i64DigitalOnLatches, out long i64DigitalOffLatches)
 Retrieve 64 digital states and latches. More...
 
DateTime Get64AnalogStates (out Single[] f32aryAnalog64States)
 Retrieve the 64-point analog states. More...
 
DateTime GetAnalog64MaxMin (out Single[] f32aryAnalog64Max, out Single[] f32aryAnalog64Min)
 Retrieve the Analog 64-point Maximum and Minimum values. More...
 
DateTime GetHDDigitalStates (out int[] i32aryHDDigitalStates)
 Retrieve the High-Density Digital States More...
 
DateTime GetLower256AnalogStates (out Single[] f32aryLower256AnalogStates)
 Get a copy of the lower 256 analog states (high-density analog included). More...
 
DateTime GetUpper256AnalogStates (out Single[] f32aryUpper256AnalogStates)
 Get a copy of the uppper 256 analog states (high-density analog included) More...
 
 OptoStrategyStream ()
 Constructor More...
 
void Open (int i32UdpPort, string sSourceIpAddress)
 Configures the object to receive an OptoStrategy Stream. More...
 
void Close ()
 Close the object. More...
 
void Start ()
 Start the a background thread that processes the stream data. More...
 
void Stop ()
 Stop the background thread. More...
 
void Example ()
 Example using the OptoStreamsHelper More...
 

Public Attributes

uint u32NumberOfDroppedPackets = 0
 Counts how many times a packet from an unwanted host is received More...
 

Detailed Description

Encapsulation class for embedded strategy oriented streaming (for streaming features not supported by OptoMMPStream).

Requires a SNAP-PAC-R1/2 Controller running a special strategy "Streaming Strategy." The strategy uses scratchpad resources to configure the stream. See the notes within this strategy for additional configuration information.

Since this is employed with the strategy, there will be a bit more jitter for high frequency applications. If you're running in the 100ms range, you may have a 1 to 2 ms jitter. This may vary slightly depending on module configuration and which particular data you have enabled. Less enabled data means more consistent updates. More enabled data means more jitter (less consistent updates).

This library is currently built with the 3.5 SP1 .Net Framework.

This library supports XP Professional, Vista Business, and Windows 7 Professional.

You should use an Intel "Core 2" or AMD Athlon II or Phenom (or newer) microprocessor.

Constructor & Destructor Documentation

Opto22.StreamsHelper.OptoStrategyStream.OptoStrategyStream ( )

Constructor

Member Function Documentation

void Opto22.StreamsHelper.OptoStrategyStream.Close ( )

Close the object.

void Opto22.StreamsHelper.OptoStrategyStream.Example ( )

Example using the OptoStreamsHelper

class Program { static void Main(string[] args) { OptoStrategyStream StrategyStream = new OptoStrategyStream();

Console.WriteLine("First Pass"); StrategyStream.Open(5001, "10.192.54.74"); StrategyStream.Start();

int i32Counter = 0; while (i32Counter < 15) { Thread.Sleep(1000); i32Counter++; }

StrategyStream.Stop(); Console.WriteLine("Second Start"); StrategyStream.Start(); i32Counter = 0; while (i32Counter < 30) { // todo: use the get functions to retrieve the data Thread.Sleep(1000); i32Counter++; }

StrategyStream.Close();

Console.WriteLine("Second Open"); StrategyStream.Open(5001, "10.192.54.74"); StrategyStream.Start();

i32Counter = 0; while (i32Counter < 15) { // todo: use the get functions to retrieve the data Thread.Sleep(1000); i32Counter++; }

StrategyStream.Stop(); Console.WriteLine("fourth Start"); StrategyStream.Start(); i32Counter = 0; while (i32Counter < 30) { // todo: use the get functions to retrieve the data Thread.Sleep(1000); i32Counter++; }

StrategyStream.Close(); } }

DateTime Opto22.StreamsHelper.OptoStrategyStream.Get64AnalogStates ( out Single[]  f32aryAnalog64States)

Retrieve the 64-point analog states.

Parameters
f32aryAnalog64StatesAnalog values.
Returns
Last DateTime stamp this data was updated.
DateTime Opto22.StreamsHelper.OptoStrategyStream.Get64DigitalStatesAndLatches ( out long  i64DigitalStates,
out long  i64DigitalOnLatches,
out long  i64DigitalOffLatches 
)

Retrieve 64 digital states and latches.

Parameters
i64DigitalStates64-point digital states.
i64DigitalOnLatches64-point on latches.
i64DigitalOffLatches64-point off latches.
Returns
Last timestamp when these values were updated.
DateTime Opto22.StreamsHelper.OptoStrategyStream.GetAnalog64MaxMin ( out Single[]  f32aryAnalog64Max,
out Single[]  f32aryAnalog64Min 
)

Retrieve the Analog 64-point Maximum and Minimum values.

Parameters
f32aryAnalog64MaxArray of the maximum values.
f32aryAnalog64MinArray of the minimum values.
Returns
DateTime stamp of the last time these values were updated.
DateTime Opto22.StreamsHelper.OptoStrategyStream.GetHDDigitalStates ( out int[]  i32aryHDDigitalStates)

Retrieve the High-Density Digital States

Parameters
i32aryHDDigitalStatesArray of digital states (32-points per module supported)
Returns
DateTime stamp when this data was last updated.
DateTime Opto22.StreamsHelper.OptoStrategyStream.GetLastHeartbeatTimeStamp ( )

Returns the last time a heartbeat message was received.

Returns
DateTime Opto22.StreamsHelper.OptoStrategyStream.GetLastMessageTimeStamp ( )

Returns the last time any message was received from the device.

Returns
DateTime Opto22.StreamsHelper.OptoStrategyStream.GetLower256AnalogStates ( out Single[]  f32aryLower256AnalogStates)

Get a copy of the lower 256 analog states (high-density analog included).

Parameters
f32aryLower256AnalogStatesValues from the first 8 module positions.
Returns
DateTime stamp when this data was last updated.
DateTime Opto22.StreamsHelper.OptoStrategyStream.GetUpper256AnalogStates ( out Single[]  f32aryUpper256AnalogStates)

Get a copy of the uppper 256 analog states (high-density analog included)

Parameters
f32aryUpper256AnalogStates
Returns
void Opto22.StreamsHelper.OptoStrategyStream.Open ( int  i32UdpPort,
string  sSourceIpAddress 
)

Configures the object to receive an OptoStrategy Stream.

This is an enhanced strategy oriented streaming function that operates on PAC-R controllers. The controller must have the strategy downloaded and running.

Parameters
i32UdpPortThe service port to use on this computer.
sSourceIpAddressIP address of the controller which is the source of the data.
void Opto22.StreamsHelper.OptoStrategyStream.Start ( )

Start the a background thread that processes the stream data.

void Opto22.StreamsHelper.OptoStrategyStream.Stop ( )

Stop the background thread.

Member Data Documentation

uint Opto22.StreamsHelper.OptoStrategyStream.u32NumberOfDroppedPackets = 0

Counts how many times a packet from an unwanted host is received


The documentation for this class was generated from the following file: