@tier0/node-opc-da 1.0.7
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/LICENSE +201 -0
- package/README.md +171 -0
- package/docs/opcda.idl +1166 -0
- package/package.json +30 -0
- package/src/constants.js +212 -0
- package/src/enumString.js +161 -0
- package/src/filetime.js +79 -0
- package/src/index.js +62 -0
- package/src/opcAsyncIO.js +102 -0
- package/src/opcBrowser.js +285 -0
- package/src/opcCommon.js +84 -0
- package/src/opcGroupStateManager.js +248 -0
- package/src/opcItemIO.js +60 -0
- package/src/opcItemManager.js +415 -0
- package/src/opcItemProperties.js +102 -0
- package/src/opcServer.js +447 -0
- package/src/opcSyncIO.js +213 -0
- package/src/opctypes.js +116 -0
package/src/opctypes.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
const constants = require('./constants');
|
|
4
|
+
const dcom = require('node-dcom');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* This file contain the function definitions for OPC types that dont need a whole class for themselves
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {Number} id
|
|
14
|
+
*/
|
|
15
|
+
function OPCNAMESPACETYPEfromID(id) {
|
|
16
|
+
switch(id){
|
|
17
|
+
case 1:
|
|
18
|
+
return constants.opc.namespaceType.HIERARCHIAL;
|
|
19
|
+
case 2:
|
|
20
|
+
return constants.opc.namespaceType.FLAT;
|
|
21
|
+
default:
|
|
22
|
+
return constants.opc.namespaceType.UNKNOWN;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class OPCITEMDEF
|
|
27
|
+
{
|
|
28
|
+
constructor() {
|
|
29
|
+
this.accessPath = "";
|
|
30
|
+
|
|
31
|
+
this.itemID = "";
|
|
32
|
+
|
|
33
|
+
this.active = true;
|
|
34
|
+
|
|
35
|
+
this.clientHandle;
|
|
36
|
+
|
|
37
|
+
this.requestedDataType = null;
|
|
38
|
+
|
|
39
|
+
this.reserved;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
getAccessPath() {
|
|
43
|
+
return this.accessPath;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
setAccessPath(accessPath) {
|
|
47
|
+
this.accessPath = accessPath;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
getClientHandle() {
|
|
51
|
+
return this.clientHandle;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
setClientHandle(clientHandle) {
|
|
55
|
+
this.clientHandle = clientHandle;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
isActive() {
|
|
59
|
+
return this.active;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setActive(active) {
|
|
63
|
+
this.active = active;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getItemID() {
|
|
67
|
+
return this.itemID;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
setItemID(itemID) {
|
|
71
|
+
this.itemID = itemID;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
getRequestedDataType() {
|
|
75
|
+
return this.requestedDataType;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
setRequestedDataType(requestedDataType) {
|
|
79
|
+
this.requestedDataType = requestedDataType;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
getReserved() {
|
|
83
|
+
return this.reserved;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
setReserved(reserved) {
|
|
87
|
+
this.reserved = reserved;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Convert to structure to a J-Interop structure
|
|
92
|
+
*
|
|
93
|
+
* @return the j-interop structe
|
|
94
|
+
* @throws JIException
|
|
95
|
+
*/
|
|
96
|
+
toStruct() {
|
|
97
|
+
let struct = new dcom.Struct ();
|
|
98
|
+
struct.addMember(new dcom.ComValue(new dcom.ComString(this.getAccessPath(), dcom.Flags.FLAG_REPRESENTATION_STRING_LPWSTR ),
|
|
99
|
+
dcom.Types.COMSTRING));
|
|
100
|
+
struct.addMember(new dcom.ComValue(new dcom.ComString(this.getItemID(), dcom.Flags.FLAG_REPRESENTATION_STRING_LPWSTR ),
|
|
101
|
+
dcom.Types.COMSTRING));
|
|
102
|
+
struct.addMember(new dcom.ComValue(Number(this.isActive() ? 1 : 0 ), dcom.Types.INTEGER));
|
|
103
|
+
struct.addMember(new dcom.ComValue(Number(this.getClientHandle()), dcom.Types.INTEGER) );
|
|
104
|
+
|
|
105
|
+
struct.addMember(new dcom.ComValue(Number( 0 ), dcom.Types.INTEGER)); // blob size
|
|
106
|
+
struct.addMember(new dcom.ComValue(new dcom.Pointer(null, true),dcom.Types.POINTER)); // blob
|
|
107
|
+
|
|
108
|
+
struct.addMember(new dcom.ComValue(Number(this.getRequestedDataType()), dcom.Types.SHORT));
|
|
109
|
+
struct.addMember(new dcom.ComValue(Number(this.getReserved()), dcom.Types.SHORT));
|
|
110
|
+
return struct;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
module.exports = {
|
|
114
|
+
OPCITEMDEF,
|
|
115
|
+
OPCNAMESPACETYPEfromID
|
|
116
|
+
}
|