Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
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
Martin Manchev
osie
Commits
88339454
Commit
88339454
authored
Jul 31, 2023
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert to proper Python type based on node_id.
parent
a745cfa2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
bt5/erp5_opcua/SkinTemplateItem/portal_skins/erp5_opcua/ERP5Site_handleOPCUARequest.py
...em/portal_skins/erp5_opcua/ERP5Site_handleOPCUARequest.py
+16
-1
bt5/erp5_opcua/SkinTemplateItem/portal_skins/erp5_opcua/OPCUADocument_view/my_node_dict.xml
...rtal_skins/erp5_opcua/OPCUADocument_view/my_node_dict.xml
+5
-0
No files found.
bt5/erp5_opcua/SkinTemplateItem/portal_skins/erp5_opcua/ERP5Site_handleOPCUARequest.py
View file @
88339454
...
...
@@ -6,6 +6,21 @@ from erp5.component.module.Log import log
# XXX: get rid of Proxy roles on this script when proper authentication is used!!!
def
convertNodeValue
(
node_id
,
node_value
):
"""
Based on node_id convert to proper Python type. Based on this format:
ns=<namespaceindex>;<type>=<value>
XXX: handle rest of datatypes!
"""
node_type
=
node_id
.
split
(
";"
)[
1
]
if
node_type
.
startswith
(
"s"
):
node_value
=
str
(
node_value
)
if
node_type
.
startswith
(
"i"
):
node_value
=
int
(
node_value
)
return
node_value
# XXX: what should be the OPCUA container?
default_opcua_document
=
context
.
opcua_document_module
[
"1"
]
...
...
@@ -24,6 +39,6 @@ else:
# set to "ERP5 OPCUA Document"
node_dict
=
default_opcua_document
.
getNodeDict
()
log
(
"Original = %s"
%
node_dict
)
node_dict
[
node_id
]
=
node_value
node_dict
[
node_id
]
=
convertNodeValue
(
node_id
,
node_value
)
default_opcua_document
.
setNodeDict
(
node_dict
)
log
(
"Changed = %s"
%
default_opcua_document
.
getNodeDict
())
bt5/erp5_opcua/SkinTemplateItem/portal_skins/erp5_opcua/OPCUADocument_view/my_node_dict.xml
View file @
88339454
...
...
@@ -11,6 +11,7 @@
<value>
<list>
<string>
editable
</string>
<string>
title
</string>
</list>
</value>
</item>
...
...
@@ -75,6 +76,10 @@
<key>
<string>
form_id
</string>
</key>
<value>
<string>
Base_viewFieldLibrary
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Node Dictionary
</string>
</value>
</item>
</dictionary>
</value>
</item>
...
...
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