aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-cdma.h
blob: a7efe91afaeb7855d6a1f30638471459ec4c2b1f (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
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details:
 *
 * Copyright (C) 2011 Google, Inc.
 */

#ifndef MM_IFACE_MODEM_CDMA_H
#define MM_IFACE_MODEM_CDMA_H

#include <glib-object.h>
#include <gio/gio.h>

#define _LIBMM_INSIDE_MM
#include <libmm-glib.h>

#include "mm-at-serial-port.h"

#define MM_TYPE_IFACE_MODEM_CDMA               (mm_iface_modem_cdma_get_type ())
#define MM_IFACE_MODEM_CDMA(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_IFACE_MODEM_CDMA, MMIfaceModemCdma))
#define MM_IS_IFACE_MODEM_CDMA(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_IFACE_MODEM_CDMA))
#define MM_IFACE_MODEM_CDMA_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_IFACE_MODEM_CDMA, MMIfaceModemCdma))

#define MM_IFACE_MODEM_CDMA_DBUS_SKELETON             "iface-modem-cdma-dbus-skeleton"
#define MM_IFACE_MODEM_CDMA_CDMA1X_REGISTRATION_STATE "iface-modem-cdma-cdma1x-registration-state"
#define MM_IFACE_MODEM_CDMA_EVDO_REGISTRATION_STATE   "iface-modem-cdma-evdo-registration-state"
#define MM_IFACE_MODEM_CDMA_EVDO_NETWORK_SUPPORTED    "iface-modem-cdma-evdo-network-supported"
#define MM_IFACE_MODEM_CDMA_CDMA1X_NETWORK_SUPPORTED  "iface-modem-cdma-cdma1x-network-supported"

#define MM_IFACE_MODEM_CDMA_ALL_ACCESS_TECHNOLOGIES_MASK        \
    (MM_IFACE_MODEM_CDMA_ALL_CDMA1X_ACCESS_TECHNOLOGIES_MASK |  \
     MM_IFACE_MODEM_CDMA_ALL_EVDO_ACCESS_TECHNOLOGIES_MASK)

#define MM_IFACE_MODEM_CDMA_ALL_EVDO_ACCESS_TECHNOLOGIES_MASK   \
    (MM_MODEM_ACCESS_TECHNOLOGY_EVDO0 |                         \
     MM_MODEM_ACCESS_TECHNOLOGY_EVDOA |                         \
     MM_MODEM_ACCESS_TECHNOLOGY_EVDOB)

#define MM_IFACE_MODEM_CDMA_ALL_CDMA1X_ACCESS_TECHNOLOGIES_MASK \
    (MM_MODEM_ACCESS_TECHNOLOGY_1XRTT)

typedef struct _MMIfaceModemCdma MMIfaceModemCdma;

struct _MMIfaceModemCdma {
    GTypeInterface g_iface;

    /* Loading of the MEID property */
    void (*load_meid) (MMIfaceModemCdma *self,
                       GAsyncReadyCallback callback,
                       gpointer user_data);
    gchar * (*load_meid_finish) (MMIfaceModemCdma *self,
                                 GAsyncResult *res,
                                 GError **error);

    /* Loading of the ESN property */
    void (*load_esn) (MMIfaceModemCdma *self,
                      GAsyncReadyCallback callback,
                      gpointer user_data);
    gchar * (*load_esn_finish) (MMIfaceModemCdma *self,
                                GAsyncResult *res,
                                GError **error);

    /* Loading of the initial activation state */
    void (* load_activation_state) (MMIfaceModemCdma *self,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);
    MMModemCdmaActivationState (* load_activation_state_finish) (MMIfaceModemCdma *self,
                                                                 GAsyncResult *res,
                                                                 GError **error);

    /* Asynchronous setting up unsolicited events */
    void (* setup_unsolicited_events) (MMIfaceModemCdma *self,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);
    gboolean (* setup_unsolicited_events_finish) (MMIfaceModemCdma *self,
                                                  GAsyncResult *res,
                                                  GError **error);


    /* Asynchronous enabling of unsolicited events */
    void (*enable_unsolicited_events) (MMIfaceModemCdma *self,
                                       GAsyncReadyCallback callback,
                                       gpointer user_data);
    gboolean (*enable_unsolicited_events_finish) (MMIfaceModemCdma *self,
                                                  GAsyncResult *res,
                                                  GError **error);

    /* Asynchronous cleaning up of unsolicited events */
    void (* cleanup_unsolicited_events) (MMIfaceModemCdma *self,
                                         GAsyncReadyCallback callback,
                                         gpointer user_data);
    gboolean (* cleanup_unsolicited_events_finish) (MMIfaceModemCdma *self,
                                                    GAsyncResult *res,
                                                    GError **error);

    /* Asynchronous disabling of unsolicited events */
    void (*disable_unsolicited_events) (MMIfaceModemCdma *self,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);
    gboolean (*disable_unsolicited_events_finish) (MMIfaceModemCdma *self,
                                                   GAsyncResult *res,
                                                   GError **error);

    /* OTA activation */
    void (* activate) (MMIfaceModemCdma *self,
                       const gchar *carrier_code,
                       GAsyncReadyCallback callback,
                       gpointer user_data);
    gboolean (* activate_finish) (MMIfaceModemCdma *self,
                                  GAsyncResult *res,
                                  GError **error);

    /* Manual activation */
    void (* activate_manual) (MMIfaceModemCdma *self,
                              MMCdmaManualActivationProperties *properties,
                              GAsyncReadyCallback callback,
                              gpointer user_data);
    gboolean (* activate_manual_finish) (MMIfaceModemCdma *self,
                                         GAsyncResult *res,
                                         GError **error);

    /* Try to register in the CDMA network. This implementation is just making
     * sure that the modem is registered, and if it's not it will wait until it
     * is.
     */
    void (* register_in_network) (MMIfaceModemCdma *self,
                                  guint max_registration_time,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data);
    gboolean (*register_in_network_finish) (MMIfaceModemCdma *self,
                                            GAsyncResult *res,
                                            GError **error);

    /* Run CDMA1x/EV-DO registration state checks..
     * Note that no registration state is returned, implementations should call
     * mm_iface_modem_cdma_update_registration_state().
     *
     * NOTE: Plugins implementing this method will NOT execute the generic
     * registration check logic involving setup_registration_checks(),
     * get_call_manager_state(), get_hdr_state(), get_service_status(),
     * get_cdma1x_serving_system() and get_detailed_registration_state().
     *
     * In other words, it is fine to leave this callback to NULL if you want
     * the generic steps to run. This callback may be implemented if there
     * is a completely independent way/command which can gather both CDMA1x
     * and EV-DO registration states, SID and NID.
     */
    void (* run_registration_checks) (MMIfaceModemCdma *self,
                                      gboolean cdma1x_supported,
                                      gboolean evdo_supported,
                                      GAsyncReadyCallback callback,
                                      gpointer user_data);
    gboolean (* run_registration_checks_finish) (MMIfaceModemCdma *self,
                                                 GAsyncResult *res,
                                                 GError **error);

    /* The following steps will only be run if run_registration_checks() is NOT
     * given by the object implementing the interface */

    /* Setup registration checks */
    void (* setup_registration_checks) (MMIfaceModemCdma *self,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);
    gboolean (* setup_registration_checks_finish) (MMIfaceModemCdma *self,
                                                   GAsyncResult *res,
                                                   gboolean *skip_qcdm_call_manager_step,
                                                   gboolean *skip_qcdm_hdr_step,
                                                   gboolean *skip_at_cdma_service_status_step,
                                                   gboolean *skip_at_cdma1x_serving_system_step,
                                                   gboolean *skip_detailed_registration_state,
                                                   GError **error);
    /* Get call manager state */
    void (* get_call_manager_state) (MMIfaceModemCdma *self,
                                     GAsyncReadyCallback callback,
                                     gpointer user_data);
    gboolean (* get_call_manager_state_finish) (MMIfaceModemCdma *self,
                                                GAsyncResult *res,
                                                guint *operating_mode,
                                                guint *system_mode,
                                                GError **error);
    /* Get HDR state */
    void (* get_hdr_state) (MMIfaceModemCdma *self,
                            GAsyncReadyCallback callback,
                            gpointer user_data);
    gboolean (* get_hdr_state_finish) (MMIfaceModemCdma *self,
                                       GAsyncResult *res,
                                       guint8 *hybrid_mode,
                                       guint8 *session_state,
                                       guint8 *almp_state,
                                       GError **error);
    /* Get service status */
    void (* get_service_status) (MMIfaceModemCdma *self,
                                 GAsyncReadyCallback callback,
                                 gpointer user_data);
    gboolean (* get_service_status_finish) (MMIfaceModemCdma *self,
                                            GAsyncResult *res,
                                            gboolean *has_cdma_service,
                                            GError **error);
    /* Get CDMA1x serving system */
    void (* get_cdma1x_serving_system) (MMIfaceModemCdma *self,
                                        GAsyncReadyCallback callback,
                                        gpointer user_data);
    gboolean (* get_cdma1x_serving_system_finish) (MMIfaceModemCdma *self,
                                                   GAsyncResult *res,
                                                   guint *class,
                                                   guint *band,
                                                   guint *sid,
                                                   guint *nid,
                                                   GError **error);
    /* Get detailed registration state */
    void (* get_detailed_registration_state) (MMIfaceModemCdma *self,
                                              MMModemCdmaRegistrationState cdma1x_state,
                                              MMModemCdmaRegistrationState evdo_state,
                                              GAsyncReadyCallback callback,
                                              gpointer user_data);
    gboolean (* get_detailed_registration_state_finish) (MMIfaceModemCdma *self,
                                                         GAsyncResult *res,
                                                         MMModemCdmaRegistrationState *detailed_cdma1x_state,
                                                         MMModemCdmaRegistrationState *detailed_evdo_state,
                                                         GError **error);
};

GType mm_iface_modem_cdma_get_type (void);

/* Initialize CDMA interface (async) */
void     mm_iface_modem_cdma_initialize        (MMIfaceModemCdma *self,
                                                GCancellable *cancellable,
                                                GAsyncReadyCallback callback,
                                                gpointer user_data);
gboolean mm_iface_modem_cdma_initialize_finish (MMIfaceModemCdma *self,
                                                GAsyncResult *res,
                                                GError **error);

/* Enable CDMA interface (async) */
void     mm_iface_modem_cdma_enable        (MMIfaceModemCdma *self,
                                            GCancellable *cancellable,
                                            GAsyncReadyCallback callback,
                                            gpointer user_data);
gboolean mm_iface_modem_cdma_enable_finish (MMIfaceModemCdma *self,
                                            GAsyncResult *res,
                                            GError **error);

/* Disable CDMA interface (async) */
void     mm_iface_modem_cdma_disable        (MMIfaceModemCdma *self,
                                             GAsyncReadyCallback callback,
                                             gpointer user_data);
gboolean mm_iface_modem_cdma_disable_finish (MMIfaceModemCdma *self,
                                             GAsyncResult *res,
                                             GError **error);

/* Shutdown CDMA interface */
void mm_iface_modem_cdma_shutdown (MMIfaceModemCdma *self);

/* Objects implementing this interface can report new registration states,
 * access technologies and activation state changes */
void mm_iface_modem_cdma_update_cdma1x_registration_state (MMIfaceModemCdma *self,
                                                           MMModemCdmaRegistrationState state,
                                                           guint sid,
                                                           guint nid);
void mm_iface_modem_cdma_update_evdo_registration_state (MMIfaceModemCdma *self,
                                                         MMModemCdmaRegistrationState state);
void mm_iface_modem_cdma_update_access_technologies (MMIfaceModemCdma *self,
                                                     MMModemAccessTechnology access_tech);

void mm_iface_modem_cdma_update_activation_state (MMIfaceModemCdma *self,
                                                  MMModemCdmaActivationState activation_state,
                                                  const GError *activation_error);

/* Run all registration checks */
void     mm_iface_modem_cdma_run_registration_checks        (MMIfaceModemCdma *self,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
gboolean mm_iface_modem_cdma_run_registration_checks_finish (MMIfaceModemCdma *self,
                                                             GAsyncResult *res,
                                                             GError **error);

/* Register in network */
void     mm_iface_modem_cdma_register_in_network        (MMIfaceModemCdma *self,
                                                         guint max_registration_time,
                                                         GAsyncReadyCallback callback,
                                                         gpointer user_data);
gboolean mm_iface_modem_cdma_register_in_network_finish (MMIfaceModemCdma *self,
                                                         GAsyncResult *res,
                                                         GError **error);

/* Bind properties for simple GetStatus() */
void mm_iface_modem_cdma_bind_simple_status (MMIfaceModemCdma *self,
                                             MMSimpleStatus *status);

#endif /* MM_IFACE_MODEM_CDMA_H */