api,errors: new MMCarrierLockError type
This new error type will be used to report errors in the carrier lock operations performed through ModemManager. They have a one to one mapping to the MBIM status specific errors.
This commit is contained in:
@@ -76,12 +76,14 @@ MM_CONNECTION_ERROR_DBUS_PREFIX
|
||||
MM_SERIAL_ERROR_DBUS_PREFIX
|
||||
MM_MESSAGE_ERROR_DBUS_PREFIX
|
||||
MM_CDMA_ACTIVATION_ERROR_DBUS_PREFIX
|
||||
MM_CARRIER_LOCK_ERROR_DBUS_PREFIX
|
||||
MMCoreError
|
||||
MMMobileEquipmentError
|
||||
MMConnectionError
|
||||
MMSerialError
|
||||
MMMessageError
|
||||
MMCdmaActivationError
|
||||
MMCarrierLockError
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
* ModemManager interface.
|
||||
**/
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* MM_CORE_ERROR_DBUS_PREFIX:
|
||||
*
|
||||
@@ -85,6 +87,17 @@
|
||||
*/
|
||||
#define MM_CDMA_ACTIVATION_ERROR_DBUS_PREFIX MM_DBUS_ERROR_PREFIX ".CdmaActivation"
|
||||
|
||||
/**
|
||||
* MM_CARRIER_LOCK_ERROR_DBUS_PREFIX:
|
||||
*
|
||||
* DBus prefix for #MMCarrierLockError errors.
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
#define MM_CARRIER_LOCK_ERROR_DBUS_PREFIX MM_DBUS_ERROR_PREFIX ".CarrierLock"
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* MMCoreError:
|
||||
* @MM_CORE_ERROR_FAILED: Operation failed.
|
||||
@@ -606,4 +619,30 @@ typedef enum { /*< underscore_name=mm_cdma_activation_error >*/
|
||||
MM_CDMA_ACTIVATION_ERROR_START_FAILED = 9 /*< nick=StartFailed >*/
|
||||
} MMCdmaActivationError;
|
||||
|
||||
/**
|
||||
* MMCarrierLockError:
|
||||
* @MM_CARRIER_LOCK_ERROR_UNKNOWN: Unknown error.
|
||||
* @MM_CARRIER_LOCK_ERROR_INVALID_SIGNATURE: Invalid signature.
|
||||
* @MM_CARRIER_LOCK_ERROR_INVALID_IMEI: Invalid IMEI.
|
||||
* @MM_CARRIER_LOCK_ERROR_INVALID_TIMESTAMP: Invalid timestamp.
|
||||
* @MM_CARRIER_LOCK_ERROR_NETWORK_LIST_TOO_LARGE: Network list too large.
|
||||
* @MM_CARRIER_LOCK_ERROR_SIGNATURE_ALGORITHM_NOT_SUPPORTED: Algorithm not supported.
|
||||
* @MM_CARRIER_LOCK_ERROR_FEATURE_NOT_SUPPORTED: Feature not supported.
|
||||
* @MM_CARRIER_LOCK_ERROR_DECODE_OR_PARSING_ERROR: Decode or parsing error.
|
||||
*
|
||||
* Carrier lock operation errors.
|
||||
*
|
||||
* Since: 1.24
|
||||
*/
|
||||
typedef enum { /*< underscore_name=mm_carrier_lock_error >*/
|
||||
MM_CARRIER_LOCK_ERROR_UNKNOWN = 0, /*< nick=Unknown >*/
|
||||
MM_CARRIER_LOCK_ERROR_INVALID_SIGNATURE = 1, /*< nick=InvalidSignature >*/
|
||||
MM_CARRIER_LOCK_ERROR_INVALID_IMEI = 2, /*< nick=InvalidImei >*/
|
||||
MM_CARRIER_LOCK_ERROR_INVALID_TIMESTAMP = 3, /*< nick=InvalidTimestamp >*/
|
||||
MM_CARRIER_LOCK_ERROR_NETWORK_LIST_TOO_LARGE = 6, /*< nick=NetworkListTooLarge >*/
|
||||
MM_CARRIER_LOCK_ERROR_SIGNATURE_ALGORITHM_NOT_SUPPORTED = 7, /*< nick=SignatureAlgorithmNotSupported >*/
|
||||
MM_CARRIER_LOCK_ERROR_FEATURE_NOT_SUPPORTED = 8, /*< nick=FeatureNotSupported >*/
|
||||
MM_CARRIER_LOCK_ERROR_DECODE_OR_PARSING_ERROR = 9, /*< nick=DecodeOrParsingError >*/
|
||||
} MMCarrierLockError;
|
||||
|
||||
#endif /* _MODEMMANAGER_ERRORS_H_ */
|
||||
|
||||
@@ -2081,6 +2081,7 @@ mm_common_register_errors (void)
|
||||
aux |= MM_SERIAL_ERROR;
|
||||
aux |= MM_MESSAGE_ERROR;
|
||||
aux |= MM_CDMA_ACTIVATION_ERROR;
|
||||
aux |= MM_CARRIER_LOCK_ERROR;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -520,6 +520,27 @@ cdma_activation_error_get_string (MMCdmaActivationError code)
|
||||
return (code < G_N_ELEMENTS (cdma_activation_error_messages)) ? cdma_activation_error_messages[code] : NULL;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* Carrier lock errors */
|
||||
|
||||
/* Human friendly messages for each error type */
|
||||
static const gchar *carrier_lock_error_messages[] = {
|
||||
[MM_CARRIER_LOCK_ERROR_UNKNOWN] = "Unknown",
|
||||
[MM_CARRIER_LOCK_ERROR_INVALID_SIGNATURE] = "Invalid signature",
|
||||
[MM_CARRIER_LOCK_ERROR_INVALID_IMEI] = "Invalid IMEI",
|
||||
[MM_CARRIER_LOCK_ERROR_INVALID_TIMESTAMP] = "Invalid timestamp",
|
||||
[MM_CARRIER_LOCK_ERROR_NETWORK_LIST_TOO_LARGE] = "Network list too large",
|
||||
[MM_CARRIER_LOCK_ERROR_SIGNATURE_ALGORITHM_NOT_SUPPORTED] = "Signature algorithm not supported",
|
||||
[MM_CARRIER_LOCK_ERROR_FEATURE_NOT_SUPPORTED] = "Feature not supported",
|
||||
[MM_CARRIER_LOCK_ERROR_DECODE_OR_PARSING_ERROR] = "Decode or parsing error",
|
||||
};
|
||||
|
||||
static const gchar *
|
||||
carrier_lock_error_get_string (MMCarrierLockError code)
|
||||
{
|
||||
return (code < G_N_ELEMENTS (carrier_lock_error_messages)) ? carrier_lock_error_messages[code] : NULL;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* Registered error mappings */
|
||||
|
||||
@@ -685,6 +706,8 @@ mm_normalize_error (const GError *error)
|
||||
return normalize_mm_error (error, message_error_get_string (error->code), "message");
|
||||
if (error->domain == MM_CDMA_ACTIVATION_ERROR)
|
||||
return normalize_mm_error (error, cdma_activation_error_get_string (error->code), "CDMA activation");
|
||||
if (error->domain == MM_CARRIER_LOCK_ERROR)
|
||||
return normalize_mm_error (error, carrier_lock_error_get_string (error->code), "carrier lock");
|
||||
|
||||
/* Normalize mapped errors */
|
||||
return normalize_mapped_error (error);
|
||||
|
||||
@@ -1566,18 +1566,20 @@ mm_register_mbim_errors (void)
|
||||
/* MBIM_STATUS_ERROR_AUTH_SYNC_FAILURE */
|
||||
/* MBIM_STATUS_ERROR_AUTH_AMF_NOT_SET */
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_CONTEXT_NOT_SUPPORTED, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED);
|
||||
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_SMS_UNKNOWN_SMSC_ADDRESS, MM_MESSAGE_ERROR, MM_MESSAGE_ERROR_SMSC_ADDRESS_UNKNOWN);
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_SMS_NETWORK_TIMEOUT, MM_MESSAGE_ERROR, MM_MESSAGE_ERROR_NETWORK_TIMEOUT);
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_SMS_LANG_NOT_SUPPORTED, MM_MESSAGE_ERROR, MM_MESSAGE_ERROR_NOT_SUPPORTED);
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_SMS_ENCODING_NOT_SUPPORTED, MM_MESSAGE_ERROR, MM_MESSAGE_ERROR_NOT_SUPPORTED);
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_SMS_FORMAT_NOT_SUPPORTED, MM_MESSAGE_ERROR, MM_MESSAGE_ERROR_NOT_SUPPORTED);
|
||||
/* MBIM_STATUS_ERROR_INVALID_SIGNATURE */
|
||||
/* MBIM_STATUS_ERROR_INVALID_IMEI */
|
||||
/* MBIM_STATUS_ERROR_INVALID_TIMESTAMP */
|
||||
/* MBIM_STATUS_ERROR_NETWORK_LIST_TOO_LARGE */
|
||||
/* MBIM_STATUS_ERROR_SIGNATURE_ALGORITHM_NOT_SUPPORTED */
|
||||
/* MBIM_STATUS_ERROR_FEATURE_NOT_SUPPORTED */
|
||||
/* MBIM_STATUS_ERROR_DECODE_OR_PARSING_ERROR */
|
||||
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_INVALID_SIGNATURE, MM_CARRIER_LOCK_ERROR, MM_CARRIER_LOCK_ERROR_INVALID_SIGNATURE);
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_INVALID_IMEI, MM_CARRIER_LOCK_ERROR, MM_CARRIER_LOCK_ERROR_INVALID_IMEI);
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_INVALID_TIMESTAMP, MM_CARRIER_LOCK_ERROR, MM_CARRIER_LOCK_ERROR_INVALID_TIMESTAMP);
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_NETWORK_LIST_TOO_LARGE, MM_CARRIER_LOCK_ERROR, MM_CARRIER_LOCK_ERROR_NETWORK_LIST_TOO_LARGE);
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_SIGNATURE_ALGORITHM_NOT_SUPPORTED, MM_CARRIER_LOCK_ERROR, MM_CARRIER_LOCK_ERROR_SIGNATURE_ALGORITHM_NOT_SUPPORTED);
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_FEATURE_NOT_SUPPORTED, MM_CARRIER_LOCK_ERROR, MM_CARRIER_LOCK_ERROR_FEATURE_NOT_SUPPORTED);
|
||||
mm_register_error_mapping (MBIM_STATUS_ERROR, MBIM_STATUS_ERROR_DECODE_OR_PARSING_ERROR, MM_CARRIER_LOCK_ERROR, MM_CARRIER_LOCK_ERROR_DECODE_OR_PARSING_ERROR);
|
||||
|
||||
g_once_init_leave (&mbim_errors_registered, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user