OptoMMP3
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Opto22.StreamsHelper.OptoMMPStream Class Reference

Encapsulation class for assisting streaming implementations using the OptoMMP streaming capability. More...

Public Member Functions

delegate void ProcessStream (StreamMessage Message)
 Delegate to process the stream message. More...
 
 OptoMMPStream ()
 Constructor More...
 
void Open (Int32 i32UdpPort, ProcessStream MessageHandler)
 Open the OptoMMPStream object More...
 
Int32 Start ()
 Start the stream object on the PC side. More...
 
void Stop ()
 Stop the background thread. More...
 
void Close ()
 Close the whole object. More...
 

Static Public Member Functions

static Boolean ProcessMessageasBrainStream (StreamMessage Message, out EndPoint endpoint, out short i16SequenceId, out Single[] faryAnalog, out UInt32[] u32aryCounters, out UInt64 u64DigitalStates, out UInt64 u64OnLatches, out UInt64 u64OffLatches, out UInt64 u64ActiveCounters)
 Process a message returned as a callback. This handles the default "streaming" configuration of the Opto MMP device. More...
 
static Boolean ProcessMessageasBrainStreamUint32Array (StreamMessage Message, out EndPoint endpoint, out Int16 i16SequenceId, out UInt32 u32ExpectedMmpAddress, Int32 i32ExpectedU32Ints, out UInt32[] u32aryValues)
 Process a message returned as a callback. This handles a customer stream of just 32-bit unsigned integers. The data may be casted as 32-bit signed integers too. More...
 
static Boolean ProcessMessageasBrainStreamSingleArray (StreamMessage Message, out EndPoint endpoint, out Int16 i16SequenceId, out Int32 i32ExpectedMmpAddress, Int32 i32ExpectedSingles, out Single[] f32aryValues)
 Process a message returned as a callback. This handles a custom stream of floats (aka Singles). More...
 
static Boolean ProcessMessageasBrainStreamRawBytes (StreamMessage Message, out EndPoint endpoint, out int i32DataLength, out Byte[] byary)
 Process a message returned as a callback. This handles a custom stream of floats (aka Singles). More...
 

Detailed Description

Encapsulation class for assisting streaming implementations using the OptoMMP streaming capability.

This functionality is available with any Opto 22 Ethernet based I/O brain.

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

This library supports Windows 7 Professional, Windows 8.1 Professional. Please use an Intel "Core 2" or AMD Athlon II or Phenom (or newer) microprocessor.

Constructor & Destructor Documentation

Opto22.StreamsHelper.OptoMMPStream.OptoMMPStream ( )

Constructor

Member Function Documentation

void Opto22.StreamsHelper.OptoMMPStream.Close ( )

Close the whole object.

void Opto22.StreamsHelper.OptoMMPStream.Open ( Int32  i32UdpPort,
ProcessStream  MessageHandler 
)

Open the OptoMMPStream object

Parameters
i32UdpPortThe PC UDP port to receive data on.
MessageHandlerDelegate call-back routine to handle the received message.
static Boolean Opto22.StreamsHelper.OptoMMPStream.ProcessMessageasBrainStream ( StreamMessage  Message,
out EndPoint  endpoint,
out short  i16SequenceId,
out Single[]  faryAnalog,
out UInt32[]  u32aryCounters,
out UInt64  u64DigitalStates,
out UInt64  u64OnLatches,
out UInt64  u64OffLatches,
out UInt64  u64ActiveCounters 
)
static

Process a message returned as a callback. This handles the default "streaming" configuration of the Opto MMP device.

Many Opto MMP devices may be configured to stream at one thread. Each device may be determined by comparing the "EndPoint" information.

Since this is UDP, the receiver should inspect the "endpoint" address to ensure it can identify the correct sender of this message.

