File: __init__.py

package info (click to toggle)
raritan-json-rpc-sdk 4.0.20%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 57,236 kB
  • sloc: cs: 223,121; perl: 117,786; python: 26,872; javascript: 6,544; makefile: 27
file content (208 lines) | stat: -rw-r--r-- 7,025 bytes parent folder | download
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
# SPDX-License-Identifier: BSD-3-Clause
#
# Copyright 2022 Raritan Inc. All rights reserved.
#
# This is an auto-generated file.

#
# Section generated by IdlC from "DisplayControl.idl"
#

import raritan.rpc
from raritan.rpc import Interface, Structure, ValueObject, Enumeration, typecheck, DecodeException
import raritan.rpc.display

import raritan.rpc.event


# interface
class DisplayControl(Interface):
    idlType = "display.DisplayControl:1.0.1"

    SUCCESS = 0

    ERR_INVALID_VALUE = 1

    # structure
    class Info(Structure):
        idlType = "display.DisplayControl_1_0_1.Info:1.0.0"
        elements = ["fwAppVersion", "fwBootVersion", "orientation", "width", "height", "versionAvailable"]

        def __init__(self, fwAppVersion, fwBootVersion, orientation, width, height, versionAvailable):
            typecheck.is_int(fwAppVersion, AssertionError)
            typecheck.is_int(fwBootVersion, AssertionError)
            typecheck.is_int(orientation, AssertionError)
            typecheck.is_int(width, AssertionError)
            typecheck.is_int(height, AssertionError)
            typecheck.is_bool(versionAvailable, AssertionError)

            self.fwAppVersion = fwAppVersion
            self.fwBootVersion = fwBootVersion
            self.orientation = orientation
            self.width = width
            self.height = height
            self.versionAvailable = versionAvailable

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                fwAppVersion = json['fwAppVersion'],
                fwBootVersion = json['fwBootVersion'],
                orientation = json['orientation'],
                width = json['width'],
                height = json['height'],
                versionAvailable = json['versionAvailable'],
            )
            return obj

        def encode(self):
            json = {}
            json['fwAppVersion'] = self.fwAppVersion
            json['fwBootVersion'] = self.fwBootVersion
            json['orientation'] = self.orientation
            json['width'] = self.width
            json['height'] = self.height
            json['versionAvailable'] = self.versionAvailable
            return json

    # structure
    class DefaultViewItem(Structure):
        idlType = "display.DisplayControl_1_0_1.DefaultViewItem:1.0.0"
        elements = ["id", "description"]

        def __init__(self, id, description):
            typecheck.is_string(id, AssertionError)
            typecheck.is_string(description, AssertionError)

            self.id = id
            self.description = description

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                id = json['id'],
                description = json['description'],
            )
            return obj

        def encode(self):
            json = {}
            json['id'] = self.id
            json['description'] = self.description
            return json

    # value object
    class DefaultViewChangedEvent(raritan.rpc.event.UserEvent):
        idlType = "display.DisplayControl_1_0_1.DefaultViewChangedEvent:1.0.0"

        def __init__(self, newView, actUserName, actIpAddr, source):
            super(raritan.rpc.display.DisplayControl.DefaultViewChangedEvent, self).__init__(actUserName, actIpAddr, source)
            typecheck.is_struct(newView, raritan.rpc.display.DisplayControl.DefaultViewItem, AssertionError)

            self.newView = newView

        def encode(self):
            json = super(raritan.rpc.display.DisplayControl.DefaultViewChangedEvent, self).encode()
            json['newView'] = raritan.rpc.display.DisplayControl.DefaultViewItem.encode(self.newView)
            return json

        @classmethod
        def decode(cls, json, agent):
            obj = cls(
                newView = raritan.rpc.display.DisplayControl.DefaultViewItem.decode(json['newView'], agent),
                # for event.UserEvent
                actUserName = json['actUserName'],
                actIpAddr = json['actIpAddr'],
                # for idl.Event
                source = Interface.decode(json['source'], agent),
            )
            return obj

        def listElements(self):
            elements = ["newView"]
            elements = elements + super(raritan.rpc.display.DisplayControl.DefaultViewChangedEvent, self).listElements()
            return elements

    class _getAvailableDefaultViews(Interface.Method):
        name = 'getAvailableDefaultViews'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = [raritan.rpc.display.DisplayControl.DefaultViewItem.decode(x0, agent) for x0 in rsp['_ret_']]
            for x0 in _ret_:
                typecheck.is_struct(x0, raritan.rpc.display.DisplayControl.DefaultViewItem, DecodeException)
            return _ret_

    class _getDefaultView(Interface.Method):
        name = 'getDefaultView'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_string(_ret_, DecodeException)
            return _ret_

    class _setDefaultView(Interface.Method):
        name = 'setDefaultView'

        @staticmethod
        def encode(id):
            typecheck.is_string(id, AssertionError)
            args = {}
            args['id'] = id
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = rsp['_ret_']
            typecheck.is_int(_ret_, DecodeException)
            return _ret_

    class _getInfo(Interface.Method):
        name = 'getInfo'

        @staticmethod
        def encode():
            args = {}
            return args

        @staticmethod
        def decode(rsp, agent):
            _ret_ = raritan.rpc.display.DisplayControl.Info.decode(rsp['_ret_'], agent)
            typecheck.is_struct(_ret_, raritan.rpc.display.DisplayControl.Info, DecodeException)
            return _ret_

    class _showSmiley(Interface.Method):
        name = 'showSmiley'

        @staticmethod
        def encode(on, happy, msg):
            typecheck.is_bool(on, AssertionError)
            typecheck.is_bool(happy, AssertionError)
            typecheck.is_string(msg, AssertionError)
            args = {}
            args['on'] = on
            args['happy'] = happy
            args['msg'] = msg
            return args

        @staticmethod
        def decode(rsp, agent):
            return None
    def __init__(self, target, agent):
        super(DisplayControl, self).__init__(target, agent)
        self.getAvailableDefaultViews = DisplayControl._getAvailableDefaultViews(self)
        self.getDefaultView = DisplayControl._getDefaultView(self)
        self.setDefaultView = DisplayControl._setDefaultView(self)
        self.getInfo = DisplayControl._getInfo(self)
        self.showSmiley = DisplayControl._showSmiley(self)