Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
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
1
Merge Requests
1
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
opcua-asyncio
Commits
066c61eb
Commit
066c61eb
authored
Sep 13, 2023
by
Yuta Okamoto
Committed by
oroulet
Sep 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add type hints to Subscription
parent
39e07108
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
174 additions
and
45 deletions
+174
-45
asyncua/client/client.py
asyncua/client/client.py
+2
-2
asyncua/common/subscription.py
asyncua/common/subscription.py
+164
-38
asyncua/server/history.py
asyncua/server/history.py
+7
-4
asyncua/server/internal_session.py
asyncua/server/internal_session.py
+1
-1
No files found.
asyncua/client/client.py
View file @
066c61eb
...
...
@@ -14,7 +14,7 @@ from ..common.xmlimporter import XmlImporter
from
..common.xmlexporter
import
XmlExporter
from
..common.node
import
Node
from
..common.manage_nodes
import
delete_nodes
from
..common.subscription
import
Sub
Handler
,
Subscription
from
..common.subscription
import
Sub
scription
,
SubscriptionHandler
from
..common.shortcuts
import
Shortcuts
from
..common.structures
import
load_type_definitions
,
load_enums
from
..common.structures104
import
load_data_type_definitions
...
...
@@ -719,7 +719,7 @@ class Client:
return
Node
(
self
.
uaclient
,
nodeid
)
async
def
create_subscription
(
self
,
period
:
Union
[
ua
.
CreateSubscriptionParameters
,
float
],
handler
:
SubHandler
,
publishing
:
bool
=
True
self
,
period
:
Union
[
ua
.
CreateSubscriptionParameters
,
float
],
handler
:
Sub
scription
Handler
,
publishing
:
bool
=
True
)
->
Subscription
:
"""
Create a subscription.
...
...
asyncua/common/subscription.py
View file @
066c61eb
This diff is collapsed.
Click to expand it.
asyncua/server/history.py
View file @
066c61eb
from
__future__
import
annotations
import
asyncio
import
logging
from
datetime
import
timedelta
from
datetime
import
datetime
from
asyncua
import
ua
from
..common.subscription
import
Subscription
,
SubHandler
from
asyncua.common
import
subscription
from
asyncua.common.subscription
import
Subscription
,
SubscriptionHandler
from
..common.utils
import
Buffer
...
...
@@ -213,8 +216,8 @@ class HistoryDict(HistoryStorageInterface):
pass
class
SubHandler
(
SubHandler
):
# type: ignore
def
__init__
(
self
,
storage
):
class
SubHandler
(
subscription
.
SubHandler
):
def
__init__
(
self
,
storage
:
HistoryStorageInterface
):
self
.
storage
=
storage
def
datachange_notification
(
self
,
node
,
val
,
data
):
...
...
@@ -240,7 +243,7 @@ class HistoryManager:
"""
self
.
storage
=
storage
async
def
_create_subscription
(
self
,
handler
):
async
def
_create_subscription
(
self
,
handler
:
SubscriptionHandler
):
params
=
ua
.
CreateSubscriptionParameters
()
params
.
RequestedPublishingInterval
=
10
params
.
RequestedLifetimeCount
=
3000
...
...
asyncua/server/internal_session.py
View file @
066c61eb
...
...
@@ -59,7 +59,7 @@ class InternalSession(AbstractSession):
def
is_activated
(
self
)
->
bool
:
return
self
.
state
==
SessionState
.
Activated
async
def
create_session
(
self
,
params
:
ua
.
CreateSessionParameters
,
sockname
:
Optional
[
Tuple
[
str
,
int
]]
=
None
):
async
def
create_session
(
self
,
params
:
ua
.
CreateSessionParameters
,
sockname
:
Optional
[
Tuple
[
str
,
int
]]
=
None
):
self
.
logger
.
info
(
'Create session request'
)
result
=
ua
.
CreateSessionResult
()
result
.
SessionId
=
self
.
session_id
...
...
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