aboutsummaryrefslogtreecommitdiff
path: root/plugins/huawei/mm-modem-helpers-huawei.h
blob: b4c7ac7a119e4f670d3a6cf0e9915ff7ac51b043 (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
/* -*- 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) 2013 Huawei Technologies Co., Ltd
 * Copyright (C) 2013 Aleksander Morgado <aleksander@gnu.org>
 */

#ifndef MM_MODEM_HELPERS_HUAWEI_H
#define MM_MODEM_HELPERS_HUAWEI_H

#include "glib.h"

/*****************************************************************************/
/* ^NDISSTAT / ^NDISSTATQRY response parser */
gboolean mm_huawei_parse_ndisstatqry_response (const gchar *response,
                                               gboolean *ipv4_available,
                                               gboolean *ipv4_connected,
                                               gboolean *ipv6_available,
                                               gboolean *ipv6_connected,
                                               GError **error);

/*****************************************************************************/
/* ^DHCP response parser */
gboolean mm_huawei_parse_dhcp_response (const char *reply,
                                        guint *out_address,
                                        guint *out_prefix,
                                        guint *out_gateway,
                                        guint *out_dns1,
                                        guint *out_dns2,
                                        GError **error);

/*****************************************************************************/
/* ^SYSINFO response parser */
gboolean mm_huawei_parse_sysinfo_response (const char *reply,
                                           guint *out_srv_status,
                                           guint *out_srv_domain,
                                           guint *out_roam_status,
                                           guint *out_sys_mode,
                                           guint *out_sim_state,
                                           gboolean *out_sys_submode_valid,
                                           guint *out_sys_submode,
                                           GError **error);

/*****************************************************************************/
/* ^SYSINFOEX response parser */
gboolean mm_huawei_parse_sysinfoex_response (const char *reply,
                                             guint *out_srv_status,
                                             guint *out_srv_domain,
                                             guint *out_roam_status,
                                             guint *out_sim_state,
                                             guint *out_sys_mode,
                                             guint *out_sys_submode,
                                             GError **error);

/*****************************************************************************/
/* ^PREFMODE test parser */

typedef struct {
    guint prefmode;
    MMModemMode allowed;
    MMModemMode preferred;
} MMHuaweiPrefmodeCombination;

GArray *mm_huawei_parse_prefmode_test (const gchar *response,
                                       GError **error);

/*****************************************************************************/
/* ^PREFMODE response parser */

const MMHuaweiPrefmodeCombination *mm_huawei_parse_prefmode_response (const gchar *response,
                                                                      const GArray *supported_mode_combinations,
                                                                      GError **error);

/*****************************************************************************/
/* ^SYSCFG test parser */

/* This is the default string we use as fallback when the modem gives
 * an empty response to AT^SYSCFG=? */
#define MM_HUAWEI_DEFAULT_SYSCFG_FMT "^SYSCFG:(2,13,14,16),(0-3),,,"

typedef struct {
    guint mode;
    guint acqorder;
    MMModemMode allowed;
    MMModemMode preferred;
} MMHuaweiSyscfgCombination;

GArray *mm_huawei_parse_syscfg_test (const gchar *response,
                                     GError **error);

/*****************************************************************************/
/* ^SYSCFG response parser */

const MMHuaweiSyscfgCombination *mm_huawei_parse_syscfg_response (const gchar *response,
                                                                  const GArray *supported_mode_combinations,
                                                                  GError **error);

/*****************************************************************************/
/* ^SYSCFGEX test parser */

typedef struct {
    gchar *mode_str;
    MMModemMode allowed;
    MMModemMode preferred;
} MMHuaweiSyscfgexCombination;

GArray *mm_huawei_parse_syscfgex_test (const gchar *response,
                                       GError **error);

/*****************************************************************************/
/* ^SYSCFGEX response parser */

const MMHuaweiSyscfgexCombination *mm_huawei_parse_syscfgex_response (const gchar *response,
                                                                      const GArray *supported_mode_combinations,
                                                                      GError **error);

/*****************************************************************************/
/* ^NWTIME response parser */

gboolean mm_huawei_parse_nwtime_response (const gchar *response,
                                          gchar **iso8601p,
                                          MMNetworkTimezone **tzp,
                                          GError **error);

/*****************************************************************************/
/* ^TIME response parser */

gboolean mm_huawei_parse_time_response (const gchar *response,
                                        gchar **iso8601p,
                                        MMNetworkTimezone **tzp,
                                        GError **error);

/*****************************************************************************/
/* ^HCSQ response parser */

gboolean mm_huawei_parse_hcsq_response (const gchar *response,
                                        MMModemAccessTechnology *out_act,
                                        guint *out_value1,
                                        guint *out_value2,
                                        guint *out_value3,
                                        guint *out_value4,
                                        guint *out_value5,
                                        GError **error);

#endif  /* MM_MODEM_HELPERS_HUAWEI_H */