Opto22.Controller
Controller .Net Software Development Kit for SNAP-PAC
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Opto22.Controller.Controller Class Reference

PAC-DEV-CONTROLLER-DOTNET; Controller .Net Software Development Kit for SNAP-PAC .Net Framework 4.0 Windows 7, Windows 8/8.1, More...

Inherits IDisposable.

Classes

class  Item
 Item class for configuring and submitting grouped item reads. More...
 
class  MessageEntry
 This object type is returned when reading the control controller's message queue. More...
 

Public Types

enum  FastDataAccessEnumerations { FastDataAccessEnumerations.NotSet = -1, FastDataAccessEnumerations.Version1 = 0, FastDataAccessEnumerations.Version2 = 1 }
 Enumerations for the generation of data access commands More...
 
enum  eChartStatus { eChartStatus.Stopped, eChartStatus.Running, eChartStatus.Suspended }
 Chart status enumerations. Simpler to use than the numeric version. More...
 
enum  ErrorResponse { ErrorResponse.Success = 0, ErrorResponse.ArgumentFault, ErrorResponse.ItemFault, ErrorResponse.CommunicationFault }
 List of response codes from data accessing methods. More...
 

Public Member Functions

 Controller ()
 Constructor More...
 
void Dispose ()
 Dispose More...
 
ErrorResponse OpenSession (String sHost, Int32 i32Port, Int32 i32CommunicationTimeoutMs)
 Open a communication session with a SNAP-PAC Controller. If a TCP session was open, this method will close the old session and attempt to connect. More...
 
void CloseSession ()
 Close the tcp session to the controller. More...
 
ErrorResponse ReadGroupItems (Item[] aryItems, Int32 i32ItemListStartIndex, Int32 i32NumberOfItemsToRead)
 Read an item list as a group. This is the preferrable method when reading a large number of objects. More...
 
ErrorResponse ReadItemPuc ()
 Power up clear. Note, this function is performed automatically when the object is successfully connected. More...
 
ErrorResponse ReadItem (Controller.Item.eItemTypes eType, out Int32 i32Value)
 Read single 32-bit integer non-variable item. More...
 
ErrorResponse ReadItem (Controller.Item.eItemTypes eType, out String sValue)
 Read non-variable string parameters. More...
 
ErrorResponse Read32BitIntegerVariable (String sTag, Boolean bTagIsPointer, out Int32 i32Variable)
 Read 32-bit integer variable. More...
 
ErrorResponse Read64BitIntegerVariable (String sTag, Boolean bTagIsPointer, out Int64 i64Variable)
 Read 64-bit integer variable. More...
 
ErrorResponse Read32BitFloatVariable (String sTag, Boolean bTagIsPointer, out Single f32Variable)
 Read 32-bit float variable. More...
 
ErrorResponse ReadUpTimerVariable (String sTag, Boolean bTagIsPointer, out Single f32Variable)
 Read up timer variable. More...
 
ErrorResponse ReadDownTimerVariable (String sTag, Boolean bTagIsPointer, out Single f32Variable)
 Read down timer variable. More...
 
ErrorResponse ReadStringVariable (String sTag, Boolean bTagIsPointer, out String sVariable)
 Read string variable. More...
 
ErrorResponse Read32BitIntegerTable (String sTag, Boolean bTagIsPointer, Int32 i32StartIndex, Int32 i32Quantity, out Int32[] i32aryTable)
 Read 32-bit integer table. More...
 
ErrorResponse Read64BitIntegerTable (String sTag, Boolean bTagIsPointer, Int32 i32StartIndex, Int32 i32Quantity, out Int64[] i64aryTable)
 Read 64-bit integer table. More...
 
ErrorResponse Read32BitFloatTable (String sTag, Boolean bTagIsPointer, Int32 i32StartIndex, Int32 i32Quantity, out Single[] f32aryTable)
 Read 32-bit float table. More...
 
ErrorResponse ReadStringTable (String sTag, Boolean bTagIsPointer, Int32 i32StartIndex, Int32 i32Quantity, out String[] saryTable)
 Read string table. More...
 
ErrorResponse ReadChartStatus (String sTag, Boolean bTagIsPointer, out eChartStatus eStatus)
 Read chart status. More...
 
ErrorResponse WriteControllerDateTimeUsingPcLocalTime ()
 Update controller's date/time using PC's local date/time. More...
 
ErrorResponse WriteStopControllerStrategy ()
 Stop controller strategy. More...
 
ErrorResponse WriteStartControllerStrategy ()
 Start controller strategy. More...
 
ErrorResponse WriteClearControllerMessageQueue ()
 Clear controller message queue. More...
 
ErrorResponse WriteAnalogPointAttribute (String sTag, Boolean bTagIsPointer, Controller.Item.eAnalogPointAttributes eAnalogAttribute, Single f32Value)
 Write analog float attribute. More...
 
ErrorResponse WriteDiscretePointAttribute (String sTag, Boolean bTagIsPointer, Controller.Item.eDiscretePointAttributes eDiscreteAttribute, Boolean bState)
 Write discrete point boolean attribute. More...
 
ErrorResponse WriteUpTimerVariable (String sTag, Boolean bTagIsPointer, Single f32Value)
 Write a up timer variable. More...
 
ErrorResponse WriteDownTimerVariable (String sTag, Boolean bTagIsPointer, Single f32Value)
 Write a down timer variable. More...
 
ErrorResponse Write32BitFloatVariable (String sTag, Boolean bTagIsPointer, Single f32Value)
 Write a 32-bit float variable. More...
 
ErrorResponse Write32BitFloatTable (String sTag, Boolean bTagIsPointer, Single[] f32aryValues, Int32 i32ControllerStartIndex, Int32 i32WriteLength)
 Write 32-bit float table. More...
 
ErrorResponse Write32BitIntegerVariable (String sTag, Boolean bTagIsPointer, Int32 i32Value)
 Write an 32-bit integer variable. More...
 
ErrorResponse Write32BitIntegerTable (String sTag, Boolean bTagIsPointer, Int32[] i32aryValues, Int32 i32ControllerStartIndex, Int32 i32WriteLength)
 Write 32-bit integer table. More...
 
ErrorResponse WriteDateTimeFromUser (Int32[] i32aryValues)
 Write controller date/time via supplied data. More...
 
ErrorResponse Write64BitIntegerVariable (String sTag, Boolean bTagIsPointer, Int64 i64Value)
 Write a 64-bit integer. More...
 
ErrorResponse Write64BitIntegerTable (String sTag, Boolean bTagIsPointer, Int64[] i64aryValues, Int32 i32ControllerStartIndex, Int32 i32WriteLength)
 Write a 64-bit integer table. More...
 
ErrorResponse WriteChartStatus (String sTag, Controller.Item.eItemTypes eType)
 Modify the status of a controller chart. More...
 
ErrorResponse WriteStringVariable (String sTag, Boolean bTagIsPointer, String sValue)
 Write a string variable. More...
 
ErrorResponse WriteStringTable (String sTag, Boolean bTagIsPointer, String[] sary, Int32 i32ControllerStartIndex, Int32 i32WriteLength)
 Write a string table. More...
 
Boolean PopMessageLogged (out String sMessage)
 Removes the newest logged message off the event log. Oldest messages are flushed if the list becomes too full. More...
 

Static Public Member Functions

static Item[] NewItemList (Int32 i32ItemQuantity)
 Create a new item list. More...
 

Protected Member Functions

virtual void Dispose (Boolean bDisposing)
 Clean up resources. More...
 

Properties

Boolean FragmentedTransmissions [get]
 Returns if fragmented transmissions is configured. Only valid after a successful communication opening to the controller. More...
 
FastDataAccessEnumerations DataAccessMethod [get]
 Retrieve controller data protocol grouped data access method. More...
 
Int32 CommunicationTimeout [get, set]
 Communication timeout in units of milliseconds. 100 millisecond minimum enforced. Normally this value is usually 1000 milliseconds or larger. More...
 
Int32 MessageLogCount [get]
 Returns how many messages are logged in the queue. More...
 

Detailed Description

PAC-DEV-CONTROLLER-DOTNET; Controller .Net Software Development Kit for SNAP-PAC .Net Framework 4.0 Windows 7, Windows 8/8.1,

Member Enumeration Documentation

Chart status enumerations. Simpler to use than the numeric version.

Enumerator
Stopped 

The chart is stopped.

Running 

The chart is running.

Suspended 

The chart is suspended.

List of response codes from data accessing methods.

Enumerator
Success 

Successful operation.

ArgumentFault 

An argument of the method (attribute or type) is not supported by this method.

