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
Nikola Balog
osie
Commits
6c4687ed
Commit
6c4687ed
authored
Jun 12, 2024
by
Philipp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit for data streams for OPCUA
parent
65c0397a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
164 additions
and
0 deletions
+164
-0
.gitignore
.gitignore
+1
-0
bt5/erp5_opcua_frauenhofer/SkinTemplateItem/portal_skins/erp5_opcua_frauenhofer.xml
.../SkinTemplateItem/portal_skins/erp5_opcua_frauenhofer.xml
+26
-0
bt5/erp5_opcua_frauenhofer/SkinTemplateItem/portal_skins/erp5_opcua_frauenhofer/ERP5Site_handleOPCUARequest_data_stream.py
...ua_frauenhofer/ERP5Site_handleOPCUARequest_data_stream.py
+71
-0
bt5/erp5_opcua_frauenhofer/SkinTemplateItem/portal_skins/erp5_opcua_frauenhofer/ERP5Site_handleOPCUARequest_data_stream.xml
...a_frauenhofer/ERP5Site_handleOPCUARequest_data_stream.xml
+62
-0
bt5/erp5_opcua_frauenhofer/bt/dependency_list
bt5/erp5_opcua_frauenhofer/bt/dependency_list
+1
-0
bt5/erp5_opcua_frauenhofer/bt/template_format_version
bt5/erp5_opcua_frauenhofer/bt/template_format_version
+1
-0
bt5/erp5_opcua_frauenhofer/bt/template_skin_id_list
bt5/erp5_opcua_frauenhofer/bt/template_skin_id_list
+1
-0
bt5/erp5_opcua_frauenhofer/bt/title
bt5/erp5_opcua_frauenhofer/bt/title
+1
-0
No files found.
.gitignore
View file @
6c4687ed
...
...
@@ -9,5 +9,6 @@
*.log
# ignore specific files
bt5/bt5list
coupler/opc-ua-server/open62541.c
coupler/opc-ua-server/open62541.h
bt5/erp5_opcua_frauenhofer/SkinTemplateItem/portal_skins/erp5_opcua_frauenhofer.xml
0 → 100644
View file @
6c4687ed
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Folder"
module=
"OFS.Folder"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
erp5_opcua_frauenhofer
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_opcua_frauenhofer/SkinTemplateItem/portal_skins/erp5_opcua_frauenhofer/ERP5Site_handleOPCUARequest_data_stream.py
0 → 100644
View file @
6c4687ed
"""
OPCUA to ERP5 OPCUA Document setter / getter glue script.
"""
import
json
from
erp5.component.module.Log
import
log
def
convertNodeValue
(
node_id
,
node_value
,
type_data
):
"""
Based on type_data convert to proper Python type.
For differentiating different integer types
https://docs.pycomm3.dev/en/latest/api_reference/data_types.html
"""
if
"STRING"
in
type_data
:
# string
return
str
(
node_value
)
elif
"REAL:"
in
type_data
:
return
float
(
node_value
)
elif
"INT"
in
type_data
:
return
int
(
node_value
)
elif
"UINT"
in
type_data
:
return
int
(
node_value
)
elif
"UDINT"
in
type_data
:
return
int
(
node_value
)
elif
"BOOL"
in
type_data
:
return
bool
(
node_value
)
else
:
raise
ValueError
(
"Unsupported data type %s"
%
node_value
)
# XXX: what should be the OPCUA container?
default_id
=
"data_stream_1"
default_data_stream
=
context
.
portal_catalog
.
data_stream_module
.
get
(
default_id
,
None
)
if
default_data_stream
is
None
:
# Create a new Data Stream if it doesn't exist
default_data_stream
=
context
.
portal_catalog
.
data_stream_module
.
newContent
(
title
=
"Data Stream 1"
,
portal_type
=
"Data Stream"
,
id
=
default_id
)
# do selection of operation in a REST fashion based in HTTP method
if
http_method
is
None
:
http_method
=
context
.
REQUEST
.
method
if
http_method
==
"GET"
:
# not yet implemented
# assume read request, return what was saved.
return
json
.
dumps
(
default_data_stream
.
getData
())
elif
http_method
==
"POST"
:
# assume write request
if
data
is
None
:
try
:
data
=
context
.
REQUEST
.
data
except
AttributeError
as
e
:
log
(
"Warning: 'data' is missing from request."
)
raise
e
raw_data
=
data
data
=
json
.
loads
(
data
)
if
'node'
in
data
.
keys
():
# log only set requests for now
node_id
=
data
[
'node'
]
node_value
=
data
[
'val'
]
# introspect type of the value
type_data
=
data
[
"data"
]
# set to "ERP5 OPCUA Document" but only if it's not a None value
if
node_value
is
not
None
and
node_value
!=
"None"
:
converted_value
=
convertNodeValue
(
node_id
,
node_value
,
type_data
)
default_data_stream
.
appendData
(
raw_data
)
log
(
"Data appended to Data Stream: %s"
%
raw_data
)
return
default_data_stream
bt5/erp5_opcua_frauenhofer/SkinTemplateItem/portal_skins/erp5_opcua_frauenhofer/ERP5Site_handleOPCUARequest_data_stream.xml
0 → 100644
View file @
6c4687ed
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</tuple>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
http_method=None, default_data_stream=None, data=None, *args, **kwargs
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_handleOPCUARequest_data_stream
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_opcua_frauenhofer/bt/dependency_list
0 → 100644
View file @
6c4687ed
erp5_mes_configurator
\ No newline at end of file
bt5/erp5_opcua_frauenhofer/bt/template_format_version
0 → 100644
View file @
6c4687ed
1
\ No newline at end of file
bt5/erp5_opcua_frauenhofer/bt/template_skin_id_list
0 → 100644
View file @
6c4687ed
erp5_opcua_frauenhofer
\ No newline at end of file
bt5/erp5_opcua_frauenhofer/bt/title
0 → 100644
View file @
6c4687ed
erp5_opcua_frauenhofer
\ No newline at end of file
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