modem-helpers-qmi: new helper to transform QmiLocIndicationStatus into a GError
This commit is contained in:

committed by
Dan Williams

parent
9e42a19742
commit
fc520eb073
@@ -10,9 +10,13 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details:
|
* 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-modem-helpers-qmi.h"
|
||||||
#include "mm-enums-types.h"
|
#include "mm-enums-types.h"
|
||||||
#include "mm-log.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;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -105,6 +105,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);
|
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 */
|
/* Utility to gather current capabilities from various sources */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user