Files
ModemManager/plugins/huawei/mm-modem-helpers-huawei.h
T
David McCullough bd0ffd24f1 huawei: improve support for network time on Huawei modules
Third revision of Huawei nwtime support.  Takes on feedback from the
mailing list including helpers,  some basic tests and use of the ^NTCT
command to determine network time support (^NWTIME).  Expanded test cases,
more use of g_assert and more logical helper return values/errors.

Signed-off-by: David McCullough <david.mccullough@accelecon.com>
2014-08-11 18:31:46 +02:00

133 lines
5.8 KiB
C

/* -*- 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);
/*****************************************************************************/
/* ^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);
#endif /* MM_MODEM_HELPERS_HUAWEI_H */