Class: PCCCTag

PCCCTag

Provides properties for configuring the tag and accessing the value of the tag (see data).

Members


autoRead :number

Gets/sets the number of milliseconds between automatic reads of the tag.

Because the remote PCCC device does not push changes made to objects, objects that are to be monitored must be occassionally polled to get any changes that may have occurred since the last read. This can be done manually using read, or it can be done automatically by setting this property to a value greater than 0.

When greater than 0, the tag will be automatically read, with the specified number of milliseconds between the automatic reads.

Set to 0 to disable automatic reading.

Type:
  • number
Since:
  • 1.0 (WAT 2.2)
Default Value:
  • 0
See:

autoWrite :bool

Gets/sets whether the tag will be automatically written when anything changes.

When set to true, the tag will attempt to be written to the remote PCCC device whenever any data in the contained memory map area changes. If an error occurs, the data may not be written, and manual steps will need to be carried out to retry.

When set to false, no automatic attempt will be made to write any changes to the remote. In this case write must be called, otherwise the next read or automatic read will restore the tag value back to the value in the remote.

Type:
  • bool
Since:
  • 1.0 (WAT 2.2)
Default Value:
  • false
See:

<readonly> data :cip.CIPVar

Gets an object that can be used to read/write the data in the tag.

A tag may be defined as a UDT or a primitive type in the XML memory map definition. If the tag is a UDT (e.g. <MyType name="myObject" addr="N7:90"/>), then the properties in the UDT MyType will be accessible as children of this object since this object will be a UDT. If the tag is a primitive type (e.g. <u32 name="aValue" addr="N7:100"/>), then this object will be a primitive cip object (e.g. Number) and give direct access to the data.

Type:
Since:
  • 1.0 (WAT 2.2)

<readonly> lastError :string

Gets a string describing the communications last error encountered while attempting to read/write the tag. When an error occurs, the error event will fire.

Type:
  • string
Since:
  • 1.0 (WAT 2.2)

Methods


read()

Attempts to read the value of the tag from the remote. If successful, readSuccess will be fired, and any changes to the memory map will be evented using the cip events (e.g. valueChanged).

Since:
  • 1.0 (WAT 2.2)

write()

Attempts to write the value of the tag to the remote. If successful, writeSuccess will be fired.

Since:
  • 1.0 (WAT 2.2)

Events


autoReadChanged

Indicates that autoRead changed.

Since:
  • 1.2 (WAT 2.4)

autoWriteChanged

Indicates that autoWrite changed.

Since:
  • 1.2 (WAT 2.4)

error

Indicates that an attempt to read from or write to the remote finished with an error.

If automatic reading or writing is enabled, this event will also fire whenever an automatic read or write fails.

Parameters:
Name Type Description
err string

Description of the error that occurred.

Since:
  • 1.0 (WAT 2.2)
See:

readSuccess

Indicates that an attempt to read from the remote finished successfully.

If autoRead is set up to automatically read, this event will also fire whenever an auto read completes successfully.

If a read attempt fails, error will be fired instead.

Since:
  • 1.0 (WAT 2.2)

writeSuccess

Indicates that an attempt to write to the remote finished successfully.

If autoWrite is set up to automatically write, this event will also fire whenever an auto write completes successfully.

If a write attempt fails, error will be fired instead.

Since:
  • 1.0 (WAT 2.2)