ItemFault 

If the method accesses a table, the indexes specified may be out of range. If the method contains a controller tag, the tag does not exist on the controller, the tag is misspelled or case incorrect.

CommunicationFault 

A communication fault occurred. Close the communication using CloseSession(); backoff for at least one second and attempt to connect using OpenSession().

Enumerations for the generation of data access commands

Enumerator
NotSet 

Not yet set. Do not use.

Version1 

Original access method.

Version2 

Reserved, not yet implemented.

Constructor & Destructor Documentation

Opto22.Controller.Controller.Controller ( )

Constructor

Member Function Documentation

void Opto22.Controller.Controller.CloseSession ( )

Close the tcp session to the controller.

void Opto22.Controller.Controller.Dispose ( )

Dispose

virtual void Opto22.Controller.Controller.Dispose ( Boolean  bDisposing)
protectedvirtual

Clean up resources.

Parameters
bDisposing
static Item [] Opto22.Controller.Controller.NewItemList ( Int32  i32ItemQuantity)
static

Create a new item list.

Parameters
i32ItemQuantityThe maximum number of items in this list.
Returns
The new item list.
ErrorResponse Opto22.Controller.Controller.OpenSession ( String  sHost,
Int32  i32Port,
Int32  i32CommunicationTimeoutMs 
)

Open a communication session with a SNAP-PAC Controller. If a TCP session was open, this method will close the old session and attempt to connect.

Parameters
sHostHost name (fully qualified domain name) in host name or IPV4 dot format (like 1.2.3.4).
i32PortPort number, typically 22001.
i32CommunicationTimeoutMsInitial communication timeout, typically 1000 ms.
Returns
ErrorResponse.CommunicationFault for a timeout or communication fault.
Boolean Opto22.Controller.Controller.PopMessageLogged ( out String  sMessage)

Removes the newest logged message off the event log. Oldest messages are flushed if the list becomes too full.

Parameters
sMessageStorage of the topmost message.
Returns
True when message retreived from list, false when list is empty.
ErrorResponse Opto22.Controller.Controller.Read32BitFloatTable ( String  sTag,
Boolean  bTagIsPointer,
Int32  i32StartIndex,
Int32  i32Quantity,
out Single[]  f32aryTable 
)

Read 32-bit float table.

Parameters
sTagController variable to read.
bTagIsPointerTrue if the tag is a pointer.
i32StartIndexController table start index.
i32QuantityNumber of elements to read.
f32aryTableWhen return is true and bSuccess is true, the value read from the controller.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Read32BitFloatVariable ( String  sTag,
Boolean  bTagIsPointer,
out Single  f32Variable 
)

Read 32-bit float variable.

Parameters
sTagController variable to read.
bTagIsPointerTrue if the tag is a pointer.
f32VariableWhen return is true and bSuccess is true, the value read from the controller.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Read32BitIntegerTable ( String  sTag,
Boolean  bTagIsPointer,
Int32  i32StartIndex,
Int32  i32Quantity,
out Int32[]  i32aryTable 
)

Read 32-bit integer table.

Parameters
sTagController variable to read.
bTagIsPointerTrue if the tag is a pointer.
i32StartIndexController table start index.
i32QuantityNumber of elements to read.
i32aryTableWhen return is true and bSuccess is true, the table read from the controller.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Read32BitIntegerVariable ( String  sTag,
Boolean  bTagIsPointer,
out Int32  i32Variable 
)

Read 32-bit integer variable.

Parameters
sTagController variable to read.
bTagIsPointerTrue if the tag is a pointer.
i32VariableWhen return is true and bSuccess is true, the value read from the controller.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Read64BitIntegerTable ( String  sTag,
Boolean  bTagIsPointer,
Int32  i32StartIndex,
Int32  i32Quantity,
out Int64[]  i64aryTable 
)

Read 64-bit integer table.

Parameters
sTagController variable to read.
bTagIsPointerTrue if the tag is a pointer.
i32StartIndexController table start index.
i32QuantityNumber of elements to read.
i64aryTableWhen return is true and bSuccess is true, the value read from the controller.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Read64BitIntegerVariable ( String  sTag,
Boolean  bTagIsPointer,
out Int64  i64Variable 
)

Read 64-bit integer variable.

