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
nexedi
osie
Commits
5746b716
Commit
5746b716
authored
Jan 11, 2024
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Plain Diff
Fix double
See merge request
nexedi/osie!37
parents
b908384a
f269aa86
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
opcua-to-http-gw/opcua-server-config.xml
opcua-to-http-gw/opcua-server-config.xml
+2
-3
opcua-to-http-gw/opcua-to-http-gw.py
opcua-to-http-gw/opcua-to-http-gw.py
+14
-4
No files found.
opcua-to-http-gw/opcua-server-config.xml
View file @
5746b716
...
...
@@ -41,13 +41,12 @@
</UAVariable>
<!-- Double (float) example -->
<!-- <UAVariable NodeId="ns=1;i=5" BrowseName="1:erp5-variable-double" ParentNodeId="i=85" DataType="Doub
e" AccessLevel="3" UserAccessLevel="3">
<UAVariable
NodeId=
"ns=1;i=5"
BrowseName=
"1:erp5-variable-double"
ParentNodeId=
"i=85"
DataType=
"Doubl
e"
AccessLevel=
"3"
UserAccessLevel=
"3"
>
<DisplayName>
erp5-variable-double
</DisplayName>
<Description>
erp5-variable-double
</Description>
<References>
<Reference
ReferenceType=
"HasComponent"
IsForward=
"false"
>
ns=1;i=9
</Reference>
<Reference
ReferenceType=
"HasTypeDefinition"
>
i=63
</Reference>
</References>
</UAVariable>-->
</UAVariable>
</UANodeSet>
opcua-to-http-gw/opcua-to-http-gw.py
View file @
5746b716
...
...
@@ -47,9 +47,19 @@ class ERP5Handler(asyncua.common.subscription.SubHandler):
if
self
.
url
is
not
None
:
return
f"%s/%s"
%
(
self
.
url
,
ERP5_REQUEST_API
)
def
call
(
self
,
http_method
=
"POST"
,
**
data
):
params
=
urllib
.
parse
.
quote_plus
(
json
.
dumps
({
k
:
str
(
v
)
for
k
,
v
in
data
.
items
()}))
def
call
(
self
,
http_method
=
"POST"
,
**
data
):
serialized_data
=
{}
for
k
,
v
in
data
.
items
():
if
not
isinstance
(
v
,
(
int
,
float
,
str
)):
v
=
str
(
v
)
serialized_data
[
k
]
=
v
print
(
f"Key:
{
k
}\
n
Value:
{
v
}\
n
Value Type:
{
type
(
v
)
}\
n
\
n
"
)
params
=
urllib
.
parse
.
quote_plus
(
json
.
dumps
(
serialized_data
))
self
.
session
.
auth
=
(
erp5_username
,
erp5_password
)
if
http_method
==
"POST"
:
self
.
session
.
post
(
f"
{
self
.
uri
}
?data=
{
params
}
"
)
elif
http_method
==
"GET"
:
...
...
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