ABB Ability™ History UI SDK - Client API Reference
    Preparing search index...

    cCurrentValueAccessor - Access current values in server data source

    import { IConnection } from "client/connection";
    import { cValueRecord } from "client/data";
    import { IDbClassInstance } from "db/cache";
    import { cCurrentValueAccessor } from "valueaccessors/currentvalueaccessor";
    function example(conn:IConnection, path:IDbClassInstance)
    {
    const cva:cCurrentValueAccessor = new cCurrentValueAccessor({
    Source: path.Class.Id,
    Instance: path.Get("Id"),
    Property: "CurrentPower"
    });
    cva.Changed.AddListener(()=>{
    const vr:cValueRecord=cva.ValueRecord.Get();
    console.log(
    "time:", vr.GetTime().ToString("G"),
    "value:", vr.GetValueString(),
    "rawvalue:", vr.GetRawValue(),
    "invalid:", vr.Invalid
    );
    });
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    AutoScaling: IProperty<boolean> = ...

    Have the widget to set the scale automatically according the incoming values. (Only supported by certain accessors.)

    AutoScalingMode: IProperty<AutoScaleMode> = ...

    The type of auto scaling used.

    Changed: IEvent<void> = ...

    Fired when the data of the value accessor has changed.

    Connection: IConnectionAPI

    The connection API for the value accessor

    Context: IContextAPI = ...

    The context handling API for the value accessor

    ConvertTimeSpan: IProperty<boolean> = ...

    Convert time span values to numeric values (as approx. ticks).

    CustomDescription: IProperty<string> = ...

    The user-definable description that overrides any defaults.

    CustomMaximumValue: IProperty<number> = ...

    The user-definable minimum value that overrides any defaults.

    CustomMinimumValue: IProperty<number> = ...

    The user-definable minimum value that overrides any defaults.

    CustomName: IProperty<string> = ...

    The user-definable name that overrides any defaults.

    CustomUnit: IProperty<string> = ...

    The user-definable unit that overrides any defaults.

    DefaultStorage: IDefaultStorage = ...

    Default property value storage - used by the default property getters and setters.

    Description: IProperty<string> = ...

    The description shown to user. (Automatically fetched)

    DisplayName: IProperty<string> = ...

    The display name shown to user.

    DisposeEvent: IManualEvent<void>

    Dispose Event signaled when the object is being disposed. NOTE: Inheriting classes should use AddDisposeHandler instead.

    Events: IEvents

    cClassBase event API

    Initialized: IManualEvent<void> = ...

    Fired when the value accessor has been initialized.

    InitializeFailed: IManualEvent<void> = ...

    Fired when the value accessor initialization has failed.

    Instance: IProperty<unknown> = ...

    The source instance of the data

    MaximumValue: IProperty<unknown> = ...

    The default maximum value. (Automatically fetched)

    MinimumValue: IProperty<unknown> = ...

    The default minimum value. (Automatically fetched)

    OwnerWidget: IProperty<cWidgetBase> = ...

    The owner widget of the single value accessor

    PathName: IProperty<string> = ...

    Process path that may be shown in the tooltip

    Property: IProperty<string> = ...

    The source property of the data (If null when Source is "Variable" CurrentValue is automatically shown.)

    ShowDescription: IProperty<boolean> = ...

    Show the description in the item tooltip.

    ShowOwner: IProperty<boolean> = ...

    Show the name of the owner instance in the item name.

    Source: IProperty<string> = ...

    The source class of the data

    TooltipDecimals: IProperty<number> = ...

    Max. Number of decimals shown in the tooltip

    UId: IProperty<string>
    Unit: IProperty<string> = ...

    The default unit. (Automatically fetched)

    Value: IProperty<unknown> = ...

    The latest value received by the accessor.

    ValueRecord: IProperty<cValueRecord> = ...

    The value record containing the time stamp, the value and the status information.

    Accessors

    • get CanDispose(): boolean

      The object can be disposed

      Returns boolean

    • set CanDispose(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get NLS(): IComponentNLSRequest

      The component class specific NLS request

      Returns IComponentNLSRequest

    • get Properties(): IPropertyAPI

      The component property API

      Returns IPropertyAPI

    Methods

    • Create function that can abort asynchronous code in case the function is called again or the owner instance have been disposed. This is useful with problematic cases where for example server request is sent and the return is handled asynchronously (with a callback). Meanwhile the configuration may have changed making the code in the callback unnecessary or even harmful. *

      Type Parameters

      • TArgs extends unknown[] = []

      Parameters

      • func: TAsyncAbortable<TArgs>

        A function with first parameter as function to check the abort state: Can be used in the function: if(abort()) return; //abort

      • disposeonly: boolean = false

        Check only the dispose state - don't check subsequent calls to the function.

      Returns TAsyncAbortableReturn<TArgs>

    • Add a dispose handler called when this object is being disposed. The dispose handlers are called in reverse order (the latest first).

      Parameters

      • disposer: () => void

        The dispose handler - should make any manual clean up necessary when the object is being disposed.

      Returns void

    • Commit Property Value / CurrentValue instance based on the accessor configuration. CurrentValue is used for historized properties and Variables showing CurrentValue, otherwise normal property change is done.

      Parameters

      • val: unknown

        The new value to commit.

      • okcallback: (result: TCommitClassDataResult) => void

        Callback called when commit was done.

      • Optionalfailurecallback: (err: string) => void

        Callback called when the commit failed.

      • Optionalstatus: string

        Status field for the new value as hexadecimal numeric string, default "0x0". (Only for historized properties and Variable CurrentValues)

      • Optionaltimestamp: cDateTime

        Time stamp for the new value. (Only for historized properties and Variable CurrentValues)

      Returns void

    • Get the value of a named property.

      Type Parameters

      • T

      Parameters

      • propertyname: string

        The name of the property

      Returns T

    • Get the registered component class name

      Returns string

      Components.Add

    • Get tooltip contents from the currently held value.

      Returns string

    • Gets the dispose state of the current class object.

      Returns boolean

      True, if the component is disposed.

    • Compare the value accessor type and data configuration to another object.

      Parameters

      Returns boolean

    • Set a value for the named property.

      Type Parameters

      • T

      Parameters

      • propertyname: string

        The name of the property

      • value: T

        The new value for the property

      Returns void

    • String representation of the component instance. Can be overridden by inheriting classes.

      Returns string