Parameters
sTagController variable to read.
bTagIsPointerTrue if the tag is a pointer.
i64VariableWhen return is true and bSuccess is true, the value read from the controller.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.ReadChartStatus ( String  sTag,
Boolean  bTagIsPointer,
out eChartStatus  eStatus 
)

Read chart status.

Parameters
sTagCase sensitive name of the chart to interrogate.
bTagIsPointerTrue if the tag is a pointer variable to a chart.
eStatusStatus of the chart. Valid only when the method returns a successful status.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.ReadDownTimerVariable ( String  sTag,
Boolean  bTagIsPointer,
out Single  f32Variable 
)

Read down timer variable.

Parameters
sTagController variable to read.
bTagIsPointerTrue if the tag is a pointer.
f32VariableWhen return is true and bSuccess is true, the value read from the controller.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.ReadGroupItems ( Item[]  aryItems,
Int32  i32ItemListStartIndex,
Int32  i32NumberOfItemsToRead 
)

Read an item list as a group. This is the preferrable method when reading a large number of objects.

This method applies to 32/64-bit integers, 32-bit floats, up/down timers, string variables, 32/64-bit tables, 32-bit float tables, string tables, discrete points and analog points.

Parameters
aryItemsThe preconfigured item array with read values.
i32ItemListStartIndexStart index of the item array to use.
i32NumberOfItemsToReadThe number of items from the start index to read from.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.ReadItem ( Controller.Item.eItemTypes  eType,
out Int32  i32Value 
)

Read single 32-bit integer non-variable item.

Parameters
eTypeUse autorunstatus, chartsrunningcount, filememory, getmessagequeuecount, nonvolatilememory, stackdepth, uptimeseconds, and volatilememory.
i32ValueReturned value from operation.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.ReadItem ( Controller.Item.eItemTypes  eType,
out String  sValue 
)

Read non-variable string parameters.

Parameters
eTypeUse firmwareversion, partnumber, strategydatestamp, strategyname, strategytimestamp, or timedate.
sValue
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.ReadItemPuc ( )

Power up clear. Note, this function is performed automatically when the object is successfully connected.

Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.ReadStringTable ( String  sTag,
Boolean  bTagIsPointer,
Int32  i32StartIndex,
Int32  i32Quantity,
out String[]  saryTable 
)

Read string table.

Parameters
sTagController variable to read.
bTagIsPointerTrue if the tag is a pointer.
i32StartIndexController table start index.
i32QuantityNumber of elements to read.
saryTableWhen return is true and bSuccess is true, the value read from the controller.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.ReadStringVariable ( String  sTag,
Boolean  bTagIsPointer,
out String  sVariable 
)

Read string variable.

Parameters
sTagController variable to read.
bTagIsPointerTrue if the tag is a pointer.
sVariableWhen return is true and bSuccess is true, the value read from the controller.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.ReadUpTimerVariable ( String  sTag,
Boolean  bTagIsPointer,
out Single  f32Variable 
)

Read up timer variable.

Parameters
sTagController variable to read.
bTagIsPointerTrue if the tag is a pointer.
f32VariableWhen return is true and bSuccess is true, the value read from the controller.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Write32BitFloatTable ( String  sTag,
Boolean  bTagIsPointer,
Single[]  f32aryValues,
Int32  i32ControllerStartIndex,
Int32  i32WriteLength 
)

Write 32-bit float table.

Parameters
sTagTag of the float table.
bTagIsPointerTrue if the tag is a pointer.
f32aryValuesArray of values to write.
i32ControllerStartIndexStarting index on the controller to begin writing at.
i32WriteLengthLength of data to write.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Write32BitFloatVariable ( String  sTag,
Boolean  bTagIsPointer,
Single  f32Value 
)

Write a 32-bit float variable.

Parameters
sTagObject name.
bTagIsPointerTrue when tag is a pointer.
f32ValueValue to write.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Write32BitIntegerTable ( String  sTag,
Boolean  bTagIsPointer,
Int32[]  i32aryValues,
Int32  i32ControllerStartIndex,
Int32  i32WriteLength 
)

Write 32-bit integer table.

Parameters
sTag32-bit integer array tag.
bTagIsPointerTrue if tag is a pointer.
i32aryValuesArray of values.
i32ControllerStartIndexStarting index on the controller to write too.
i32WriteLengthQuantity of values to write.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Write32BitIntegerVariable ( String  sTag,
Boolean  bTagIsPointer,
Int32  i32Value 
)

