Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
0501e23c
Commit
0501e23c
authored
May 15, 2019
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Web: Changed Gdh to use Promises
parent
115edd49
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
820 additions
and
1014 deletions
+820
-1014
java/jsw/co/src/gdh.ts
java/jsw/co/src/gdh.ts
+392
-563
java/jsw/ev/src/ev.ts
java/jsw/ev/src/ev.ts
+64
-70
java/jsw/flow/src/flow.ts
java/jsw/flow/src/flow.ts
+1
-4
java/jsw/ge/src/ge_appl.ts
java/jsw/ge/src/ge_appl.ts
+8
-8
java/jsw/ge/src/ge_dyn.ts
java/jsw/ge/src/ge_dyn.ts
+119
-127
java/jsw/ge/src/ge_graph.ts
java/jsw/ge/src/ge_graph.ts
+7
-11
java/jsw/opwind/src/opwind.ts
java/jsw/opwind/src/opwind.ts
+9
-10
java/jsw/xtt/src/xtt.ts
java/jsw/xtt/src/xtt.ts
+220
-221
No files found.
java/jsw/co/src/gdh.ts
View file @
0501e23c
...
@@ -222,36 +222,6 @@ enum Msg {
...
@@ -222,36 +222,6 @@ enum Msg {
GET_OBJECT_FROM_AREF
GET_OBJECT_FROM_AREF
}
}
class
Uint8ArrayHelper
{
buf
:
Uint8Array
;
idx
:
number
;
constructor
(
size
,
tag
)
{
this
.
buf
=
new
Uint8Array
(
size
);
this
.
buf
[
0
]
=
tag
;
this
.
idx
=
2
;
}
pack16Bit
(
value
)
{
this
.
buf
[
this
.
idx
++
]
=
value
&
0xFF
;
this
.
buf
[
this
.
idx
++
]
=
(
value
>>
8
)
&
0xFF
;
}
pack32Bit
(
value
)
{
this
.
buf
[
this
.
idx
++
]
=
value
&
0xFF
;
this
.
buf
[
this
.
idx
++
]
=
(
value
>>
8
)
&
0xFF
;
this
.
buf
[
this
.
idx
++
]
=
(
value
>>
16
)
&
0xFF
;
this
.
buf
[
this
.
idx
++
]
=
(
value
>>
24
)
&
0xFF
;
}
packString
(
string
)
{
this
.
pack16Bit
(
string
.
length
);
for
(
let
i
=
0
;
i
<
string
.
length
;
i
++
)
{
this
.
buf
[
this
.
idx
++
]
=
string
.
charCodeAt
(
i
);
}
}
}
class
DataViewHelper
{
class
DataViewHelper
{
dv
:
DataView
;
dv
:
DataView
;
offset
=
0
;
offset
=
0
;
...
@@ -296,20 +266,19 @@ class DataViewHelper {
...
@@ -296,20 +266,19 @@ class DataViewHelper {
}
}
class
Gdh
{
class
Gdh
{
pending
:
Array
=
[];
sub
:
Array
<
Sub
>
=
[];
sub
:
Array
<
Sub
>
=
[];
static
PORT
=
4448
;
static
PORT
=
4448
;
ws
:
WebSocket
=
null
;
ws
:
WebSocket
=
null
;
return_cb
:
()
=>
void
=
null
;
next_id
=
1234
;
next_id
=
1234
;
subscriptionCount
=
1
;
subscriptionCount
=
1
;
listSent
=
false
;
listSent
=
false
;
pending
=
[];
constructor
(
open_cb
,
close_cb
=
null
)
{
constructor
(
open_cb
,
close_cb
=
null
)
{
if
(
window
.
location
.
hostname
===
""
)
{
if
(
window
.
location
.
hostname
===
""
)
{
this
.
ws
=
new
WebSocket
(
"
ws:127.0.0.1:
4448
"
);
this
.
ws
=
new
WebSocket
(
"
ws:127.0.0.1:
"
+
String
(
Gdh
.
PORT
)
);
}
else
{
}
else
{
this
.
ws
=
new
WebSocket
(
"
ws://
"
+
window
.
location
.
hostname
+
"
:
4448
"
);
this
.
ws
=
new
WebSocket
(
"
ws://
"
+
window
.
location
.
hostname
+
"
:
"
+
String
(
Gdh
.
PORT
)
);
}
}
this
.
ws
.
binaryType
=
"
arraybuffer
"
;
this
.
ws
.
binaryType
=
"
arraybuffer
"
;
...
@@ -326,406 +295,253 @@ class Gdh {
...
@@ -326,406 +295,253 @@ class Gdh {
};
};
this
.
ws
.
onmessage
=
function
(
e
)
{
this
.
ws
.
onmessage
=
function
(
e
)
{
if
(
typeof
e
.
data
===
"
string
"
)
{
let
dv
=
new
DataViewHelper
(
e
.
data
);
let
type
=
dv
.
getUint8
();
let
id
=
dv
.
getUint32
();
let
resolve
=
this
.
pending
[
id
];
if
(
type
===
Msg
.
GET_OBJECT_REF_INFO_ALL
)
{
resolve
(
new
DataViewHelper
(
e
.
data
));
delete
this
.
pending
[
id
];
}
else
{
}
else
{
if
(
e
.
data
instanceof
ArrayBuffer
)
{
let
sts
=
dv
.
getUint32
();
let
dv
=
new
DataViewHelper
(
e
.
data
);
let
value
=
this
.
unpackType
(
dv
,
sts
,
type
);
let
type
=
dv
.
getUint8
();
resolve
({
let
id
=
dv
.
getUint32
();
"
sts
"
:
sts
,
let
sts
=
dv
.
getUint32
();
"
value
"
:
value
});
switch
(
type
)
{
delete
this
.
pending
[
id
];
case
Msg
.
GET_OBJECT_INFO_BOOLEAN
:
}
let
value
=
dv
.
getUint8
();
};
let
func_cb
=
this
.
gdh
.
pending
[
id
].
func_cb
;
}
func_cb
(
id
,
sts
,
value
);
delete
this
.
gdh
.
pending
[
id
];
unpackType
(
dv
,
sts
,
type
)
{
break
;
switch
(
type
)
{
case
Msg
.
GET_OBJECT_INFO_INT
:
case
Msg
.
GET_OBJECT_INFO_BOOLEAN
:
let
value
=
dv
.
getUint32
();
return
dv
.
getUint8
();
let
pending_data
=
this
.
gdh
.
pending
[
id
];
case
Msg
.
GET_OBJECT_INFO_INT
:
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
value
);
return
dv
.
getUint32
();
delete
this
.
gdh
.
pending
[
id
];
case
Msg
.
GET_OBJECT_INFO_FLOAT
:
break
;
return
dv
.
getFloat32
();
case
Msg
.
GET_OBJECT_INFO_FLOAT
:
case
Msg
.
GET_OBJECT_INFO_FLOAT_ARRAY
:
let
value
=
dv
.
getFloat32
();
let
asize
=
dv
.
getInt32
();
let
pending_data
=
this
.
gdh
.
pending
[
id
];
let
value
=
new
Array
(
asize
);
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
value
);
for
(
let
i
=
0
;
i
<
asize
;
i
++
)
{
delete
this
.
gdh
.
pending
[
id
];
value
[
i
]
=
dv
.
getFloat32
();
break
;
}
case
Msg
.
GET_OBJECT_INFO_FLOAT_ARRAY
:
return
value
;
let
asize
=
dv
.
getInt32
();
case
Msg
.
GET_ALL_XTT_CHILDREN
:
let
value
=
new
Array
(
asize
);
let
result
=
[];
for
(
let
i
=
0
;
i
<
asize
;
i
++
)
{
let
size
=
dv
.
getUint32
();
value
[
i
]
=
dv
.
getFloat32
();
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
}
let
info
=
new
ObjectInfo
();
let
pending_data
=
this
.
gdh
.
pending
[
id
];
let
vid
=
dv
.
getUint32
();
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
value
);
let
oix
=
dv
.
getUint32
();
delete
this
.
gdh
.
pending
[
id
];
info
.
objid
=
new
PwrtObjid
(
vid
,
oix
);
break
;
info
.
cid
=
dv
.
getUint32
();
case
Msg
.
SET_OBJECT_INFO_BOOLEAN
:
info
.
has_children
=
dv
.
getUint16
()
!==
0
;
break
;
info
.
name
=
dv
.
getString
();
case
Msg
.
SET_OBJECT_INFO_INT
:
info
.
description
=
dv
.
getString
();
break
;
info
.
classname
=
dv
.
getString
();
case
Msg
.
SET_OBJECT_INFO_FLOAT
:
result
.
push
(
info
);
break
;
}
case
Msg
.
SET_OBJECT_INFO_STRING
:
return
result
;
break
;
case
Msg
.
GET_ALL_CLASS_ATTRIBUTES
:
case
Msg
.
TOGGLE_OBJECT_INFO
:
let
result
=
[];
break
;
let
size
=
dv
.
getUint32
();
case
Msg
.
REF_OBJECT_INFO
:
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
delete
this
.
gdh
.
pending
[
id
];
let
info
=
new
AttributeInfo
();
break
;
info
.
type
=
dv
.
getUint32
();
case
Msg
.
UNREF_OBJECT_INFO
:
info
.
flags
=
dv
.
getUint32
();
delete
this
.
gdh
.
pending
[
id
];
info
.
size
=
dv
.
getUint16
();
break
;
info
.
elements
=
dv
.
getUint16
();
case
Msg
.
REF_OBJECT_INFO_LIST
:
info
.
name
=
dv
.
getString
();
let
func_cb
=
this
.
gdh
.
pending
[
id
].
func_cb
;
info
.
classname
=
dv
.
getString
();
func_cb
(
id
,
sts
);
result
.
push
(
info
);
delete
this
.
gdh
.
pending
[
id
];
}
break
;
return
result
;
case
Msg
.
GET_OBJECT_REF_INFO_ALL
:
case
Msg
.
GET_OBJECT
:
let
size
=
dv
.
getUint32
();
case
Msg
.
GET_OBJECT_FROM_AREF
:
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
case
Msg
.
GET_OBJECT_FROM_NAME
:
let
eid
=
dv
.
getUint32
();
let
info
=
null
;
let
esize
=
dv
.
getUint32
();
if
(
odd
(
sts
))
{
let
sub
=
this
.
gdh
.
sub
[
eid
];
info
=
new
ObjectInfo
();
if
(
typeof
sub
!==
'
undefined
'
)
{
let
vid
=
dv
.
getUint32
();
let
value
;
let
oix
=
dv
.
getUint32
();
switch
(
sub
.
type
)
{
info
.
objid
=
new
PwrtObjid
(
vid
,
oix
);
case
Type
.
Boolean
:
info
.
cid
=
dv
.
getUint32
();
if
(
sub
.
elements
<=
1
)
{
info
.
has_children
=
dv
.
getUint16
()
!==
0
;
value
=
dv
.
getUint8
();
info
.
name
=
dv
.
getString
();
}
else
{
info
.
fullname
=
dv
.
getString
();
let
elements
=
esize
;
info
.
classname
=
dv
.
getString
();
if
(
elements
!==
sub
.
elements
)
{
info
.
description
=
dv
.
getString
();
console
.
log
(
"
Subscription size error
"
,
elements
,
info
.
param1
=
dv
.
getString
();
sub
.
elements
,
eid
);
}
}
return
info
;
value
=
new
Array
(
elements
);
case
Msg
.
CRR_SIGNAL
:
for
(
let
k
=
0
;
k
<
elements
;
k
++
)
{
let
crrtext
=
null
;
value
[
k
]
=
dv
.
getUint8
();
let
result
=
[];
}
if
(
odd
(
sts
))
{
}
let
size
=
dv
.
getUint16
();
break
;
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
case
Type
.
Float32
:
let
info
=
new
CrrInfo
();
if
(
sub
.
elements
<=
1
)
{
info
.
type
=
dv
.
getUint16
();
value
=
dv
.
getFloat32
();
let
vid
=
dv
.
getUint32
();
}
else
{
let
oix
=
dv
.
getUint32
();
let
elements
=
esize
/
4
;
info
.
objid
=
new
PwrtObjid
(
vid
,
oix
);
if
(
elements
!==
sub
.
elements
)
{
info
.
name
=
dv
.
getString
();
console
.
log
(
"
Subscription size error
"
,
elements
,
info
.
classname
=
dv
.
getString
();
sub
.
elements
,
eid
);
result
.
push
(
info
);
}
value
=
new
Array
(
elements
);
for
(
let
k
=
0
;
k
<
elements
;
k
++
)
{
value
[
k
]
=
dv
.
getFloat32
();
}
}
break
;
case
Type
.
Int8
:
case
Type
.
Int16
:
case
Type
.
Int32
:
case
Type
.
UInt8
:
case
Type
.
UInt16
:
case
Type
.
UInt32
:
case
Type
.
Status
:
case
Type
.
NetStatus
:
case
Type
.
Mask
:
case
Type
.
Enum
:
case
Type
.
Bit
:
if
(
sub
.
elements
<=
1
)
{
value
=
dv
.
getInt32
();
}
else
{
let
elements
=
esize
/
4
;
if
(
elements
!==
sub
.
elements
)
{
console
.
log
(
"
Subscription size error
"
,
elements
,
sub
.
elements
,
eid
);
}
value
=
new
Array
(
elements
);
for
(
let
k
=
0
;
k
<
elements
;
k
++
)
{
value
[
k
]
=
dv
.
getInt32
();
}
}
break
;
case
Type
.
String
:
case
Type
.
Time
:
case
Type
.
DeltaTime
:
case
Type
.
AttrRef
:
case
Type
.
Objid
:
if
(
sub
.
elements
<=
1
)
{
value
=
dv
.
getString
();
}
else
{
let
elements
=
sub
.
elements
;
if
(
elements
!==
sub
.
elements
)
{
console
.
log
(
"
Subscription size error
"
,
elements
,
sub
.
elements
,
eid
);
}
value
=
new
Array
(
elements
);
for
(
let
l
=
0
;
l
<
elements
;
l
++
)
{
value
[
l
]
=
dv
.
getString
();
}
}
break
;
default
:
break
;
}
this
.
gdh
.
sub
[
eid
].
value
=
value
;
}
}
if
(
typeof
this
.
gdh
.
pending
[
id
]
===
'
undefined
'
)
{
console
.
log
(
"
** GetObjectRefInfoAll received removed
"
,
id
);
break
;
}
let
func_cb
=
this
.
gdh
.
pending
[
id
].
func_cb
;
func_cb
(
id
,
sts
);
delete
this
.
gdh
.
pending
[
id
];
break
;
case
Msg
.
GET_ALL_XTT_CHILDREN
:
let
result
=
[];
let
size
=
dv
.
getUint32
();
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
let
info
=
new
ObjectInfo
();
let
vid
=
dv
.
getUint32
();
let
oix
=
dv
.
getUint32
();
info
.
objid
=
new
PwrtObjid
(
vid
,
oix
);
info
.
cid
=
dv
.
getUint32
();
info
.
has_children
=
dv
.
getUint16
()
!==
0
;
info
.
name
=
dv
.
getString
();
info
.
description
=
dv
.
getString
();
info
.
classname
=
dv
.
getString
();
result
.
push
(
info
);
}
let
pending_data
=
this
.
gdh
.
pending
[
id
];
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
result
);
delete
this
.
gdh
.
pending
[
id
];
break
;
case
Msg
.
GET_ALL_CLASS_ATTRIBUTES
:
let
result
=
[];
let
size
=
dv
.
getUint32
();
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
let
info
=
new
AttributeInfo
();
info
.
type
=
dv
.
getUint32
();
info
.
flags
=
dv
.
getUint32
();
info
.
size
=
dv
.
getUint16
();
info
.
elements
=
dv
.
getUint16
();
info
.
name
=
dv
.
getString
();
info
.
classname
=
dv
.
getString
();
result
.
push
(
info
);
}
let
pending_data
=
this
.
gdh
.
pending
[
id
];
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
result
);
delete
this
.
gdh
.
pending
[
id
];
break
;
case
Msg
.
GET_OBJECT
:
case
Msg
.
GET_OBJECT_FROM_AREF
:
case
Msg
.
GET_OBJECT_FROM_NAME
:
let
info
=
null
;
if
(
odd
(
sts
))
{
info
=
new
ObjectInfo
();
let
vid
=
dv
.
getUint32
();
let
oix
=
dv
.
getUint32
();
info
.
objid
=
new
PwrtObjid
(
vid
,
oix
);
info
.
cid
=
dv
.
getUint32
();
info
.
has_children
=
dv
.
getUint16
()
!==
0
;
info
.
name
=
dv
.
getString
();
info
.
fullname
=
dv
.
getString
();
info
.
classname
=
dv
.
getString
();
info
.
description
=
dv
.
getString
();
info
.
param1
=
dv
.
getString
();
}
let
pending_data
=
this
.
gdh
.
pending
[
id
];
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
info
);
delete
this
.
gdh
.
pending
[
id
];
break
;
case
Msg
.
CRR_SIGNAL
:
let
crrtext
=
null
;
let
result
=
[];
if
(
odd
(
sts
))
{
let
size
=
dv
.
getUint16
();
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
let
info
=
new
CrrInfo
();
info
.
type
=
dv
.
getUint16
();
let
vid
=
dv
.
getUint32
();
let
oix
=
dv
.
getUint32
();
info
.
objid
=
new
PwrtObjid
(
vid
,
oix
);
info
.
name
=
dv
.
getString
();
info
.
classname
=
dv
.
getString
();
result
.
push
(
info
);
}
}
let
pending_data
=
this
.
gdh
.
pending
[
id
];
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
result
);
delete
this
.
gdh
.
pending
[
id
];
break
;
case
Msg
.
GET_OPWIND_MENU
:
let
result
=
new
OpwindMenuInfo
();
if
(
odd
(
sts
))
{
result
.
title
=
dv
.
getString
();
result
.
text
=
dv
.
getString
();
result
.
enable_language
=
dv
.
getUint32
();
result
.
enable_login
=
dv
.
getUint32
();
result
.
enable_alarmlist
=
dv
.
getUint32
();
result
.
enable_eventlog
=
dv
.
getUint32
();
result
.
enable_navigator
=
dv
.
getUint32
();
result
.
disable_help
=
dv
.
getUint32
();
result
.
disable_proview
=
dv
.
getUint32
();
result
.
language
=
dv
.
getUint32
();
let
bsize
=
dv
.
getUint16
();
for
(
let
i
=
0
;
i
<
bsize
;
i
++
)
{
let
button
=
new
MenuButton
();
button
.
type
=
dv
.
getUint32
();
button
.
text
=
dv
.
getString
();
button
.
name
=
dv
.
getString
();
button
.
url
=
dv
.
getString
();
result
.
buttons
.
push
(
button
);
}
}
let
pending_data
=
this
.
gdh
.
pending
[
id
];
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
result
);
delete
this
.
gdh
.
pending
[
id
];
break
;
case
Msg
.
CHECK_USER
:
let
priv
=
0
;
if
(
odd
(
sts
))
{
priv
=
dv
.
getUint32
();
}
let
pending_data
=
this
.
gdh
.
pending
[
id
];
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
priv
);
delete
this
.
gdh
.
pending
[
id
];
break
;
case
Msg
.
GET_MSG
:
let
msg
=
""
;
if
(
odd
(
sts
))
{
msg
=
dv
.
getString
();
}
let
pending_data
=
this
.
gdh
.
pending
[
id
];
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
msg
);
delete
this
.
gdh
.
pending
[
id
];
break
;
case
Msg
.
MH_SYNC
:
let
result
=
[];
let
size
=
dv
.
getUint32
();
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
let
e
=
new
MhEvent
();
e
.
eventTime
=
dv
.
getString
();
e
.
eventText
=
dv
.
getString
();
e
.
eventName
=
dv
.
getString
();
e
.
eventFlags
=
dv
.
getUint32
();
e
.
eventStatus
=
dv
.
getUint32
();
e
.
eventPrio
=
dv
.
getUint32
();
e
.
eventId
=
new
MhEventId
();
e
.
eventId
.
nix
=
dv
.
getUint32
();
e
.
eventId
.
idx
=
dv
.
getUint32
();
e
.
eventId
.
birthTime
=
dv
.
getString
();
e
.
targetId
=
new
MhEventId
();
e
.
targetId
.
nix
=
dv
.
getUint32
();
e
.
targetId
.
idx
=
dv
.
getUint32
();
e
.
targetId
.
birthTime
=
dv
.
getString
();
e
.
eventType
=
dv
.
getUint32
();
let
objid
=
new
PwrtObjid
(
0
,
0
);
objid
.
vid
=
dv
.
getUint32
();
objid
.
oix
=
dv
.
getUint32
();
e
.
object
=
new
PwrtAttrRef
();
e
.
object
.
objid
=
objid
;
e
.
object
.
offset
=
dv
.
getUint32
();
e
.
object
.
body
=
dv
.
getUint32
();
e
.
object
.
size
=
dv
.
getUint32
();
e
.
object
.
flags
=
dv
.
getUint32
();
let
supObjid
=
new
PwrtObjid
(
0
,
0
);
supObjid
.
vid
=
dv
.
getUint32
();
supObjid
.
oix
=
dv
.
getUint32
();
e
.
supObject
=
new
PwrtAttrRef
();
e
.
supObject
.
objid
=
supObjid
;
e
.
supObject
.
offset
=
dv
.
getUint32
();
e
.
supObject
.
body
=
dv
.
getUint32
();
e
.
supObject
.
size
=
dv
.
getUint32
();
e
.
supObject
.
flags
=
dv
.
getUint32
();
e
.
eventMoreText
=
dv
.
getString
();
e
.
syncIdx
=
dv
.
getUint32
();
result
.
push
(
e
);
}
let
pending_data
=
this
.
gdh
.
pending
[
id
];
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
,
result
);
delete
this
.
gdh
.
pending
[
id
];
break
;
case
Msg
.
MH_ACK
:
let
pending_data
=
this
.
gdh
.
pending
[
id
];
pending_data
.
func_cb
(
id
,
pending_data
.
data
,
sts
);
delete
this
.
gdh
.
pending
[
id
];
break
;
default
:
console
.
log
(
"
Unknown message type
"
);
}
}
}
}
return
result
;
case
Msg
.
GET_OPWIND_MENU
:
let
result
=
new
OpwindMenuInfo
();
if
(
odd
(
sts
))
{
result
.
title
=
dv
.
getString
();
result
.
text
=
dv
.
getString
();
result
.
enable_language
=
dv
.
getUint32
();
result
.
enable_login
=
dv
.
getUint32
();
result
.
enable_alarmlist
=
dv
.
getUint32
();
result
.
enable_eventlog
=
dv
.
getUint32
();
result
.
enable_navigator
=
dv
.
getUint32
();
result
.
disable_help
=
dv
.
getUint32
();
result
.
disable_proview
=
dv
.
getUint32
();
result
.
language
=
dv
.
getUint32
();
let
bsize
=
dv
.
getUint16
();
for
(
let
i
=
0
;
i
<
bsize
;
i
++
)
{
let
button
=
new
MenuButton
();
button
.
type
=
dv
.
getUint32
();
button
.
text
=
dv
.
getString
();
button
.
name
=
dv
.
getString
();
button
.
url
=
dv
.
getString
();
result
.
buttons
.
push
(
button
);
}
}
return
result
;
case
Msg
.
CHECK_USER
:
let
priv
=
0
;
if
(
odd
(
sts
))
{
priv
=
dv
.
getUint32
();
}
return
priv
;
case
Msg
.
GET_MSG
:
let
msg
=
""
;
if
(
odd
(
sts
))
{
msg
=
dv
.
getString
();
}
return
msg
;
case
Msg
.
MH_SYNC
:
let
result
=
[];
let
size
=
dv
.
getUint32
();
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
let
e
=
new
MhEvent
();
e
.
eventTime
=
dv
.
getString
();
e
.
eventText
=
dv
.
getString
();
e
.
eventName
=
dv
.
getString
();
e
.
eventFlags
=
dv
.
getUint32
();
e
.
eventStatus
=
dv
.
getUint32
();
e
.
eventPrio
=
dv
.
getUint32
();
e
.
eventId
=
new
MhEventId
();
e
.
eventId
.
nix
=
dv
.
getUint32
();
e
.
eventId
.
idx
=
dv
.
getUint32
();
e
.
eventId
.
birthTime
=
dv
.
getString
();
e
.
targetId
=
new
MhEventId
();
e
.
targetId
.
nix
=
dv
.
getUint32
();
e
.
targetId
.
idx
=
dv
.
getUint32
();
e
.
targetId
.
birthTime
=
dv
.
getString
();
e
.
eventType
=
dv
.
getUint32
();
let
objid
=
new
PwrtObjid
(
0
,
0
);
objid
.
vid
=
dv
.
getUint32
();
objid
.
oix
=
dv
.
getUint32
();
e
.
object
=
new
PwrtAttrRef
();
e
.
object
.
objid
=
objid
;
e
.
object
.
offset
=
dv
.
getUint32
();
e
.
object
.
body
=
dv
.
getUint32
();
e
.
object
.
size
=
dv
.
getUint32
();
e
.
object
.
flags
=
dv
.
getUint32
();
let
supObjid
=
new
PwrtObjid
(
0
,
0
);
supObjid
.
vid
=
dv
.
getUint32
();
supObjid
.
oix
=
dv
.
getUint32
();
e
.
supObject
=
new
PwrtAttrRef
();
e
.
supObject
.
objid
=
supObjid
;
e
.
supObject
.
offset
=
dv
.
getUint32
();
e
.
supObject
.
body
=
dv
.
getUint32
();
e
.
supObject
.
size
=
dv
.
getUint32
();
e
.
supObject
.
flags
=
dv
.
getUint32
();
e
.
eventMoreText
=
dv
.
getString
();
e
.
syncIdx
=
dv
.
getUint32
();
result
.
push
(
e
);
}
return
result
;
default
:
return
null
;
}
}
Uint8ArrayHelper
(
tag
)
{
let
obj
=
{
buf
:
[
tag
,
0
],
pack16Bit
:
function
(
value
)
{
this
.
buf
.
push
(
value
&
0xFF
);
this
.
buf
.
push
((
value
>>
8
)
&
0xFF
);
},
pack32Bit
:
function
(
value
)
{
this
.
buf
.
push
(
value
&
0xFF
);
this
.
buf
.
push
((
value
>>
8
)
&
0xFF
);
this
.
buf
.
push
((
value
>>
16
)
&
0xFF
);
this
.
buf
.
push
((
value
>>
24
)
&
0xFF
);
},
packString
:
function
(
string
)
{
this
.
pack16Bit
(
string
.
length
);
for
(
let
i
=
0
;
i
<
string
.
length
;
i
++
)
{
this
.
buf
.
push
(
string
.
charCodeAt
(
i
));
}
}
}
};
};
obj
.
pack32Bit
(
this
.
next_id
);
return
obj
;
}
}
getObjectInfoBoolean
(
name
,
return_cb
)
{
getObjectInfoBoolean
(
name
)
{
this
.
return_cb
=
return_cb
;
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_OBJECT_INFO_BOOLEAN
);
let
helper
=
new
Uint8ArrayHelper
(
name
.
length
+
6
,
Msg
.
GET_OBJECT_INFO_BOOLEAN
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
null
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
getObjectInfoInt
(
name
,
return_cb
,
data
)
{
getObjectInfoInt
(
name
)
{
this
.
return_cb
=
return_cb
;
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_OBJECT_INFO_INT
);
let
helper
=
new
Uint8ArrayHelper
(
name
.
length
+
6
,
Msg
.
GET_OBJECT_INFO_INT
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
getObjectInfoIntArray
(
name
,
asize
,
return_cb
,
data
)
{
getObjectInfoIntArray
(
name
,
asize
)
{
this
.
return_cb
=
return_cb
;
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_OBJECT_INFO_INT_ARRAY
);
let
helper
=
new
Uint8ArrayHelper
(
name
.
length
+
10
,
Msg
.
GET_OBJECT_INFO_INT_ARRAY
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
asize
);
helper
.
pack32Bit
(
asize
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
getObjectInfoFloat
(
name
,
return_cb
,
data
)
{
getObjectInfoFloat
(
name
)
{
this
.
return_cb
=
return_cb
;
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_OBJECT_INFO_FLOAT
);
let
helper
=
new
Uint8ArrayHelper
(
name
.
length
+
6
,
Msg
.
GET_OBJECT_INFO_FLOAT
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
getObjectInfoFloatArray
(
name
,
asize
,
return_cb
,
data
)
{
getObjectInfoFloatArray
(
name
,
asize
)
{
this
.
return_cb
=
return_cb
;
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_OBJECT_INFO_FLOAT_ARRAY
);
let
helper
=
new
Uint8ArrayHelper
(
name
.
length
+
10
,
Msg
.
GET_OBJECT_INFO_FLOAT_ARRAY
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
asize
);
helper
.
pack32Bit
(
asize
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
refObjectInfo
(
name
,
type
,
elements
)
{
refObjectInfo
(
name
,
type
,
elements
)
{
...
@@ -737,81 +553,143 @@ class Gdh {
...
@@ -737,81 +553,143 @@ class Gdh {
this
.
sub
[
this
.
subscriptionCount
]
=
sub
;
this
.
sub
[
this
.
subscriptionCount
]
=
sub
;
this
.
subscriptionCount
++
;
this
.
subscriptionCount
++
;
if
(
this
.
listSent
)
{
if
(
this
.
listSent
)
{
let
size
=
12
+
sub
.
name
.
length
;
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
REF_OBJECT_INFO
);
let
helper
=
new
Uint8ArrayHelper
(
size
+
10
,
Msg
.
REF_OBJECT_INFO
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
sub
.
refid
);
helper
.
pack32Bit
(
sub
.
refid
);
helper
.
pack32Bit
(
sub
.
elements
);
helper
.
pack32Bit
(
sub
.
elements
);
helper
.
packString
(
sub
.
name
);
helper
.
packString
(
sub
.
name
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
this
.
refObjectInfoReply
,
null
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
return
sub
.
refid
;
return
sub
.
refid
;
}
}
refObjectInfoReply
(
id
,
sts
)
{
}
unrefObjectInfo
(
refid
)
{
unrefObjectInfo
(
refid
)
{
let
size
=
4
;
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
UNREF_OBJECT_INFO
);
let
helper
=
new
Uint8ArrayHelper
(
size
+
10
,
Msg
.
UNREF_OBJECT_INFO
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
refid
);
helper
.
pack32Bit
(
refid
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
this
.
unrefObjectInfoReply
,
null
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
delete
this
.
sub
[
refid
];
delete
this
.
sub
[
refid
];
return
this
.
sendRequest
(
helper
);
}
}
unrefObjectInfoReply
(
id
,
sts
)
{
refObjectInfoList
()
{
}
refObjectInfoList
(
return_cb
)
{
let
size
=
0
;
let
size
=
0
;
let
len
=
0
;
let
len
=
0
;
this
.
return_cb
=
return_cb
;
for
(
let
i
in
this
.
sub
)
{
for
(
let
i
in
this
.
sub
)
{
size
+=
12
+
this
.
sub
[
i
].
name
.
length
;
size
+=
12
+
this
.
sub
[
i
].
name
.
length
;
len
++
;
len
++
;
}
}
let
helper
=
new
Uint8ArrayHelper
(
size
+
10
,
Msg
.
REF_OBJECT_INFO_LIST
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
REF_OBJECT_INFO_LIST
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
len
);
helper
.
pack32Bit
(
len
);
this
.
sub
.
slice
(
1
).
forEach
(
function
(
s
)
{
this
.
sub
.
slice
(
1
).
forEach
(
function
(
s
)
{
helper
.
pack32Bit
(
s
.
refid
);
helper
.
pack32Bit
(
s
.
refid
);
helper
.
pack32Bit
(
s
.
elements
);
helper
.
pack32Bit
(
s
.
elements
);
helper
.
packString
(
s
.
name
);
helper
.
packString
(
s
.
name
);
});
});
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
null
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
this
.
listSent
=
true
;
this
.
listSent
=
true
;
}
return
this
.
sendRequest
(
helper
);
refObjectInfoListReply
(
id
,
sts
)
{
}
}
getRefObjectInfoAll
(
return_cb
)
{
getRefObjectInfoAll
(
return_cb
)
{
let
helper
=
new
Uint8ArrayHelper
(
6
,
Msg
.
GET_OBJECT_REF_INFO_ALL
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_OBJECT_REF_INFO_ALL
);
helper
.
pack32Bit
(
this
.
next_id
);
this
.
sendRequest
(
helper
).
then
(
function
(
dv
)
{
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
null
);
let
type
=
dv
.
getUint8
();
this
.
ws
.
send
(
helper
.
buf
);
let
id
=
dv
.
getUint32
();
this
.
next_id
++
;
let
sts
=
dv
.
getUint32
();
}
let
size
=
dv
.
getUint32
();
for
(
let
i
=
0
;
i
<
size
;
i
++
)
{
getRefObjectInfoAllReply
(
id
,
sts
)
{
let
eid
=
dv
.
getUint32
();
let
esize
=
dv
.
getUint32
();
let
sub
=
this
.
gdh
.
sub
[
eid
];
if
(
typeof
sub
!==
'
undefined
'
)
{
let
value
;
switch
(
sub
.
type
)
{
case
Type
.
Boolean
:
if
(
sub
.
elements
<=
1
)
{
value
=
dv
.
getUint8
();
}
else
{
let
elements
=
esize
;
if
(
elements
!==
sub
.
elements
)
{
console
.
log
(
"
Subscription size error
"
,
elements
,
sub
.
elements
,
eid
);
}
value
=
new
Array
(
elements
);
for
(
let
k
=
0
;
k
<
elements
;
k
++
)
{
value
[
k
]
=
dv
.
getUint8
();
}
}
break
;
case
Type
.
Float32
:
if
(
sub
.
elements
<=
1
)
{
value
=
dv
.
getFloat32
();
}
else
{
let
elements
=
esize
/
4
;
if
(
elements
!==
sub
.
elements
)
{
console
.
log
(
"
Subscription size error
"
,
elements
,
sub
.
elements
,
eid
);
}
value
=
new
Array
(
elements
);
for
(
let
k
=
0
;
k
<
elements
;
k
++
)
{
value
[
k
]
=
dv
.
getFloat32
();
}
}
break
;
case
Type
.
Int8
:
case
Type
.
Int16
:
case
Type
.
Int32
:
case
Type
.
UInt8
:
case
Type
.
UInt16
:
case
Type
.
UInt32
:
case
Type
.
Status
:
case
Type
.
NetStatus
:
case
Type
.
Mask
:
case
Type
.
Enum
:
case
Type
.
Bit
:
if
(
sub
.
elements
<=
1
)
{
value
=
dv
.
getInt32
();
}
else
{
let
elements
=
esize
/
4
;
if
(
elements
!==
sub
.
elements
)
{
console
.
log
(
"
Subscription size error
"
,
elements
,
sub
.
elements
,
eid
);
}
value
=
new
Array
(
elements
);
for
(
let
k
=
0
;
k
<
elements
;
k
++
)
{
value
[
k
]
=
dv
.
getInt32
();
}
}
break
;
case
Type
.
String
:
case
Type
.
Time
:
case
Type
.
DeltaTime
:
case
Type
.
AttrRef
:
case
Type
.
Objid
:
if
(
sub
.
elements
<=
1
)
{
value
=
dv
.
getString
();
}
else
{
let
elements
=
sub
.
elements
;
if
(
elements
!==
sub
.
elements
)
{
console
.
log
(
"
Subscription size error
"
,
elements
,
sub
.
elements
,
eid
);
}
value
=
new
Array
(
elements
);
for
(
let
l
=
0
;
l
<
elements
;
l
++
)
{
value
[
l
]
=
dv
.
getString
();
}
}
break
;
default
:
break
;
}
this
.
gdh
.
sub
[
eid
].
value
=
value
;
}
}
if
(
typeof
this
.
gdh
.
pending
[
id
]
===
'
undefined
'
)
{
console
.
log
(
"
** GetObjectRefInfoAll received removed
"
,
id
);
return
;
}
return_cb
();
});
}
}
getObjectRefInfo
(
id
)
{
getObjectRefInfo
(
id
)
{
...
@@ -819,117 +697,83 @@ class Gdh {
...
@@ -819,117 +697,83 @@ class Gdh {
}
}
setObjectInfoBoolean
(
name
,
value
)
{
setObjectInfoBoolean
(
name
,
value
)
{
let
helper
=
new
Uint8ArrayHelper
(
12
+
name
.
length
,
Msg
.
SET_OBJECT_INFO_BOOLEAN
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
SET_OBJECT_INFO_BOOLEAN
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
value
);
helper
.
pack32Bit
(
value
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
this
.
ws
.
send
(
helper
.
buf
);
return
this
.
sendRequest
(
helper
);
this
.
next_id
++
;
return
1
;
}
}
setObjectInfoInt
(
name
,
value
)
{
setObjectInfoInt
(
name
,
value
)
{
let
helper
=
new
Uint8ArrayHelper
(
12
+
name
.
length
,
Msg
.
SET_OBJECT_INFO_INT
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
SET_OBJECT_INFO_INT
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
value
);
helper
.
pack32Bit
(
value
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
// this.pending[this.next_id] = new PendingData( return_cb, null);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
return
1
;
}
}
setObjectInfoFloat
(
name
,
value
)
{
setObjectInfoFloat
(
name
,
value
)
{
let
helper
=
new
Uint8ArrayHelper
(
12
+
name
.
length
,
Msg
.
SET_OBJECT_INFO_FLOAT
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
SET_OBJECT_INFO_FLOAT
);
helper
.
pack32Bit
(
this
.
next_id
);
let
fbuf
=
new
ArrayBuffer
(
4
);
let
fbuf
=
new
ArrayBuffer
(
4
);
let
fa
=
new
Float32Array
(
fbuf
);
let
fa
=
new
Float32Array
(
fbuf
);
fa
[
0
]
=
value
;
fa
[
0
]
=
value
;
let
ba
=
new
Uint8Array
(
fbuf
);
let
ba
=
new
Uint8Array
(
fbuf
);
helper
.
buf
[
helper
.
idx
++
]
=
ba
[
0
]
;
helper
.
buf
.
push
(
ba
[
0
])
;
helper
.
buf
[
helper
.
idx
++
]
=
ba
[
1
]
;
helper
.
buf
.
push
(
ba
[
1
])
;
helper
.
buf
[
helper
.
idx
++
]
=
ba
[
2
]
;
helper
.
buf
.
push
(
ba
[
2
])
;
helper
.
buf
[
helper
.
idx
++
]
=
ba
[
3
]
;
helper
.
buf
.
push
(
ba
[
3
])
;
helper
.
packString
(
name
);
helper
.
packString
(
name
);
// this.pending[this.next_id] = new PendingData( return_cb, null);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
return
1
;
}
}
setObjectInfoString
(
name
,
value
)
{
setObjectInfoString
(
name
,
value
)
{
let
helper
=
new
Uint8ArrayHelper
(
10
+
value
.
length
+
name
.
length
,
Msg
.
SET_OBJECT_INFO_STRING
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
SET_OBJECT_INFO_STRING
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
packString
(
value
);
helper
.
packString
(
value
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
// this.pending[this.next_id] = new PendingData( return_cb, null);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
return
1
;
}
}
setObjectInfo
(
name
,
value
,
type
)
{
setObjectInfo
(
name
,
value
,
type
)
{
if
(
type
===
Type
.
Boolean
)
{
if
(
type
===
Type
.
Boolean
)
{
this
.
setObjectInfoBoolean
(
name
,
value
);
return
this
.
setObjectInfoBoolean
(
name
,
value
);
}
else
if
(
type
===
Type
.
Float32
||
type
===
Type
.
Float64
)
{
}
else
if
(
type
===
Type
.
Float32
||
type
===
Type
.
Float64
)
{
this
.
setObjectInfoFloat
(
name
,
value
);
return
this
.
setObjectInfoFloat
(
name
,
value
);
}
else
if
(
type
===
Type
.
String
)
{
}
else
if
(
type
===
Type
.
String
)
{
this
.
setObjectInfoString
(
name
,
value
);
return
this
.
setObjectInfoString
(
name
,
value
);
}
else
{
}
else
{
this
.
setObjectInfoInt
(
name
,
value
);
return
this
.
setObjectInfoInt
(
name
,
value
);
}
}
}
}
toggleObjectInfo
(
name
)
{
toggleObjectInfo
(
name
)
{
let
helper
=
new
Uint8ArrayHelper
(
8
+
name
.
length
,
Msg
.
TOGGLE_OBJECT_INFO
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
TOGGLE_OBJECT_INFO
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
// this.pending[this.next_id] = new PendingData( return_cb, null);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
return
1
;
}
}
getAllXttChildren
(
oid
,
return_cb
,
data
)
{
getAllXttChildren
(
oid
)
{
let
helper
=
new
Uint8ArrayHelper
(
14
,
Msg
.
GET_ALL_XTT_CHILDREN
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_ALL_XTT_CHILDREN
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
oid
.
vid
);
helper
.
pack32Bit
(
oid
.
vid
);
helper
.
pack32Bit
(
oid
.
oix
);
helper
.
pack32Bit
(
oid
.
oix
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
getAllClassAttributes
(
cid
,
oid
,
return_cb
,
data
)
{
getAllClassAttributes
(
cid
,
oid
)
{
let
helper
=
new
Uint8ArrayHelper
(
18
,
Msg
.
GET_ALL_CLASS_ATTRIBUTES
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_ALL_CLASS_ATTRIBUTES
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
cid
);
helper
.
pack32Bit
(
cid
);
helper
.
pack32Bit
(
oid
.
vid
);
helper
.
pack32Bit
(
oid
.
vid
);
helper
.
pack32Bit
(
oid
.
oix
);
helper
.
pack32Bit
(
oid
.
oix
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
getObject
(
oid
,
op
,
return_cb
,
data
)
{
getObject
(
oid
,
op
)
{
let
helper
=
new
Uint8ArrayHelper
(
16
,
Msg
.
GET_OBJECT
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_OBJECT
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack16Bit
(
op
);
helper
.
pack16Bit
(
op
);
helper
.
pack32Bit
(
oid
.
vid
);
helper
.
pack32Bit
(
oid
.
vid
);
helper
.
pack32Bit
(
oid
.
oix
);
helper
.
pack32Bit
(
oid
.
oix
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
getObjectFromAref
(
aref
,
op
,
return_cb
,
data
)
{
getObjectFromAref
(
aref
,
op
)
{
let
helper
=
new
Uint8ArrayHelper
(
32
,
Msg
.
GET_OBJECT_FROM_AREF
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_OBJECT_FROM_AREF
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack16Bit
(
op
);
helper
.
pack16Bit
(
op
);
helper
.
pack32Bit
(
aref
.
objid
.
vid
);
helper
.
pack32Bit
(
aref
.
objid
.
vid
);
helper
.
pack32Bit
(
aref
.
objid
.
oix
);
helper
.
pack32Bit
(
aref
.
objid
.
oix
);
...
@@ -937,76 +781,61 @@ class Gdh {
...
@@ -937,76 +781,61 @@ class Gdh {
helper
.
pack32Bit
(
aref
.
body
);
helper
.
pack32Bit
(
aref
.
body
);
helper
.
pack32Bit
(
aref
.
size
);
helper
.
pack32Bit
(
aref
.
size
);
helper
.
pack32Bit
(
aref
.
flags
);
helper
.
pack32Bit
(
aref
.
flags
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
getObjectFromName
(
name
,
op
,
return_cb
,
data
)
{
getObjectFromName
(
name
,
op
)
{
let
helper
=
new
Uint8ArrayHelper
(
10
+
name
.
length
,
Msg
.
GET_OBJECT_FROM_NAME
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_OBJECT_FROM_NAME
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack16Bit
(
op
);
helper
.
pack16Bit
(
op
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
crrSignal
(
oid
,
return_cb
,
data
)
{
crrSignal
(
oid
)
{
let
helper
=
new
Uint8ArrayHelper
(
14
,
Msg
.
CRR_SIGNAL
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
CRR_SIGNAL
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
oid
.
vid
);
helper
.
pack32Bit
(
oid
.
vid
);
helper
.
pack32Bit
(
oid
.
oix
);
helper
.
pack32Bit
(
oid
.
oix
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
getOpwindMenu
(
name
,
return_cb
,
data
)
{
getOpwindMenu
(
name
)
{
let
helper
=
new
Uint8ArrayHelper
(
8
+
name
.
length
,
Msg
.
GET_OPWIND_MENU
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_OPWIND_MENU
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
packString
(
name
);
helper
.
packString
(
name
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
login
(
user
,
passwd
,
return_cb
,
data
)
{
login
(
user
,
passwd
)
{
let
helper
=
new
Uint8ArrayHelper
(
6
+
2
+
user
.
length
+
2
+
passwd
.
length
,
Msg
.
CHECK_USER
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
CHECK_USER
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
packString
(
user
);
helper
.
packString
(
user
);
helper
.
packString
(
passwd
);
helper
.
packString
(
passwd
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
getMsg
(
value
,
return_cb
,
data
)
{
getMsg
(
value
)
{
let
helper
=
new
Uint8ArrayHelper
(
10
,
Msg
.
GET_MSG
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
GET_MSG
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
value
);
helper
.
pack32Bit
(
value
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
mhSync
(
sync
,
return_cb
,
data
)
{
mhSync
(
sync
)
{
let
helper
=
new
Uint8ArrayHelper
(
10
,
Msg
.
MH_SYNC
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
MH_SYNC
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
sync
);
helper
.
pack32Bit
(
sync
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
this
.
next_id
++
;
}
}
mhAcknowledge
(
event_id
,
return_cb
,
data
)
{
mhAcknowledge
(
event_id
)
{
let
helper
=
new
Uint8ArrayHelper
(
16
+
event_id
.
birthTime
.
length
,
Msg
.
MH_ACK
);
let
helper
=
this
.
Uint8ArrayHelper
(
Msg
.
MH_ACK
);
helper
.
pack32Bit
(
this
.
next_id
);
helper
.
pack32Bit
(
event_id
.
nix
);
helper
.
pack32Bit
(
event_id
.
nix
);
helper
.
pack32Bit
(
event_id
.
idx
);
helper
.
pack32Bit
(
event_id
.
idx
);
helper
.
packString
(
event_id
.
birthTime
);
helper
.
packString
(
event_id
.
birthTime
);
this
.
pending
[
this
.
next_id
]
=
new
PendingData
(
return_cb
,
data
);
return
this
.
sendRequest
(
helper
);
this
.
ws
.
send
(
helper
.
buf
);
}
this
.
next_id
++
;
sendRequest
(
data
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
pending
[
this
.
next_id
]
=
resolve
;
this
.
next_id
++
;
this
.
ws
.
send
(
Uint8Array
.
from
(
data
.
buf
));
});
}
}
}
}
\ No newline at end of file
java/jsw/ev/src/ev.ts
View file @
0501e23c
...
@@ -95,7 +95,7 @@ class Ev {
...
@@ -95,7 +95,7 @@ class Ev {
console
.
log
(
"
toolitem2
"
,
o
.
userdata
.
e
.
supObject
.
vid
,
console
.
log
(
"
toolitem2
"
,
o
.
userdata
.
e
.
supObject
.
vid
,
o
.
userdata
.
e
.
supObject
.
oix
);
o
.
userdata
.
e
.
supObject
.
oix
);
this
.
ctx
.
gdh
.
getObjectFromAref
(
o
.
userdata
.
e
.
supObject
,
this
.
ctx
.
gdh
.
getObjectFromAref
(
o
.
userdata
.
e
.
supObject
,
GdhOp
.
GET_OP_SELF
,
this
.
open_navigator_cb
,
null
);
GdhOp
.
GET_OP_SELF
).
then
(
this
.
open_navigator_cb
);
console
.
log
(
"
toolitem2 event
"
);
console
.
log
(
"
toolitem2 event
"
);
});
});
// Trace sup object
// Trace sup object
...
@@ -106,18 +106,16 @@ class Ev {
...
@@ -106,18 +106,16 @@ class Ev {
if
(
o
===
null
)
{
if
(
o
===
null
)
{
return
;
return
;
}
}
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObjectFromAref
(
o
.
userdata
.
e
.
supObject
,
this
.
ctx
.
gdh
.
getObjectFromAref
(
o
.
userdata
.
e
.
supObject
,
GdhOp
.
GET_OP_METHOD_PLC
,
this
.
open_plc_cb
,
newwindow
);
GdhOp
.
GET_OP_METHOD_PLC
).
then
(
this
.
open_plc_cb
);
});
});
// Graph event name
// Graph event name
document
.
getElementById
(
"
toolitem4
"
)
document
.
getElementById
(
"
toolitem4
"
)
.
addEventListener
(
"
click
"
,
function
(
event
)
{
.
addEventListener
(
"
click
"
,
function
(
event
)
{
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
.
userdata
instanceof
EvItemAlarm
)
{
if
(
o
.
userdata
instanceof
EvItemAlarm
)
{
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObjectFromName
(
o
.
userdata
.
e
.
eventName
,
this
.
ctx
.
gdh
.
getObjectFromName
(
o
.
userdata
.
e
.
eventName
,
GdhOp
.
GET_OP_METHOD_GRAPH
,
this
.
open_graph_cb
,
newwindow
);
GdhOp
.
GET_OP_METHOD_GRAPH
).
then
(
this
.
open_graph_cb
);
}
}
});
});
// Object raph event name
// Object raph event name
...
@@ -125,9 +123,8 @@ class Ev {
...
@@ -125,9 +123,8 @@ class Ev {
.
addEventListener
(
"
click
"
,
function
(
event
)
{
.
addEventListener
(
"
click
"
,
function
(
event
)
{
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
.
userdata
instanceof
EvItemAlarm
)
{
if
(
o
.
userdata
instanceof
EvItemAlarm
)
{
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObjectFromName
(
o
.
userdata
.
e
.
eventName
,
this
.
ctx
.
gdh
.
getObjectFromName
(
o
.
userdata
.
e
.
eventName
,
GdhOp
.
GET_OP_METHOD_OBJECTGRAPH
,
this
.
open_graph_cb
,
newwindow
);
GdhOp
.
GET_OP_METHOD_OBJECTGRAPH
).
then
(
this
.
open_graph_cb
);
}
}
});
});
// Navigator event name
// Navigator event name
...
@@ -147,9 +144,8 @@ class Ev {
...
@@ -147,9 +144,8 @@ class Ev {
if
(
o
===
null
)
{
if
(
o
===
null
)
{
return
;
return
;
}
}
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObjectFromName
(
o
.
userdata
.
e
.
eventName
,
this
.
ctx
.
gdh
.
getObjectFromName
(
o
.
userdata
.
e
.
eventName
,
GdhOp
.
GET_OP_METHOD_PLC
,
this
.
open_plc_cb
,
newwindow
);
GdhOp
.
GET_OP_METHOD_PLC
).
then
(
this
.
open_plc_cb
);
console
.
log
(
"
toolitem7 event
"
);
console
.
log
(
"
toolitem7 event
"
);
});
});
// History event name
// History event name
...
@@ -175,7 +171,7 @@ class Ev {
...
@@ -175,7 +171,7 @@ class Ev {
if
(
o
===
null
)
{
if
(
o
===
null
)
{
return
;
return
;
}
}
this
.
ctx
.
gdh
.
crrSignal
(
o
.
userdata
.
e
.
eventName
,
this
.
open_crr_cb
,
o
);
this
.
ctx
.
gdh
.
crrSignal
(
o
.
userdata
.
e
.
eventName
).
then
(
this
.
open_crr_cb
(
o
)
);
console
.
log
(
"
toolitem10 event
"
);
console
.
log
(
"
toolitem10 event
"
);
});
});
// Help event name
// Help event name
...
@@ -192,12 +188,10 @@ class Ev {
...
@@ -192,12 +188,10 @@ class Ev {
return
;
return
;
}
}
if
(
o
.
userdata
instanceof
EvItemAlarm
)
{
if
(
o
.
userdata
instanceof
EvItemAlarm
)
{
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObjectFromName
(
o
.
userdata
.
e
.
eventName
,
this
.
ctx
.
gdh
.
getObjectFromName
(
o
.
userdata
.
e
.
eventName
,
GdhOp
.
GET_OP_METHOD_HELPCLASS
,
this
.
open_helpclass_cb
,
newwindow
);
GdhOp
.
GET_OP_METHOD_HELPCLASS
).
then
(
this
.
open_helpclass_cb
);
}
}
});
});
}
}
is_authorized
(
access
)
{
is_authorized
(
access
)
{
...
@@ -206,25 +200,26 @@ class Ev {
...
@@ -206,25 +200,26 @@ class Ev {
gdh_init_cb
()
{
gdh_init_cb
()
{
if
(
!
this
.
priv
)
{
if
(
!
this
.
priv
)
{
this
.
ctx
.
gdh
.
login
(
""
,
""
,
this
.
login_cb
,
this
);
this
.
ctx
.
gdh
.
login
(
""
,
""
).
then
(
this
.
login_cb
);
}
}
//this.ctx.gdh.mhSync(
this.mhSyncIdx, this.sync_cb, this
);
//this.ctx.gdh.mhSync(
this.mhSyncIdx).then(this.sync_cb
);
this
.
ctx
.
gdh
.
listSent
=
true
;
this
.
ctx
.
gdh
.
listSent
=
true
;
this
.
trace_cyclic
();
this
.
trace_cyclic
();
}
}
login_cb
(
id
,
data
,
sts
,
result
)
{
login_cb
(
res
)
{
console
.
log
(
"
Login:
"
,
sts
,
result
);
console
.
log
(
"
Login:
"
,
res
.
sts
,
res
.
value
);
this
.
priv
=
(
sts
&
1
)
?
result
:
0
;
this
.
priv
=
(
res
.
sts
&
1
)
?
res
.
value
:
0
;
}
}
sync_cb
(
id
,
data
,
sts
,
result
)
{
sync_cb
(
res
)
{
if
(
!
(
sts
&
1
))
{
if
(
!
(
res
.
sts
&
1
))
{
return
;
return
;
}
}
let
result
=
res
.
value
;
if
(
result
.
length
===
0
)
{
if
(
result
.
length
===
0
)
{
return
;
return
;
}
}
...
@@ -326,7 +321,7 @@ class Ev {
...
@@ -326,7 +321,7 @@ class Ev {
let
item
=
node
.
get_userdata
();
let
item
=
node
.
get_userdata
();
console
.
log
(
"
Ack
"
,
item
.
e
.
eventText
);
console
.
log
(
"
Ack
"
,
item
.
e
.
eventText
);
this
.
ctx
.
gdh
.
mhAcknowledge
(
item
.
e
.
eventId
,
this
.
ack_cb
,
this
);
this
.
ctx
.
gdh
.
mhAcknowledge
(
item
.
e
.
eventId
).
then
(
this
.
ack_cb
);
if
(
item
.
e
.
eventStatus
&
EventStatus
.
NotRet
)
{
if
(
item
.
e
.
eventStatus
&
EventStatus
.
NotRet
)
{
item
.
e
.
eventStatus
&=
~
EventStatus
.
NotAck
;
item
.
e
.
eventStatus
&=
~
EventStatus
.
NotAck
;
...
@@ -338,24 +333,28 @@ class Ev {
...
@@ -338,24 +333,28 @@ class Ev {
this
.
ctx
.
draw
();
this
.
ctx
.
draw
();
}
}
ack_cb
(
id
,
data
,
st
s
)
{
ack_cb
(
re
s
)
{
console
.
log
(
"
ack sts
"
,
sts
);
console
.
log
(
"
ack sts
"
,
res
.
sts
);
}
}
open_objectgraph_cb
(
id
,
data
,
sts
,
result
)
{
open_objectgraph_cb
(
res
)
{
if
((
sts
&
1
)
===
0
)
{
let
w
=
window
.
open
(
""
,
"
_blank
"
);
data
.
document
.
write
(
"
Error status
"
+
sts
);
if
((
res
.
sts
&
1
)
===
0
)
{
w
.
document
.
write
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
data
.
location
.
href
=
let
result
=
res
.
value
;
w
.
location
.
href
=
"
ge.html?graph=
"
+
result
.
param1
+
"
&instance=
"
+
result
.
fullname
;
"
ge.html?graph=
"
+
result
.
param1
+
"
&instance=
"
+
result
.
fullname
;
data
.
document
.
title
=
result
.
fullname
;
w
.
document
.
title
=
result
.
fullname
;
}
}
}
}
open_graph_cb
(
id
,
data
,
sts
,
result
)
{
open_graph_cb
(
res
)
{
if
((
sts
&
1
)
===
0
)
{
let
w
=
window
.
open
(
""
,
"
_blank
"
);
data
.
document
.
write
(
"
Error status
"
+
sts
);
if
((
res
.
sts
&
1
)
===
0
)
{
w
.
document
.
write
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
let
result
=
res
.
value
;
let
idx
=
result
.
param1
.
indexOf
(
'
.
'
);
let
idx
=
result
.
param1
.
indexOf
(
'
.
'
);
if
(
idx
!==
-
1
)
{
if
(
idx
!==
-
1
)
{
result
.
param1
=
result
.
param1
.
substring
(
0
,
idx
);
result
.
param1
=
result
.
param1
.
substring
(
0
,
idx
);
...
@@ -366,62 +365,61 @@ class Ev {
...
@@ -366,62 +365,61 @@ class Ev {
instancestr
=
"
&instance=
"
+
result
.
fullname
;
instancestr
=
"
&instance=
"
+
result
.
fullname
;
}
}
data
.
location
.
href
=
"
ge.html?graph=
"
+
result
.
param1
+
instancestr
;
w
.
location
.
href
=
"
ge.html?graph=
"
+
result
.
param1
+
instancestr
;
data
.
document
.
title
=
result
.
param1
;
w
.
document
.
title
=
result
.
param1
;
}
}
}
}
open_plc_cb
(
id
,
data
,
sts
,
result
)
{
open_plc_cb
(
res
)
{
if
((
sts
&
1
)
===
0
)
{
let
w
=
window
.
open
(
""
,
"
_blank
"
);
data
.
document
.
write
(
"
Error status
"
+
sts
);
if
((
res
.
sts
&
1
)
===
0
)
{
w
.
document
.
write
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
let
param1
;
let
result
=
res
.
value
;
if
(
result
.
param1
===
""
)
{
let
param1
=
result
.
param1
?
(
"
&obj=
"
+
result
.
param1
)
:
""
;
param1
=
""
;
}
else
{
param1
=
"
&obj=
"
+
result
.
param1
;
}
console
.
log
(
"
flow.html?vid=
"
+
result
.
objid
.
vid
+
"
&oix=
"
+
console
.
log
(
"
flow.html?vid=
"
+
result
.
objid
.
vid
+
"
&oix=
"
+
result
.
objid
.
oix
+
param1
);
result
.
objid
.
oix
+
param1
);
data
.
location
.
href
=
w
.
location
.
href
=
"
flow.html?vid=
"
+
result
.
objid
.
vid
+
"
&oix=
"
+
result
.
objid
.
oix
+
"
flow.html?vid=
"
+
result
.
objid
.
vid
+
"
&oix=
"
+
result
.
objid
.
oix
+
param1
;
param1
;
data
.
document
.
title
=
"
Trace
"
+
result
.
fullname
;
w
.
document
.
title
=
"
Trace
"
+
result
.
fullname
;
}
}
}
}
open_navigator_cb
(
id
,
data
,
sts
,
result
)
{
open_navigator_cb
(
res
)
{
console
.
log
(
"
Open navigator
"
,
sts
);
console
.
log
(
"
Open navigator
"
,
res
.
sts
);
if
((
sts
&
1
)
===
0
)
{
if
((
res
.
sts
&
1
)
===
0
)
{
console
.
log
(
"
Error status
"
+
sts
);
console
.
log
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
localStorage
.
setItem
(
"
XttMethodNavigator
"
,
res
ult
.
fullname
);
localStorage
.
setItem
(
"
XttMethodNavigator
"
,
res
.
value
.
fullname
);
console
.
log
(
"
storage
"
,
localStorage
.
getItem
(
"
XttMethodNavigator
"
));
console
.
log
(
"
storage
"
,
localStorage
.
getItem
(
"
XttMethodNavigator
"
));
}
}
}
}
open_objectgraph_cb
(
id
,
data
,
sts
,
result
)
{
open_objectgraph_cb
(
res
)
{
if
((
sts
&
1
)
===
0
)
{
let
w
=
window
.
open
(
""
,
"
_blank
"
);
data
.
document
.
write
(
"
Error status
"
+
sts
);
if
((
res
.
sts
&
1
)
===
0
)
{
w
.
document
.
write
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
let
classname
=
res
ult
.
classname
.
toLowerCase
();
let
classname
=
res
.
value
.
classname
.
toLowerCase
();
if
(
classname
.
substring
(
0
,
1
)
===
"
$
"
)
{
if
(
classname
.
substring
(
0
,
1
)
===
"
$
"
)
{
classname
=
classname
.
substring
(
1
);
classname
=
classname
.
substring
(
1
);
}
}
let
graphname
=
"
pwr_c_
"
+
classname
;
let
graphname
=
"
pwr_c_
"
+
classname
;
data
.
location
.
href
=
w
.
location
.
href
=
"
ge.html?graph=
"
+
graphname
+
"
&instance=
"
+
res
ult
.
fullname
;
"
ge.html?graph=
"
+
graphname
+
"
&instance=
"
+
res
.
value
.
fullname
;
data
.
document
.
title
=
graphname
+
"
"
+
result
.
fullname
;
w
.
document
.
title
=
graphname
+
"
"
+
res
.
value
.
fullname
;
}
}
}
}
open_helpclass_cb
(
id
,
data
,
sts
,
result
)
{
open_helpclass_cb
(
res
)
{
if
((
sts
&
1
)
===
0
)
{
let
w
=
window
.
open
(
""
,
"
_blank
"
);
data
.
document
.
write
(
"
Error status
"
+
sts
);
if
((
res
.
sts
&
1
)
===
0
)
{
w
.
document
.
write
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
console
.
log
(
"
open_helpclass
"
,
res
ult
.
param1
);
console
.
log
(
"
open_helpclass
"
,
res
.
value
.
param1
);
data
.
location
.
href
=
w
.
location
.
href
=
location
.
protocol
+
"
//
"
+
location
.
host
+
res
ult
.
param1
;
location
.
protocol
+
"
//
"
+
location
.
host
+
res
.
value
.
param1
;
}
}
}
}
...
@@ -442,12 +440,12 @@ class Ev {
...
@@ -442,12 +440,12 @@ class Ev {
}
}
trace_cyclic
()
{
trace_cyclic
()
{
this
.
ctx
.
gdh
.
mhSync
(
this
.
mhSyncIdx
,
this
.
sync_cb
,
this
);
this
.
ctx
.
gdh
.
mhSync
(
this
.
mhSyncIdx
).
then
(
this
.
sync_cb
);
this
.
timer
=
setTimeout
(
this
.
trace_cyclic
,
1000
);
this
.
timer
=
setTimeout
(
this
.
trace_cyclic
,
1000
);
}
}
trace_scan
(
id
,
st
s
)
{
trace_scan
(
re
s
)
{
this
.
scan_update
=
false
;
this
.
scan_update
=
false
;
if
(
this
.
scan_update
)
{
if
(
this
.
scan_update
)
{
this
.
ctx
.
draw
();
this
.
ctx
.
draw
();
...
@@ -581,17 +579,13 @@ class Ev {
...
@@ -581,17 +579,13 @@ class Ev {
case
Event
.
Key_CtrlL
:
case
Event
.
Key_CtrlL
:
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
.
userdata
instanceof
EvItemAlarm
)
{
if
(
o
.
userdata
instanceof
EvItemAlarm
)
{
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_PLC
).
then
(
this
.
open_plc_cb
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_PLC
,
this
.
open_plc_cb
,
newwindow
);
}
}
break
;
break
;
case
Event
.
Key_CtrlG
:
case
Event
.
Key_CtrlG
:
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
.
userdata
instanceof
EvItemAlarm
)
{
if
(
o
.
userdata
instanceof
EvItemAlarm
)
{
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_PLC
).
then
(
this
.
open_objectgraph_cb
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_PLC
,
this
.
open_objectgraph_cb
,
newwindow
);
}
}
break
;
break
;
default
:
default
:
...
...
java/jsw/flow/src/flow.ts
View file @
0501e23c
...
@@ -1775,10 +1775,8 @@ class FlowFrame {
...
@@ -1775,10 +1775,8 @@ class FlowFrame {
}
}
flow_open
()
{
flow_open
()
{
console
.
log
(
"
flow_open
"
);
console
.
log
(
"
ctx.gdh
"
,
this
.
ctx
.
gdh
);
this
.
ctx
.
connect
();
this
.
ctx
.
connect
();
this
.
ctx
.
gdh
.
refObjectInfoList
(
this
.
ctx
.
gdh
.
refObjectInfoListReply
);
this
.
ctx
.
gdh
.
refObjectInfoList
();
this
.
timer
=
setTimeout
(
this
.
flow_cyclic
,
1000
);
this
.
timer
=
setTimeout
(
this
.
flow_cyclic
,
1000
);
}
}
...
@@ -1793,7 +1791,6 @@ class FlowFrame {
...
@@ -1793,7 +1791,6 @@ class FlowFrame {
}
}
flow_close
()
{
flow_close
()
{
console
.
log
(
"
Close function
"
,
this
.
timer
);
clearTimeout
(
this
.
timer
);
clearTimeout
(
this
.
timer
);
for
(
let
i
in
this
.
ctx
.
gdh
.
pending
)
{
for
(
let
i
in
this
.
ctx
.
gdh
.
pending
)
{
delete
this
.
ctx
.
gdh
.
pending
[
i
];
delete
this
.
ctx
.
gdh
.
pending
[
i
];
...
...
java/jsw/ge/src/ge_appl.ts
View file @
0501e23c
...
@@ -74,10 +74,8 @@ class Appl {
...
@@ -74,10 +74,8 @@ class Appl {
}
}
if
(
classGraph
)
{
if
(
classGraph
)
{
console
.
log
(
"
Cmd classGraph
"
);
console
.
log
(
"
Cmd classGraph
"
);
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
graph
.
gdh
.
getObjectFromName
(
instanceValue
,
this
.
graph
.
gdh
.
getObjectFromName
(
instanceValue
,
GdhOp
.
GET_OP_METHOD_OBJECTGRAPH
,
this
.
open_objectgraph_cb
,
GdhOp
.
GET_OP_METHOD_OBJECTGRAPH
).
then
(
this
.
open_objectgraph_cb
);
newwindow
);
}
else
{
}
else
{
let
graphName
=
cli
.
getQualValue
(
"
cli_arg2
"
).
toLowerCase
();
let
graphName
=
cli
.
getQualValue
(
"
cli_arg2
"
).
toLowerCase
();
if
(
!
graphName
)
{
if
(
!
graphName
)
{
...
@@ -266,14 +264,16 @@ class Appl {
...
@@ -266,14 +264,16 @@ class Appl {
}
}
}
}
open_objectgraph_cb
(
id
,
data
,
sts
,
result
)
{
open_objectgraph_cb
(
res
)
{
if
((
sts
&
1
)
===
0
)
{
let
w
=
window
.
open
(
""
,
"
_blank
"
);
data
.
document
.
write
(
"
Error status
"
+
sts
);
if
((
res
.
sts
&
1
)
===
0
)
{
w
.
document
.
write
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
let
result
=
res
.
value
;
console
.
log
(
"
param1
"
,
result
.
param1
);
console
.
log
(
"
param1
"
,
result
.
param1
);
data
.
location
.
href
=
w
.
location
.
href
=
"
ge.html?graph=
"
+
result
.
param1
+
"
&instance=
"
+
result
.
fullname
;
"
ge.html?graph=
"
+
result
.
param1
+
"
&instance=
"
+
result
.
fullname
;
data
.
document
.
title
=
result
.
param1
+
"
"
+
result
.
fullname
;
w
.
document
.
title
=
result
.
param1
+
"
"
+
result
.
fullname
;
}
}
}
}
}
}
...
...
java/jsw/ge/src/ge_dyn.ts
View file @
0501e23c
...
@@ -1740,19 +1740,17 @@ class DynValue extends DynElem {
...
@@ -1740,19 +1740,17 @@ class DynValue extends DynElem {
return
format
;
return
format
;
}
}
// TODO
let
sts
=
this
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
pname
.
name
);
return
format
;
// TODO
if
(
even
(
sts
))
{
let
ret
=
this
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
pname
.
name
);
if
(
even
(
ret
))
{
return
format
;
return
format
;
}
}
decimals
=
Math
.
max
(
ret
.
value
-
decr
,
0
);
decimals
=
Math
.
max
(
sts
-
decr
,
0
);
if
(
decimals
>=
10
)
{
if
(
decimals
>=
10
)
{
return
format
;
return
format
;
}
}
if
(
format
===
null
)
{
if
(
!
format
)
{
return
"
%.
"
+
decimals
+
"
f
"
;
return
"
%.
"
+
decimals
+
"
f
"
;
}
}
...
@@ -1764,7 +1762,7 @@ class DynValue extends DynElem {
...
@@ -1764,7 +1762,7 @@ class DynValue extends DynElem {
if
(
s
<
2
||
format
.
charAt
(
s
-
2
)
!==
'
.
'
)
{
if
(
s
<
2
||
format
.
charAt
(
s
-
2
)
!==
'
.
'
)
{
return
"
%.
"
+
decimals
+
"
f
"
;
return
"
%.
"
+
decimals
+
"
f
"
;
}
else
{
}
else
{
return
format
.
substring
(
0
,
s
-
1
)
+
decimals
+
format
.
substring
(
s
)
;
return
format
.
substring
(
0
,
format
.
indexOf
(
'
.
'
)
+
1
)
+
decimals
+
"
f
"
;
}
}
}
}
}
}
...
@@ -1866,10 +1864,7 @@ class DynValue extends DynElem {
...
@@ -1866,10 +1864,7 @@ class DynValue extends DynElem {
this
.
dyn
.
repaintNow
=
true
;
this
.
dyn
.
repaintNow
=
true
;
}
else
{
}
else
{
if
(
this
.
a
.
database
===
Database
.
Gdh
)
{
if
(
this
.
a
.
database
===
Database
.
Gdh
)
{
let
data
=
new
Array
(
2
);
this
.
dyn
.
graph
.
getGdh
().
getMsg
(
value0
).
then
(
this
.
scan2
(
object
));
data
[
0
]
=
this
;
data
[
1
]
=
object
;
this
.
dyn
.
graph
.
getGdh
().
getMsg
(
value0
,
DynValue
.
scan2
,
data
);
}
}
}
}
}
}
...
@@ -1897,16 +1892,16 @@ class DynValue extends DynElem {
...
@@ -1897,16 +1892,16 @@ class DynValue extends DynElem {
}
}
}
}
static
scan2
(
id
,
data
,
sts
,
value
)
{
scan2
(
object
)
{
let
self
=
data
[
0
];
return
function
(
res
)
{
let
object
=
data
[
1
];
let
annot_num
=
Dyn
.
instance_to_number
(
this
.
instance
);
let
annot_num
=
Dyn
.
instance_to_number
(
self
.
instance
);
if
(
res
.
sts
&
1
!==
0
)
{
if
(
sts
&
1
!==
0
)
{
object
.
setAnnotation
(
annot_num
,
res
.
value
);
object
.
setAnnotation
(
annot_num
,
value
);
}
else
{
}
else
{
object
.
setAnnotation
(
annot_num
,
"
Unknown message
"
);
object
.
setAnnotation
(
annot_num
,
"
Unknown message
"
);
}
this
.
dyn
.
repaintNow
=
true
;
}
}
self
.
dyn
.
repaintNow
=
true
;
}
}
open
(
lines
,
row
)
{
open
(
lines
,
row
)
{
...
@@ -3860,7 +3855,7 @@ class DynTrend extends DynElem {
...
@@ -3860,7 +3855,7 @@ class DynTrend extends DynElem {
if
(
dt
>=
0.001
)
{
if
(
dt
>=
0.001
)
{
object
.
set_scan_time
(
dt
);
object
.
set_scan_time
(
dt
);
this
.
scan_time
=
dt
;
this
.
scan_time
=
dt
;
if
(
this
.
cycle
===
Cycle
.
Slow
)
{
if
(
this
.
dyn
.
cycle
===
Cycle
.
Slow
)
{
let
current_graph_scan_time
=
this
.
dyn
.
graph
.
getScanTime
();
let
current_graph_scan_time
=
this
.
dyn
.
graph
.
getScanTime
();
if
(
current_graph_scan_time
>
this
.
scan_time
||
this
.
scan_time
<=
this
.
orig_graph_scan_time
)
{
if
(
current_graph_scan_time
>
this
.
scan_time
||
this
.
scan_time
<=
this
.
orig_graph_scan_time
)
{
this
.
dyn
.
graph
.
setScanTime
(
this
.
scan_time
);
this
.
dyn
.
graph
.
setScanTime
(
this
.
scan_time
);
...
@@ -3932,7 +3927,7 @@ class DynTrend extends DynElem {
...
@@ -3932,7 +3927,7 @@ class DynTrend extends DynElem {
this
.
firstScan
=
false
;
this
.
firstScan
=
false
;
}
}
if
(
this
.
cycle
===
Cycle
.
Slow
)
{
if
(
this
.
dyn
.
cycle
===
Cycle
.
Slow
)
{
this
.
acc_time
+=
this
.
dyn
.
graph
.
getScanTime
();
this
.
acc_time
+=
this
.
dyn
.
graph
.
getScanTime
();
}
else
{
}
else
{
this
.
acc_time
+=
this
.
dyn
.
graph
.
getFastScanTime
();
this
.
acc_time
+=
this
.
dyn
.
graph
.
getFastScanTime
();
...
@@ -4431,7 +4426,7 @@ class DynXY_Curve extends DynElem {
...
@@ -4431,7 +4426,7 @@ class DynXY_Curve extends DynElem {
switch
(
this
.
xAttrType
)
{
switch
(
this
.
xAttrType
)
{
case
Type
.
Float32
:
case
Type
.
Float32
:
this
.
dyn
.
graph
.
getGdh
()
this
.
dyn
.
graph
.
getGdh
()
.
getObjectInfoFloatArray
(
pname
.
name
,
size
,
DynXY_Curve
.
scan2
,
this
);
.
getObjectInfoFloatArray
(
pname
.
name
,
size
).
then
(
this
.
scan2
);
break
;
break
;
case
Type
.
Int32
:
case
Type
.
Int32
:
case
Type
.
Int16
:
case
Type
.
Int16
:
...
@@ -4440,7 +4435,7 @@ class DynXY_Curve extends DynElem {
...
@@ -4440,7 +4435,7 @@ class DynXY_Curve extends DynElem {
case
Type
.
UInt16
:
case
Type
.
UInt16
:
case
Type
.
UInt8
:
case
Type
.
UInt8
:
this
.
dyn
.
graph
.
getGdh
()
this
.
dyn
.
graph
.
getGdh
()
.
getObjectInfoIntArray
(
pname
.
name
,
size
,
DynXY_Curve
.
scan2
,
this
);
.
getObjectInfoIntArray
(
pname
.
name
,
size
).
then
(
this
.
scan2
);
break
;
break
;
default
:
default
:
return
;
return
;
...
@@ -4449,8 +4444,8 @@ class DynXY_Curve extends DynElem {
...
@@ -4449,8 +4444,8 @@ class DynXY_Curve extends DynElem {
this
.
firstScan
=
false
;
this
.
firstScan
=
false
;
}
}
s
tatic
scan2
(
id
,
self
,
sts
,
value
)
{
s
can2
(
res
)
{
switch
(
self
.
xAttrType
)
{
switch
(
this
.
xAttrType
)
{
case
Type
.
Float32
:
case
Type
.
Float32
:
case
Type
.
Int32
:
case
Type
.
Int32
:
case
Type
.
Int16
:
case
Type
.
Int16
:
...
@@ -4458,31 +4453,31 @@ class DynXY_Curve extends DynElem {
...
@@ -4458,31 +4453,31 @@ class DynXY_Curve extends DynElem {
case
Type
.
UInt32
:
case
Type
.
UInt32
:
case
Type
.
UInt16
:
case
Type
.
UInt16
:
case
Type
.
UInt8
:
case
Type
.
UInt8
:
if
(
!
(
sts
&
1
))
{
if
(
!
(
res
.
sts
&
1
))
{
return
;
return
;
}
}
switch
(
self
.
datatype
)
{
switch
(
this
.
datatype
)
{
case
CurveDataType
.
XYArrays
:
case
CurveDataType
.
XYArrays
:
self
.
curveX
=
value
.
slice
(
0
,
self
.
noOfPoints
);
this
.
curveX
=
res
.
value
.
slice
(
0
,
this
.
noOfPoints
);
break
;
break
;
case
CurveDataType
.
PointArray
:
case
CurveDataType
.
PointArray
:
self
.
curveX
=
new
Array
(
self
.
noOfPoints
);
this
.
curveX
=
new
Array
(
this
.
noOfPoints
);
self
.
curveY
=
new
Array
(
self
.
noOfPoints
);
this
.
curveY
=
new
Array
(
this
.
noOfPoints
);
for
(
let
i
=
0
;
i
<
self
.
noOfPoints
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
noOfPoints
;
i
++
)
{
self
.
curveX
[
i
]
=
value
[
2
*
i
];
this
.
curveX
[
i
]
=
res
.
value
[
2
*
i
];
self
.
curveY
[
i
]
=
value
[
2
*
i
+
1
];
this
.
curveY
[
i
]
=
res
.
value
[
2
*
i
+
1
];
}
}
self
.
dyn
.
repaintNow
=
true
;
this
.
dyn
.
repaintNow
=
true
;
break
;
break
;
case
CurveDataType
.
TableObject
:
case
CurveDataType
.
TableObject
:
self
.
noOfPoints
=
Math
.
min
(
Math
.
floor
(
value
[
0
]),
self
.
noofpoints
);
this
.
noOfPoints
=
Math
.
min
(
Math
.
floor
(
res
.
value
[
0
]),
this
.
noofpoints
);
self
.
curveY
=
new
Array
(
self
.
noOfPoints
);
this
.
curveY
=
new
Array
(
this
.
noOfPoints
);
self
.
curveX
=
new
Array
(
self
.
noOfPoints
);
this
.
curveX
=
new
Array
(
this
.
noOfPoints
);
for
(
let
i
=
0
;
i
<
self
.
noOfPoints
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
noOfPoints
;
i
++
)
{
self
.
curveX
[
i
]
=
value
[
2
*
i
+
1
];
this
.
curveX
[
i
]
=
res
.
value
[
2
*
i
+
1
];
self
.
curveY
[
i
]
=
value
[
2
*
i
+
2
];
this
.
curveY
[
i
]
=
res
.
value
[
2
*
i
+
2
];
}
}
self
.
dyn
.
repaintNow
=
true
;
this
.
dyn
.
repaintNow
=
true
;
break
;
break
;
}
}
break
;
break
;
...
@@ -4491,18 +4486,17 @@ class DynXY_Curve extends DynElem {
...
@@ -4491,18 +4486,17 @@ class DynXY_Curve extends DynElem {
}
}
// Read y-array
// Read y-array
switch
(
self
.
datatype
)
{
switch
(
this
.
datatype
)
{
case
CurveDataType
.
XYArrays
:
case
CurveDataType
.
XYArrays
:
let
pname
=
self
.
dyn
.
parseAttrName
(
self
.
y_attr
);
let
pname
=
this
.
dyn
.
parseAttrName
(
this
.
y_attr
);
self
.
noOfPoints
=
Math
.
min
(
self
.
noOfPoints
,
pname
.
elements
);
this
.
noOfPoints
=
Math
.
min
(
this
.
noOfPoints
,
pname
.
elements
);
self
.
yAttrType
=
pname
.
type
;
this
.
yAttrType
=
pname
.
type
;
self
.
curveY
=
new
Array
(
self
.
noOfPoints
);
this
.
curveY
=
new
Array
(
this
.
noOfPoints
);
switch
(
self
.
yAttrType
)
{
switch
(
this
.
yAttrType
)
{
case
Type
.
Float32
:
case
Type
.
Float32
:
self
.
dyn
.
graph
.
getGdh
()
this
.
dyn
.
graph
.
getGdh
()
.
getObjectInfoFloatArray
(
pname
.
name
,
self
.
noOfPoints
,
self
.
scan3
,
.
getObjectInfoFloatArray
(
pname
.
name
,
this
.
noOfPoints
).
then
(
this
.
scan3
);
self
);
break
;
break
;
case
Type
.
Int32
:
case
Type
.
Int32
:
case
Type
.
Int16
:
case
Type
.
Int16
:
...
@@ -4510,9 +4504,8 @@ class DynXY_Curve extends DynElem {
...
@@ -4510,9 +4504,8 @@ class DynXY_Curve extends DynElem {
case
Type
.
UInt32
:
case
Type
.
UInt32
:
case
Type
.
UInt16
:
case
Type
.
UInt16
:
case
Type
.
UInt8
:
case
Type
.
UInt8
:
self
.
dyn
.
graph
.
getGdh
()
this
.
dyn
.
graph
.
getGdh
()
.
getObjectInfoIntArray
(
pname
.
name
,
self
.
noOfPoints
,
self
.
scan3
,
.
getObjectInfoIntArray
(
pname
.
name
,
this
.
noOfPoints
).
then
(
this
.
scan3
);
self
);
break
;
break
;
default
:
default
:
return
;
return
;
...
@@ -4521,14 +4514,14 @@ class DynXY_Curve extends DynElem {
...
@@ -4521,14 +4514,14 @@ class DynXY_Curve extends DynElem {
}
}
}
}
s
tatic
scan3
(
id
,
self
,
sts
,
value
)
{
s
can3
(
res
)
{
if
(
!
(
sts
&
1
))
{
if
(
!
(
res
.
sts
&
1
))
{
return
;
return
;
}
}
switch
(
self
.
datatype
)
{
switch
(
this
.
datatype
)
{
case
CurveDataType
.
XYArrays
:
case
CurveDataType
.
XYArrays
:
switch
(
self
.
yAttrType
)
{
switch
(
this
.
yAttrType
)
{
case
Type
.
Float32
:
case
Type
.
Float32
:
case
Type
.
Int32
:
case
Type
.
Int32
:
case
Type
.
Int16
:
case
Type
.
Int16
:
...
@@ -4536,8 +4529,8 @@ class DynXY_Curve extends DynElem {
...
@@ -4536,8 +4529,8 @@ class DynXY_Curve extends DynElem {
case
Type
.
UInt32
:
case
Type
.
UInt32
:
case
Type
.
UInt16
:
case
Type
.
UInt16
:
case
Type
.
UInt8
:
case
Type
.
UInt8
:
self
.
curveY
=
value
.
slice
(
0
,
self
.
noOfPoints
);
this
.
curveY
=
res
.
value
.
slice
(
0
,
this
.
noOfPoints
);
self
.
dyn
.
repaintNow
=
true
;
this
.
dyn
.
repaintNow
=
true
;
break
;
break
;
default
:
default
:
return
;
return
;
...
@@ -4545,8 +4538,8 @@ class DynXY_Curve extends DynElem {
...
@@ -4545,8 +4538,8 @@ class DynXY_Curve extends DynElem {
break
;
break
;
}
}
self
.
object
.
set_xy_data
(
self
.
curveY
,
self
.
curveX
,
self
.
curve_number
-
1
,
this
.
object
.
set_xy_data
(
this
.
curveY
,
this
.
curveX
,
this
.
curve_number
-
1
,
self
.
noOfPoints
);
this
.
noOfPoints
);
}
}
}
}
...
@@ -6674,16 +6667,16 @@ class DynIncrAnalog extends DynElem {
...
@@ -6674,16 +6667,16 @@ class DynIncrAnalog extends DynElem {
case
Database
.
Gdh
:
case
Database
.
Gdh
:
if
(
typeId
===
Type
.
Int32
)
{
if
(
typeId
===
Type
.
Int32
)
{
this
.
dyn
.
graph
.
getGdh
()
this
.
dyn
.
graph
.
getGdh
()
.
getObjectInfoInt
(
pname
.
name
,
DynIncrAnalog
.
action2
,
this
);
.
getObjectInfoInt
(
pname
.
name
).
then
(
this
.
action2
);
}
else
{
}
else
{
this
.
dyn
.
graph
.
getGdh
()
this
.
dyn
.
graph
.
getGdh
()
.
getObjectInfoFloat
(
pname
.
name
,
DynIncrAnalog
.
action2
,
this
);
.
getObjectInfoFloat
(
pname
.
name
).
then
(
this
.
action2
);
}
}
break
;
break
;
case
Database
.
Local
:
case
Database
.
Local
:
let
ret
=
this
.
dyn
.
graph
.
getLdb
()
let
ret
=
this
.
dyn
.
graph
.
getLdb
()
.
getObjectInfo
(
this
.
dyn
.
graph
,
pname
.
name
);
.
getObjectInfo
(
this
.
dyn
.
graph
,
pname
.
name
);
DynIncrAnalog
.
action2
(
0
,
this
,
1
,
ret
.
value
);
this
.
action2
({
id
:
0
,
sts
:
1
,
value
:
ret
.
value
}
);
break
;
break
;
}
}
break
;
break
;
...
@@ -6692,33 +6685,34 @@ class DynIncrAnalog extends DynElem {
...
@@ -6692,33 +6685,34 @@ class DynIncrAnalog extends DynElem {
return
1
;
return
1
;
}
}
static
action2
(
id
,
self
,
sts
,
value
)
{
action2
(
res
)
{
if
(
!
(
sts
&
1
))
{
if
(
!
(
res
.
sts
&
1
))
{
return
;
return
;
}
}
let
pname
=
self
.
dyn
.
parseAttrName
(
self
.
attribute
);
let
pname
=
this
.
dyn
.
parseAttrName
(
this
.
attribute
);
if
(
pname
===
null
)
{
if
(
pname
===
null
)
{
return
1
;
return
1
;
}
}
let
typeId
=
(
pname
.
type
<
0
)
?
Type
.
Float32
:
pname
.
type
;
let
typeId
=
(
pname
.
type
<
0
)
?
Type
.
Float32
:
pname
.
type
;
value
+=
self
.
increment
;
let
sts
=
res
.
sts
;
if
(
!
(
self
.
min_value
===
0
&&
self
.
max_value
===
0
))
{
let
value
=
res
.
value
+
this
.
increment
;
if
(
!
(
this
.
min_value
===
0
&&
this
.
max_value
===
0
))
{
if
(
typeId
===
Type
.
Int32
)
{
if
(
typeId
===
Type
.
Int32
)
{
value
=
clamp
(
value
,
Math
.
floor
(
self
.
min_value
),
Math
.
floor
(
self
.
max_value
));
value
=
clamp
(
value
,
Math
.
floor
(
this
.
min_value
),
Math
.
floor
(
this
.
max_value
));
}
else
{
}
else
{
value
=
clamp
(
value
,
self
.
min_value
,
self
.
max_value
);
value
=
clamp
(
value
,
this
.
min_value
,
this
.
max_value
);
}
}
}
}
if
(
pname
.
database
===
Database
.
Gdh
)
{
if
(
pname
.
database
===
Database
.
Gdh
)
{
if
(
typeId
===
Type
.
Int32
)
{
if
(
typeId
===
Type
.
Int32
)
{
sts
=
self
.
dyn
.
graph
.
getGdh
().
setObjectInfoInt
(
pname
.
name
,
value
);
sts
=
this
.
dyn
.
graph
.
getGdh
().
setObjectInfoInt
(
pname
.
name
,
value
);
}
else
{
}
else
{
sts
=
self
.
dyn
.
graph
.
getGdh
().
setObjectInfoFloat
(
pname
.
name
,
value
);
sts
=
this
.
dyn
.
graph
.
getGdh
().
setObjectInfoFloat
(
pname
.
name
,
value
);
}
}
}
else
if
(
pname
.
database
===
Database
.
Local
)
{
}
else
if
(
pname
.
database
===
Database
.
Local
)
{
sts
=
self
.
dyn
.
graph
.
getLdb
().
setObjectInfo
(
self
.
dyn
.
graph
,
pname
.
name
,
value
);
sts
=
this
.
dyn
.
graph
.
getLdb
().
setObjectInfo
(
this
.
dyn
.
graph
,
pname
.
name
,
value
);
}
}
if
(
even
(
sts
))
{
if
(
even
(
sts
))
{
console
.
log
(
"
IncrAnalog
"
+
pname
.
name
);
console
.
log
(
"
IncrAnalog
"
+
pname
.
name
);
...
@@ -8406,46 +8400,46 @@ class DynMethodToolbar extends DynElem {
...
@@ -8406,46 +8400,46 @@ class DynMethodToolbar extends DynElem {
this
.
pname_name
=
pname
.
name
;
this
.
pname_name
=
pname
.
name
;
let
parsed_name
=
this
.
pname_name
+
"
.XttMethodsMask.Flags
"
;
let
parsed_name
=
this
.
pname_name
+
"
.XttMethodsMask.Flags
"
;
this
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
parsed_name
,
DynMethodToolbar
.
connect2
,
this
);
this
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
parsed_name
).
then
(
this
.
connect2
);
}
}
static
connect2
(
id
,
self
,
sts
,
value
)
{
connect2
(
res
)
{
if
(
sts
&
1
)
{
if
(
res
.
sts
&
1
)
{
self
.
xm_mask_flags
=
value
;
this
.
xm_mask_flags
=
res
.
value
;
if
((
self
.
xm_mask_flags
&
XttMethodsFlagsMask
.
IsConfigured
)
===
0
)
{
if
((
this
.
xm_mask_flags
&
XttMethodsFlagsMask
.
IsConfigured
)
===
0
)
{
self
.
mask_configure
=
1
;
this
.
mask_configure
=
1
;
self
.
mask_store
=
1
;
this
.
mask_store
=
1
;
self
.
connect5
();
this
.
connect5
();
}
else
{
}
else
{
let
parsed_name
=
self
.
pname_name
+
"
.XttMethodsMask.OpMethods
"
;
let
parsed_name
=
this
.
pname_name
+
"
.XttMethodsMask.OpMethods
"
;
self
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
parsed_name
,
self
.
connect3
,
self
);
this
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
parsed_name
).
then
(
this
.
connect3
);
}
}
}
else
{
}
else
{
self
.
mask_configure
=
1
;
this
.
mask_configure
=
1
;
self
.
connect5
();
this
.
connect5
();
}
}
}
}
static
connect3
(
id
,
self
,
sts
,
value
)
{
connect3
(
res
)
{
if
(
sts
&
1
)
{
if
(
res
.
sts
&
1
)
{
self
.
xm_mask_opmethods
=
value
;
this
.
xm_mask_opmethods
=
res
.
value
;
}
else
{
}
else
{
console
.
log
(
"
DynMethodToolbar:
"
+
self
.
pname_name
);
console
.
log
(
"
DynMethodToolbar:
"
+
this
.
pname_name
);
self
.
mask_configure
=
1
;
this
.
mask_configure
=
1
;
}
}
let
parsed_name
=
self
.
pname_name
+
"
.XttMethodsMask.MntMethods
"
;
let
parsed_name
=
this
.
pname_name
+
"
.XttMethodsMask.MntMethods
"
;
self
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
parsed_name
,
self
.
connect4
,
self
);
this
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
parsed_name
).
then
(
this
.
connect4
);
}
}
static
connect4
(
id
,
self
,
sts
,
value
)
{
connect4
(
res
)
{
if
(
sts
&
1
)
{
if
(
res
.
sts
&
1
)
{
self
.
xm_mask_mntmethods
=
value
;
this
.
xm_mask_mntmethods
=
res
.
value
;
}
else
{
}
else
{
console
.
log
(
"
DynMethodToolbar:
"
+
self
.
pname_name
);
console
.
log
(
"
DynMethodToolbar:
"
+
this
.
pname_name
);
self
.
mask_configure
=
1
;
this
.
mask_configure
=
1
;
}
}
self
.
connect5
();
this
.
connect5
();
}
}
connect5
()
{
connect5
()
{
...
@@ -8667,8 +8661,7 @@ class DynMethodPulldownMenu extends DynElem {
...
@@ -8667,8 +8661,7 @@ class DynMethodPulldownMenu extends DynElem {
this
.
pname_name
=
pname
.
name
;
this
.
pname_name
=
pname
.
name
;
let
parsed_name
=
this
.
pname_name
+
"
.XttMethodsMask.Flags
"
;
let
parsed_name
=
this
.
pname_name
+
"
.XttMethodsMask.Flags
"
;
this
.
dyn
.
graph
.
getGdh
()
this
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
parsed_name
).
then
(
this
.
action2
);
.
getObjectInfoInt
(
parsed_name
,
DynMethodPulldownMenu
.
action2
,
this
);
}
}
break
;
break
;
...
@@ -8744,46 +8737,45 @@ class DynMethodPulldownMenu extends DynElem {
...
@@ -8744,46 +8737,45 @@ class DynMethodPulldownMenu extends DynElem {
return
1
;
return
1
;
}
}
static
action2
(
id
,
self
,
sts
,
value
)
{
action2
(
res
)
{
if
(
sts
&
1
)
{
if
(
res
.
sts
&
1
)
{
self
.
xm_mask_flags
=
value
;
this
.
xm_mask_flags
=
res
.
value
;
if
((
self
.
xm_mask_flags
&
XttMethodsFlagsMask
.
IsConfigured
)
===
0
)
{
if
((
this
.
xm_mask_flags
&
XttMethodsFlagsMask
.
IsConfigured
)
===
0
)
{
self
.
mask_configure
=
1
;
this
.
mask_configure
=
1
;
self
.
mask_store
=
1
;
this
.
mask_store
=
1
;
self
.
action5
();
this
.
action5
();
}
else
{
}
else
{
let
parsed_name
=
self
.
pname_name
+
"
.XttMethodsMask.OpMethods
"
;
let
parsed_name
=
this
.
pname_name
+
"
.XttMethodsMask.OpMethods
"
;
self
.
dyn
.
graph
.
getGdh
()
this
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
parsed_name
).
then
(
this
.
action3
);
.
getObjectInfoInt
(
parsed_name
,
self
.
action3
,
self
);
}
}
}
else
{
}
else
{
self
.
mask_configure
=
1
;
this
.
mask_configure
=
1
;
self
.
action5
();
this
.
action5
();
}
}
}
}
static
action3
(
id
,
self
,
sts
,
value
)
{
action3
(
res
)
{
if
(
sts
&
1
)
{
if
(
res
.
sts
&
1
)
{
self
.
xm_mask_opmethods
=
value
;
this
.
xm_mask_opmethods
=
res
.
value
;
}
else
{
}
else
{
console
.
log
(
"
DynMethodToolbar:
"
+
self
.
pname_name
);
console
.
log
(
"
DynMethodToolbar:
"
+
this
.
pname_name
);
self
.
mask_configure
=
1
;
this
.
mask_configure
=
1
;
}
}
let
parsed_name
=
self
.
pname_name
+
"
.XttMethodsMask.MntMethods
"
;
let
parsed_name
=
this
.
pname_name
+
"
.XttMethodsMask.MntMethods
"
;
self
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
parsed_name
,
self
.
action4
,
self
);
this
.
dyn
.
graph
.
getGdh
().
getObjectInfoInt
(
parsed_name
).
then
(
this
.
action4
);
}
}
static
action4
(
id
,
self
,
sts
,
value
)
{
action4
(
res
)
{
if
(
sts
&
1
)
{
if
(
res
.
sts
&
1
)
{
self
.
xm_mask_mntmethods
=
value
;
this
.
xm_mask_mntmethods
=
res
.
value
;
}
else
{
}
else
{
console
.
log
(
"
DynMethodToolbar:
"
+
self
.
pname_name
);
console
.
log
(
"
DynMethodToolbar:
"
+
this
.
pname_name
);
self
.
mask_configure
=
1
;
this
.
mask_configure
=
1
;
}
}
self
.
action5
();
this
.
action5
();
}
}
action5
()
{
action5
()
{
...
...
java/jsw/ge/src/ge_graph.ts
View file @
0501e23c
...
@@ -249,31 +249,27 @@ class Graph {
...
@@ -249,31 +249,27 @@ class Graph {
gdh_init_cb
()
{
gdh_init_cb
()
{
if
(
this
.
priv
===
null
)
{
if
(
this
.
priv
===
null
)
{
this
.
gdh
.
login
(
""
,
""
,
this
.
login_cb
,
this
);
this
.
gdh
.
login
(
""
,
""
).
then
(
this
.
login_cb
);
}
}
this
.
ctx
.
traceConnect
();
this
.
ctx
.
traceConnect
();
this
.
gdh
.
refObjectInfoList
(
this
.
trace_connected
);
this
.
gdh
.
refObjectInfoList
(
).
then
(
e
=>
this
.
trace_cyclic
()
);
}
}
login_cb
(
id
,
data
,
sts
,
result
)
{
login_cb
(
res
)
{
console
.
log
(
"
Login:
"
,
sts
,
result
);
console
.
log
(
"
Login:
"
,
res
.
sts
,
res
.
value
);
this
.
priv
=
(
sts
&
1
)
?
result
:
0
;
this
.
priv
=
(
res
.
sts
&
1
)
?
res
.
value
:
0
;
}
trace_connected
(
id
,
sts
)
{
this
.
trace_cyclic
();
}
}
trace_cyclic
()
{
trace_cyclic
()
{
if
(
this
.
frame
.
nogdh
)
{
if
(
this
.
frame
.
nogdh
)
{
this
.
trace_scan
(
0
,
0
);
this
.
trace_scan
();
}
else
{
}
else
{
this
.
gdh
.
getRefObjectInfoAll
(
this
.
trace_scan
);
this
.
gdh
.
getRefObjectInfoAll
(
this
.
trace_scan
);
}
}
}
}
trace_scan
(
id
,
sts
)
{
trace_scan
()
{
this
.
scan_time
=
this
.
ctx
.
scantime
;
this
.
scan_time
=
this
.
ctx
.
scantime
;
this
.
fast_scan_time
=
this
.
ctx
.
fast_scantime
;
this
.
fast_scan_time
=
this
.
ctx
.
fast_scantime
;
this
.
animation_scan_time
=
this
.
ctx
.
animation_scantime
;
this
.
animation_scan_time
=
this
.
ctx
.
animation_scantime
;
...
...
java/jsw/opwind/src/opwind.ts
View file @
0501e23c
...
@@ -32,8 +32,8 @@ class OpWindMenu {
...
@@ -32,8 +32,8 @@ class OpWindMenu {
gdh_init_cb
()
{
gdh_init_cb
()
{
let
oid
=
new
PwrtObjid
(
0
,
0
);
let
oid
=
new
PwrtObjid
(
0
,
0
);
this
.
user
=
"
Default
"
;
this
.
user
=
"
Default
"
;
this
.
gdh
.
login
(
""
,
""
,
this
.
login_cb
,
this
);
this
.
gdh
.
login
(
""
,
""
).
then
(
this
.
login_cb
);
this
.
gdh
.
getOpwindMenu
(
this
.
get_opplace
()
,
this
.
get_menu_cb
,
999
);
this
.
gdh
.
getOpwindMenu
(
this
.
get_opplace
()
).
then
(
this
.
get_menu_cb
);
}
}
add_menu_button
(
context
,
text
)
{
add_menu_button
(
context
,
text
)
{
...
@@ -49,9 +49,9 @@ class OpWindMenu {
...
@@ -49,9 +49,9 @@ class OpWindMenu {
return
button
;
return
button
;
}
}
get_menu_cb
(
id
,
data
,
sts
,
result
)
{
get_menu_cb
(
res
)
{
let
result
=
res
.
value
;
this
.
info
=
result
;
this
.
info
=
result
;
console
.
log
(
"
Menu received
"
,
sts
,
data
,
result
.
buttons
.
length
);
let
context
=
document
.
getElementById
(
"
opwindmenu
"
);
let
context
=
document
.
getElementById
(
"
opwindmenu
"
);
document
.
getElementById
(
"
opwind_title
"
).
innerHTML
=
result
.
title
;
document
.
getElementById
(
"
opwind_title
"
).
innerHTML
=
result
.
title
;
...
@@ -89,7 +89,7 @@ class OpWindMenu {
...
@@ -89,7 +89,7 @@ class OpWindMenu {
passwd
=
c
.
crypt
(
"
aa
"
,
passwd
);
passwd
=
c
.
crypt
(
"
aa
"
,
passwd
);
this
.
user
=
user
;
this
.
user
=
user
;
this
.
gdh
.
login
(
user
,
passwd
,
this
.
login_cb
,
this
);
this
.
gdh
.
login
(
user
,
passwd
).
then
(
this
.
login_cb
);
});
});
document
.
getElementById
(
"
cancel_button
"
)
document
.
getElementById
(
"
cancel_button
"
)
.
addEventListener
(
"
click
"
,
function
(
event
)
{
.
addEventListener
(
"
click
"
,
function
(
event
)
{
...
@@ -102,7 +102,7 @@ class OpWindMenu {
...
@@ -102,7 +102,7 @@ class OpWindMenu {
document
.
getElementById
(
"
login_frame
"
).
style
.
height
=
'
0px
'
;
document
.
getElementById
(
"
login_frame
"
).
style
.
height
=
'
0px
'
;
this
.
priv
=
0
;
this
.
priv
=
0
;
this
.
user
=
"
Default
"
;
this
.
user
=
"
Default
"
;
this
.
gdh
.
login
(
""
,
""
,
this
.
login_cb
,
this
);
this
.
gdh
.
login
(
""
,
""
).
then
(
this
.
login_cb
);
});
});
document
.
getElementById
(
"
login_user
"
).
innerHTML
=
""
;
document
.
getElementById
(
"
login_user
"
).
innerHTML
=
""
;
...
@@ -200,10 +200,9 @@ class OpWindMenu {
...
@@ -200,10 +200,9 @@ class OpWindMenu {
}
}
}
}
login_cb
(
id
,
data
,
sts
,
result
)
{
login_cb
(
res
)
{
console
.
log
(
"
Login:
"
,
sts
,
result
);
if
(
res
.
sts
&
1
)
{
if
(
sts
&
1
)
{
this
.
priv
=
res
.
value
;
this
.
priv
=
result
;
sessionStorage
.
setItem
(
"
pwr_privilege
"
,
String
(
this
.
priv
));
sessionStorage
.
setItem
(
"
pwr_privilege
"
,
String
(
this
.
priv
));
if
(
this
.
user_text
!==
null
)
{
if
(
this
.
user_text
!==
null
)
{
this
.
user_text
.
textContent
=
this
.
user
+
"
on
"
+
this
.
host
;
this
.
user_text
.
textContent
=
this
.
user
+
"
on
"
+
this
.
host
;
...
...
java/jsw/xtt/src/xtt.ts
View file @
0501e23c
...
@@ -32,9 +32,9 @@ class Xtt {
...
@@ -32,9 +32,9 @@ class Xtt {
let
y
=
event
.
pageY
-
this
.
ctx
.
gdraw
.
offset_top
;
let
y
=
event
.
pageY
-
this
.
ctx
.
gdraw
.
offset_top
;
let
x
=
event
.
pageX
;
let
x
=
event
.
pageX
;
if
(
event
.
shiftKey
)
{
if
(
event
.
shiftKey
)
{
xtt
.
ctx
.
event_handler
(
Event
.
MB1ClickShift
,
x
,
y
);
this
.
ctx
.
event_handler
(
Event
.
MB1ClickShift
,
x
,
y
);
}
else
{
}
else
{
xtt
.
ctx
.
event_handler
(
Event
.
MB1Click
,
x
,
y
);
this
.
ctx
.
event_handler
(
Event
.
MB1Click
,
x
,
y
);
}
}
});
});
document
.
addEventListener
(
"
keydown
"
,
function
(
event
)
{
document
.
addEventListener
(
"
keydown
"
,
function
(
event
)
{
...
@@ -62,9 +62,7 @@ class Xtt {
...
@@ -62,9 +62,7 @@ class Xtt {
.
addEventListener
(
"
click
"
,
function
(
event
)
{
.
addEventListener
(
"
click
"
,
function
(
event
)
{
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
.
userdata
instanceof
XttItemObject
)
{
if
(
o
.
userdata
instanceof
XttItemObject
)
{
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_GRAPH
).
then
(
this
.
open_graph_cb
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_GRAPH
,
this
.
open_graph_cb
,
newwindow
);
}
}
console
.
log
(
"
toolitem1 event
"
);
console
.
log
(
"
toolitem1 event
"
);
});
});
...
@@ -72,10 +70,7 @@ class Xtt {
...
@@ -72,10 +70,7 @@ class Xtt {
.
addEventListener
(
"
click
"
,
function
(
event
)
{
.
addEventListener
(
"
click
"
,
function
(
event
)
{
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
.
userdata
instanceof
XttItemObject
)
{
if
(
o
.
userdata
instanceof
XttItemObject
)
{
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_OBJECTGRAPH
).
then
(
this
.
open_objectgraph_cb
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_OBJECTGRAPH
,
this
.
open_objectgraph_cb
,
newwindow
);
}
}
console
.
log
(
"
toolitem2 event
"
);
console
.
log
(
"
toolitem2 event
"
);
});
});
...
@@ -84,9 +79,7 @@ class Xtt {
...
@@ -84,9 +79,7 @@ class Xtt {
console
.
log
(
"
toolitem1 event
"
);
console
.
log
(
"
toolitem1 event
"
);
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
.
userdata
instanceof
XttItemObject
)
{
if
(
o
.
userdata
instanceof
XttItemObject
)
{
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_PLC
).
then
(
this
.
open_plc_cb
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_PLC
,
this
.
open_plc_cb
,
newwindow
);
}
else
if
(
o
.
userdata
instanceof
XttItemCrr
)
{
}
else
if
(
o
.
userdata
instanceof
XttItemCrr
)
{
let
idx
=
o
.
userdata
.
name
.
lastIndexOf
(
'
-
'
);
let
idx
=
o
.
userdata
.
name
.
lastIndexOf
(
'
-
'
);
let
ostring
=
""
;
let
ostring
=
""
;
...
@@ -117,7 +110,7 @@ class Xtt {
...
@@ -117,7 +110,7 @@ class Xtt {
document
.
getElementById
(
"
toolitem6
"
)
document
.
getElementById
(
"
toolitem6
"
)
.
addEventListener
(
"
click
"
,
function
(
event
)
{
.
addEventListener
(
"
click
"
,
function
(
event
)
{
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
this
.
ctx
.
gdh
.
crrSignal
(
o
.
userdata
.
objid
,
this
.
open_crr_cb
,
o
);
this
.
ctx
.
gdh
.
crrSignal
(
o
.
userdata
.
objid
).
then
(
this
.
open_crr_cb
(
o
)
);
console
.
log
(
"
toolitem6 event
"
);
console
.
log
(
"
toolitem6 event
"
);
});
});
document
.
getElementById
(
"
toolitem7
"
)
document
.
getElementById
(
"
toolitem7
"
)
...
@@ -132,9 +125,8 @@ class Xtt {
...
@@ -132,9 +125,8 @@ class Xtt {
return
;
return
;
}
}
if
(
o
.
userdata
instanceof
XttItemObject
)
{
if
(
o
.
userdata
instanceof
XttItemObject
)
{
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_HELPCLASS
,
this
.
open_helpclass_cb
,
newwindow
);
GdhOp
.
GET_OP_METHOD_HELPCLASS
).
then
(
this
.
open_helpclass_cb
);
}
}
});
});
...
@@ -153,148 +145,151 @@ class Xtt {
...
@@ -153,148 +145,151 @@ class Xtt {
gdh_init_cb
()
{
gdh_init_cb
()
{
if
(
this
.
priv
===
null
)
{
if
(
this
.
priv
===
null
)
{
this
.
ctx
.
gdh
.
login
(
""
,
""
,
this
.
login_cb
,
this
);
this
.
ctx
.
gdh
.
login
(
""
,
""
).
then
(
this
.
login_cb
);
}
}
let
oid
=
new
PwrtObjid
(
0
,
0
);
let
oid
=
new
PwrtObjid
(
0
,
0
);
this
.
ctx
.
gdh
.
getAllXttChildren
(
oid
,
this
.
open_children_cb
,
this
.
ctx
.
gdh
.
getAllXttChildren
(
oid
).
then
(
this
.
open_children_cb
(
new
XttOpenChildrenData
(
null
,
null
)));
new
XttOpenChildrenData
(
null
,
null
));
this
.
ctx
.
gdh
.
listSent
=
true
;
this
.
ctx
.
gdh
.
listSent
=
true
;
this
.
trace_cyclic
();
this
.
trace_cyclic
();
}
}
login_cb
(
id
,
data
,
sts
,
result
)
{
login_cb
(
res
)
{
console
.
log
(
"
Login:
"
,
sts
,
result
);
console
.
log
(
"
Login:
"
,
res
.
sts
,
res
.
value
);
this
.
priv
=
(
sts
&
1
)
?
result
:
0
;
this
.
priv
=
(
res
.
sts
&
1
)
?
res
.
value
:
0
;
}
}
open_children_cb
(
id
,
data
,
sts
,
result
)
{
open_children_cb
(
child
)
{
this
.
ctx
.
set_nodraw
();
return
function
(
res
)
{
for
(
let
i
=
0
;
i
<
result
.
length
;
i
++
)
{
let
result
=
res
.
value
;
if
(
data
.
node
===
null
)
{
this
.
ctx
.
set_nodraw
();
result
[
i
].
full_name
=
result
[
i
].
name
;
for
(
let
i
=
0
;
i
<
result
.
length
;
i
++
)
{
new
XttItemObject
(
this
,
result
[
i
],
null
,
Dest
.
AFTER
);
if
(
child
.
node
===
null
)
{
}
else
{
result
[
i
].
full_name
=
result
[
i
].
name
;
result
[
i
].
full_name
=
new
XttItemObject
(
this
,
result
[
i
],
null
,
Dest
.
AFTER
);
data
.
node
.
userdata
.
full_name
+
"
-
"
+
result
[
i
].
name
;
}
else
{
new
XttItemObject
(
this
,
result
[
i
],
data
.
node
,
Dest
.
INTOLAST
);
result
[
i
].
full_name
=
child
.
node
.
userdata
.
full_name
+
"
-
"
+
result
[
i
].
name
;
new
XttItemObject
(
this
,
result
[
i
],
child
.
node
,
Dest
.
INTOLAST
);
}
}
}
}
this
.
ctx
.
configure
();
this
.
ctx
.
configure
();
if
(
data
.
open_next
!==
null
)
{
if
(
child
.
open_next
!==
null
)
{
if
(
data
.
open_next
.
length
===
0
)
{
if
(
child
.
open_next
.
length
===
0
)
{
this
.
ctx
.
reset_nodraw
();
this
.
ctx
.
reset_nodraw
();
return
;
return
;
}
}
let
child
=
this
.
ctx
.
a
.
get_first_child
(
data
.
node
);
let
child
=
this
.
ctx
.
a
.
get_first_child
(
child
.
node
);
while
(
child
!==
null
)
{
while
(
child
!==
null
)
{
if
(
child
.
userdata
.
name
===
data
.
open_next
[
0
])
{
if
(
child
.
userdata
.
name
===
child
.
open_next
[
0
])
{
if
(
data
.
open_next
.
length
===
1
)
{
if
(
child
.
open_next
.
length
===
1
)
{
child
.
set_select
(
true
);
child
.
set_select
(
true
);
child
.
set_invert
(
true
);
child
.
set_invert
(
true
);
if
(
!
this
.
ctx
.
is_visible
(
child
))
{
if
(
!
this
.
ctx
.
is_visible
(
child
))
{
this
.
ctx
.
scroll
(
child
.
ll_y
,
0.50
);
this
.
ctx
.
scroll
(
child
.
ll_y
,
0.50
);
}
}
window
.
focus
();
// Doesn't work
window
.
focus
();
// Doesn't work
}
else
{
data
.
open_next
.
splice
(
0
,
1
);
if
(
data
.
open_next
[
0
]
===
'
.
'
)
{
data
.
open_next
.
splice
(
0
,
1
);
child
.
userdata
.
open_attributes
(
this
,
data
.
open_next
);
}
else
{
}
else
{
child
.
userdata
.
open_children
(
this
,
data
.
open_next
);
child
.
open_next
.
splice
(
0
,
1
);
if
(
child
.
open_next
[
0
]
===
'
.
'
)
{
child
.
open_next
.
splice
(
0
,
1
);
child
.
userdata
.
open_attributes
(
this
,
child
.
open_next
);
}
else
{
child
.
userdata
.
open_children
(
child
.
open_next
);
}
}
}
break
;
}
}
break
;
child
=
this
.
ctx
.
a
.
get_next_sibling
(
child
)
;
}
}
child
=
this
.
ctx
.
a
.
get_next_sibling
(
child
);
}
}
}
this
.
ctx
.
reset_nodraw
();
this
.
ctx
.
reset_nodraw
();
this
.
ctx
.
draw
();
this
.
ctx
.
draw
();
}
}
}
open_attributes_cb
(
id
,
data
,
sts
,
result
)
{
open_attributes_cb
(
child
)
{
this
.
ctx
.
set_nodraw
();
return
function
(
res
)
{
for
(
let
i
=
0
;
i
<
result
.
length
;
i
++
)
{
let
result
=
res
.
value
;
result
[
i
].
objid
=
data
.
node
.
userdata
.
objid
;
this
.
ctx
.
set_nodraw
();
result
[
i
].
full_name
=
data
.
node
.
userdata
.
full_name
+
"
.
"
+
result
[
i
].
name
;
for
(
let
i
=
0
;
i
<
result
.
length
;
i
++
)
{
if
((
result
[
i
].
flags
&
Adef
.
Array
)
!==
0
)
{
result
[
i
].
objid
=
child
.
node
.
userdata
.
objid
;
new
XttItemAttrArray
(
this
,
result
[
i
],
data
.
node
,
Dest
.
INTOLAST
);
result
[
i
].
full_name
=
child
.
node
.
userdata
.
full_name
+
"
.
"
+
result
[
i
].
name
;
}
else
if
((
result
[
i
].
flags
&
Adef
.
Class
)
!==
0
)
{
if
((
result
[
i
].
flags
&
Adef
.
Array
)
!==
0
)
{
new
XttItemAttrObject
(
this
,
result
[
i
],
data
.
node
,
Dest
.
INTOLAST
);
new
XttItemAttrArray
(
this
,
result
[
i
],
child
.
node
,
Dest
.
INTOLAST
);
}
else
{
}
else
if
((
result
[
i
].
flags
&
Adef
.
Class
)
!==
0
)
{
new
XttItemAttr
(
this
,
result
[
i
],
data
.
node
,
Dest
.
INTOLAST
);
new
XttItemAttrObject
(
this
,
result
[
i
],
child
.
node
,
Dest
.
INTOLAST
);
}
else
{
new
XttItemAttr
(
this
,
result
[
i
],
child
.
node
,
Dest
.
INTOLAST
);
}
}
}
}
this
.
ctx
.
configure
();
this
.
ctx
.
configure
();
if
(
data
.
open_next
!==
null
)
{
if
(
child
.
open_next
!==
null
)
{
if
(
data
.
open_next
.
length
===
0
)
{
if
(
child
.
open_next
.
length
===
0
)
{
this
.
ctx
.
reset_nodraw
();
this
.
ctx
.
reset_nodraw
();
return
;
return
;
}
}
let
child
=
this
.
ctx
.
a
.
get_first_child
(
data
.
node
);
let
child2
=
this
.
ctx
.
a
.
get_first_child
(
child
.
node
);
while
(
child
!==
null
)
{
while
(
child2
!==
null
)
{
if
(
child
.
userdata
.
name
===
data
.
open_next
[
0
])
{
if
(
child2
.
userdata
.
name
===
child
.
open_next
[
0
])
{
if
(
data
.
open_next
.
length
===
1
)
{
if
(
child
.
open_next
.
length
===
1
)
{
child
.
set_select
(
true
);
child2
.
set_select
(
true
);
child
.
set_invert
(
true
);
child2
.
set_invert
(
true
);
if
(
!
this
.
ctx
.
is_visible
(
child
))
{
if
(
!
this
.
ctx
.
is_visible
(
child2
))
{
this
.
ctx
.
scroll
(
child
.
ll_y
,
0.50
);
this
.
ctx
.
scroll
(
child2
.
ll_y
,
0.50
);
}
window
.
focus
();
// Doesn't work
}
else
{
child
.
open_next
.
splice
(
0
,
1
);
child2
.
userdata
.
open_attributes
(
this
,
child
.
open_next
);
}
}
window
.
focus
();
// Doesn't work
break
;
}
else
{
data
.
open_next
.
splice
(
0
,
1
);
child
.
userdata
.
open_attributes
(
this
,
data
.
open_next
);
}
}
break
;
child2
=
this
.
ctx
.
a
.
get_next_sibling
(
child2
)
;
}
}
child
=
this
.
ctx
.
a
.
get_next_sibling
(
child
);
}
}
}
this
.
ctx
.
reset_nodraw
();
this
.
ctx
.
reset_nodraw
();
this
.
ctx
.
draw
();
this
.
ctx
.
draw
();
}
}
}
open_plc_cb
(
id
,
data
,
sts
,
result
:
ObjectInfo
)
{
open_plc_cb
(
res
)
{
if
((
sts
&
1
)
===
0
)
{
let
w
=
window
.
open
(
""
,
"
_blank
"
);
data
.
document
.
write
(
"
Error status
"
+
sts
);
if
((
res
.
sts
&
1
)
===
0
)
{
w
.
document
.
write
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
let
param1
;
let
result
=
res
.
value
;
if
(
result
.
param1
===
""
)
{
let
param1
=
result
.
param1
?
(
"
&obj=
"
+
result
.
param1
)
:
""
;
param1
=
""
;
w
.
location
.
href
=
"
flow.html?vid=
"
+
result
.
objid
.
vid
+
"
&oix=
"
+
}
else
{
result
.
objid
.
oix
+
param1
;
param1
=
"
&obj=
"
+
result
.
param1
;
w
.
document
.
title
=
"
Trace
"
+
result
.
fullname
;
}
console
.
log
(
"
flow.html?vid=
"
+
result
.
objid
.
vid
+
"
&oix=
"
+
result
.
objid
.
oix
+
param1
);
data
.
location
.
href
=
"
flow.html?vid=
"
+
result
.
objid
.
vid
+
"
&oix=
"
+
result
.
objid
.
oix
+
param1
;
data
.
document
.
title
=
"
Trace
"
+
result
.
fullname
;
}
}
}
}
open_objectgraph_cb
(
id
,
data
,
sts
,
result
:
ObjectInfo
)
{
open_objectgraph_cb
(
res
)
{
if
((
sts
&
1
)
===
0
)
{
let
w
=
window
.
open
(
""
,
"
_blank
"
);
data
.
document
.
write
(
"
Error status
"
+
sts
);
if
((
res
.
sts
&
1
)
===
0
)
{
w
.
document
.
write
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
data
.
location
.
href
=
let
result
=
res
.
value
;
w
.
location
.
href
=
"
ge.html?graph=
"
+
result
.
param1
+
"
&instance=
"
+
result
.
fullname
;
"
ge.html?graph=
"
+
result
.
param1
+
"
&instance=
"
+
result
.
fullname
;
data
.
document
.
title
=
result
.
fullname
;
w
.
document
.
title
=
result
.
fullname
;
}
}
}
}
open_graph_cb
(
id
,
data
,
sts
,
result
:
ObjectInfo
)
{
open_graph_cb
(
res
)
{
if
((
sts
&
1
)
===
0
)
{
let
w
=
window
.
open
(
""
,
"
_blank
"
);
data
.
document
.
write
(
"
Error status
"
+
sts
);
if
((
res
.
sts
&
1
)
===
0
)
{
w
.
document
.
write
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
let
result
=
res
.
value
;
let
idx
=
result
.
param1
.
indexOf
(
'
.
'
);
let
idx
=
result
.
param1
.
indexOf
(
'
.
'
);
if
(
idx
!==
-
1
)
{
if
(
idx
!==
-
1
)
{
result
.
param1
=
result
.
param1
.
substring
(
0
,
idx
);
result
.
param1
=
result
.
param1
.
substring
(
0
,
idx
);
...
@@ -305,25 +300,28 @@ class Xtt {
...
@@ -305,25 +300,28 @@ class Xtt {
instancestr
=
"
&instance=
"
+
result
.
fullname
;
instancestr
=
"
&instance=
"
+
result
.
fullname
;
}
}
data
.
location
.
href
=
"
ge.html?graph=
"
+
result
.
param1
+
instancestr
;
w
.
location
.
href
=
"
ge.html?graph=
"
+
result
.
param1
+
instancestr
;
data
.
document
.
title
=
result
.
param1
;
w
.
document
.
title
=
result
.
param1
;
}
}
}
}
open_crr_cb
(
id
,
node
,
sts
,
crrdata
)
{
open_crr_cb
(
node
)
{
if
((
sts
&
1
)
===
0
)
{
return
function
(
res
)
{
return
;
if
((
res
.
sts
&
1
)
===
0
)
{
return
;
}
node
.
userdata
.
open_crossreferences
(
res
.
value
);
}
}
node
.
userdata
.
open_crossreferences
(
this
,
crrdata
);
}
}
open_helpclass_cb
(
id
,
data
,
sts
,
result
:
ObjectInfo
)
{
open_helpclass_cb
(
res
)
{
if
((
sts
&
1
)
===
0
)
{
let
w
=
window
.
open
(
""
,
"
_blank
"
);
data
.
document
.
write
(
"
Error status
"
+
sts
);
if
((
res
.
sts
&
1
)
===
0
)
{
w
.
document
.
write
(
"
Error status
"
+
res
.
sts
);
}
else
{
}
else
{
console
.
log
(
"
open_helpclass
"
,
res
ult
.
param1
);
console
.
log
(
"
open_helpclass
"
,
res
.
value
.
param1
);
data
.
location
.
href
=
w
.
location
.
href
=
location
.
protocol
+
"
//
"
+
location
.
host
+
res
ult
.
param1
;
location
.
protocol
+
"
//
"
+
location
.
host
+
res
.
value
.
param1
;
}
}
}
}
...
@@ -336,12 +334,12 @@ class Xtt {
...
@@ -336,12 +334,12 @@ class Xtt {
switch
(
event
)
{
switch
(
event
)
{
case
Event
.
ObjectDeleted
:
case
Event
.
ObjectDeleted
:
if
(
object
.
userdata
instanceof
XttItemAttr
)
{
if
(
object
.
userdata
instanceof
XttItemAttr
)
{
object
.
userdata
.
scan_close
(
this
);
object
.
userdata
.
scan_close
();
}
}
break
;
break
;
case
Event
.
MB1Click
:
case
Event
.
MB1Click
:
if
(
object
.
in_icon
(
x
,
y
))
{
if
(
object
.
in_icon
(
x
,
y
))
{
item
.
open_children
(
this
,
null
);
item
.
open_children
(
null
);
}
else
{
}
else
{
if
(
object
.
select
)
{
if
(
object
.
select
)
{
object
.
set_select
(
false
);
object
.
set_select
(
false
);
...
@@ -400,7 +398,7 @@ class Xtt {
...
@@ -400,7 +398,7 @@ class Xtt {
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
!==
null
)
{
if
(
o
!==
null
)
{
item
=
o
.
userdata
;
item
=
o
.
userdata
;
item
.
open_children
(
this
,
null
);
item
.
open_children
(
null
);
}
}
break
;
break
;
case
Event
.
Key_Left
:
case
Event
.
Key_Left
:
...
@@ -420,15 +418,13 @@ class Xtt {
...
@@ -420,15 +418,13 @@ class Xtt {
case
Event
.
Key_CtrlR
:
case
Event
.
Key_CtrlR
:
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
!==
null
)
{
if
(
o
!==
null
)
{
this
.
ctx
.
gdh
.
crrSignal
(
o
.
userdata
.
objid
,
this
.
open_crr_cb
,
o
);
this
.
ctx
.
gdh
.
crrSignal
(
o
.
userdata
.
objid
).
then
(
this
.
open_crr_cb
(
o
)
);
}
}
break
;
break
;
case
Event
.
Key_CtrlL
:
case
Event
.
Key_CtrlL
:
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
.
userdata
instanceof
XttItemObject
)
{
if
(
o
.
userdata
instanceof
XttItemObject
)
{
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_PLC
).
then
(
this
.
open_plc_cb
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_PLC
,
this
.
open_plc_cb
,
newwindow
);
}
else
if
(
o
.
userdata
instanceof
XttItemCrr
)
{
}
else
if
(
o
.
userdata
instanceof
XttItemCrr
)
{
let
idx
=
o
.
userdata
.
name
.
lastIndexOf
(
'
-
'
);
let
idx
=
o
.
userdata
.
name
.
lastIndexOf
(
'
-
'
);
let
ostring
=
""
;
let
ostring
=
""
;
...
@@ -443,10 +439,7 @@ class Xtt {
...
@@ -443,10 +439,7 @@ class Xtt {
let
o
=
this
.
ctx
.
get_select
();
let
o
=
this
.
ctx
.
get_select
();
if
(
o
.
userdata
instanceof
XttItemObject
)
{
if
(
o
.
userdata
instanceof
XttItemObject
)
{
console
.
log
(
"
CtrlG
"
,
o
.
userdata
.
objid
.
vid
,
o
.
userdata
.
objid
.
oix
);
console
.
log
(
"
CtrlG
"
,
o
.
userdata
.
objid
.
vid
,
o
.
userdata
.
objid
.
oix
);
let
newwindow
=
window
.
open
(
""
,
"
_blank
"
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_OBJECTGRAPH
).
then
(
this
.
open_objectgraph_cb
);
this
.
ctx
.
gdh
.
getObject
(
o
.
userdata
.
objid
,
GdhOp
.
GET_OP_METHOD_OBJECTGRAPH
,
this
.
open_objectgraph_cb
,
newwindow
);
}
}
break
;
break
;
default
:
default
:
...
@@ -526,7 +519,7 @@ class Xtt {
...
@@ -526,7 +519,7 @@ class Xtt {
window
.
focus
();
// Doesn't work
window
.
focus
();
// Doesn't work
}
else
{
}
else
{
path
.
splice
(
0
,
1
);
path
.
splice
(
0
,
1
);
(
<
XttItemObject
>
this
.
ctx
.
a
.
get
(
j
).
userdata
).
open_children
(
this
,
path
);
(
<
XttItemObject
>
this
.
ctx
.
a
.
get
(
j
).
userdata
).
open_children
(
path
);
}
}
break
;
break
;
}
}
...
@@ -537,13 +530,12 @@ class Xtt {
...
@@ -537,13 +530,12 @@ class Xtt {
this
.
ctx
.
gdh
.
getRefObjectInfoAll
(
this
.
trace_scan
);
this
.
ctx
.
gdh
.
getRefObjectInfoAll
(
this
.
trace_scan
);
}
}
trace_scan
(
id
,
sts
)
{
trace_scan
()
{
this
.
scan_update
=
false
;
this
.
scan_update
=
false
;
let
self
=
this
;
this
.
ctx
.
a
.
forEach
(
function
(
e
)
{
this
.
ctx
.
a
.
forEach
(
function
(
e
)
{
let
item
=
e
.
userdata
;
let
item
=
e
.
userdata
;
if
(
item
instanceof
XttItemAttr
)
{
if
(
item
instanceof
XttItemAttr
)
{
item
.
scan
(
self
);
item
.
scan
();
}
}
});
});
if
(
this
.
scan_update
)
{
if
(
this
.
scan_update
)
{
...
@@ -567,6 +559,7 @@ class Xtt {
...
@@ -567,6 +559,7 @@ class Xtt {
}
}
class
XttItemObject
{
class
XttItemObject
{
xtt
:
Xtt
;
objid
:
PwrtObjid
;
objid
:
PwrtObjid
;
cid
:
number
;
cid
:
number
;
name
:
string
;
name
:
string
;
...
@@ -575,6 +568,7 @@ class XttItemObject {
...
@@ -575,6 +568,7 @@ class XttItemObject {
node
:
PlowNode
;
node
:
PlowNode
;
constructor
(
xtt
,
object_info
,
destination
,
destCode
)
{
constructor
(
xtt
,
object_info
,
destination
,
destCode
)
{
this
.
xtt
=
xtt
;
this
.
objid
=
object_info
.
objid
;
this
.
objid
=
object_info
.
objid
;
this
.
cid
=
object_info
.
cid
;
this
.
cid
=
object_info
.
cid
;
this
.
name
=
object_info
.
name
;
this
.
name
=
object_info
.
name
;
...
@@ -590,67 +584,65 @@ class XttItemObject {
...
@@ -590,67 +584,65 @@ class XttItemObject {
this
.
node
.
set_annotation_pixmap
(
0
,
object_info
.
has_children
?
Bitmaps
.
map
:
Bitmaps
.
leaf
);
this
.
node
.
set_annotation_pixmap
(
0
,
object_info
.
has_children
?
Bitmaps
.
map
:
Bitmaps
.
leaf
);
}
}
open_children
(
xtt
,
open_next
)
{
open_children
(
open_next
)
{
if
(
this
.
node
.
node_open
!==
0
)
{
if
(
this
.
node
.
node_open
!==
0
)
{
this
.
close
(
xtt
);
this
.
close
();
}
else
if
(
!
this
.
has_children
)
{
}
else
if
(
!
this
.
has_children
)
{
this
.
open_attributes
(
xtt
,
null
);
this
.
open_attributes
(
null
);
}
else
{
}
else
{
xtt
.
ctx
.
gdh
.
getAllXttChildren
(
this
.
objid
,
xtt
.
open_children_cb
,
this
.
xtt
.
ctx
.
gdh
.
getAllXttChildren
(
this
.
objid
).
then
(
this
.
xtt
.
open_children_cb
(
new
XttOpenChildrenData
(
this
.
node
,
open_next
)));
new
XttOpenChildrenData
(
this
.
node
,
open_next
));
this
.
node
.
node_open
|=
Open
.
CHILDREN
;
this
.
node
.
node_open
|=
Open
.
CHILDREN
;
this
.
node
.
set_annotation_pixmap
(
0
,
Bitmaps
.
openmap
);
this
.
node
.
set_annotation_pixmap
(
0
,
Bitmaps
.
openmap
);
}
}
}
}
open_attributes
(
xtt
,
open_next
)
{
open_attributes
(
open_next
)
{
if
(
this
.
node
.
node_open
===
0
)
{
if
(
this
.
node
.
node_open
===
0
)
{
xtt
.
ctx
.
gdh
.
getAllClassAttributes
(
this
.
cid
,
this
.
objid
,
this
.
xtt
.
ctx
.
gdh
.
getAllClassAttributes
(
this
.
cid
,
this
.
objid
).
then
(
this
.
xtt
.
open_attributes_cb
(
new
XttOpenChildrenData
(
this
.
node
,
open_next
)));
xtt
.
open_attributes_cb
,
new
XttOpenChildrenData
(
this
.
node
,
open_next
));
this
.
node
.
node_open
|=
Open
.
ATTRIBUTES
;
this
.
node
.
node_open
|=
Open
.
ATTRIBUTES
;
xtt
.
ctx
.
configure
();
this
.
xtt
.
ctx
.
configure
();
xtt
.
ctx
.
draw
();
this
.
xtt
.
ctx
.
draw
();
}
else
{
}
else
{
this
.
close
(
xtt
);
this
.
close
();
}
}
}
}
open_crossreferences
(
xtt
,
crrdata
)
{
open_crossreferences
(
crrdata
)
{
if
(
this
.
node
.
node_open
===
0
)
{
if
(
this
.
node
.
node_open
===
0
)
{
for
(
let
i
=
0
;
i
<
crrdata
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
crrdata
.
length
;
i
++
)
{
new
XttItemCrr
(
xtt
,
crrdata
[
i
],
this
.
node
,
Dest
.
INTOLAST
);
new
XttItemCrr
(
this
.
xtt
,
crrdata
[
i
],
this
.
node
,
Dest
.
INTOLAST
);
}
}
this
.
node
.
node_open
|=
Open
.
CROSSREFERENCES
;
this
.
node
.
node_open
|=
Open
.
CROSSREFERENCES
;
xtt
.
ctx
.
configure
();
this
.
xtt
.
ctx
.
configure
();
xtt
.
ctx
.
draw
();
this
.
xtt
.
ctx
.
draw
();
}
else
{
}
else
{
this
.
close
(
xtt
);
this
.
close
();
}
}
}
}
close
(
xtt
)
{
close
()
{
if
(
this
.
node
.
node_open
&
Open
.
CHILDREN
)
{
if
(
this
.
node
.
node_open
&
Open
.
CHILDREN
)
{
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
node
.
node_open
&=
~
Open
.
CHILDREN
;
this
.
node
.
node_open
&=
~
Open
.
CHILDREN
;
this
.
node
.
set_annotation_pixmap
(
0
,
Bitmaps
.
map
);
this
.
node
.
set_annotation_pixmap
(
0
,
Bitmaps
.
map
);
xtt
.
ctx
.
configure
();
this
.
xtt
.
ctx
.
configure
();
xtt
.
ctx
.
draw
();
this
.
xtt
.
ctx
.
draw
();
}
else
if
(
this
.
node
.
node_open
&
Open
.
ATTRIBUTES
)
{
}
else
if
(
this
.
node
.
node_open
&
Open
.
ATTRIBUTES
)
{
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
node
.
node_open
&=
~
Open
.
ATTRIBUTES
;
this
.
node
.
node_open
&=
~
Open
.
ATTRIBUTES
;
xtt
.
ctx
.
configure
();
this
.
xtt
.
ctx
.
configure
();
xtt
.
ctx
.
draw
();
this
.
xtt
.
ctx
.
draw
();
}
else
if
(
this
.
node
.
node_open
&
Open
.
CROSSREFERENCES
)
{
}
else
if
(
this
.
node
.
node_open
&
Open
.
CROSSREFERENCES
)
{
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
node
.
node_open
&=
~
Open
.
CROSSREFERENCES
;
this
.
node
.
node_open
&=
~
Open
.
CROSSREFERENCES
;
xtt
.
ctx
.
configure
();
this
.
xtt
.
ctx
.
configure
();
xtt
.
ctx
.
draw
();
this
.
xtt
.
ctx
.
draw
();
}
else
{
}
else
{
let
parent
=
xtt
.
ctx
.
get_parent_object
(
this
.
node
);
let
parent
=
this
.
xtt
.
ctx
.
get_parent_object
(
this
.
node
);
if
(
parent
!==
null
)
{
if
(
parent
!==
null
)
{
parent
.
userdata
.
close
(
xtt
);
parent
.
userdata
.
close
();
parent
.
set_select
(
true
);
parent
.
set_select
(
true
);
parent
.
set_invert
(
true
);
parent
.
set_invert
(
true
);
}
}
...
@@ -659,6 +651,7 @@ class XttItemObject {
...
@@ -659,6 +651,7 @@ class XttItemObject {
}
}
class
XttItemAttr
{
class
XttItemAttr
{
xtt
:
Xtt
;
name
:
string
;
name
:
string
;
objid
:
PwrtObjid
;
objid
:
PwrtObjid
;
full_name
:
string
;
full_name
:
string
;
...
@@ -671,6 +664,7 @@ class XttItemAttr {
...
@@ -671,6 +664,7 @@ class XttItemAttr {
node
:
PlowNode
;
node
:
PlowNode
;
constructor
(
xtt
,
info
,
destination
,
destCode
)
{
constructor
(
xtt
,
info
,
destination
,
destCode
)
{
this
.
xtt
=
xtt
;
this
.
name
=
info
.
name
;
this
.
name
=
info
.
name
;
this
.
objid
=
info
.
objid
;
this
.
objid
=
info
.
objid
;
this
.
full_name
=
info
.
full_name
;
this
.
full_name
=
info
.
full_name
;
...
@@ -687,15 +681,15 @@ class XttItemAttr {
...
@@ -687,15 +681,15 @@ class XttItemAttr {
this
.
refid
=
xtt
.
ctx
.
gdh
.
refObjectInfo
(
this
.
full_name
,
info
.
type
,
1
);
this
.
refid
=
xtt
.
ctx
.
gdh
.
refObjectInfo
(
this
.
full_name
,
info
.
type
,
1
);
}
}
open_children
(
xtt
,
open_next
)
{
open_children
(
open_next
)
{
xtt
.
openValueInputDialog
(
this
,
"
Enter value
"
);
this
.
xtt
.
openValueInputDialog
(
this
,
"
Enter value
"
);
}
}
set_value
(
xtt
,
value
)
{
set_value
(
value
)
{
switch
(
this
.
type
)
{
switch
(
this
.
type
)
{
case
Type
.
Float32
:
case
Type
.
Float32
:
let
inputValue
=
parseFloat
(
value
.
trim
());
let
inputValue
=
parseFloat
(
value
.
trim
());
xtt
.
ctx
.
gdh
.
setObjectInfoFloat
(
this
.
full_name
,
inputValue
);
this
.
xtt
.
ctx
.
gdh
.
setObjectInfoFloat
(
this
.
full_name
,
inputValue
);
break
;
break
;
case
Type
.
Int8
:
case
Type
.
Int8
:
case
Type
.
Int16
:
case
Type
.
Int16
:
...
@@ -708,37 +702,37 @@ class XttItemAttr {
...
@@ -708,37 +702,37 @@ class XttItemAttr {
case
Type
.
Enum
:
case
Type
.
Enum
:
case
Type
.
Boolean
:
case
Type
.
Boolean
:
let
inputValue
=
parseInt
(
value
.
trim
(),
10
);
let
inputValue
=
parseInt
(
value
.
trim
(),
10
);
xtt
.
ctx
.
gdh
.
setObjectInfoInt
(
this
.
full_name
,
inputValue
);
this
.
xtt
.
ctx
.
gdh
.
setObjectInfoInt
(
this
.
full_name
,
inputValue
);
break
;
break
;
case
Type
.
String
:
case
Type
.
String
:
case
Type
.
Time
:
case
Type
.
Time
:
case
Type
.
DeltaTime
:
case
Type
.
DeltaTime
:
case
Type
.
AttrRef
:
case
Type
.
AttrRef
:
case
Type
.
Objid
:
case
Type
.
Objid
:
xtt
.
ctx
.
gdh
.
setObjectInfoString
(
this
.
full_name
,
value
);
this
.
xtt
.
ctx
.
gdh
.
setObjectInfoString
(
this
.
full_name
,
value
);
break
;
break
;
default
:
default
:
break
;
break
;
}
}
}
}
open_attributes
(
xtt
,
open_next
)
{
open_attributes
(
open_next
)
{
}
}
close
(
xtt
)
{
close
()
{
let
parent
=
xtt
.
ctx
.
get_parent_object
(
this
.
node
);
let
parent
=
this
.
xtt
.
ctx
.
get_parent_object
(
this
.
node
);
if
(
parent
!==
null
)
{
if
(
parent
!==
null
)
{
parent
.
userdata
.
close
(
xtt
);
parent
.
userdata
.
close
();
parent
.
set_select
(
true
);
parent
.
set_select
(
true
);
parent
.
set_invert
(
true
);
parent
.
set_invert
(
true
);
}
}
}
}
scan
(
xtt
)
{
scan
()
{
if
(
!
this
.
refid
)
{
if
(
!
this
.
refid
)
{
return
;
return
;
}
}
let
value
=
xtt
.
ctx
.
gdh
.
getObjectRefInfo
(
this
.
refid
);
let
value
=
this
.
xtt
.
ctx
.
gdh
.
getObjectRefInfo
(
this
.
refid
);
if
(
this
.
firstScan
||
value
!==
this
.
old_value
)
{
if
(
this
.
firstScan
||
value
!==
this
.
old_value
)
{
let
value_str
;
let
value_str
;
...
@@ -768,17 +762,18 @@ class XttItemAttr {
...
@@ -768,17 +762,18 @@ class XttItemAttr {
this
.
old_value
=
value
;
this
.
old_value
=
value
;
this
.
node
.
set_annotation
(
1
,
value_str
);
this
.
node
.
set_annotation
(
1
,
value_str
);
xtt
.
scan_update
=
true
;
this
.
xtt
.
scan_update
=
true
;
}
}
this
.
firstScan
=
false
;
this
.
firstScan
=
false
;
}
}
scan_close
(
xtt
)
{
scan_close
()
{
xtt
.
ctx
.
gdh
.
unrefObjectInfo
(
this
.
refid
);
this
.
xtt
.
ctx
.
gdh
.
unrefObjectInfo
(
this
.
refid
);
}
}
}
}
class
XttItemAttrArray
{
class
XttItemAttrArray
{
xtt
:
Xtt
;
name
:
string
;
name
:
string
;
objid
:
PwrtObjid
;
objid
:
PwrtObjid
;
full_name
:
string
;
full_name
:
string
;
...
@@ -789,6 +784,7 @@ class XttItemAttrArray {
...
@@ -789,6 +784,7 @@ class XttItemAttrArray {
node
:
PlowNode
;
node
:
PlowNode
;
constructor
(
xtt
,
info
,
destination
,
destCode
)
{
constructor
(
xtt
,
info
,
destination
,
destCode
)
{
this
.
xtt
=
xtt
;
this
.
name
=
info
.
name
;
this
.
name
=
info
.
name
;
this
.
objid
=
info
.
objid
;
this
.
objid
=
info
.
objid
;
this
.
full_name
=
info
.
full_name
;
this
.
full_name
=
info
.
full_name
;
...
@@ -803,11 +799,11 @@ class XttItemAttrArray {
...
@@ -803,11 +799,11 @@ class XttItemAttrArray {
xtt
.
ctx
.
insertNode
(
this
.
node
,
destination
,
destCode
);
xtt
.
ctx
.
insertNode
(
this
.
node
,
destination
,
destCode
);
}
}
open_children
(
xtt
,
open_next
)
{
open_children
(
open_next
)
{
this
.
open_attributes
(
xtt
,
open_next
);
this
.
open_attributes
(
open_next
);
}
}
open_attributes
(
xtt
,
open_next
)
{
open_attributes
(
open_next
)
{
let
info
=
new
AttributeInfo
();
let
info
=
new
AttributeInfo
();
info
.
objid
=
this
.
objid
;
info
.
objid
=
this
.
objid
;
...
@@ -819,34 +815,34 @@ class XttItemAttrArray {
...
@@ -819,34 +815,34 @@ class XttItemAttrArray {
info
.
full_name
=
""
;
info
.
full_name
=
""
;
info
.
classname
=
""
;
info
.
classname
=
""
;
xtt
.
ctx
.
set_nodraw
();
this
.
xtt
.
ctx
.
set_nodraw
();
for
(
let
i
=
0
;
i
<
this
.
elements
;
i
++
)
{
for
(
let
i
=
0
;
i
<
this
.
elements
;
i
++
)
{
info
.
name
=
this
.
name
+
"
[
"
+
i
+
"
]
"
;
info
.
name
=
this
.
name
+
"
[
"
+
i
+
"
]
"
;
info
.
full_name
=
this
.
full_name
+
"
[
"
+
i
+
"
]
"
;
info
.
full_name
=
this
.
full_name
+
"
[
"
+
i
+
"
]
"
;
if
((
info
.
flags
&
Adef
.
Array
)
!==
0
)
{
if
((
info
.
flags
&
Adef
.
Array
)
!==
0
)
{
new
XttItemAttrArray
(
xtt
,
info
,
this
.
node
,
Dest
.
INTOLAST
);
new
XttItemAttrArray
(
this
.
xtt
,
info
,
this
.
node
,
Dest
.
INTOLAST
);
}
else
if
((
info
.
flags
&
Adef
.
Class
)
!==
0
)
{
}
else
if
((
info
.
flags
&
Adef
.
Class
)
!==
0
)
{
new
XttItemAttrObject
(
xtt
,
info
,
this
.
node
,
Dest
.
INTOLAST
);
new
XttItemAttrObject
(
this
.
xtt
,
info
,
this
.
node
,
Dest
.
INTOLAST
);
}
else
{
}
else
{
new
XttItemAttr
(
xtt
,
info
,
this
.
node
,
Dest
.
INTOLAST
);
new
XttItemAttr
(
this
.
xtt
,
info
,
this
.
node
,
Dest
.
INTOLAST
);
}
}
}
}
this
.
node
.
node_open
|=
Open
.
ATTRIBUTES
;
this
.
node
.
node_open
|=
Open
.
ATTRIBUTES
;
xtt
.
ctx
.
configure
();
this
.
xtt
.
ctx
.
configure
();
xtt
.
ctx
.
reset_nodraw
();
this
.
xtt
.
ctx
.
reset_nodraw
();
xtt
.
ctx
.
draw
();
this
.
xtt
.
ctx
.
draw
();
}
}
close
(
xtt
)
{
close
()
{
if
(
this
.
node
.
node_open
&
Open
.
ATTRIBUTES
)
{
if
(
this
.
node
.
node_open
&
Open
.
ATTRIBUTES
)
{
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
node
.
node_open
&=
~
Open
.
ATTRIBUTES
;
this
.
node
.
node_open
&=
~
Open
.
ATTRIBUTES
;
xtt
.
ctx
.
configure
();
this
.
xtt
.
ctx
.
configure
();
xtt
.
ctx
.
draw
();
this
.
xtt
.
ctx
.
draw
();
}
else
{
}
else
{
let
parent
=
xtt
.
ctx
.
get_parent_object
(
this
.
node
);
let
parent
=
this
.
xtt
.
ctx
.
get_parent_object
(
this
.
node
);
if
(
parent
!==
null
)
{
if
(
parent
!==
null
)
{
parent
.
userdata
.
close
(
xtt
);
parent
.
userdata
.
close
();
parent
.
set_select
(
true
);
parent
.
set_select
(
true
);
parent
.
set_invert
(
true
);
parent
.
set_invert
(
true
);
}
}
...
@@ -855,6 +851,7 @@ class XttItemAttrArray {
...
@@ -855,6 +851,7 @@ class XttItemAttrArray {
}
}
class
XttItemAttrObject
{
class
XttItemAttrObject
{
xtt
:
Xtt
;
name
:
string
;
name
:
string
;
classname
:
string
;
classname
:
string
;
objid
:
PwrtObjid
;
objid
:
PwrtObjid
;
...
@@ -865,6 +862,7 @@ class XttItemAttrObject {
...
@@ -865,6 +862,7 @@ class XttItemAttrObject {
node
:
PlowNode
;
node
:
PlowNode
;
constructor
(
xtt
,
info
,
destination
,
destCode
)
{
constructor
(
xtt
,
info
,
destination
,
destCode
)
{
this
.
xtt
=
Xtt
;
this
.
name
=
info
.
name
;
this
.
name
=
info
.
name
;
this
.
classname
=
info
.
classname
;
this
.
classname
=
info
.
classname
;
this
.
objid
=
info
.
objid
;
this
.
objid
=
info
.
objid
;
...
@@ -880,36 +878,35 @@ class XttItemAttrObject {
...
@@ -880,36 +878,35 @@ class XttItemAttrObject {
xtt
.
ctx
.
insertNode
(
this
.
node
,
destination
,
destCode
);
xtt
.
ctx
.
insertNode
(
this
.
node
,
destination
,
destCode
);
}
}
open_children
(
xtt
,
open_next
)
{
open_children
(
open_next
)
{
this
.
open_attributes
(
xtt
,
null
);
this
.
open_attributes
(
null
);
}
}
open_attributes
(
xtt
,
open_next
)
{
open_attributes
(
open_next
)
{
if
(
this
.
node
.
node_open
===
0
)
{
if
(
this
.
node
.
node_open
===
0
)
{
xtt
.
ctx
.
gdh
.
getAllClassAttributes
(
this
.
cid
,
this
.
objid
,
this
.
xtt
.
ctx
.
gdh
.
getAllClassAttributes
(
this
.
cid
,
this
.
objid
).
then
(
this
.
xtt
.
open_attributes_cb
(
new
XttOpenChildrenData
(
this
.
node
,
open_next
)));
xtt
.
open_attributes_cb
,
new
XttOpenChildrenData
(
this
.
node
,
open_next
));
this
.
node
.
node_open
|=
Open
.
ATTRIBUTES
;
this
.
node
.
node_open
|=
Open
.
ATTRIBUTES
;
}
else
{
}
else
{
this
.
close
(
xtt
);
this
.
close
();
}
}
}
}
close
(
xtt
)
{
close
()
{
if
(
this
.
node
.
node_open
&
Open
.
ATTRIBUTES
)
{
if
(
this
.
node
.
node_open
&
Open
.
ATTRIBUTES
)
{
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
node
.
node_open
&=
~
Open
.
ATTRIBUTES
;
this
.
node
.
node_open
&=
~
Open
.
ATTRIBUTES
;
xtt
.
ctx
.
configure
();
this
.
xtt
.
ctx
.
configure
();
xtt
.
ctx
.
draw
();
this
.
xtt
.
ctx
.
draw
();
}
else
if
(
this
.
node
.
node_open
&
Open
.
CROSSREFERENCES
)
{
}
else
if
(
this
.
node
.
node_open
&
Open
.
CROSSREFERENCES
)
{
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
xtt
.
ctx
.
close_node
(
this
.
node
);
this
.
node
.
node_open
&=
~
Open
.
CROSSREFERENCES
;
this
.
node
.
node_open
&=
~
Open
.
CROSSREFERENCES
;
xtt
.
ctx
.
configure
();
this
.
xtt
.
ctx
.
configure
();
xtt
.
ctx
.
draw
();
this
.
xtt
.
ctx
.
draw
();
}
else
{
}
else
{
let
parent
=
xtt
.
ctx
.
get_parent_object
(
this
.
node
);
let
parent
=
this
.
xtt
.
ctx
.
get_parent_object
(
this
.
node
);
if
(
parent
!==
null
)
{
if
(
parent
!==
null
)
{
parent
.
userdata
.
close
(
xtt
);
parent
.
userdata
.
close
();
parent
.
set_select
(
true
);
parent
.
set_select
(
true
);
parent
.
set_invert
(
true
);
parent
.
set_invert
(
true
);
}
}
...
@@ -918,6 +915,7 @@ class XttItemAttrObject {
...
@@ -918,6 +915,7 @@ class XttItemAttrObject {
}
}
class
XttItemCrr
{
class
XttItemCrr
{
xtt
:
Xtt
;
name
:
string
;
name
:
string
;
classname
:
string
;
classname
:
string
;
objid
:
PwrtObjid
;
objid
:
PwrtObjid
;
...
@@ -925,6 +923,7 @@ class XttItemCrr {
...
@@ -925,6 +923,7 @@ class XttItemCrr {
node
:
PlowNode
;
node
:
PlowNode
;
constructor
(
xtt
,
info
,
destination
,
destCode
)
{
constructor
(
xtt
,
info
,
destination
,
destCode
)
{
this
.
xtt
=
Xtt
;
this
.
name
=
info
.
name
;
this
.
name
=
info
.
name
;
this
.
classname
=
info
.
classname
;
this
.
classname
=
info
.
classname
;
this
.
objid
=
info
.
objid
;
this
.
objid
=
info
.
objid
;
...
@@ -939,10 +938,10 @@ class XttItemCrr {
...
@@ -939,10 +938,10 @@ class XttItemCrr {
xtt
.
ctx
.
insertNode
(
this
.
node
,
destination
,
destCode
);
xtt
.
ctx
.
insertNode
(
this
.
node
,
destination
,
destCode
);
}
}
close
(
xtt
)
{
close
()
{
let
parent
=
xtt
.
ctx
.
get_parent_object
(
this
.
node
);
let
parent
=
this
.
xtt
.
ctx
.
get_parent_object
(
this
.
node
);
if
(
parent
)
{
if
(
parent
)
{
parent
.
userdata
.
close
(
xtt
);
parent
.
userdata
.
close
();
parent
.
set_select
(
true
);
parent
.
set_select
(
true
);
parent
.
set_invert
(
true
);
parent
.
set_invert
(
true
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment