sdbus-modemmanager 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of sdbus-modemmanager might be problematic. Click here for more details.
- sdbus_async/modemmanager/__init__.py +49 -0
- sdbus_async/modemmanager/enums.py +247 -0
- sdbus_async/modemmanager/interfaces_bearer.py +125 -0
- sdbus_async/modemmanager/interfaces_call.py +95 -0
- sdbus_async/modemmanager/interfaces_modem.py +552 -0
- sdbus_async/modemmanager/interfaces_root.py +39 -0
- sdbus_async/modemmanager/interfaces_sim.py +130 -0
- sdbus_async/modemmanager/interfaces_sms.py +97 -0
- sdbus_async/modemmanager/objects.py +204 -0
- sdbus_async/modemmanager/py.typed +0 -0
- sdbus_block/modemmanager/__init__.py +49 -0
- sdbus_block/modemmanager/enums.py +247 -0
- sdbus_block/modemmanager/interfaces_bearer.py +93 -0
- sdbus_block/modemmanager/interfaces_call.py +88 -0
- sdbus_block/modemmanager/interfaces_modem.py +418 -0
- sdbus_block/modemmanager/interfaces_root.py +39 -0
- sdbus_block/modemmanager/interfaces_sim.py +130 -0
- sdbus_block/modemmanager/interfaces_sms.py +97 -0
- sdbus_block/modemmanager/objects.py +193 -0
- sdbus_block/modemmanager/py.typed +0 -0
- sdbus_modemmanager-1.0.2.dist-info/COPYING.LESSER +502 -0
- sdbus_modemmanager-1.0.2.dist-info/METADATA +48 -0
- sdbus_modemmanager-1.0.2.dist-info/RECORD +25 -0
- sdbus_modemmanager-1.0.2.dist-info/WHEEL +5 -0
- sdbus_modemmanager-1.0.2.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
from typing import Dict, List, Optional
|
|
2
|
+
|
|
3
|
+
from sdbus.sd_bus_internals import SdBus
|
|
4
|
+
|
|
5
|
+
from .enums import MMCallDirection, MMCallState, MMCallStateReason
|
|
6
|
+
from .interfaces_bearer import MMBearerInterface
|
|
7
|
+
from .interfaces_call import MMCallInterface
|
|
8
|
+
from .interfaces_modem import MMModemInterface, MMModemMessagingInterface, MMModemSimpleInterface, MMModemSignalInterface, MMModemsInterface, MMModemVoiceInterface
|
|
9
|
+
from .interfaces_root import MMInterface
|
|
10
|
+
from .interfaces_sim import MMSimInterface
|
|
11
|
+
from .interfaces_sms import MMSmsInterface
|
|
12
|
+
|
|
13
|
+
MODEM_MANAGER_SERVICE_NAME = 'org.freedesktop.ModemManager1'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class MM(MMInterface):
|
|
17
|
+
"""Modem Manger main object
|
|
18
|
+
|
|
19
|
+
Implements :py:class:`ModemManagerInterface`
|
|
20
|
+
|
|
21
|
+
Service name ``'org.freedesktop.ModemManager1'``
|
|
22
|
+
and object path ``/org/freedesktop/ModemManager1`` is predetermined.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __init__(self, bus: Optional[SdBus] = None) -> None:
|
|
26
|
+
"""
|
|
27
|
+
:param bus: You probably want to set default bus to system bus \
|
|
28
|
+
or pass system bus directly.
|
|
29
|
+
"""
|
|
30
|
+
super().__init__(MODEM_MANAGER_SERVICE_NAME, '/org/freedesktop/ModemManager1', bus)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class MMSms(MMSmsInterface):
|
|
34
|
+
|
|
35
|
+
def __init__(
|
|
36
|
+
self,
|
|
37
|
+
object_path: str,
|
|
38
|
+
bus: Optional[SdBus] = None,
|
|
39
|
+
) -> None:
|
|
40
|
+
"""
|
|
41
|
+
:param bus: You probably want to set default bus to system bus \
|
|
42
|
+
or pass system bus directly.
|
|
43
|
+
"""
|
|
44
|
+
super().__init__(MODEM_MANAGER_SERVICE_NAME, object_path, bus)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class MMModemMessaging(MMModemMessagingInterface):
|
|
48
|
+
|
|
49
|
+
def __init__(self, object_path: str, bus: Optional[SdBus] = None) -> None:
|
|
50
|
+
super().__init__(MODEM_MANAGER_SERVICE_NAME, object_path, bus)
|
|
51
|
+
|
|
52
|
+
def create_sms(self, number: str, text: str = None, data: bytes = None) -> MMSms:
|
|
53
|
+
"""Creates a new message object."""
|
|
54
|
+
args = {"number": ("s", number)}
|
|
55
|
+
if text:
|
|
56
|
+
args["text"] = ("s", text)
|
|
57
|
+
elif data:
|
|
58
|
+
args["data"] = ("ay", data)
|
|
59
|
+
|
|
60
|
+
return MMSms(self.create(properties=args))
|
|
61
|
+
|
|
62
|
+
def delete_sms(self, sms: MMSms) -> None:
|
|
63
|
+
"""Delete an SMS message."""
|
|
64
|
+
self.delete(sms._remote_object_path)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class MMModemSignal(MMModemSignalInterface):
|
|
68
|
+
|
|
69
|
+
def __init__(self, object_path: str, bus: Optional[SdBus] = None) -> None:
|
|
70
|
+
"""
|
|
71
|
+
:param bus: You probably want to set default bus to system bus \
|
|
72
|
+
or pass system bus directly.
|
|
73
|
+
"""
|
|
74
|
+
super().__init__(MODEM_MANAGER_SERVICE_NAME, object_path, bus)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class MMModemSimple(MMModemSimpleInterface):
|
|
78
|
+
|
|
79
|
+
def __init__(self, object_path: str, bus: Optional[SdBus] = None) -> None:
|
|
80
|
+
super().__init__(MODEM_MANAGER_SERVICE_NAME, object_path, bus)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class MMModemVoice(MMModemVoiceInterface):
|
|
84
|
+
|
|
85
|
+
def __init__(self, object_path: str, bus: Optional[SdBus] = None) -> None:
|
|
86
|
+
super().__init__(MODEM_MANAGER_SERVICE_NAME, object_path, bus)
|
|
87
|
+
|
|
88
|
+
def get_calls(self):
|
|
89
|
+
return [MMCall(path) for path in self.call_object_paths]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class MMModem(MMModemInterface):
|
|
93
|
+
|
|
94
|
+
def __init__(
|
|
95
|
+
self,
|
|
96
|
+
object_path: str,
|
|
97
|
+
bus: Optional[SdBus] = None,
|
|
98
|
+
) -> None:
|
|
99
|
+
"""
|
|
100
|
+
:param bus: You probably want to set default bus to system bus \
|
|
101
|
+
or pass system bus directly.
|
|
102
|
+
"""
|
|
103
|
+
super().__init__(MODEM_MANAGER_SERVICE_NAME, object_path, bus)
|
|
104
|
+
self.messaging = MMModemMessaging(object_path=object_path, bus=bus)
|
|
105
|
+
self.simple = MMModemSimple(object_path=object_path, bus=bus)
|
|
106
|
+
self.signal = MMModemSignal(object_path=object_path, bus=bus)
|
|
107
|
+
self.voice = MMModemVoice(object_path=object_path, bus=bus)
|
|
108
|
+
self.sim: Optional[MMSim] = None
|
|
109
|
+
self.bearers: List[MMBearer] = []
|
|
110
|
+
|
|
111
|
+
def set_sim(self, object_path: str):
|
|
112
|
+
self.sim = MMSim(object_path=object_path)
|
|
113
|
+
|
|
114
|
+
def set_bearers(self, object_paths: List[str]):
|
|
115
|
+
for p in object_paths:
|
|
116
|
+
b = MMBearer(p)
|
|
117
|
+
self.bearers.append(b)
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class MMModems(MMModemsInterface):
|
|
121
|
+
modems: List[MMModem] = []
|
|
122
|
+
|
|
123
|
+
def __init__(self, bus: Optional[SdBus] = None) -> None:
|
|
124
|
+
super().__init__(service_name=MODEM_MANAGER_SERVICE_NAME, object_path='/org/freedesktop/ModemManager1', bus=bus)
|
|
125
|
+
|
|
126
|
+
def get_modems(self) -> List[MMModem]:
|
|
127
|
+
self.modems = []
|
|
128
|
+
for k, v in self.get_managed_objects().items():
|
|
129
|
+
m: MMModem = MMModem(object_path=k)
|
|
130
|
+
self.modems.append(m)
|
|
131
|
+
return self.modems
|
|
132
|
+
|
|
133
|
+
def get_first(self) -> Optional[MMModem]:
|
|
134
|
+
if len(self.modems) <= 0:
|
|
135
|
+
self.get_modems()
|
|
136
|
+
return self.modems[0] if len(self.modems) >= 1 else None
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
class MMSim(MMSimInterface):
|
|
140
|
+
|
|
141
|
+
def __init__(
|
|
142
|
+
self,
|
|
143
|
+
object_path: str,
|
|
144
|
+
bus: Optional[SdBus] = None,
|
|
145
|
+
) -> None:
|
|
146
|
+
"""
|
|
147
|
+
:param bus: You probably want to set default bus to system bus \
|
|
148
|
+
or pass system bus directly.
|
|
149
|
+
"""
|
|
150
|
+
super().__init__(MODEM_MANAGER_SERVICE_NAME, object_path, bus)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class MMBearer(MMBearerInterface):
|
|
154
|
+
|
|
155
|
+
def __init__(
|
|
156
|
+
self,
|
|
157
|
+
object_path: str,
|
|
158
|
+
bus: Optional[SdBus] = None,
|
|
159
|
+
) -> None:
|
|
160
|
+
"""
|
|
161
|
+
:param bus: You probably want to set default bus to system bus \
|
|
162
|
+
or pass system bus directly.
|
|
163
|
+
"""
|
|
164
|
+
super().__init__(MODEM_MANAGER_SERVICE_NAME, object_path, bus)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class MMCall(MMCallInterface):
|
|
168
|
+
|
|
169
|
+
def __init__(
|
|
170
|
+
self,
|
|
171
|
+
object_path: str,
|
|
172
|
+
bus: Optional[SdBus] = None,
|
|
173
|
+
) -> None:
|
|
174
|
+
"""
|
|
175
|
+
:param bus: You probably want to set default bus to system bus \
|
|
176
|
+
or pass system bus directly.
|
|
177
|
+
"""
|
|
178
|
+
super().__init__(MODEM_MANAGER_SERVICE_NAME, object_path, bus)
|
|
179
|
+
|
|
180
|
+
@property
|
|
181
|
+
def state_text(self) -> str:
|
|
182
|
+
"""A MMCallState name, describing the state of the call."""
|
|
183
|
+
return MMCallState(self.state).name
|
|
184
|
+
|
|
185
|
+
@property
|
|
186
|
+
def state_reason_text(self) -> str:
|
|
187
|
+
"""A MMCallStateReason name, describing why the state is changed."""
|
|
188
|
+
return MMCallStateReason(self.state_reason).name
|
|
189
|
+
|
|
190
|
+
@property
|
|
191
|
+
def direction_text(self) -> str:
|
|
192
|
+
"""A MMCallDirection name, describing the direction of the call."""
|
|
193
|
+
return MMCallDirection(self.direction).name
|
|
File without changes
|