Write an 32-bit integer variable.

Parameters
sTagTag of the integer.
bTagIsPointerTrue if tag is a pointer.
i32ValueValue to write.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Write64BitIntegerTable ( String  sTag,
Boolean  bTagIsPointer,
Int64[]  i64aryValues,
Int32  i32ControllerStartIndex,
Int32  i32WriteLength 
)

Write a 64-bit integer table.

Parameters
sTag64-bit controller table name.
bTagIsPointerTrue if tag is a pointer.
i64aryValuesArray of values to write.
i32ControllerStartIndexController start index to begin writing too.
i32WriteLengthLength of values to write.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.Write64BitIntegerVariable ( String  sTag,
Boolean  bTagIsPointer,
Int64  i64Value 
)

Write a 64-bit integer.

Parameters
sTag64-bit integer tag.
bTagIsPointerTrue if tag is a pointer.
i64ValueValue to write.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteAnalogPointAttribute ( String  sTag,
Boolean  bTagIsPointer,
Controller.Item.eAnalogPointAttributes  eAnalogAttribute,
Single  f32Value 
)

Write analog float attribute.

Parameters
sTagAnalog point tag.
bTagIsPointerUse apoint or papoint.
eAnalogAttributeUse eu.
f32ValueValue read.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteChartStatus ( String  sTag,
Controller.Item.eItemTypes  eType 
)

Modify the status of a controller chart.

Parameters
sTagController name of a chart.
eTypeUse startchart, pstartchart, continuechart, pcontinuechart, suspendchart, psuspendchart, stopchart, or pstopchart. Use continuechart to resume a suspended chart.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteClearControllerMessageQueue ( )

Clear controller message queue.

Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteControllerDateTimeUsingPcLocalTime ( )

Update controller's date/time using PC's local date/time.

Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteDateTimeFromUser ( Int32[]  i32aryValues)

Write controller date/time via supplied data.

Parameters
i32aryValuesInt32[6] of time data.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteDiscretePointAttribute ( String  sTag,
Boolean  bTagIsPointer,
Controller.Item.eDiscretePointAttributes  eDiscreteAttribute,
Boolean  bState 
)

Write discrete point boolean attribute.

Parameters
sTagName of the discrete point.
bTagIsPointerTrue when tag is a pointer.
eDiscreteAttributeUse state.
bStateState to write.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteDownTimerVariable ( String  sTag,
Boolean  bTagIsPointer,
Single  f32Value 
)

Write a down timer variable.

Parameters
sTagObject name.
bTagIsPointerTrue when tag is a pointer.
f32ValueValue to write.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteStartControllerStrategy ( )

Start controller strategy.

Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteStopControllerStrategy ( )

Stop controller strategy.

Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteStringTable ( String  sTag,
Boolean  bTagIsPointer,
String[]  sary,
Int32  i32ControllerStartIndex,
Int32  i32WriteLength 
)

Write a string table.

Parameters
sTagController string table name.
bTagIsPointerTrue if the tag is a pointer to a string table.
saryString array.
i32ControllerStartIndexController string table beginning index.
i32WriteLengthQuantity of strings to write.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteStringVariable ( String  sTag,
Boolean  bTagIsPointer,
String  sValue 
)

Write a string variable.

Parameters
sTagName of the controller's string variable.
bTagIsPointerTrue if tag is a pointer.
sValueString to write.
Returns
See enumeration ErrorResponse.
ErrorResponse Opto22.Controller.Controller.WriteUpTimerVariable ( String  sTag,
Boolean  bTagIsPointer,
Single  f32Value 
)

Write a up timer variable.

Parameters
sTagObject name.
bTagIsPointerTrue when tag is a pointer.
f32ValueValue to write.
Returns
See enumeration ErrorResponse.

Property Documentation

Int32 Opto22.Controller.Controller.CommunicationTimeout
getset

Communication timeout in units of milliseconds. 100 millisecond minimum enforced. Normally this value is usually 1000 milliseconds or larger.

FastDataAccessEnumerations Opto22.Controller.Controller.DataAccessMethod
get

Retrieve controller data protocol grouped data access method.

Boolean Opto22.Controller.Controller.FragmentedTransmissions
get

Returns if fragmented transmissions is configured. Only valid after a successful communication opening to the controller.

Int32 Opto22.Controller.Controller.MessageLogCount
get

Returns how many messages are logged in the queue.


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