API that HTML5 controls can call to interact with IEC code

class CDSWebVisuAccess()

Provides functions that HTML5 elements can call to interact with IEC code.

Html5 elements cannot access this API directly in the constructor. They need to wait for the iFrame to be loaded. Therefore the elements can use the “load” event of the window like this:

StaticElementElementWrapper = function() { window.addEventListener(“load”, this.init); };

CDSWebVisuAccess.checkSimpleValue(methodName, param)

Checks if a scalar value can be written into the configured variable.

Arguments
  • methodName (String) – The method name as configured in the column “Call method” in the HTML5 editor.

  • param (*) – The scalar value that will be sent to the IEC application. Can be number, bigint, date or another type.

Returns

Promise.<value> – Promise.Resolve() is called if the value can be written into the specified variable. Otherwise, the promise is rejected.

CDSWebVisuAccess.sendSimpleValue(methodName, param)

Sends a scalar value to IEC code.

Arguments
  • methodName (String) – The method name as configured in the column “Call method” in the HTML5 editor.

  • param (*) – The scalar value that will be sent to the IEC application.

Returns

Promise.<value> – A promise that is resolved or rejected.

CDSWebVisuAccess.checkComplexValue(methodName, param, indexCount, index0, index1, index2)

Checks if a certain value of a complex value (array-like structure) can be written to into the configured variable.

Arguments
  • methodName (String) – The method name as configured in the column “Call method” in the HTML5 editor.

  • param (*) – The scalar value that will be sent to the IEC application. Can be of the types number, bigint, date or others.

  • indexCount (Number) – Number of dimensions of the configured datatype. E.g. 2 for a simple table. Maximum is 3.

  • index0 (Number) – Zero-Based index in the first dimension.

  • index1 (Number) – Zero-Based index in the second dimension.

  • index2 (Number) – Zero-Based index in the third dimension.

Returns

Promise.<value> – Resolve() is called if the value can be written into the specified variable. Otherwise, the promise is rejected.

CDSWebVisuAccess.sendComplexValue(methodName, param, indexCount, index0, index1, index2)

Sends a certain value of a complex value (array-like structure) to the configured variable in the application.

Arguments
  • methodName (String) – The method name as configured in the column “Call method” in the HTML5 editor.

  • param (*) – The scalar value that will be sent to the IEC application.

  • indexCount (Number) – Number of dimensions of the configured datatype. E.g. 2 for a simple table. Maximum is 3.

  • index0 (Number) – Zero-Based index in the first dimension.

  • index1 (Number) – Zero-Based index in the second dimension.

  • index2 (Number) – Zero-Based index in the third dimension.

Returns

Promise.<value, indexCount, index0, index1, index2> – A promise that is resolved or rejected.

CDSWebVisuAccess.sendMouseEvent(event)

Sends a mouse event for this Html element to the IEC application. If the element has input actions like ‘OnMouseClick’ or ‘OnMouseDown’ configured, these events can be triggered here.

Arguments
Returns

Promise – A resolved promise. Not relevant.

CDSWebVisuAccess.setScrollRange(methodName, startIndex, endIndex, scrollDimension)

Notifies the IEC application about which parts of the array values should be sent. Can be used for example with a scrollable table element that only receives the values that are currently visible. New values may be requested after the user has scrolled.

Arguments
  • methodName (String) – The method name as configured in the column “Call method” in the HTML5 editor.

  • startIndex (Number) – Specifies the zero-based start of the array range.

  • endIndex (Number) – Specifies the zero-based end of the array range.

  • scrollDimension (Number) – The dimension of the array values that should be retrieved.

Returns

Promise – A resolved promise. Not relevant.

CDSWebVisuAccess.getTypeDesc(typeId)

Returns the type description for the corresponding type Id. Typically the method call of an element has the following signature: function(value, type, typeid) {…} The value is the value itself and the typeid identifies the type description which provides further information about the value like size or dimensions in case of an array type.

Arguments
  • typeId (Number) – The type Id that comes from the element’s method call together with the value.

Returns

Promise.<typeDesc> – A promise that contains a JSON object with the members descripted in the type descriptions section starting with TypeDesc..

CDSWebVisuAccess.getTextFile(filenameFromAdditionalFiles)

Returns the content of a file in text format. The filename must be the same as in the Additional Files section in the HTML5 editor. As this is an asnychronous call a promise containing the file’s content is returned.

Arguments
  • filenameFromAdditionalFiles (String) – Filename of the image that was declared in the Additional Files section of the HTML5 editor.

Returns

Promise.<String> – A promise that contains a string with the content of the requested file.

CDSWebVisuAccess.getBinaryFile(filenameFromAdditionalFiles)

Returns the content of a file in binary format. The filename must be the same as in the Additional Files section in the HTML5 editor. As this is an asnychronous call a promise containing the file’s content is returned.

Arguments
  • filenameFromAdditionalFiles (String) – Filename of the image that was declared in the Additional Files section of the HTML5 editor.

Returns

Promise.<blob> – A promise that contains a blob object with the content of the requested file.

CDSWebVisuAccess.getImageById(imagePoolId)

Creates an HTML image element with the provided image name from an Image Pool as source that can be used in the html document of the element. The image source is created by calling the browser function createObjectURL() with the file’s binary content. It will stay in memory until the HTML5 element gets destroyed. As this is an asnychronous call a promise containing the Image is returned.

Arguments
  • imagePoolId (String) – Path to the image pool and the image id, e.g. “ImagePool.img01”.

Returns

Promise.<Image> – A promise that contains a HTML image element.

CDSWebVisuAccess.getImageByFilename(filenameFromAdditionalFiles)

Creates an HTML image element with the provided image filename as source that can be used in the html document of the element. The image source is created by calling the browser function createObjectURL() with the image file’s binary content. It will stay in memory until the HTML5 element gets destroyed. As this is an asnychronous call a promise containing the Image is returned.

Arguments
  • filenameFromAdditionalFiles (String) – Filename of the image that was declared in the Additional Files section of the HTML5 editor.

Returns

Promise.<Image> – A promise that contains a HTML image element.

CDSWebVisuAccess.getAdditionalFile(additionalFile)

Note

Deprecated: since Visualization 4.3.0.0. Use getTextFile() or getBinaryFile() instead.

Gets the actual filename of a additional file that can be referenced in the element. The original filenames are renamed after downloading the application in order to prevent name collisions with other elements.

Arguments
  • additionalFile (String) – The original name of the file specified in the ‘Additional Files’ section in the Html5 Editor.

Returns

Promise.<resultingAdditionalFileName> – A promise that contains the resulting file name.

CDSWebVisuAccess.getImagePoolFileName(imageId)

Note

Deprecated: since Visualization 4.3.0.0. Use getImageById() instead.

Gets the actual filename of a provided image file that can be referenced in the element. The original filenames are renamed after downloading the application in order to prevent name collisions with other elements.

Arguments
  • imageId (String) – The original name of the file specified in the ‘Image’ section in the Html5 Editor.

Returns

Promise.<resultingFileName> – A promise that contains the resulting file name.