Service: Ext (Host)
The EXT service is intended for use by Extension only. It is tailored for use by a specific Extension and filter their output accordingly.
The Extension does not have to add their Id as a parameter but is determined automatically from the Id of the calling client.
In contrast to data service functions, EXT service functions do not require any access rights that have to be set in WinGuard, i.e., they are always available and access to them cannot be restricted.
Functions
| Result | Name / Params | Comment | ||
|---|---|---|---|---|
| StaticExtObject[] | ext.object.Query | Returns all Objects configured for the requesting Extension. | ||
| value{} | ext.setting.Query | Returns all Settings for the local coupling point of the requesting Extension. Result: The key is SymbolPath. | ||
| ExtIncident[] | ext.incident.Query | Returns all currently active Incidents for the requesting Extension. | ||
| void | ext.object.Sync | Creates new Objects or fully updates existing Objects. | ||
| object | StaticExtObject[] | Complete Objects, including all Properties. | ||
| void | ext.object.Delete | Removes the Objects with the indicated URLs. | ||
| url | string[] | (Value: AopUrl) URLs of Objects to be deleted. | ||
| void | ext.object.Set | Sets specific Properties of an Object. Other Properties remain unchanged. | ||
| url | string | (Value: AopUrl) Object URL. | ||
| props | value{} | (Key: PropertyPath) The updated Property values. Any partial aspects of the Property can be addressed via property path. | ||
| void | ext.object.state.Set | Sets specific States of an Object. Other States remain unchanged. | ||
| url | string | (Value: AopUrl) Object URL. | ||
| states | value{} | (Key: Symbol) The updated State values. Transmitting a State with value 'null' indicates removal of the State. As an option, a ExtState object can be transferred as a value if there is additional information about the State. | ||
| void | ext.object.state.Sync | Synchronizes the States and Events of one or more Objects completely. | ||
| object | ExtObjectSync[] | For each Object, transmits the complete set of States and Events. Anything not included is considered removed. | ||
| void | ext.object.event.Set | Sets specific Events of an Object. Other Events remain unchanged. | ||
| url | string | (Value: AopUrl) Object URL. | ||
| events | value{} | Key is an Event key which is an arbitrary string to uniquely identify the instance of the Event type. Value is an ExtEvent object to create or update the respective Event, or 'null' to clear the Event. Events are always transferred completely, even in case of partial changes. | ||
| void | ext.object.event.Clear | Clears specific Events of an Object. Only the indicated Events will be removed. | ||
| url | string | (Value: AopUrl) Object URL. | ||
| events | value{} | Key is an Event key which is an arbitrary string to uniquely identify the instance of the Event type. Value is an ExtEvent object to indicate the final state of the Event before removing. | ||
| void | ext.object.event.Notify | Transmits one or more Notification Events for an Object. | ||
| url | string | (Value: AopUrl) Object URL. | ||
| event | ExtEvent[] | Notification Events to transmit. These Events do not have to be cleared. | ||
| void | ext.activity.Sync | Transmits a new Activity or fully updates an existing one. | ||
| activity | ExtActivity | The complete Activity. | ||
| void | ext.activity.Set | Sets specific Properties of an Activity. Other Properties remain unchanged. | ||
| url | string | (Value: AopUrl) URL of the Activity. | ||
| props | value{} | (Key: Symbol) The Activity Properties to update. | ||
| void | ext.activity.End | Ends an Activity. | ||
| url | string | (Value: AopUrl) URL of the Activity. | ||
| params | value{} | (Optional, Key: Symbol) Additional information about the Activity end. | ||
| void | ext.incident.Sync | Transfers updated complete Incidents. | ||
| incidents | ExtIncident[] | The complete Incidents. | ||
| void | ext.incident.Set | Sets specific Properties of an Incident. Other Properties remain unchanged. | ||
| url | string | (Value: AopUrl) URL of the Incident. | ||
| props | value{} | (Key: Symbol) The Incident Properties to update. | ||
| ResourceResult | ext.resource.Get | Requests a resource from the host. Note that the resource may only be accessible temporarily; for instance immediately after an Operation containing the resource URL was received from the host. | ||
| url | string | (Value: AopUrl) Resource URL. | ||
| props | value{} | (Optional, Key: Symbol) Additional properties required to get the resource. | ||
| void | ext.resource.Put | Sends a resource to the host. The definition of the resource with this URL must be known at the host and has to be provided previously, e.g., in the context of an Object Event. If the resource value is very large (e.g., > 1 MB), consider using out-of-band HTTP transfer instead. | ||
| url | string | (Value: AopUrl) Resource URL. | ||
| value | value | The resource value. | ||
| void | ext.log.Add | Adds a new entry to the extension log. Only information concerning the functionality of the Extension should be logged here. Entries regarding communication with the third-party system belong in the IO log. Changes to States/Events/Activities are automatically logged to the extension log by the host. | ||
| url | string | (Optional, Value: AopUrl) URL of the Object the log entry is related to. | ||
| text | string | The message to be logged. This can be an LNG string. | ||
| type | int | (Optional) Type of log entry. See EnumExtLogType. | ||
| props | value{} | (Optional, Key: Symbol) Additional properties. These are used to translate the log text if it is an LNG string. | ||
| time | time | (Optional) Time that the log entry should have. If not set, the current time will be used. | ||
| iotag | string | (Optional) Tag for association to IO log entries or Events. | ||
| void | ext.iolog.Add | Adds an entry to the IO log. Only entries related to the communication with the third-party system should be logged. | ||
| url | string | (Optional, Value: AopUrl) URL of the Object representing the communication partner (e.g., the server or panel Object). | ||
| data | data | (Optional) The data to log if it is binary. Only 'data' or 'text' can be set at the same time. | ||
| text | string | (Optional) The data to log if it is text. Only 'data' or 'text' can be set at the same time. | ||
| info | string | (Optional) If 'data' is set, a readable representation can be transmitted optionally. | ||
| io | int | (Optional) Transfer/receive direction. See EnumExtIoLogType. | ||
| time | time | (Optional) Time that the entry should have. If not set, the current time will be used. | ||
| iotag | string | (Optional) Tag for association to extension log entries or Events. | ||
| data | ext.GetFile | Reads the file with the given name from the Extension's data folder and returns its content as binary data. If a custom folder is set for the Extension and the file doesn't exist there or if no custom folder is set, it looks for the file in the Modules data folder (e.g. 'data/mod/demopanel'). Returns an empty byte buffer if the file doesn't exist or is empty. | ||
| filename | string | Name of the requested file. Can be a path relative to the Extension's data folder or custom folder (if set). Example: 'test.txt' or 'mypath\test.txt' | ||
| bool | ext.PutFile | Writes the given data to a file in the Extension's data folder (e.g. 'data/mod/demopanel') or custom folder (if set). If the file doesn't exist, it is created. If the file exists, its content is replaced by the given data. If the path contains non-existing folders (e.g. 'mypath\newfolder\test.txt'), the missing folders are created automatically. It is not possible to overwrite the Module's LNG files or any of its Module/App/Legacy/Config XML files. Returns true if the file was written successfully, otherwise false. | ||
| path | string | Name of the file to be written to. Can be a relative path to the Extension's data folder or custom folder (if set). Example: 'test.txt' or 'mypath\test.txt' | ||
| data | data | The complete file content. | ||
Notifications
| Name / Params | Comment | ||
|---|---|---|---|
| ext.object.Created | New Objects have been created at the host. | ||
| object | StaticExtObject[] | List of newly created Objects. | |
| ext.object.Updated | Properties of Objects have been changed at the host. | ||
| object | StaticExtObject[] | List of updated Objects. The complete Objects are transferred, containing all Properties including unchanged ones. | |
| ext.object.Deleted | Objects have been removed at the host. | ||
| url | string[] | (Value: AopUrl) List of URLs of the removed Objects. | |
| ext.setting.Updated | Settings of the Extension have been changed at the host. | ||
| ext | string | (Value: Code) Code of the Extension. | |
| setting | value{} | (Key: SymbolPath) List of changed Settings. | |
All notifications can contain one or more Objects or URLs. In most cases, however, the passed array will have only one entry.
An Extension can, but does not have to, react to the notifications ext.object.Updated and ext.object.Deleted to reconfigure itself. If it does not react, such changes will only be applied after a restart of the Extension. The implemented behavior should be documented for the Extension.