Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TcType

Base class for a TwinCAT Type, designed to store the basic information of the Type, as well as provide options for cloning itself, and extending with additional attributes.

Types can be mutated with attributes, which allow for altered behavior.

Hierarchy

Index

Constructors

Protected constructor

  • Creates the base for a TwinCAT Data type. Can be build either from raw ADS Type Info, or from an existing TcType

    Parameters

    • context: TcContext

      The TcContext, to which this Type belongs

    • typeData: TcTypeInfo | TcType

      The information, from which the TcType is build

    • Default value debug: boolean = false

      If enabled, will produce debug information

    Returns TcType

Accessors

adst

  • get adst(): number

context

defaultBuffer

  • get defaultBuffer(): Buffer | undefined
  • set defaultBuffer(val: Buffer | undefined): void
  • If a default value is present, the default byte buffer of that value

    Returns Buffer | undefined

  • If a default value is present, the default byte buffer of that value

    Parameters

    • val: Buffer | undefined

    Returns void

defaultValue

  • get defaultValue(): any
  • set defaultValue(val: any): void
  • The default value for this TcType

    Returns any

  • The default value for this TcType

    Parameters

    • val: any

    Returns void

ignored

  • get ignored(): boolean
  • set ignored(val: boolean): void
  • Flag, if this TcType is ignored during Symbol Building

    Returns boolean

  • Flag, if this TcType is ignored during Symbol Building

    Parameters

    • val: boolean

    Returns void

name

  • get name(): string

offset

  • get offset(): number
  • set offset(val: number): void
  • The memory offset, relative to its parent, if the TcType is a child

    Returns number

  • The memory offset, relative to its parent, if the TcType is a child

    Parameters

    • val: number

    Returns void

onChange

  • get onChange(): string
  • set onChange(val: string): void
  • Alias to use, in place of the default 'changed' event, when a TcSymbol of this type is constructed

    Returns string

  • Alias to use, in place of the default 'changed' event, when a TcSymbol of this type is constructed

    Parameters

    • val: string

    Returns void

onClear

  • get onClear(): string
  • set onClear(val: string): void
  • Alias to use, in place of the default 'cleared' event, when a TcSymbol of this type is constructed

    Returns string

  • Alias to use, in place of the default 'cleared' event, when a TcSymbol of this type is constructed

    Parameters

    • val: string

    Returns void

onGet

  • get onGet(): string
  • set onGet(val: string): void
  • Alias to use, in place of the default 'get' event, when a TcSymbol of this type is constructed

    Returns string

  • Alias to use, in place of the default 'get' event, when a TcSymbol of this type is constructed

    Parameters

    • val: string

    Returns void

onSet

  • get onSet(): string
  • set onSet(val: string): void
  • Alias to use, in place of the default 'set' event, when a TcSymbol of this type is constructed

    Returns string

  • Alias to use, in place of the default 'set' event, when a TcSymbol of this type is constructed

    Parameters

    • val: string

    Returns void

readOnly

  • get readOnly(): boolean
  • set readOnly(val: boolean): void
  • Flag, if this TcType is ReadOnly

    Returns boolean

  • Flag, if this TcType is ReadOnly

    Parameters

    • val: boolean

    Returns void

size

  • get size(): number
  • set size(val: number): void

Methods

Protected __clone

  • Internal function for applying mutations to the created clone. Used for code reduction

    throws

    TcComIsInvalidException - Attempting to use an invalidated TcCom Object

    throws

    TcComToRawException - Error occurred when transforming value to raw data

    Parameters

    • type: TcType

      the TcType, which can be potentially mutated

    • Optional mutator: TcTypeBase

      The mutator which can be applied to the TcType

    Returns Promise<TcType | undefined>

    • Either the clone TcType or undefined if cloning failed

Protected __getParameter

  • __getParameter(name: string, value: string): void
  • Internal function, which analyses attribute data from the Type ADS Data and adjusts aspects of this TcType

    Mutations supported :

    • ReadOnly
    • Ignored
    • OnSet
    • OnGet
    • OnClear
    • OnChange

    Parameters

    • name: string

      name of the Attribute

    • value: string

      value of the Attribute

    Returns void

Abstract clone

  • Creates a clone with an optional mutation of this TcType

    throws

    TcComIsInvalidException - Attempting to use an invalidated TcCom Object

    throws

    TcComToRawException - Error occurred when transforming value to raw data

    Parameters

    • Optional mutator: TcTypeBase

      Optional mutator, which can be applied to the clone

    Returns Promise<TcType | undefined>

    • Either the clone TcType or undefined if cloning failed

extend

  • Extends the current TcType with the provided TcTypeInfo. The default extension can either create a mutation of the current TcType or transform the TcType into an array

    Parameters

    • adsTypeData: TcTypeInfo

      Data with which to extends the TcType

    Returns Promise<TcType | undefined>

    • Either the extends TcType or undefined if extension failed

Abstract instance

  • Will create a TcSymbol instance based on this TcType

    Parameters

    • path: string

      Path of the created TcSymbol

    • parent: TcSymbol

      Parent of the created TcSymbol

    • pointer: TcSymbolPointer

      Memory location of created TcSymbol in the Target PLC

    • debug: boolean

      If enabled, will produce debug information

    Returns TcSymbol

    • Instance of TcSymbol based on this TcType

mutate

  • Clones this TcType and mutates it, with additional attributes from the mutator

    Parameters

    • mutator: TcTypeBase

      Will use the Attributes and Offset to create a mutation of this TcType

    Returns void

Generated using TypeDoc