Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TcSymbol

Class representing an instance of a PLC Symbol, mapped to the TcContext. The TcSymbol itself acts as a bridge to the TcBinding, which has the responsibility of low-level ADS operations.

NOTE: In order to avoid naming collisions with the Symbols declared in the Target PLC, all public methods of TcSymbol start with the '$' character.

The TcSymbol should not be directly created, as it serves as a Template for the Derived TcSymbols

Hierarchy

Indexable

[key: string]: TcSymbol | TcSymbolMethod

TcSymbols are indexable, in case they are structured types, and can nest children TcSymbols. Alternatively, if a TcSymbol has Rpc Methods enabled, this methods can be also invoked over the index.

NOTE: In order to avoid naming collisions with the Symbols declared in the Target PLC, all public methods of TcSymbol start with the '$' character.

The TcSymbol should not be directly created, as it serves as a Template for the Derived TcSymbols

Index

Constructors

constructor

  • new TcSymbol(path: string, parent?: TcSymbol, readOnly?: boolean, debug?: boolean): TcSymbol
  • Constructs the foundation of a TcSymbol Object

    Parameters

    • path: string

      The Path of this Symbol, relative to its origin point

    • Optional parent: TcSymbol

      Potential parent of this TcSymbol and to whom events will propagate to

    • Default value readOnly: boolean = false

      Flag which marks this TcSymbol as a ReadOnly symbol, and no operation of write-type can be issued to the TcSymbol

    • Default value debug: boolean = false

      If enabled, will produce debug information

    Returns TcSymbol

Events

$on

Accessors

$binding

$get

  • get $get(): Promise<any>

$parent

$path

  • get $path(): string
  • Access the path of this TcSymbol from its origin point

    Returns string

$readOnly

  • get $readOnly(): boolean

Methods

$clear

  • $clear(): Promise<void>

$off

  • $off(eventName: string, listener: (e: any) => void): TcSymbol
  • Removes a listener from the specified event

    Parameters

    • eventName: string

      The event name, from which the listener is to be removed

    • listener: (e: any) => void

      The listener, which is to be removed from the specified event

        • (e: any): void
        • Parameters

          • e: any

          Returns void

    Returns TcSymbol

$onInvalidated

  • $onInvalidated(callback: (symbol: TcSymbol) => void): void
  • Attached the provided callback, which will be called when the `TcSymbol becomes invalidated

    Parameters

    • callback: (symbol: TcSymbol) => void

      The function, which is to be called upon invalidation

    Returns void

$once

  • $once(eventName: string, listener: (e: any) => void): TcSymbol
  • Attached a listener to an event, which is only invoked once. For the full list of events, see TcSymbol.$on()

    Parameters

    • eventName: string

      The event name, which the listener will listen for

    • listener: (e: any) => void

      The listener, which is called when the event is emitted

        • (e: any): void
        • Parameters

          • e: any

          Returns void

    Returns TcSymbol

$set

  • $set(value: any): Promise<any>

$subscribe

  • $subscribe(sampling?: number): Promise<void>
  • Activates value change detection of the Target PLC Symbol. The sampling rate can be explicitly set, in case the value changes uneseceraly too fast.

    throws

    TcBindingIsInvalidException - Attempting operation on an invalidated TcBinding

    throws

    TcComIsInvalidException - Attempting operation on an invalidated TcCom Object

    throws

    TcComSubscribeException - An error occurred when subscribing to the Symbol

    Parameters

    • Default value sampling: number = 10

      The speed at which change in the Target PLC Symbol value is detected

    Returns Promise<void>

$unsubscribe

  • $unsubscribe(): Promise<void>

Protected __invalidate

  • __invalidate(): void
  • Invalidates the TcBindingof this symbol, as well as, if a callback as provided in case of invalidation - will invoke it

    Returns void

Generated using TypeDoc