File: api_util.py

package info (click to toggle)
pytango 10.0.2-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 10,216 kB
  • sloc: python: 28,206; cpp: 16,380; sql: 255; sh: 82; makefile: 43
file content (179 lines) | stat: -rw-r--r-- 4,885 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# SPDX-FileCopyrightText: All Contributors to the PyTango project
# SPDX-License-Identifier: LGPL-3.0-or-later

"""
This is an internal PyTango module.
"""

__all__ = ("api_util_init",)

__docformat__ = "restructuredtext"

from tango._tango import ApiUtil

from tango.utils import document_method, document_static_method


def __doc_api_util():
    ApiUtil.__doc__ = """
    This class allows you to access the tango syncronization model API.
    It is designed as a singleton. To get a reference to the singleton object
    you must do::

        import tango
        apiutil = tango.ApiUtil.instance()

    New in PyTango 7.1.3
    """

    document_static_method(
        ApiUtil,
        "instance",
        """
    instance() -> ApiUtil

            Returns the ApiUtil singleton instance.

        Parameters : None
        Return     : (ApiUtil) a reference to the ApiUtil singleton object.

        New in PyTango 7.1.3
    """,
    )

    document_method(
        ApiUtil,
        "pending_asynch_call",
        """
    pending_asynch_call(self, req) -> int

            Return number of asynchronous pending requests (any device).
            The input parameter is an enumeration with three values which are:

                - POLLING: Return only polling model asynchronous request number
                - CALL_BACK: Return only callback model asynchronous request number
                - ALL_ASYNCH: Return all asynchronous request number

        Parameters :
            - req : (asyn_req_type) asynchronous request type

        Return     : (int) the number of pending requests for the given type

        New in PyTango 7.1.3
    """,
    )

    document_method(
        ApiUtil,
        "get_asynch_replies",
        """
    get_asynch_replies(self) -> None

            Fire callback methods for all (any device) asynchronous requests
            (command and attribute) with already arrived replied. Returns
            immediately if there is no replies already arrived or if there is
            no asynchronous requests.

        Parameters : None
        Return     : None

        Throws     : None, all errors are reported using the err and errors fields
                     of the parameter passed to the callback method.

        New in PyTango 7.1.3

    get_asynch_replies(self) -> None

            Fire callback methods for all (any device) asynchronous requests
            (command and attributes) with already arrived replied. Wait and
            block the caller for timeout milliseconds if they are some
            device asynchronous requests which are not yet arrived.
            Returns immediately if there is no asynchronous request.
            If timeout is set to 0, the call waits until all the asynchronous
            requests sent has received a reply.

        Parameters :
            - timeout : (int) timeout (milliseconds)
        Return     : None

        Throws     : AsynReplyNotArrived. All other errors are reported using
                     the err and errors fields of the object passed to the
                     callback methods.

        New in PyTango 7.1.3
    """,
    )

    document_method(
        ApiUtil,
        "set_asynch_cb_sub_model",
        """
    set_asynch_cb_sub_model(self, model) -> None

            Set the asynchronous callback sub-model between the pull and push sub-model.
            The cb_sub_model data type is an enumeration with two values which are:

                - PUSH_CALLBACK: The push sub-model
                - PULL_CALLBACK: The pull sub-model

        Parameters :
            - model : (cb_sub_model) the callback sub-model
        Return     : None

        New in PyTango 7.1.3
    """,
    )

    document_method(
        ApiUtil,
        "get_asynch_cb_sub_model",
        """
    get_asynch_cb_sub_model(self) -> cb_sub_model

            Get the asynchronous callback sub-model.

        Parameters : None
        Return     : (cb_sub_model) the active asynchronous callback sub-model.

        New in PyTango 7.1.3
    """,
    )

    document_static_method(
        ApiUtil,
        "cleanup",
        """
    cleanup() -> None

            Destroy the ApiUtil singleton instance.
            After `cleanup()` all references to
            `DeviceProxy`, `AttributeProxy` or `Database` objects
            in the current process become invalid
            and these objects need to be reconstructed.

        Parameters : None
        Return     : None

        New in PyTango 9.3.0
    """,
    )

    document_static_method(
        ApiUtil,
        "in_server",
        """
    in_server() -> bool

            Returns True if current process is a running Tango device server.

        :returns: running in server
        :rtype: bool

        .. versionadded:: 10.0.0
    """,
    )


def api_util_init(doc=True):
    if doc:
        __doc_api_util()