aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib/mm-modem.h
blob: a2ece5afdac61c1338df7b8316d4b2b18ae13f61 (plain)
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * libmm -- Access modem status & information from glib applications
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA.
 *
 * Copyright (C) 2011 - 2012 Aleksander Morgado <aleksander@gnu.org>
 * Copyright (C) 2012 Google, Inc.
 */

#ifndef _MM_MODEM_H_
#define _MM_MODEM_H_

#if !defined (__LIBMM_GLIB_H_INSIDE__) && !defined (LIBMM_GLIB_COMPILATION)
#error "Only <libmm-glib.h> can be included directly."
#endif

#include <ModemManager.h>

#include "mm-gdbus-modem.h"
#include "mm-unlock-retries.h"
#include "mm-sim.h"
#include "mm-bearer.h"
#include "mm-helper-types.h"

G_BEGIN_DECLS

#define MM_TYPE_MODEM            (mm_modem_get_type ())
#define MM_MODEM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_MODEM, MMModem))
#define MM_MODEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_MODEM, MMModemClass))
#define MM_IS_MODEM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_MODEM))
#define MM_IS_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), MM_TYPE_MODEM))
#define MM_MODEM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_MODEM, MMModemClass))

typedef struct _MMModem MMModem;
typedef struct _MMModemClass MMModemClass;
typedef struct _MMModemPrivate MMModemPrivate;

/**
 * MMModem:
 *
 * The #MMModem structure contains private data and should only be accessed
 * using the provided API.
 */
struct _MMModem {
    /*< private >*/
    MmGdbusModemProxy parent;
    MMModemPrivate *priv;
};

struct _MMModemClass {
    /*< private >*/
    MmGdbusModemProxyClass parent;
};

GType mm_modem_get_type (void);

const gchar *mm_modem_get_path (MMModem *self);
gchar       *mm_modem_dup_path (MMModem *self);

const gchar       *mm_modem_get_sim_path             (MMModem *self);
gchar             *mm_modem_dup_sim_path             (MMModem *self);

gboolean           mm_modem_peek_supported_capabilities (MMModem *self,
                                                         const MMModemCapability **capabilities,
                                                         guint *n_capabilities);
gboolean           mm_modem_get_supported_capabilities (MMModem *self,
                                                        MMModemCapability **capabilities,
                                                        guint *n_capabilities);

MMModemCapability  mm_modem_get_current_capabilities (MMModem *self);

guint              mm_modem_get_max_bearers          (MMModem *self);

guint              mm_modem_get_max_active_bearers   (MMModem *self);

const gchar       *mm_modem_get_manufacturer         (MMModem *self);
gchar             *mm_modem_dup_manufacturer         (MMModem *self);

const gchar       *mm_modem_get_model                (MMModem *self);
gchar             *mm_modem_dup_model                (MMModem *self);

const gchar       *mm_modem_get_revision             (MMModem *self);
gchar             *mm_modem_dup_revision             (MMModem *self);

const gchar       *mm_modem_get_device_identifier    (MMModem *self);
gchar             *mm_modem_dup_device_identifier    (MMModem *self);

const gchar       *mm_modem_get_device               (MMModem *self);
gchar             *mm_modem_dup_device               (MMModem *self);

const gchar * const  *mm_modem_get_drivers           (MMModem *self);
gchar               **mm_modem_dup_drivers           (MMModem *self);

const gchar       *mm_modem_get_plugin               (MMModem *self);
gchar             *mm_modem_dup_plugin               (MMModem *self);

const gchar       *mm_modem_get_primary_port         (MMModem *self);
gchar             *mm_modem_dup_primary_port         (MMModem *self);

const gchar       *mm_modem_get_equipment_identifier (MMModem *self);
gchar             *mm_modem_dup_equipment_identifier (MMModem *self);

const gchar *const  *mm_modem_get_own_numbers        (MMModem *self);
gchar              **mm_modem_dup_own_numbers        (MMModem *self);

MMModemLock        mm_modem_get_unlock_required      (MMModem *self);

MMUnlockRetries   *mm_modem_get_unlock_retries       (MMModem *self);
MMUnlockRetries   *mm_modem_peek_unlock_retries      (MMModem *self);

MMModemState       mm_modem_get_state                (MMModem *self);

MMModemStateFailedReason mm_modem_get_state_failed_reason (MMModem *self);

MMModemPowerState  mm_modem_get_power_state          (MMModem *self);

MMModemAccessTechnology mm_modem_get_access_technologies (MMModem *self);

guint              mm_modem_get_signal_quality       (MMModem *self,
                                                      gboolean *recent);

gboolean           mm_modem_peek_supported_modes     (MMModem *self,
                                                      const MMModemModeCombination **modes,
                                                      guint *n_modes);
gboolean           mm_modem_get_supported_modes      (MMModem *self,
                                                      MMModemModeCombination **modes,
                                                      guint *n_modes);

gboolean           mm_modem_get_current_modes        (MMModem *self,
                                                      MMModemMode *allowed,
                                                      MMModemMode *preferred);

gboolean           mm_modem_peek_supported_bands     (MMModem *self,
                                                      const MMModemBand **bands,
                                                      guint *n_bands);
gboolean           mm_modem_get_supported_bands      (MMModem *self,
                                                      MMModemBand **bands,
                                                      guint *n_bands);

gboolean           mm_modem_peek_current_bands       (MMModem *self,
                                                      const MMModemBand **bands,
                                                      guint *n_bands);
gboolean           mm_modem_get_current_bands        (MMModem *self,
                                                      MMModemBand **bands,
                                                      guint *n_bands);

MMBearerIpFamily   mm_modem_get_supported_ip_families (MMModem *self);

