node-opcua-address-space-base 2.76.0 → 2.76.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/address_space.d.ts +168 -168
- package/dist/address_space.js +2 -2
- package/dist/base_node.d.ts +186 -186
- package/dist/base_node.js +3 -3
- package/dist/bind_variable.d.ts +52 -52
- package/dist/bind_variable.js +2 -2
- package/dist/clone_options.d.ts +44 -44
- package/dist/clone_options.js +18 -18
- package/dist/continuation_point.d.ts +2 -2
- package/dist/continuation_point.js +2 -2
- package/dist/event_notifier_flags.d.ts +7 -7
- package/dist/event_notifier_flags.js +11 -11
- package/dist/i_event_data.d.ts +17 -17
- package/dist/i_event_data.js +2 -2
- package/dist/index.d.ts +23 -23
- package/dist/index.js +39 -39
- package/dist/instantiate_options.d.ts +80 -80
- package/dist/instantiate_options.js +2 -2
- package/dist/modelling_rule_type.d.ts +1 -1
- package/dist/modelling_rule_type.js +2 -2
- package/dist/namespace.d.ts +279 -279
- package/dist/namespace.js +2 -2
- package/dist/session_context.d.ts +51 -51
- package/dist/session_context.js +2 -2
- package/dist/ua_data_type.d.ts +32 -32
- package/dist/ua_data_type.js +2 -2
- package/dist/ua_dynamic_variable_array.d.ts +12 -12
- package/dist/ua_dynamic_variable_array.js +2 -2
- package/dist/ua_event_type.d.ts +3 -3
- package/dist/ua_event_type.js +2 -2
- package/dist/ua_method.d.ts +41 -41
- package/dist/ua_method.js +4 -4
- package/dist/ua_object.d.ts +131 -131
- package/dist/ua_object.js +2 -2
- package/dist/ua_object_type.d.ts +27 -27
- package/dist/ua_object_type.js +2 -2
- package/dist/ua_property.d.ts +16 -16
- package/dist/ua_property.js +2 -2
- package/dist/ua_reference.d.ts +12 -12
- package/dist/ua_reference.js +2 -2
- package/dist/ua_reference_type.d.ts +18 -18
- package/dist/ua_reference_type.js +3 -3
- package/dist/ua_variable.d.ts +285 -285
- package/dist/ua_variable.js +2 -2
- package/dist/ua_variable_t.d.ts +15 -15
- package/dist/ua_variable_t.js +2 -2
- package/dist/ua_variable_type.d.ts +39 -39
- package/dist/ua_variable_type.js +3 -3
- package/dist/ua_view.d.ts +7 -7
- package/dist/ua_view.js +2 -2
- package/package.json +14 -14
package/dist/ua_variable.d.ts
CHANGED
|
@@ -1,285 +1,285 @@
|
|
|
1
|
-
import { AttributeIds, CallbackT, PreciseClock, StatusCode, StatusCodeCallback, UInt32 } from "node-opcua-basic-types";
|
|
2
|
-
import { NodeClass, QualifiedNameLike } from "node-opcua-data-model";
|
|
3
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
4
|
-
import { DataValue } from "node-opcua-data-value";
|
|
5
|
-
import { ExtensionObject } from "node-opcua-extension-object";
|
|
6
|
-
import { NumericRange } from "node-opcua-numeric-range";
|
|
7
|
-
import { WriteValueOptions, HistoryReadDetails, HistoryReadResult, ReadRawModifiedDetails, ReadEventDetails, ReadProcessedDetails, ReadAtTimeDetails } from "node-opcua-types";
|
|
8
|
-
import { VariantLike } from "node-opcua-variant";
|
|
9
|
-
import { CloneOptions, CloneFilter, CloneExtraInfo } from "./clone_options";
|
|
10
|
-
import { BaseNode, IPropertyAndComponentHolder } from "./base_node";
|
|
11
|
-
import { ISessionContext, ContinuationData } from "./session_context";
|
|
12
|
-
import { UADataType } from "./ua_data_type";
|
|
13
|
-
import { UAVariableType } from "./ua_variable_type";
|
|
14
|
-
import { BindVariableOptions } from "./bind_variable";
|
|
15
|
-
export interface IVariableHistorian {
|
|
16
|
-
/**
|
|
17
|
-
* push a new value into the history for this variable
|
|
18
|
-
* the method should take a very small amount of time and not
|
|
19
|
-
* directly write to the underlying database
|
|
20
|
-
* @param newDataValue
|
|
21
|
-
*/
|
|
22
|
-
push(newDataValue: DataValue): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Extract a series of dataValue from the History database for this value
|
|
25
|
-
* @param historyReadRawModifiedDetails
|
|
26
|
-
* @param maxNumberToExtract
|
|
27
|
-
* @param isReversed
|
|
28
|
-
* @param reverseDataValue
|
|
29
|
-
* @param callback
|
|
30
|
-
*/
|
|
31
|
-
extractDataValues(historyReadRawModifiedDetails: ReadRawModifiedDetails, maxNumberToExtract: number, isReversed: boolean, reverseDataValue: boolean, callback: (err: Error | null, dataValue?: DataValue[]) => void): void;
|
|
32
|
-
}
|
|
33
|
-
export interface IVariableHistorianOptions {
|
|
34
|
-
maxOnlineValues?: number;
|
|
35
|
-
historian?: IVariableHistorian;
|
|
36
|
-
}
|
|
37
|
-
export declare type IHistoricalDataNodeOptions = IVariableHistorianOptions | {
|
|
38
|
-
historian: IVariableHistorian;
|
|
39
|
-
};
|
|
40
|
-
export interface VariableAttributes {
|
|
41
|
-
dataType: NodeId;
|
|
42
|
-
valueRank: number;
|
|
43
|
-
minimumSamplingInterval: number;
|
|
44
|
-
}
|
|
45
|
-
export interface EnumValue2 {
|
|
46
|
-
name: string;
|
|
47
|
-
value: number;
|
|
48
|
-
}
|
|
49
|
-
export interface BindExtensionObjectOptions {
|
|
50
|
-
createMissingProp?: boolean;
|
|
51
|
-
force?: boolean;
|
|
52
|
-
}
|
|
53
|
-
export interface UAVariable extends BaseNode, VariableAttributes, IPropertyAndComponentHolder {
|
|
54
|
-
readonly nodeClass: NodeClass.Variable;
|
|
55
|
-
readonly parent: BaseNode | null;
|
|
56
|
-
readonly dataTypeObj: UADataType;
|
|
57
|
-
semantic_version: number;
|
|
58
|
-
$extensionObject?: any;
|
|
59
|
-
get typeDefinitionObj(): UAVariableType;
|
|
60
|
-
get typeDefinition(): NodeId;
|
|
61
|
-
dataType: NodeId;
|
|
62
|
-
/**
|
|
63
|
-
* The **AccessLevel Attribute** is used to indicate how the Value of a Variable can be accessed
|
|
64
|
-
* (read/write) and if it contains current and/or historic data.
|
|
65
|
-
*
|
|
66
|
-
* The AccessLevel does not take any user access rights into account, i.e. although the Variable is
|
|
67
|
-
* writable this may be restricted to a certain user / user group.
|
|
68
|
-
*
|
|
69
|
-
* The {{link:AccessLevelType}}
|
|
70
|
-
*/
|
|
71
|
-
accessLevel: number;
|
|
72
|
-
/**
|
|
73
|
-
* The UserAccessLevel Attribute is used to indicate how the Value of a Variable can be accessed
|
|
74
|
-
* (read/write) and if it contains current or historic data taking user access rights into account.
|
|
75
|
-
*
|
|
76
|
-
* The AccessLevelType is defined in 8.57.
|
|
77
|
-
*/
|
|
78
|
-
userAccessLevel?: number;
|
|
79
|
-
/**
|
|
80
|
-
* This Attribute indicates whether the Value Attribute of the Variable is an array and how many dimensions
|
|
81
|
-
* the array has.
|
|
82
|
-
* It may have the following values:
|
|
83
|
-
*
|
|
84
|
-
* * n > 1 : the Value is an array with the specified number of dimensions.
|
|
85
|
-
* * OneDimension (1): The value is an array with one dimension.
|
|
86
|
-
* * OneOrMoreDimensions (0): The value is an array with one or more dimensions.
|
|
87
|
-
* * Scalar (-1): The value is not an array.
|
|
88
|
-
* * Any (-2): The value can be a scalar or an array with any number of dimensions.
|
|
89
|
-
* * ScalarOrOneDimension (-3): The value can be a scalar or a one dimensional array.
|
|
90
|
-
*
|
|
91
|
-
* NOTE:
|
|
92
|
-
* * All DataTypes are considered to be scalar, even if they have array-like semantics like ByteString and String.
|
|
93
|
-
*/
|
|
94
|
-
valueRank: number;
|
|
95
|
-
/**
|
|
96
|
-
* The MinimumSamplingInterval Attribute indicates how 'current' the Value of the Variable will
|
|
97
|
-
* be kept.
|
|
98
|
-
*
|
|
99
|
-
* It specifies (in milliseconds) how fast the Server can reasonably sample the value
|
|
100
|
-
* for changes (see Part 4 for a detailed description of sampling interval).
|
|
101
|
-
*
|
|
102
|
-
* A MinimumSamplingInterval of 0 indicates that the Server is to monitor the item continuously.
|
|
103
|
-
*
|
|
104
|
-
* A MinimumSamplingInterval of -1 means indeterminate.
|
|
105
|
-
*/
|
|
106
|
-
minimumSamplingInterval: number;
|
|
107
|
-
/**
|
|
108
|
-
* This Attribute specifies the length of each dimension for an array value.
|
|
109
|
-
*
|
|
110
|
-
* - The Attribute is intended to describe the capability of the Variable, not the current size.
|
|
111
|
-
* - The number of elements shall be equal to the value of the `valueRank` Attribute.
|
|
112
|
-
* - Shall be null if `valueRank` <=0.
|
|
113
|
-
* - A value of 0 for an individual dimension indicates that the dimension has a variable length.
|
|
114
|
-
*
|
|
115
|
-
* **example**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* For example, if a Variable is defined by the following javascript array with 346 Int32 elements:
|
|
119
|
-
*
|
|
120
|
-
* `const myArray = new Array(346).fill(0);`
|
|
121
|
-
*
|
|
122
|
-
* then:
|
|
123
|
-
* * `DataType` would point to an `Int32`
|
|
124
|
-
* * the Variable's `valueRank` has the value 1 and,
|
|
125
|
-
* * the `arrayDimensions` is an array with one entry having the value 346.
|
|
126
|
-
*
|
|
127
|
-
* ```javascript
|
|
128
|
-
* {
|
|
129
|
-
* dataType: "Int32",
|
|
130
|
-
* valueRank: 1,
|
|
131
|
-
* arrayDimensions: [346]
|
|
132
|
-
* }
|
|
133
|
-
* ```
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* **Note**: the maximum length of an array transferred on the wire is 2147483647 (max Int32)
|
|
137
|
-
* and a multidimensional array is encoded as a one dimensional array.
|
|
138
|
-
*
|
|
139
|
-
*/
|
|
140
|
-
arrayDimensions: UInt32[] | null;
|
|
141
|
-
/**
|
|
142
|
-
* The `historizing` attribute indicates whether the server is actively collecting data for the
|
|
143
|
-
* history of the variable.
|
|
144
|
-
*
|
|
145
|
-
* This differs from the `accessLevel` Attribute which identifies if the variable has any historical data.
|
|
146
|
-
*
|
|
147
|
-
* A value of **true** indicates that the server is actively collecting data.
|
|
148
|
-
*
|
|
149
|
-
* A value of **false** indicates the server is not actively collecting data.
|
|
150
|
-
*
|
|
151
|
-
* Default value is **false**.
|
|
152
|
-
*/
|
|
153
|
-
historizing: boolean;
|
|
154
|
-
/**
|
|
155
|
-
* returns true if the `accessLevel` flag allows the variable to be readable in the specified context.
|
|
156
|
-
* @param context
|
|
157
|
-
*/
|
|
158
|
-
isReadable(context: ISessionContext): boolean;
|
|
159
|
-
/**
|
|
160
|
-
* returns true if the `userAccessLevel` flag allows the variable to be readable in the specified context.
|
|
161
|
-
* @param context
|
|
162
|
-
*/
|
|
163
|
-
isUserReadable(context: ISessionContext): boolean;
|
|
164
|
-
/**
|
|
165
|
-
* returns true if the `accessLevel` flag allows the variable to be writeable in the specified context.
|
|
166
|
-
* @param context
|
|
167
|
-
*/
|
|
168
|
-
isWritable(context: ISessionContext): boolean;
|
|
169
|
-
/**
|
|
170
|
-
* returns true if the `userAccessLevel` flag allows the variable to be writeable in the specified context.
|
|
171
|
-
* @param context
|
|
172
|
-
*/
|
|
173
|
-
isUserWritable(context: ISessionContext): boolean;
|
|
174
|
-
/***
|
|
175
|
-
* from OPC.UA.Spec 1.02 part 4
|
|
176
|
-
* 5.10.2.4 StatusCodes
|
|
177
|
-
* Table 51 defines values for the operation level statusCode contained in the DataValue structure of
|
|
178
|
-
* each values element. Common StatusCodes are defined in Table 166.
|
|
179
|
-
*
|
|
180
|
-
* **Read Operation Level Result Codes**
|
|
181
|
-
*
|
|
182
|
-
* |Symbolic Id | Description|
|
|
183
|
-
* |----------------------------|----------------------------------------|
|
|
184
|
-
* |BadNodeIdInvalid | The syntax of the node id is not valid.|
|
|
185
|
-
* |BadNodeIdUnknown | The node id refers to a node that does not exist in the server address space.|
|
|
186
|
-
* |BadAttributeIdInvalid | BadAttributeIdInvalid The attribute is not supported for the specified node.|
|
|
187
|
-
* |BadIndexRangeInvalid | The syntax of the index range parameter is invalid.|
|
|
188
|
-
* |BadIndexRangeNoData | No data exists within the range of indexes specified.|
|
|
189
|
-
* |BadDataEncodingInvalid | The data encoding is invalid. This result is used if no dataEncoding can be applied because an Attribute other than Value was requested or the DataType of the Value Attribute is not a subtype of the Structure DataType. |
|
|
190
|
-
* |BadDataEncodingUnsupported | The server does not support the requested data encoding for the node. This result is used if a dataEncoding can be applied but the passed data encoding is not known to the Server.|
|
|
191
|
-
* |BadNotReadable | The access level does not allow reading or subscribing to the Node.|
|
|
192
|
-
* |BadUserAccessDenied | User does not have permission to perform the requested operation. (table 165)|
|
|
193
|
-
* | BadSecurityModeInsufficient | The operation is not permitted over the current secure channel. |
|
|
194
|
-
* | BadInsufficientPrivileges | The user does not have enough privileges to perform the requested operation.
|
|
195
|
-
*/
|
|
196
|
-
readValue(context?: ISessionContext | null, indexRange?: NumericRange, dataEncoding?: QualifiedNameLike | null): DataValue;
|
|
197
|
-
readValueAsync(context: ISessionContext | null): Promise<DataValue>;
|
|
198
|
-
readValueAsync(context: ISessionContext | null, callback: CallbackT<DataValue>): void;
|
|
199
|
-
isEnumeration(): boolean;
|
|
200
|
-
isExtensionObject(): boolean;
|
|
201
|
-
/**
|
|
202
|
-
*
|
|
203
|
-
*/
|
|
204
|
-
readEnumValue(): EnumValue2;
|
|
205
|
-
/**
|
|
206
|
-
*
|
|
207
|
-
* @precondition UAVariable must have a dataType deriving from "Enumeration"
|
|
208
|
-
*/
|
|
209
|
-
writeEnumValue(value: string | number): void;
|
|
210
|
-
readAttribute(context: ISessionContext | null, attributeId: AttributeIds, indexRange?: NumericRange, dataEncoding?: QualifiedNameLike | null): DataValue;
|
|
211
|
-
setValueFromSource(value: VariantLike, statusCode?: StatusCode, sourceTimestamp?: Date): void;
|
|
212
|
-
writeValue(context: ISessionContext, dataValue: DataValue, indexRange: string | NumericRange | null, callback: StatusCodeCallback): void;
|
|
213
|
-
writeValue(context: ISessionContext, dataValue: DataValue, callback: StatusCodeCallback): void;
|
|
214
|
-
writeValue(context: ISessionContext, dataValue: DataValue, indexRange?: string | NumericRange | null): Promise<StatusCode>;
|
|
215
|
-
asyncRefresh(oldestDate: Date, callback: CallbackT<DataValue>): void;
|
|
216
|
-
asyncRefresh(oldestDate: Date): Promise<DataValue>;
|
|
217
|
-
/**
|
|
218
|
-
* write a variable attribute (callback version)
|
|
219
|
-
* @param context
|
|
220
|
-
* @param writeValue
|
|
221
|
-
* @param callback
|
|
222
|
-
*
|
|
223
|
-
* **example**
|
|
224
|
-
*
|
|
225
|
-
* ```javascript
|
|
226
|
-
* const writeValue = {
|
|
227
|
-
* attributeId: AttributeIds.Value,
|
|
228
|
-
* dataValue: new DataValue({
|
|
229
|
-
* statusCode: StatusCodes.Good,
|
|
230
|
-
* sourceTimestamp: new Date(),
|
|
231
|
-
* value: new Variant({ dataType: DataType.Double, value: 3.14 })
|
|
232
|
-
* }),
|
|
233
|
-
* nodeId
|
|
234
|
-
* };
|
|
235
|
-
* myVariable.writeAttribute(context,writeValue,(err, statusCode) => {
|
|
236
|
-
* if (err) { console.log("Write has failed"); return; }
|
|
237
|
-
* console.log("write statusCode = ",statusCode.toString());
|
|
238
|
-
* });
|
|
239
|
-
* ```
|
|
240
|
-
*
|
|
241
|
-
*/
|
|
242
|
-
writeAttribute(context: ISessionContext | null, writeValue: WriteValueOptions, callback: StatusCodeCallback): void;
|
|
243
|
-
/**
|
|
244
|
-
* write a variable attribute (async/await version)
|
|
245
|
-
* @param context
|
|
246
|
-
* @param writeValue
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* **example**
|
|
250
|
-
*
|
|
251
|
-
* ```javascript
|
|
252
|
-
* try {
|
|
253
|
-
* const writeValue = {
|
|
254
|
-
* attributeId: AttributeIds.Value,
|
|
255
|
-
* dataValue: new DataValue({
|
|
256
|
-
* statusCode: StatusCodes.Good,
|
|
257
|
-
* sourceTimestamp: new Date(),
|
|
258
|
-
* value: new Variant({ dataType: DataType.Double, value: 3.14 })
|
|
259
|
-
* }),
|
|
260
|
-
* nodeId
|
|
261
|
-
* };
|
|
262
|
-
* const statusCode = await myVariable.writeAttribute(context,writeValue);
|
|
263
|
-
* } catch(err) {
|
|
264
|
-
* console.log("Write has failed");
|
|
265
|
-
* return;
|
|
266
|
-
* }
|
|
267
|
-
* console.log("write statusCode = ", statusCode.toString());
|
|
268
|
-
* ```
|
|
269
|
-
*
|
|
270
|
-
*/
|
|
271
|
-
writeAttribute(context: ISessionContext | null, writeValue: WriteValueOptions): Promise<StatusCode>;
|
|
272
|
-
touchValue(updateNow?: PreciseClock): void;
|
|
273
|
-
bindVariable(options?: BindVariableOptions, overwrite?: boolean): void;
|
|
274
|
-
bindExtensionObject(optionalExtensionObject?: ExtensionObject | ExtensionObject[], options?: BindExtensionObjectOptions): ExtensionObject | ExtensionObject[] | null;
|
|
275
|
-
bindExtensionObjectScalar(optionalExtensionObject: ExtensionObject, options?: BindExtensionObjectOptions): ExtensionObject | null;
|
|
276
|
-
bindExtensionObjectArray(optionalExtensionObjectArray: ExtensionObject[], options?: BindExtensionObjectOptions): ExtensionObject[] | null;
|
|
277
|
-
installExtensionObjectVariables(): void;
|
|
278
|
-
historyRead(context: ISessionContext, historyReadDetails: HistoryReadDetails | ReadRawModifiedDetails | ReadEventDetails | ReadProcessedDetails | ReadAtTimeDetails, indexRange: NumericRange | null, dataEncoding: QualifiedNameLike | null, continuationData: ContinuationData): Promise<HistoryReadResult>;
|
|
279
|
-
historyRead(context: ISessionContext, historyReadDetails: HistoryReadDetails | ReadRawModifiedDetails | ReadEventDetails | ReadProcessedDetails | ReadAtTimeDetails, indexRange: NumericRange | null, dataEncoding: QualifiedNameLike | null, continuationData: ContinuationData, callback: CallbackT<HistoryReadResult>): void;
|
|
280
|
-
clone(options: CloneOptions, optionalFilter?: CloneFilter, extraInfo?: CloneExtraInfo): UAVariable;
|
|
281
|
-
on(eventName: "semantic_changed", eventHandler: () => void): this;
|
|
282
|
-
on(eventName: "value_changed", eventHandler: (dataValue: DataValue) => void): this;
|
|
283
|
-
once(eventName: "semantic_changed", eventHandler: () => void): this;
|
|
284
|
-
once(eventName: "value_changed", eventHandler: (dataValue: DataValue) => void): this;
|
|
285
|
-
}
|
|
1
|
+
import { AttributeIds, CallbackT, PreciseClock, StatusCode, StatusCodeCallback, UInt32 } from "node-opcua-basic-types";
|
|
2
|
+
import { NodeClass, QualifiedNameLike } from "node-opcua-data-model";
|
|
3
|
+
import { NodeId } from "node-opcua-nodeid";
|
|
4
|
+
import { DataValue } from "node-opcua-data-value";
|
|
5
|
+
import { ExtensionObject } from "node-opcua-extension-object";
|
|
6
|
+
import { NumericRange } from "node-opcua-numeric-range";
|
|
7
|
+
import { WriteValueOptions, HistoryReadDetails, HistoryReadResult, ReadRawModifiedDetails, ReadEventDetails, ReadProcessedDetails, ReadAtTimeDetails } from "node-opcua-types";
|
|
8
|
+
import { VariantLike } from "node-opcua-variant";
|
|
9
|
+
import { CloneOptions, CloneFilter, CloneExtraInfo } from "./clone_options";
|
|
10
|
+
import { BaseNode, IPropertyAndComponentHolder } from "./base_node";
|
|
11
|
+
import { ISessionContext, ContinuationData } from "./session_context";
|
|
12
|
+
import { UADataType } from "./ua_data_type";
|
|
13
|
+
import { UAVariableType } from "./ua_variable_type";
|
|
14
|
+
import { BindVariableOptions } from "./bind_variable";
|
|
15
|
+
export interface IVariableHistorian {
|
|
16
|
+
/**
|
|
17
|
+
* push a new value into the history for this variable
|
|
18
|
+
* the method should take a very small amount of time and not
|
|
19
|
+
* directly write to the underlying database
|
|
20
|
+
* @param newDataValue
|
|
21
|
+
*/
|
|
22
|
+
push(newDataValue: DataValue): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Extract a series of dataValue from the History database for this value
|
|
25
|
+
* @param historyReadRawModifiedDetails
|
|
26
|
+
* @param maxNumberToExtract
|
|
27
|
+
* @param isReversed
|
|
28
|
+
* @param reverseDataValue
|
|
29
|
+
* @param callback
|
|
30
|
+
*/
|
|
31
|
+
extractDataValues(historyReadRawModifiedDetails: ReadRawModifiedDetails, maxNumberToExtract: number, isReversed: boolean, reverseDataValue: boolean, callback: (err: Error | null, dataValue?: DataValue[]) => void): void;
|
|
32
|
+
}
|
|
33
|
+
export interface IVariableHistorianOptions {
|
|
34
|
+
maxOnlineValues?: number;
|
|
35
|
+
historian?: IVariableHistorian;
|
|
36
|
+
}
|
|
37
|
+
export declare type IHistoricalDataNodeOptions = IVariableHistorianOptions | {
|
|
38
|
+
historian: IVariableHistorian;
|
|
39
|
+
};
|
|
40
|
+
export interface VariableAttributes {
|
|
41
|
+
dataType: NodeId;
|
|
42
|
+
valueRank: number;
|
|
43
|
+
minimumSamplingInterval: number;
|
|
44
|
+
}
|
|
45
|
+
export interface EnumValue2 {
|
|
46
|
+
name: string;
|
|
47
|
+
value: number;
|
|
48
|
+
}
|
|
49
|
+
export interface BindExtensionObjectOptions {
|
|
50
|
+
createMissingProp?: boolean;
|
|
51
|
+
force?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface UAVariable extends BaseNode, VariableAttributes, IPropertyAndComponentHolder {
|
|
54
|
+
readonly nodeClass: NodeClass.Variable;
|
|
55
|
+
readonly parent: BaseNode | null;
|
|
56
|
+
readonly dataTypeObj: UADataType;
|
|
57
|
+
semantic_version: number;
|
|
58
|
+
$extensionObject?: any;
|
|
59
|
+
get typeDefinitionObj(): UAVariableType;
|
|
60
|
+
get typeDefinition(): NodeId;
|
|
61
|
+
dataType: NodeId;
|
|
62
|
+
/**
|
|
63
|
+
* The **AccessLevel Attribute** is used to indicate how the Value of a Variable can be accessed
|
|
64
|
+
* (read/write) and if it contains current and/or historic data.
|
|
65
|
+
*
|
|
66
|
+
* The AccessLevel does not take any user access rights into account, i.e. although the Variable is
|
|
67
|
+
* writable this may be restricted to a certain user / user group.
|
|
68
|
+
*
|
|
69
|
+
* The {{link:AccessLevelType}}
|
|
70
|
+
*/
|
|
71
|
+
accessLevel: number;
|
|
72
|
+
/**
|
|
73
|
+
* The UserAccessLevel Attribute is used to indicate how the Value of a Variable can be accessed
|
|
74
|
+
* (read/write) and if it contains current or historic data taking user access rights into account.
|
|
75
|
+
*
|
|
76
|
+
* The AccessLevelType is defined in 8.57.
|
|
77
|
+
*/
|
|
78
|
+
userAccessLevel?: number;
|
|
79
|
+
/**
|
|
80
|
+
* This Attribute indicates whether the Value Attribute of the Variable is an array and how many dimensions
|
|
81
|
+
* the array has.
|
|
82
|
+
* It may have the following values:
|
|
83
|
+
*
|
|
84
|
+
* * n > 1 : the Value is an array with the specified number of dimensions.
|
|
85
|
+
* * OneDimension (1): The value is an array with one dimension.
|
|
86
|
+
* * OneOrMoreDimensions (0): The value is an array with one or more dimensions.
|
|
87
|
+
* * Scalar (-1): The value is not an array.
|
|
88
|
+
* * Any (-2): The value can be a scalar or an array with any number of dimensions.
|
|
89
|
+
* * ScalarOrOneDimension (-3): The value can be a scalar or a one dimensional array.
|
|
90
|
+
*
|
|
91
|
+
* NOTE:
|
|
92
|
+
* * All DataTypes are considered to be scalar, even if they have array-like semantics like ByteString and String.
|
|
93
|
+
*/
|
|
94
|
+
valueRank: number;
|
|
95
|
+
/**
|
|
96
|
+
* The MinimumSamplingInterval Attribute indicates how 'current' the Value of the Variable will
|
|
97
|
+
* be kept.
|
|
98
|
+
*
|
|
99
|
+
* It specifies (in milliseconds) how fast the Server can reasonably sample the value
|
|
100
|
+
* for changes (see Part 4 for a detailed description of sampling interval).
|
|
101
|
+
*
|
|
102
|
+
* A MinimumSamplingInterval of 0 indicates that the Server is to monitor the item continuously.
|
|
103
|
+
*
|
|
104
|
+
* A MinimumSamplingInterval of -1 means indeterminate.
|
|
105
|
+
*/
|
|
106
|
+
minimumSamplingInterval: number;
|
|
107
|
+
/**
|
|
108
|
+
* This Attribute specifies the length of each dimension for an array value.
|
|
109
|
+
*
|
|
110
|
+
* - The Attribute is intended to describe the capability of the Variable, not the current size.
|
|
111
|
+
* - The number of elements shall be equal to the value of the `valueRank` Attribute.
|
|
112
|
+
* - Shall be null if `valueRank` <=0.
|
|
113
|
+
* - A value of 0 for an individual dimension indicates that the dimension has a variable length.
|
|
114
|
+
*
|
|
115
|
+
* **example**
|
|
116
|
+
*
|
|
117
|
+
*
|
|
118
|
+
* For example, if a Variable is defined by the following javascript array with 346 Int32 elements:
|
|
119
|
+
*
|
|
120
|
+
* `const myArray = new Array(346).fill(0);`
|
|
121
|
+
*
|
|
122
|
+
* then:
|
|
123
|
+
* * `DataType` would point to an `Int32`
|
|
124
|
+
* * the Variable's `valueRank` has the value 1 and,
|
|
125
|
+
* * the `arrayDimensions` is an array with one entry having the value 346.
|
|
126
|
+
*
|
|
127
|
+
* ```javascript
|
|
128
|
+
* {
|
|
129
|
+
* dataType: "Int32",
|
|
130
|
+
* valueRank: 1,
|
|
131
|
+
* arrayDimensions: [346]
|
|
132
|
+
* }
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
*
|
|
136
|
+
* **Note**: the maximum length of an array transferred on the wire is 2147483647 (max Int32)
|
|
137
|
+
* and a multidimensional array is encoded as a one dimensional array.
|
|
138
|
+
*
|
|
139
|
+
*/
|
|
140
|
+
arrayDimensions: UInt32[] | null;
|
|
141
|
+
/**
|
|
142
|
+
* The `historizing` attribute indicates whether the server is actively collecting data for the
|
|
143
|
+
* history of the variable.
|
|
144
|
+
*
|
|
145
|
+
* This differs from the `accessLevel` Attribute which identifies if the variable has any historical data.
|
|
146
|
+
*
|
|
147
|
+
* A value of **true** indicates that the server is actively collecting data.
|
|
148
|
+
*
|
|
149
|
+
* A value of **false** indicates the server is not actively collecting data.
|
|
150
|
+
*
|
|
151
|
+
* Default value is **false**.
|
|
152
|
+
*/
|
|
153
|
+
historizing: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* returns true if the `accessLevel` flag allows the variable to be readable in the specified context.
|
|
156
|
+
* @param context
|
|
157
|
+
*/
|
|
158
|
+
isReadable(context: ISessionContext): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* returns true if the `userAccessLevel` flag allows the variable to be readable in the specified context.
|
|
161
|
+
* @param context
|
|
162
|
+
*/
|
|
163
|
+
isUserReadable(context: ISessionContext): boolean;
|
|
164
|
+
/**
|
|
165
|
+
* returns true if the `accessLevel` flag allows the variable to be writeable in the specified context.
|
|
166
|
+
* @param context
|
|
167
|
+
*/
|
|
168
|
+
isWritable(context: ISessionContext): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* returns true if the `userAccessLevel` flag allows the variable to be writeable in the specified context.
|
|
171
|
+
* @param context
|
|
172
|
+
*/
|
|
173
|
+
isUserWritable(context: ISessionContext): boolean;
|
|
174
|
+
/***
|
|
175
|
+
* from OPC.UA.Spec 1.02 part 4
|
|
176
|
+
* 5.10.2.4 StatusCodes
|
|
177
|
+
* Table 51 defines values for the operation level statusCode contained in the DataValue structure of
|
|
178
|
+
* each values element. Common StatusCodes are defined in Table 166.
|
|
179
|
+
*
|
|
180
|
+
* **Read Operation Level Result Codes**
|
|
181
|
+
*
|
|
182
|
+
* |Symbolic Id | Description|
|
|
183
|
+
* |----------------------------|----------------------------------------|
|
|
184
|
+
* |BadNodeIdInvalid | The syntax of the node id is not valid.|
|
|
185
|
+
* |BadNodeIdUnknown | The node id refers to a node that does not exist in the server address space.|
|
|
186
|
+
* |BadAttributeIdInvalid | BadAttributeIdInvalid The attribute is not supported for the specified node.|
|
|
187
|
+
* |BadIndexRangeInvalid | The syntax of the index range parameter is invalid.|
|
|
188
|
+
* |BadIndexRangeNoData | No data exists within the range of indexes specified.|
|
|
189
|
+
* |BadDataEncodingInvalid | The data encoding is invalid. This result is used if no dataEncoding can be applied because an Attribute other than Value was requested or the DataType of the Value Attribute is not a subtype of the Structure DataType. |
|
|
190
|
+
* |BadDataEncodingUnsupported | The server does not support the requested data encoding for the node. This result is used if a dataEncoding can be applied but the passed data encoding is not known to the Server.|
|
|
191
|
+
* |BadNotReadable | The access level does not allow reading or subscribing to the Node.|
|
|
192
|
+
* |BadUserAccessDenied | User does not have permission to perform the requested operation. (table 165)|
|
|
193
|
+
* | BadSecurityModeInsufficient | The operation is not permitted over the current secure channel. |
|
|
194
|
+
* | BadInsufficientPrivileges | The user does not have enough privileges to perform the requested operation.
|
|
195
|
+
*/
|
|
196
|
+
readValue(context?: ISessionContext | null, indexRange?: NumericRange, dataEncoding?: QualifiedNameLike | null): DataValue;
|
|
197
|
+
readValueAsync(context: ISessionContext | null): Promise<DataValue>;
|
|
198
|
+
readValueAsync(context: ISessionContext | null, callback: CallbackT<DataValue>): void;
|
|
199
|
+
isEnumeration(): boolean;
|
|
200
|
+
isExtensionObject(): boolean;
|
|
201
|
+
/**
|
|
202
|
+
*
|
|
203
|
+
*/
|
|
204
|
+
readEnumValue(): EnumValue2;
|
|
205
|
+
/**
|
|
206
|
+
*
|
|
207
|
+
* @precondition UAVariable must have a dataType deriving from "Enumeration"
|
|
208
|
+
*/
|
|
209
|
+
writeEnumValue(value: string | number): void;
|
|
210
|
+
readAttribute(context: ISessionContext | null, attributeId: AttributeIds, indexRange?: NumericRange, dataEncoding?: QualifiedNameLike | null): DataValue;
|
|
211
|
+
setValueFromSource(value: VariantLike, statusCode?: StatusCode, sourceTimestamp?: Date): void;
|
|
212
|
+
writeValue(context: ISessionContext, dataValue: DataValue, indexRange: string | NumericRange | null, callback: StatusCodeCallback): void;
|
|
213
|
+
writeValue(context: ISessionContext, dataValue: DataValue, callback: StatusCodeCallback): void;
|
|
214
|
+
writeValue(context: ISessionContext, dataValue: DataValue, indexRange?: string | NumericRange | null): Promise<StatusCode>;
|
|
215
|
+
asyncRefresh(oldestDate: Date, callback: CallbackT<DataValue>): void;
|
|
216
|
+
asyncRefresh(oldestDate: Date): Promise<DataValue>;
|
|
217
|
+
/**
|
|
218
|
+
* write a variable attribute (callback version)
|
|
219
|
+
* @param context
|
|
220
|
+
* @param writeValue
|
|
221
|
+
* @param callback
|
|
222
|
+
*
|
|
223
|
+
* **example**
|
|
224
|
+
*
|
|
225
|
+
* ```javascript
|
|
226
|
+
* const writeValue = {
|
|
227
|
+
* attributeId: AttributeIds.Value,
|
|
228
|
+
* dataValue: new DataValue({
|
|
229
|
+
* statusCode: StatusCodes.Good,
|
|
230
|
+
* sourceTimestamp: new Date(),
|
|
231
|
+
* value: new Variant({ dataType: DataType.Double, value: 3.14 })
|
|
232
|
+
* }),
|
|
233
|
+
* nodeId
|
|
234
|
+
* };
|
|
235
|
+
* myVariable.writeAttribute(context,writeValue,(err, statusCode) => {
|
|
236
|
+
* if (err) { console.log("Write has failed"); return; }
|
|
237
|
+
* console.log("write statusCode = ",statusCode.toString());
|
|
238
|
+
* });
|
|
239
|
+
* ```
|
|
240
|
+
*
|
|
241
|
+
*/
|
|
242
|
+
writeAttribute(context: ISessionContext | null, writeValue: WriteValueOptions, callback: StatusCodeCallback): void;
|
|
243
|
+
/**
|
|
244
|
+
* write a variable attribute (async/await version)
|
|
245
|
+
* @param context
|
|
246
|
+
* @param writeValue
|
|
247
|
+
*
|
|
248
|
+
*
|
|
249
|
+
* **example**
|
|
250
|
+
*
|
|
251
|
+
* ```javascript
|
|
252
|
+
* try {
|
|
253
|
+
* const writeValue = {
|
|
254
|
+
* attributeId: AttributeIds.Value,
|
|
255
|
+
* dataValue: new DataValue({
|
|
256
|
+
* statusCode: StatusCodes.Good,
|
|
257
|
+
* sourceTimestamp: new Date(),
|
|
258
|
+
* value: new Variant({ dataType: DataType.Double, value: 3.14 })
|
|
259
|
+
* }),
|
|
260
|
+
* nodeId
|
|
261
|
+
* };
|
|
262
|
+
* const statusCode = await myVariable.writeAttribute(context,writeValue);
|
|
263
|
+
* } catch(err) {
|
|
264
|
+
* console.log("Write has failed");
|
|
265
|
+
* return;
|
|
266
|
+
* }
|
|
267
|
+
* console.log("write statusCode = ", statusCode.toString());
|
|
268
|
+
* ```
|
|
269
|
+
*
|
|
270
|
+
*/
|
|
271
|
+
writeAttribute(context: ISessionContext | null, writeValue: WriteValueOptions): Promise<StatusCode>;
|
|
272
|
+
touchValue(updateNow?: PreciseClock): void;
|
|
273
|
+
bindVariable(options?: BindVariableOptions, overwrite?: boolean): void;
|
|
274
|
+
bindExtensionObject(optionalExtensionObject?: ExtensionObject | ExtensionObject[], options?: BindExtensionObjectOptions): ExtensionObject | ExtensionObject[] | null;
|
|
275
|
+
bindExtensionObjectScalar(optionalExtensionObject: ExtensionObject, options?: BindExtensionObjectOptions): ExtensionObject | null;
|
|
276
|
+
bindExtensionObjectArray(optionalExtensionObjectArray: ExtensionObject[], options?: BindExtensionObjectOptions): ExtensionObject[] | null;
|
|
277
|
+
installExtensionObjectVariables(): void;
|
|
278
|
+
historyRead(context: ISessionContext, historyReadDetails: HistoryReadDetails | ReadRawModifiedDetails | ReadEventDetails | ReadProcessedDetails | ReadAtTimeDetails, indexRange: NumericRange | null, dataEncoding: QualifiedNameLike | null, continuationData: ContinuationData): Promise<HistoryReadResult>;
|
|
279
|
+
historyRead(context: ISessionContext, historyReadDetails: HistoryReadDetails | ReadRawModifiedDetails | ReadEventDetails | ReadProcessedDetails | ReadAtTimeDetails, indexRange: NumericRange | null, dataEncoding: QualifiedNameLike | null, continuationData: ContinuationData, callback: CallbackT<HistoryReadResult>): void;
|
|
280
|
+
clone(options: CloneOptions, optionalFilter?: CloneFilter, extraInfo?: CloneExtraInfo): UAVariable;
|
|
281
|
+
on(eventName: "semantic_changed", eventHandler: () => void): this;
|
|
282
|
+
on(eventName: "value_changed", eventHandler: (dataValue: DataValue) => void): this;
|
|
283
|
+
once(eventName: "semantic_changed", eventHandler: () => void): this;
|
|
284
|
+
once(eventName: "value_changed", eventHandler: (dataValue: DataValue) => void): this;
|
|
285
|
+
}
|
package/dist/ua_variable.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=ua_variable.js.map
|
package/dist/ua_variable_t.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { QualifiedNameLike } from "node-opcua-data-model";
|
|
2
|
-
import { DataValueT } from "node-opcua-data-value";
|
|
3
|
-
import { NumericRange } from "node-opcua-numeric-range";
|
|
4
|
-
import { CallbackT, StatusCode, StatusCodeCallback } from "node-opcua-status-code";
|
|
5
|
-
import { DataType } from "node-opcua-variant";
|
|
6
|
-
import { ISessionContext } from "./session_context";
|
|
7
|
-
import { UAVariable } from "./ua_variable";
|
|
8
|
-
export interface UAVariableT<T, DT extends DataType> extends UAVariable {
|
|
9
|
-
readValue(context?: ISessionContext | null, indexRange?: NumericRange, dataEncoding?: QualifiedNameLike | null): DataValueT<T, DT>;
|
|
10
|
-
readValueAsync(context: ISessionContext | null): Promise<DataValueT<T, DT>>;
|
|
11
|
-
readValueAsync(context: ISessionContext | null, callback: CallbackT<DataValueT<T, DT>>): void;
|
|
12
|
-
writeValue(context: ISessionContext, dataValue: DataValueT<T, DT>, indexRange: NumericRange | null, callback: StatusCodeCallback): void;
|
|
13
|
-
writeValue(context: ISessionContext, dataValue: DataValueT<T, DT>, callback: StatusCodeCallback): void;
|
|
14
|
-
writeValue(context: ISessionContext, dataValue: DataValueT<T, DT>, indexRange?: NumericRange | null): Promise<StatusCode>;
|
|
15
|
-
}
|
|
1
|
+
import { QualifiedNameLike } from "node-opcua-data-model";
|
|
2
|
+
import { DataValueT } from "node-opcua-data-value";
|
|
3
|
+
import { NumericRange } from "node-opcua-numeric-range";
|
|
4
|
+
import { CallbackT, StatusCode, StatusCodeCallback } from "node-opcua-status-code";
|
|
5
|
+
import { DataType } from "node-opcua-variant";
|
|
6
|
+
import { ISessionContext } from "./session_context";
|
|
7
|
+
import { UAVariable } from "./ua_variable";
|
|
8
|
+
export interface UAVariableT<T, DT extends DataType> extends UAVariable {
|
|
9
|
+
readValue(context?: ISessionContext | null, indexRange?: NumericRange, dataEncoding?: QualifiedNameLike | null): DataValueT<T, DT>;
|
|
10
|
+
readValueAsync(context: ISessionContext | null): Promise<DataValueT<T, DT>>;
|
|
11
|
+
readValueAsync(context: ISessionContext | null, callback: CallbackT<DataValueT<T, DT>>): void;
|
|
12
|
+
writeValue(context: ISessionContext, dataValue: DataValueT<T, DT>, indexRange: NumericRange | null, callback: StatusCodeCallback): void;
|
|
13
|
+
writeValue(context: ISessionContext, dataValue: DataValueT<T, DT>, callback: StatusCodeCallback): void;
|
|
14
|
+
writeValue(context: ISessionContext, dataValue: DataValueT<T, DT>, indexRange?: NumericRange | null): Promise<StatusCode>;
|
|
15
|
+
}
|
package/dist/ua_variable_t.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=ua_variable_t.js.map
|