summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2018-06-30 17:12:50 +0200
committerAleksander Morgado <aleksander@aleksander.es>2018-08-10 15:11:45 +0200
commitd088bb8d59ef77c100b155ac12a93f55834aa470 (patch)
tree7460090e02afdbfe4d5104fba816c6e4e7655886
parentb390c5389aa8ffbca20da190ae56edb3c780a651 (diff)
downloadModemManager-d088bb8d59ef77c100b155ac12a93f55834aa470.tar.gz
modem-helpers-qmi: new helper to transform QmiLocIndicationStatus into a GError
-rw-r--r--src/mm-modem-helpers-qmi.c37
-rw-r--r--src/mm-modem-helpers-qmi.h6
2 files changed, 42 insertions, 1 deletions
diff --git a/src/mm-modem-helpers-qmi.c b/src/mm-modem-helpers-qmi.c
index 911b9a6d6..ccc2a9122 100644
--- a/src/mm-modem-helpers-qmi.c
+++ b/src/mm-modem-helpers-qmi.c
@@ -10,9 +10,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
- * Copyright (C) 2012 Google, Inc.
+ * Copyright (C) 2012-2018 Google, Inc.
+ * Copyright (C) 2018 Aleksander Morgado <aleksander@aleksander.es>
*/
+#include <ModemManager.h>
+#include <mm-errors-types.h>
+
#include "mm-modem-helpers-qmi.h"
#include "mm-enums-types.h"
#include "mm-log.h"
@@ -1350,3 +1354,34 @@ mm_oma_session_state_failed_reason_from_qmi_oma_session_failed_reason (QmiOmaSes
return MM_OMA_SESSION_STATE_FAILED_REASON_UNKNOWN;
}
}
+
+gboolean
+mm_error_from_qmi_loc_indication_status (QmiLocIndicationStatus status,
+ GError **error)
+{
+ switch (status) {
+ case QMI_LOC_INDICATION_STATUS_SUCCESS:
+ return TRUE;
+ case QMI_LOC_INDICATION_STATUS_GENERAL_FAILURE:
+ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "LOC service: general failure");
+ return FALSE;
+ case QMI_LOC_INDICATION_STATUS_UNSUPPORTED:
+ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED, "LOC service: unsupported");
+ return FALSE;
+ case QMI_LOC_INDICATION_STATUS_INVALID_PARAMETER:
+ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS, "LOC service: invalid parameter");
+ return FALSE;
+ case QMI_LOC_INDICATION_STATUS_ENGINE_BUSY:
+ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS, "LOC service: engine busy");
+ return FALSE;
+ case QMI_LOC_INDICATION_STATUS_PHONE_OFFLINE:
+ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE, "LOC service: phone offline");
+ return FALSE;
+ case QMI_LOC_INDICATION_STATUS_TIMEOUT:
+ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_ABORTED, "LOC service: timeout");
+ return FALSE;
+ default:
+ g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, "LOC service: unknown failure");
+ return FALSE;
+ }
+}
diff --git a/src/mm-modem-helpers-qmi.h b/src/mm-modem-helpers-qmi.h
index a19851fd9..8f02b95b5 100644
--- a/src/mm-modem-helpers-qmi.h
+++ b/src/mm-modem-helpers-qmi.h
@@ -106,6 +106,12 @@ MMOmaSessionState mm_oma_session_state_from_qmi_oma_session_state (QmiOmaSession
MMOmaSessionStateFailedReason mm_oma_session_state_failed_reason_from_qmi_oma_session_failed_reason (QmiOmaSessionFailedReason qmi_session_failed_reason);
/*****************************************************************************/
+/* QMI/LOC to MM translations */
+
+gboolean mm_error_from_qmi_loc_indication_status (QmiLocIndicationStatus status,
+ GError **error);
+
+/*****************************************************************************/
/* Utility to gather current capabilities from various sources */
typedef struct {