Commit 2916ee5a authored by Ivan Tyagov's avatar Ivan Tyagov

WIP.

parent 041b0055
...@@ -4,6 +4,15 @@ Simple script for OPCUA POC ...@@ -4,6 +4,15 @@ Simple script for OPCUA POC
import json import json
from erp5.component.module.Log import log from erp5.component.module.Log import log
def getPropertyId(node_id):
# XXX: based on node_id guess property type, too! -i -> integer , s- string, etc,,
return node_id.replace(";", "")
# XXX: get rid of Proxy roles on this script when proper authentication is used!!!
# XXX: what should be the OPCUA container?
default_opcua_document = context.opcua_document_module["1"]
try: try:
data = context.REQUEST.data data = context.REQUEST.data
except AttributeError: except AttributeError:
...@@ -14,5 +23,6 @@ else: ...@@ -14,5 +23,6 @@ else:
# log only set requests for now # log only set requests for now
node_id = data['node'] node_id = data['node']
node_value = data['val'] node_value = data['val']
log("Set '%s' = '%s'" %(node_id, node_value)) log("Set '%s' = '%s' to %s as %s" %(node_id, node_value, default_opcua_document, getPropertyId(node_id)))
log(data)
# XXX: set to "ERP5 OPCUA Document" property # XXX: set to "ERP5 OPCUA Document" property
...@@ -52,6 +52,14 @@ ...@@ -52,6 +52,14 @@
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>*args, **kwargs</string> </value> <value> <string>*args, **kwargs</string> </value>
</item> </item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ERP5Site_handleOPCUARequest</string> </value> <value> <string>ERP5Site_handleOPCUARequest</string> </value>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment