Fix error codes.
This commit is contained in:
219
src/mm-errors.c
219
src/mm-errors.c
@@ -22,9 +22,9 @@ mm_serial_error_get_type (void)
|
|||||||
|
|
||||||
if (etype == 0) {
|
if (etype == 0) {
|
||||||
static const GEnumValue values[] = {
|
static const GEnumValue values[] = {
|
||||||
ENUM_ENTRY (MM_SERIAL_OPEN_FAILED, "Could not open the serial device"),
|
ENUM_ENTRY (MM_SERIAL_OPEN_FAILED, "SerialOpenFailed"),
|
||||||
ENUM_ENTRY (MM_SERIAL_SEND_FAILED, "Writing to serial device failed"),
|
ENUM_ENTRY (MM_SERIAL_SEND_FAILED, "SerialSendfailed"),
|
||||||
ENUM_ENTRY (MM_SERIAL_RESPONSE_TIMEOUT, "Did not receive response"),
|
ENUM_ENTRY (MM_SERIAL_RESPONSE_TIMEOUT, "SerialResponseTimeout"),
|
||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,8 +52,8 @@ mm_modem_error_get_type (void)
|
|||||||
|
|
||||||
if (etype == 0) {
|
if (etype == 0) {
|
||||||
static const GEnumValue values[] = {
|
static const GEnumValue values[] = {
|
||||||
ENUM_ENTRY (MM_MODEM_ERROR_GENERAL, "Unknown error"),
|
ENUM_ENTRY (MM_MODEM_ERROR_GENERAL, "Generial"),
|
||||||
ENUM_ENTRY (MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED, "Operation not supported"),
|
ENUM_ENTRY (MM_MODEM_ERROR_OPERATION_NOT_SUPPORTED, "OperationNotSupported"),
|
||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,10 +81,10 @@ mm_modem_connect_error_get_type (void)
|
|||||||
|
|
||||||
if (etype == 0) {
|
if (etype == 0) {
|
||||||
static const GEnumValue values[] = {
|
static const GEnumValue values[] = {
|
||||||
ENUM_ENTRY (MM_MODEM_CONNECT_ERROR_NO_CARRIER, "No carrier"),
|
ENUM_ENTRY (MM_MODEM_CONNECT_ERROR_NO_CARRIER, "NoCarrier"),
|
||||||
ENUM_ENTRY (MM_MODEM_CONNECT_ERROR_NO_DIALTONE, "No dialtone"),
|
ENUM_ENTRY (MM_MODEM_CONNECT_ERROR_NO_DIALTONE, "NoDialtone"),
|
||||||
ENUM_ENTRY (MM_MODEM_CONNECT_ERROR_BUSY, "Busy"),
|
ENUM_ENTRY (MM_MODEM_CONNECT_ERROR_BUSY, "Busy"),
|
||||||
ENUM_ENTRY (MM_MODEM_CONNECT_ERROR_NO_ANSWER, "No answer"),
|
ENUM_ENTRY (MM_MODEM_CONNECT_ERROR_NO_ANSWER, "NoAnswer"),
|
||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -94,6 +94,36 @@ mm_modem_connect_error_get_type (void)
|
|||||||
return etype;
|
return etype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GError *
|
||||||
|
mm_modem_connect_error_for_code (int error_code)
|
||||||
|
{
|
||||||
|
const char *msg;
|
||||||
|
|
||||||
|
switch (error_code) {
|
||||||
|
case MM_MODEM_CONNECT_ERROR_NO_CARRIER:
|
||||||
|
msg = "No carrier";
|
||||||
|
break;
|
||||||
|
case MM_MODEM_CONNECT_ERROR_NO_DIALTONE:
|
||||||
|
msg = "No dialtone";
|
||||||
|
break;
|
||||||
|
case MM_MODEM_CONNECT_ERROR_BUSY:
|
||||||
|
msg = "Busy";
|
||||||
|
break;
|
||||||
|
case MM_MODEM_CONNECT_ERROR_NO_ANSWER:
|
||||||
|
msg = "No answer";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
g_warning ("Invalid error code");
|
||||||
|
/* uhm... make something up (yes, ok, lie!). */
|
||||||
|
error_code = MM_MODEM_CONNECT_ERROR_NO_CARRIER;
|
||||||
|
msg = "No carrier";
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_error_new_literal (MM_MODEM_CONNECT_ERROR, error_code, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
GQuark
|
GQuark
|
||||||
mm_mobile_error_quark (void)
|
mm_mobile_error_quark (void)
|
||||||
{
|
{
|
||||||
@@ -113,57 +143,57 @@ mm_mobile_error_get_type (void)
|
|||||||
if (etype == 0) {
|
if (etype == 0) {
|
||||||
static const GEnumValue values[] = {
|
static const GEnumValue values[] = {
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_PHONE_FAILURE, "PhoneFailure"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_PHONE_FAILURE, "PhoneFailure"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NO_CONNECTION, "No connection to phone"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NO_CONNECTION, "NoConnection"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_LINK_RESERVED, "Phone-adaptor link reserved"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_LINK_RESERVED, "LinkReserved"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NOT_ALLOWED, "Operation not allowed"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NOT_ALLOWED, "OperationNotAllowed"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NOT_SUPPORTED, "Operation not supported"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NOT_SUPPORTED, "OperationNotSupported"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_PH_SIM_PIN, "PH-SIM PIN required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_PH_SIM_PIN, "PhSimPinRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_PH_FSIM_PIN, "PH-FSIM PIN required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_PH_FSIM_PIN, "PhFSimPinRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_PH_FSIM_PUK, "PH-FSIM PUK required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_PH_FSIM_PUK, "PhFSimPukRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_NOT_INSERTED, "SIM not inserted"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_NOT_INSERTED, "SimNotInserted"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_PIN, "SIM PIN required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_PIN, "SimPinRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_PUK, "SIM PUK required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_PUK, "SimPukRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_FAILURE, "SIM failure"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_FAILURE, "SimFailure"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_BUSY, "SIM busy"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_BUSY, "SimBusy"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_WRONG, "SIM wrong"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_WRONG, "SimWrong"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_WRONG_PASSWORD, "Incorrect password"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_WRONG_PASSWORD, "IncorrectPassword"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_PIN2, "SIM PIN2 required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_PIN2, "SimPin2Required"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_PUK2, "SIM PUK2 required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_SIM_PUK2, "SimPuk2Required"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_MEMORY_FULL, "Memory full"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_MEMORY_FULL, "MemoryFull"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_INVALID_INDEX, "Invalid index"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_INVALID_INDEX, "InvalidIndex"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NOT_FOUND, "Not found"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NOT_FOUND, "NotFound"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_MEMORY_FAILURE, "Memory failure"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_MEMORY_FAILURE, "MemoryFailure"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_TEXT_TOO_LONG, "Text string too long"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_TEXT_TOO_LONG, "TextTooLong"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_INVALID_CHARS, "Invalid charactes in text string"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_INVALID_CHARS, "InvalidChars"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_DIAL_STRING_TOO_LONG, "Dial string too long"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_DIAL_STRING_TOO_LONG, "DialStringTooLong"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_DIAL_STRING_INVALID, "Invalid charactes in dial string"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_DIAL_STRING_INVALID, "InvalidDialString"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NO_NETWORK, "No network service"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NO_NETWORK, "NoNetwork"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_TIMEOUT, "Network timeout"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_TIMEOUT, "NetworkTimeout"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_NOT_ALLOWED, "Network not allowed - emergency calls only"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_NOT_ALLOWED, "NetworkNotAllowed"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_PIN, "Network personalization PIN required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_PIN, "NetworkPinRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_PUK, "Network personalization PUK required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_PUK, "NetworkPukRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_SUBSET_PIN, "Network subset personalization PIN required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_SUBSET_PIN, "NetworkSubsetPinRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_SUBSET_PUK, "Network subset personalization PUK required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_NETWORK_SUBSET_PUK, "NetworkSubsetPukRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_SERVICE_PIN, "Service provider personalization PIN required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_SERVICE_PIN, "ServicePinRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_SERVICE_PUK, "Service provider personalization PUK required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_SERVICE_PUK, "ServicePukRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_CORP_PIN, "Corporate personalization PIN required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_CORP_PIN, "CorporatePinRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_CORP_PUK, "Corporate personalization PUK required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_CORP_PUK, "CorporatePukRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_HIDDEN_KEY, "Hidden key required"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_HIDDEN_KEY, "HiddenKeyRequired"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_EAP_NOT_SUPPORTED, "EAP method not supported"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_EAP_NOT_SUPPORTED, "EAPMethodNotSupported"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_INCORRECT_PARAMS, "Incorrect parameters"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_INCORRECT_PARAMS, "IncorrectParams"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_UNKNOWN, "Unknown"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_UNKNOWN, "Unknown"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_ILLEGAL_MS, "Illegal MS"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_ILLEGAL_MS, "GprsIllegalMs"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_ILLEGAL_ME, "Illegal ME"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_ILLEGAL_ME, "GprsIllegalMe"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_SERVICE_NOT_ALLOWED, "GPRS services not allowed"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_SERVICE_NOT_ALLOWED, "GprsServiceNotAllowed"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_PLMN_NOT_ALLOWED, "PLMN not allowed"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_PLMN_NOT_ALLOWED, "GprsPlmnNotAllowed"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_LOCATION_NOT_ALLOWED, "Location area not allowed"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_LOCATION_NOT_ALLOWED, "GprsLocationNotAllowed"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_ROAMING_NOT_ALLOWED, "Roaming not allowed in this location area"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_ROAMING_NOT_ALLOWED, "GprsRoamingNotAllowed"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_OPTION_NOT_SUPPORTED, "Service option not supported"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_OPTION_NOT_SUPPORTED, "GprsOptionNotSupported"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_NOT_SUBSCRIBED, "Requested service option not subscribed"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_NOT_SUBSCRIBED, "GprsNotSubscribed"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_OUT_OF_ORDER, "Service option temporarily out of order"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_OUT_OF_ORDER, "GprsOutOfOrder"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_PDP_AUTH_FAILURE, "PDP authentication failure"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_PDP_AUTH_FAILURE, "GprsPdpAuthFailure"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_UNKNOWN, "Unspecified GPRS error"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_UNKNOWN, "GprsUnspecified"),
|
||||||
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_INVALID_CLASS, "Invalid mobile class"),
|
ENUM_ENTRY (MM_MOBILE_ERROR_GPRS_INVALID_CLASS, "GprsInvalidclass"),
|
||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -173,3 +203,76 @@ mm_mobile_error_get_type (void)
|
|||||||
|
|
||||||
return etype;
|
return etype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GError *
|
||||||
|
mm_mobile_error_for_code (int error_code)
|
||||||
|
{
|
||||||
|
const char *msg;
|
||||||
|
|
||||||
|
switch (error_code) {
|
||||||
|
case MM_MOBILE_ERROR_SIM_PIN:
|
||||||
|
msg = "PIN code required";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MM_MOBILE_ERROR_PHONE_FAILURE:
|
||||||
|
case MM_MOBILE_ERROR_NO_CONNECTION:
|
||||||
|
case MM_MOBILE_ERROR_LINK_RESERVED:
|
||||||
|
case MM_MOBILE_ERROR_NOT_ALLOWED:
|
||||||
|
case MM_MOBILE_ERROR_NOT_SUPPORTED:
|
||||||
|
case MM_MOBILE_ERROR_PH_SIM_PIN:
|
||||||
|
case MM_MOBILE_ERROR_PH_FSIM_PIN:
|
||||||
|
case MM_MOBILE_ERROR_PH_FSIM_PUK:
|
||||||
|
case MM_MOBILE_ERROR_SIM_NOT_INSERTED:
|
||||||
|
case MM_MOBILE_ERROR_SIM_PUK:
|
||||||
|
case MM_MOBILE_ERROR_SIM_FAILURE:
|
||||||
|
case MM_MOBILE_ERROR_SIM_BUSY:
|
||||||
|
case MM_MOBILE_ERROR_SIM_WRONG:
|
||||||
|
case MM_MOBILE_ERROR_WRONG_PASSWORD:
|
||||||
|
case MM_MOBILE_ERROR_SIM_PIN2:
|
||||||
|
case MM_MOBILE_ERROR_SIM_PUK2:
|
||||||
|
case MM_MOBILE_ERROR_MEMORY_FULL:
|
||||||
|
case MM_MOBILE_ERROR_INVALID_INDEX:
|
||||||
|
case MM_MOBILE_ERROR_NOT_FOUND:
|
||||||
|
case MM_MOBILE_ERROR_MEMORY_FAILURE:
|
||||||
|
case MM_MOBILE_ERROR_TEXT_TOO_LONG:
|
||||||
|
case MM_MOBILE_ERROR_INVALID_CHARS:
|
||||||
|
case MM_MOBILE_ERROR_DIAL_STRING_TOO_LONG:
|
||||||
|
case MM_MOBILE_ERROR_DIAL_STRING_INVALID:
|
||||||
|
case MM_MOBILE_ERROR_NO_NETWORK:
|
||||||
|
case MM_MOBILE_ERROR_NETWORK_TIMEOUT:
|
||||||
|
case MM_MOBILE_ERROR_NETWORK_NOT_ALLOWED:
|
||||||
|
case MM_MOBILE_ERROR_NETWORK_PIN:
|
||||||
|
case MM_MOBILE_ERROR_NETWORK_PUK:
|
||||||
|
case MM_MOBILE_ERROR_NETWORK_SUBSET_PIN:
|
||||||
|
case MM_MOBILE_ERROR_NETWORK_SUBSET_PUK:
|
||||||
|
case MM_MOBILE_ERROR_SERVICE_PIN:
|
||||||
|
case MM_MOBILE_ERROR_SERVICE_PUK:
|
||||||
|
case MM_MOBILE_ERROR_CORP_PIN:
|
||||||
|
case MM_MOBILE_ERROR_CORP_PUK:
|
||||||
|
case MM_MOBILE_ERROR_HIDDEN_KEY:
|
||||||
|
case MM_MOBILE_ERROR_EAP_NOT_SUPPORTED:
|
||||||
|
case MM_MOBILE_ERROR_INCORRECT_PARAMS:
|
||||||
|
case MM_MOBILE_ERROR_UNKNOWN:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_ILLEGAL_MS:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_ILLEGAL_ME:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_SERVICE_NOT_ALLOWED:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_PLMN_NOT_ALLOWED:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_LOCATION_NOT_ALLOWED:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_ROAMING_NOT_ALLOWED:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_OPTION_NOT_SUPPORTED:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_NOT_SUBSCRIBED:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_OUT_OF_ORDER:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_PDP_AUTH_FAILURE:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_UNKNOWN:
|
||||||
|
case MM_MOBILE_ERROR_GPRS_INVALID_CLASS:
|
||||||
|
/* FIXME */
|
||||||
|
msg = "Error";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_warning ("Invalid error code");
|
||||||
|
error_code = MM_MOBILE_ERROR_UNKNOWN;
|
||||||
|
msg = "Unknown error";
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_error_new_literal (MM_MOBILE_ERROR, error_code, msg);
|
||||||
|
}
|
||||||
|
@@ -42,6 +42,7 @@ enum {
|
|||||||
|
|
||||||
GQuark mm_modem_connect_error_quark (void);
|
GQuark mm_modem_connect_error_quark (void);
|
||||||
GType mm_modem_connect_error_get_type (void);
|
GType mm_modem_connect_error_get_type (void);
|
||||||
|
GError *mm_modem_connect_error_for_code (int error_code);
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -106,5 +107,6 @@ enum {
|
|||||||
|
|
||||||
GQuark mm_mobile_error_quark (void);
|
GQuark mm_mobile_error_quark (void);
|
||||||
GType mm_mobile_error_get_type (void);
|
GType mm_mobile_error_get_type (void);
|
||||||
|
GError *mm_mobile_error_for_code (int error_code);
|
||||||
|
|
||||||
#endif /* MM_MODEM_ERROR_H */
|
#endif /* MM_MODEM_ERROR_H */
|
||||||
|
@@ -672,7 +672,8 @@ scan_done (MMSerial *serial,
|
|||||||
if (err) {
|
if (err) {
|
||||||
g_error ("Invalid regular expression: %s", err->message);
|
g_error ("Invalid regular expression: %s", err->message);
|
||||||
g_error_free (err);
|
g_error_free (err);
|
||||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, "%s", "Could not parse scan results.");
|
info->error = g_error_new_literal (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
|
||||||
|
"Could not parse scan results.");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,8 +778,8 @@ get_signal_quality_done (MMSerial *serial,
|
|||||||
MM_GENERIC_GSM_GET_PRIVATE (serial)->signal_quality = quality;
|
MM_GENERIC_GSM_GET_PRIVATE (serial)->signal_quality = quality;
|
||||||
mm_callback_info_set_result (info, GUINT_TO_POINTER (quality), NULL);
|
mm_callback_info_set_result (info, GUINT_TO_POINTER (quality), NULL);
|
||||||
} else
|
} else
|
||||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
|
info->error = g_error_new_literal (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
|
||||||
"%s", "Could not parse signal quality results");
|
"Could not parse signal quality results");
|
||||||
}
|
}
|
||||||
|
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
|
@@ -455,8 +455,8 @@ mm_manager_class_init (MMManagerClass *manager_class)
|
|||||||
&dbus_glib_mm_manager_object_info);
|
&dbus_glib_mm_manager_object_info);
|
||||||
|
|
||||||
/* FIXME: Sigh, these don't work either */
|
/* FIXME: Sigh, these don't work either */
|
||||||
#if 0
|
|
||||||
dbus_g_error_domain_register (MM_SERIAL_ERROR, NULL, MM_TYPE_SERIAL_ERROR);
|
dbus_g_error_domain_register (MM_SERIAL_ERROR, NULL, MM_TYPE_SERIAL_ERROR);
|
||||||
|
#if 0
|
||||||
dbus_g_error_domain_register (MM_MODEM_ERROR, NULL, MM_TYPE_MODEM_ERROR);
|
dbus_g_error_domain_register (MM_MODEM_ERROR, NULL, MM_TYPE_MODEM_ERROR);
|
||||||
dbus_g_error_domain_register (MM_MODEM_CONNECT_ERROR, NULL, MM_TYPE_MODEM_CONNECT_ERROR);
|
dbus_g_error_domain_register (MM_MODEM_CONNECT_ERROR, NULL, MM_TYPE_MODEM_CONNECT_ERROR);
|
||||||
dbus_g_error_domain_register (MM_MOBILE_ERROR, NULL, MM_TYPE_MOBILE_ERROR);
|
dbus_g_error_domain_register (MM_MOBILE_ERROR, NULL, MM_TYPE_MOBILE_ERROR);
|
||||||
|
@@ -162,7 +162,7 @@ mm_serial_parser_v1_parse (gpointer data,
|
|||||||
{
|
{
|
||||||
MMSerialParserV1 *parser = (MMSerialParserV1 *) data;
|
MMSerialParserV1 *parser = (MMSerialParserV1 *) data;
|
||||||
GMatchInfo *match_info;
|
GMatchInfo *match_info;
|
||||||
const char *msg;
|
GError *local_error;
|
||||||
int code;
|
int code;
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
|
|
||||||
@@ -181,6 +181,7 @@ mm_serial_parser_v1_parse (gpointer data,
|
|||||||
|
|
||||||
/* Now failures */
|
/* Now failures */
|
||||||
code = MM_MOBILE_ERROR_UNKNOWN;
|
code = MM_MOBILE_ERROR_UNKNOWN;
|
||||||
|
local_error = NULL;
|
||||||
|
|
||||||
found = g_regex_match_full (parser->regex_detailed_error,
|
found = g_regex_match_full (parser->regex_detailed_error,
|
||||||
response->str, response->len,
|
response->str, response->len,
|
||||||
@@ -198,19 +199,9 @@ mm_serial_parser_v1_parse (gpointer data,
|
|||||||
} else
|
} else
|
||||||
found = g_regex_match_full (parser->regex_unknown_error, response->str, response->len, 0, 0, NULL, NULL);
|
found = g_regex_match_full (parser->regex_unknown_error, response->str, response->len, 0, 0, NULL, NULL);
|
||||||
|
|
||||||
if (found) {
|
if (found)
|
||||||
#if 0
|
local_error = mm_mobile_error_for_code (code);
|
||||||
/* FIXME: This does not work for some reason. */
|
else {
|
||||||
GEnumValue *enum_value;
|
|
||||||
|
|
||||||
enum_value = g_enum_get_value ((GEnumClass *) g_type_class_peek_static (), code);
|
|
||||||
msg = enum_value->value_nick;
|
|
||||||
#endif
|
|
||||||
msg = "FIXME";
|
|
||||||
|
|
||||||
g_debug ("Got error code %d: %s", code, msg);
|
|
||||||
g_set_error (error, MM_MOBILE_ERROR, code, "%s", msg);
|
|
||||||
} else {
|
|
||||||
found = g_regex_match_full (parser->regex_connect_failed,
|
found = g_regex_match_full (parser->regex_connect_failed,
|
||||||
response->str, response->len,
|
response->str, response->len,
|
||||||
0, 0, &match_info, NULL);
|
0, 0, &match_info, NULL);
|
||||||
@@ -219,36 +210,32 @@ mm_serial_parser_v1_parse (gpointer data,
|
|||||||
|
|
||||||
str = g_match_info_fetch (match_info, 1);
|
str = g_match_info_fetch (match_info, 1);
|
||||||
if (str) {
|
if (str) {
|
||||||
if (!strcmp (str, "NO CARRIER")) {
|
if (!strcmp (str, "NO CARRIER"))
|
||||||
code = MM_MODEM_CONNECT_ERROR_NO_CARRIER;
|
code = MM_MODEM_CONNECT_ERROR_NO_CARRIER;
|
||||||
msg = "No carrier";
|
else if (!strcmp (str, "BUSY"))
|
||||||
} else if (!strcmp (str, "BUSY")) {
|
|
||||||
code = MM_MODEM_CONNECT_ERROR_BUSY;
|
code = MM_MODEM_CONNECT_ERROR_BUSY;
|
||||||
msg = "Busy";
|
else if (!strcmp (str, "NO ANSWER"))
|
||||||
} else if (!strcmp (str, "NO ANSWER")) {
|
|
||||||
code = MM_MODEM_CONNECT_ERROR_NO_ANSWER;
|
code = MM_MODEM_CONNECT_ERROR_NO_ANSWER;
|
||||||
msg = "No answer";
|
else if (!strcmp (str, "NO DIALTONE"))
|
||||||
} else if (!strcmp (str, "NO DIALTONE")) {
|
|
||||||
code = MM_MODEM_CONNECT_ERROR_NO_DIALTONE;
|
code = MM_MODEM_CONNECT_ERROR_NO_DIALTONE;
|
||||||
msg = "No dialtone";
|
else
|
||||||
} else {
|
|
||||||
g_warning ("Got matching connect failure, but can't parse it");
|
|
||||||
/* uhm... make something up (yes, ok, lie!). */
|
/* uhm... make something up (yes, ok, lie!). */
|
||||||
code = MM_MODEM_CONNECT_ERROR_NO_CARRIER;
|
code = MM_MODEM_CONNECT_ERROR_NO_CARRIER;
|
||||||
msg = "No carrier";
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (str);
|
g_free (str);
|
||||||
}
|
}
|
||||||
g_match_info_free (match_info);
|
g_match_info_free (match_info);
|
||||||
|
|
||||||
g_debug ("Got connect failure code %d: %s", code, msg);
|
local_error = mm_modem_connect_error_for_code (code);
|
||||||
g_set_error (error, MM_MODEM_CONNECT_ERROR, code, "%s", msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (local_error) {
|
||||||
|
g_debug ("Got failure code %d: %s", local_error->code, local_error->message);
|
||||||
|
g_propagate_error (error, local_error);
|
||||||
|
}
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -376,9 +376,9 @@ mm_serial_timed_out (gpointer data)
|
|||||||
|
|
||||||
priv->timeout_id = 0;
|
priv->timeout_id = 0;
|
||||||
|
|
||||||
error = g_error_new (MM_SERIAL_ERROR,
|
error = g_error_new_literal (MM_SERIAL_ERROR,
|
||||||
MM_SERIAL_RESPONSE_TIMEOUT,
|
MM_SERIAL_RESPONSE_TIMEOUT,
|
||||||
"%s", "Serial command timed out");
|
"Serial command timed out");
|
||||||
/* FIXME: This is not completely correct - if the response finally arrives and there's
|
/* FIXME: This is not completely correct - if the response finally arrives and there's
|
||||||
some other command waiting for response right now, the other command will
|
some other command waiting for response right now, the other command will
|
||||||
get the output of the timed out command. Maybe flashing would help here? */
|
get the output of the timed out command. Maybe flashing would help here? */
|
||||||
@@ -480,6 +480,8 @@ data_available (GIOChannel *source,
|
|||||||
if (parse_response (self, priv->response, &err))
|
if (parse_response (self, priv->response, &err))
|
||||||
mm_serial_got_response (self, err);
|
mm_serial_got_response (self, err);
|
||||||
|
|
||||||
|
/* FIXME: Make sure the string doesn't grow too long */
|
||||||
|
|
||||||
} while (bytes_read == SERIAL_BUF_SIZE || status == G_IO_STATUS_AGAIN);
|
} while (bytes_read == SERIAL_BUF_SIZE || status == G_IO_STATUS_AGAIN);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Reference in New Issue
Block a user