Parameters
MessageThe message given by the callback.
endpointThe source of the message.
i16SequenceIdSequence ID of this message, a value from 0 to 15.
faryAnalog64 analog values of the brain.
u32aryCountersValue of the enabled digital input counters (from 64 point map)
u64DigitalStates64-bit compressed value of all the 64-point digital states. 1 == on.
u64OnLatches64-bit compressed value of all the 64-point digital on latches. 1 == latched.
u64OffLatches64-bit compressed value of all the 64-point digital off latches. 1 == latched.
u64ActiveCounters64-bit compressed value of all the active counter states. 1 == enabled.
Returns
true if the received message is a valid default stream message, false if it is not.
static Boolean Opto22.StreamsHelper.OptoMMPStream.ProcessMessageasBrainStreamRawBytes ( StreamMessage  Message,
out EndPoint  endpoint,
out int  i32DataLength,
out Byte[]  byary 
)
static

Process a message returned as a callback. This handles a custom stream of floats (aka Singles).

Many Opto MMP devices may be configured to stream at one thread. Each device may be determined by comparing the "EndPoint" information.

Since this is UDP, the receiver should inspect the "endpoint" address to ensure it can identify the correct sender of this message.

Parameters
MessageThe message given by the callback.
endpointThe source of the message.
i32DataLengthLength of the data in bytes.
byaryThe data received.
Returns
true if the received message is a valid default stream message, false if it is not.
static Boolean Opto22.StreamsHelper.OptoMMPStream.ProcessMessageasBrainStreamSingleArray ( StreamMessage  Message,
out EndPoint  endpoint,
out Int16  i16SequenceId,
out Int32  i32ExpectedMmpAddress,
Int32  i32ExpectedSingles,
out Single[]  f32aryValues 
)
static

Process a message returned as a callback. This handles a custom stream of floats (aka Singles).

Many Opto MMP devices may be configured to stream at one thread. Each device may be determined by comparing the "EndPoint" information.

Since this is UDP, the receiver should inspect the "endpoint" address to ensure it can identify the correct sender of this message.

Parameters
MessageThe message given by the callback.
endpointThe source of the message.
i16SequenceIdSequence ID of this message, a value from 0 to 15.
i32ExpectedMmpAddressThe OptoMMP address reported.
i32ExpectedSinglesThe number of expected singles in the response.
f32aryValues
Returns
true if the received message is a valid default stream message, false if it is not.
static Boolean Opto22.StreamsHelper.OptoMMPStream.ProcessMessageasBrainStreamUint32Array ( StreamMessage  Message,
out EndPoint  endpoint,
out Int16  i16SequenceId,
out UInt32  u32ExpectedMmpAddress,
Int32  i32ExpectedU32Ints,
out UInt32[]  u32aryValues 
)
static

Process a message returned as a callback. This handles a customer stream of just 32-bit unsigned integers. The data may be casted as 32-bit signed integers too.

Many Opto MMP devices may be configured to stream at one thread. Each device may be determined by comparing the "EndPoint" information.

Since this is UDP, the receiver should inspect the "endpoint" address to ensure it can identify the correct sender of this message.

Parameters
MessageThe message given by the callback.
endpointThe source of the message.
i16SequenceIdSequence ID of this message, a value from 0 to 15.
u32ExpectedMmpAddressThe expected Opto MMP address of the packet.
i32ExpectedU32IntsExpected number of 32-bit integers to receive.
u32aryValuesThe values received.
Returns
true if the received message is a valid default stream message, false if it is not.
delegate void Opto22.StreamsHelper.OptoMMPStream.ProcessStream ( StreamMessage  Message)

Delegate to process the stream message.

Parameters
MessageA raw message buffer containing the data that arrived on the UDP socket.
Int32 Opto22.StreamsHelper.OptoMMPStream.Start ( )

Start the stream object on the PC side.

Returns
Negative value for error, probably for overlapping UDP service ports. Zero for okay.
void Opto22.StreamsHelper.OptoMMPStream.Stop ( )

Stop the background thread.


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