void     mm_modem_enable        (MMModem *self,
                                 GCancellable *cancellable,
                                 GAsyncReadyCallback callback,
                                 gpointer user_data);
gboolean mm_modem_enable_finish (MMModem *self,
                                 GAsyncResult *res,
                                 GError **error);
gboolean mm_modem_enable_sync   (MMModem *self,
                                 GCancellable *cancellable,
                                 GError **error);

void     mm_modem_disable        (MMModem *self,
                                  GCancellable *cancellable,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data);
gboolean mm_modem_disable_finish (MMModem *self,
                                  GAsyncResult *res,
                                  GError **error);
gboolean mm_modem_disable_sync   (MMModem *self,
                                  GCancellable *cancellable,
                                  GError **error);

void     mm_modem_list_bearers        (MMModem *self,
                                       GCancellable *cancellable,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);
GList   *mm_modem_list_bearers_finish (MMModem *self,
                                       GAsyncResult *res,
                                       GError **error);
GList   *mm_modem_list_bearers_sync   (MMModem *self,
                                       GCancellable *cancellable,
                                       GError **error);

void     mm_modem_create_bearer         (MMModem *self,
                                         MMBearerProperties *properties,
                                         GCancellable *cancellable,
                                         GAsyncReadyCallback callback,
                                         gpointer user_data);
MMBearer *mm_modem_create_bearer_finish (MMModem *self,
                                         GAsyncResult *res,
                                         GError **error);
MMBearer *mm_modem_create_bearer_sync   (MMModem *self,
                                         MMBearerProperties *properties,
                                         GCancellable *cancellable,
                                         GError **error);

void     mm_modem_delete_bearer        (MMModem *self,
                                        const gchar *bearer,
                                        GCancellable *cancellable,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);
gboolean mm_modem_delete_bearer_finish (MMModem *self,
                                        GAsyncResult *res,
                                        GError **error);
gboolean mm_modem_delete_bearer_sync   (MMModem *self,
                                        const gchar *bearer,
                                        GCancellable *cancellable,
                                        GError **error);

void     mm_modem_reset        (MMModem *self,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);
gboolean mm_modem_reset_finish (MMModem *self,
                                GAsyncResult *res,
                                GError **error);
gboolean mm_modem_reset_sync   (MMModem *self,
                                GCancellable *cancellable,
                                GError **error);

void     mm_modem_factory_reset        (MMModem *self,
                                        const gchar *code,
                                        GCancellable *cancellable,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);
gboolean mm_modem_factory_reset_finish (MMModem *self,
                                        GAsyncResult *res,
                                        GError **error);
gboolean mm_modem_factory_reset_sync   (MMModem *self,
                                        const gchar *code,
                                        GCancellable *cancellable,
                                        GError **error);

void      mm_modem_command        (MMModem *self,
                                   const gchar *cmd,
                                   guint timeout,
                                   GCancellable *cancellable,
                                   GAsyncReadyCallback callback,
                                   gpointer user_data);
gchar    *mm_modem_command_finish (MMModem *self,
                                   GAsyncResult *res,
                                   GError **error);
gchar    *mm_modem_command_sync   (MMModem *self,
                                   const gchar *cmd,
                                   guint timeout,
                                   GCancellable *cancellable,
                                   GError **error);

void     mm_modem_set_power_state        (MMModem *self,
                                          MMModemPowerState state,
                                          GCancellable *cancellable,
                                          GAsyncReadyCallback callback,
                                          gpointer user_data);
gboolean mm_modem_set_power_state_finish (MMModem *self,
                                          GAsyncResult *res,
                                          GError **error);
gboolean mm_modem_set_power_state_sync   (MMModem *self,
                                          MMModemPowerState state,
                                          GCancellable *cancellable,
                                          GError **error);

void     mm_modem_set_current_capabilities        (MMModem *self,
                                                   MMModemCapability capabilities,
                                                   GCancellable *cancellable,
                                                   GAsyncReadyCallback callback,
                                                   gpointer user_data);
gboolean mm_modem_set_current_capabilities_finish (MMModem *self,
                                                   GAsyncResult *res,
                                                   GError **error);
gboolean mm_modem_set_current_capabilities_sync   (MMModem *self,
                                                   MMModemCapability capabilities,
                                                   GCancellable *cancellable,
                                                   GError **error);

void     mm_modem_set_current_modes        (MMModem *self,
                                            MMModemMode modes,
                                            MMModemMode preferred,
                                            GCancellable *cancellable,
                                            GAsyncReadyCallback callback,
                                            gpointer user_data);
gboolean mm_modem_set_current_modes_finish (MMModem *self,
                                            GAsyncResult *res,
                                            GError **error);
gboolean mm_modem_set_current_modes_sync   (MMModem *self,
                                            MMModemMode modes,
                                            MMModemMode preferred,
                                            GCancellable *cancellable,
                                            GError **error);

void     mm_modem_set_current_bands        (MMModem *self,
                                            const MMModemBand *bands,
                                            guint n_bands,
                                            GCancellable *cancellable,
                                            GAsyncReadyCallback callback,
                                            gpointer user_data);
gboolean mm_modem_set_current_bands_finish (MMModem *self,
                                            GAsyncResult *res,
                                            GError **error);
gboolean mm_modem_set_current_bands_sync   (MMModem *self,
                                            const MMModemBand *bands,
                                            guint n_bands,
                                            GCancellable *cancellable,
                                            GError **error);

void   mm_modem_get_sim        (MMModem *self,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);
MMSim *mm_modem_get_sim_finish (MMModem *self,
                                GAsyncResult *res,
                                GError **error);
MMSim *mm_modem_get_sim_sync   (MMModem *self,
                                GCancellable *cancellable,
                                GError **error);

G_END_DECLS

#endif /* _MM_MODEM_H_ */