summaryrefslogtreecommitdiffstats
path: root/plugins/wwan/cc-wwan-device.h
blob: add27d3d27db9bd49b906eed9ac639775f028d02 (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
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* cc-wwan-device.h
 *
 * Copyright 2019-2020 Purism SPC
 *
 * 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 3 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Author(s):
 *   Mohammed Sadiq <sadiq@sadiqpk.org>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#pragma once

#include <glib-object.h>
#include <libmm-glib.h>

#if defined(HAVE_NETWORK_MANAGER) && defined(BUILD_NETWORK)
# include "cc-wwan-data.h"
#endif

G_BEGIN_DECLS

typedef enum
{
  CC_WWAN_REGISTRATION_STATE_UNKNOWN,
  CC_WWAN_REGISTRATION_STATE_IDLE,
  CC_WWAN_REGISTRATION_STATE_REGISTERED,
  CC_WWAN_REGISTRATION_STATE_ROAMING,
  CC_WWAN_REGISTRATION_STATE_SEARCHING,
  CC_WWAN_REGISTRATION_STATE_DENIED
} CcWwanState;

typedef struct _CcWwanData CcWwanData;

#define CC_TYPE_WWAN_DEVICE (cc_wwan_device_get_type())
G_DECLARE_FINAL_TYPE (CcWwanDevice, cc_wwan_device, CC, WWAN_DEVICE, GObject)

CcWwanDevice  *cc_wwan_device_new                (MMObject            *mm_object,
                                                  GObject             *nm_client);
gboolean       cc_wwan_device_has_sim            (CcWwanDevice        *self);
MMModemLock    cc_wwan_device_get_lock           (CcWwanDevice        *self);
gboolean       cc_wwan_device_get_sim_lock       (CcWwanDevice        *self);
guint          cc_wwan_device_get_unlock_retries (CcWwanDevice        *self,
                                                  MMModemLock          lock);
void           cc_wwan_device_enable_pin         (CcWwanDevice        *self,
                                                  const gchar         *pin,
                                                  GCancellable        *cancellable,
                                                  GAsyncReadyCallback  callback,
                                                  gpointer             user_data);
gboolean       cc_wwan_device_enable_pin_finish  (CcWwanDevice        *self,
                                                  GAsyncResult        *result,
                                                  GError             **error);
void           cc_wwan_device_disable_pin        (CcWwanDevice        *self,
                                                  const gchar         *pin,
                                                  GCancellable        *cancellable,
                                                  GAsyncReadyCallback  callback,
                                                  gpointer             user_data);
gboolean       cc_wwan_device_disable_pin_finish (CcWwanDevice        *self,
                                                  GAsyncResult        *result,
                                                  GError             **error);
void           cc_wwan_device_send_pin           (CcWwanDevice        *self,
                                                  const gchar         *pin,
                                                  GCancellable        *cancellable,
                                                  GAsyncReadyCallback  callback,
                                                  gpointer             user_data);
gboolean       cc_wwan_device_send_pin_finish    (CcWwanDevice        *self,
                                                  GAsyncResult        *result,
                                                  GError             **error);
void          cc_wwan_device_send_puk            (CcWwanDevice        *self,
                                                  const gchar         *puk,
                                                  const gchar         *pin,
                                                  GCancellable        *cancellable,
                                                  GAsyncReadyCallback  callback,
                                                  gpointer             user_data);
gboolean      cc_wwan_device_send_puk_finish     (CcWwanDevice        *self,
                                                  GAsyncResult        *result,
                                                  GError             **error);
void           cc_wwan_device_change_pin         (CcWwanDevice        *self,
                                                  const gchar         *old_pin,
                                                  const gchar         *new_pin,
                                                  GCancellable        *cancellable,
                                                  GAsyncReadyCallback  callback,
                                                  gpointer             user_data);
gboolean       cc_wwan_device_change_pin_finish  (CcWwanDevice        *self,
                                                  GAsyncResult        *result,
                                                  GError             **error);
const gchar   *cc_wwan_device_get_operator_name  (CcWwanDevice        *self);
gchar         *cc_wwan_device_dup_sim_identifier (CcWwanDevice        *self);
gchar         *cc_wwan_device_dup_network_type_string (CcWwanDevice   *self);
gchar         *cc_wwan_device_dup_signal_string  (CcWwanDevice        *self);
const gchar   *cc_wwan_device_get_manufacturer   (CcWwanDevice        *self);
const gchar   *cc_wwan_device_get_model          (CcWwanDevice        *self);
const gchar   *cc_wwan_device_get_firmware_version (CcWwanDevice      *self);
const gchar   *cc_wwan_device_get_identifier     (CcWwanDevice        *self);
gboolean       cc_wwan_device_get_current_mode   (CcWwanDevice        *self,
                                                  MMModemMode         *allowed,
                                                  MMModemMode         *preferred);
gboolean       cc_wwan_device_is_auto_network    (CcWwanDevice        *self);
CcWwanState    cc_wwan_device_get_network_state  (CcWwanDevice        *self);
gboolean       cc_wwan_device_get_supported_modes (CcWwanDevice       *self,
                                                   MMModemMode        *allowed,
                                                   MMModemMode        *preferred);
void           cc_wwan_device_set_current_mode   (CcWwanDevice        *self,
                                                  MMModemMode          allowed,
                                                  MMModemMode          preferred,
                                                  GCancellable        *cancellable,
                                                  GAsyncReadyCallback  callback,
                                                  gpointer             user_data);
gboolean       cc_wwan_device_set_current_mode_finish (CcWwanDevice        *self,
                                                       GAsyncResult        *result,
                                                       GError             **error);
gchar         *cc_wwan_device_get_string_from_mode    (CcWwanDevice        *self,
                                                       MMModemMode          allowed,
                                                       MMModemMode          preferred);
void           cc_wwan_device_scan_networks           (CcWwanDevice        *self,
                                                       GCancellable        *cancellable,
                                                       GAsyncReadyCallback  callback,
                                                       gpointer             user_data);
GList         *cc_wwan_device_scan_networks_finish    (CcWwanDevice        *self,
                                                       GAsyncResult        *result,
                                                       GError             **error);
void           cc_wwan_device_register_network        (CcWwanDevice        *self,
                                                       const gchar         *network_id,
                                                       GCancellable        *cancellable,
                                                       GAsyncReadyCallback  callback,
                                                       gpointer             user_data);
gboolean       cc_wwan_device_register_network_finish (CcWwanDevice        *self,
                                                       GAsyncResult        *result,
                                                       GError             **error);
const gchar   *cc_wwan_device_get_simple_error        (CcWwanDevice        *self);
GSList        *cc_wwan_device_get_apn_list            (CcWwanDevice        *self);
gboolean       cc_wwan_device_is_nm_device            (CcWwanDevice        *self,
                                                       GObject             *nm_device);
const gchar   *cc_wwan_device_get_path                (CcWwanDevice        *self);
CcWwanData    *cc_wwan_device_get_data                (CcWwanDevice        *self);
gboolean       cc_wwan_device_pin_valid               (const gchar         *password,
                                                       MMModemLock          lock);

G_END_DECLS