Now rejecting calls correctly

This commit is contained in:
Pierre Pronchery 2010-05-10 01:39:08 +00:00
parent 7fafe3261f
commit 9a8c41f8dc
7 changed files with 42 additions and 2 deletions

View File

@ -110,7 +110,7 @@ void on_phone_call_reject(gpointer data)
{
Phone * phone = data;
phone_call_hangup(phone);
phone_call_reject(phone);
}

View File

@ -455,6 +455,13 @@ int gsm_call_hangup(GSM * gsm)
}
/* gsm_call_reject */
int gsm_call_reject(GSM * gsm)
{
return gsm_modem_call_reject(gsm->modem);
}
/* gsm_enter_sim_pin */
int gsm_enter_sim_pin(GSM * gsm, char const * code)
{

View File

@ -71,8 +71,9 @@ typedef enum _GSMError
GSM_ERROR_NO_CARRIER,
GSM_ERROR_NO_DIALTONE,
GSM_ERROR_OPERATOR_MODE_FAILED,
GSM_ERROR_SIGNAL_LEVEL_FAILED,
GSM_ERROR_REJECT_FAILED,
GSM_ERROR_RESET_FAILED,
GSM_ERROR_SIGNAL_LEVEL_FAILED,
GSM_ERROR_SIM_PIN_REQUIRED,
GSM_ERROR_SIM_PIN_WRONG
} GSMError;
@ -281,6 +282,7 @@ int gsm_call_answer(GSM * gsm);
int gsm_call(GSM * gsm, GSMCallType calltype, char const * number);
int gsm_call_contact(GSM * gsm, GSMCallType calltype, unsigned int index);
int gsm_call_hangup(GSM * gsm);
int gsm_call_reject(GSM * gsm);
int gsm_enter_sim_pin(GSM * gsm, char const * code);

View File

@ -182,6 +182,23 @@ int gsm_modem_call_last(GSMModem * gsmm, GSMCallType calltype)
}
/* gsm_modem_call_reject */
static void _modem_call_reject_callback(GSM * gsm);
int gsm_modem_call_reject(GSMModem * gsmm)
{
char const cmd[] = "AT+CHUP";
return gsm_queue_full(gsmm->gsm, GSM_PRIORITY_HIGH, cmd,
GSM_ERROR_REJECT_FAILED, _modem_call_reject_callback);
}
static void _modem_call_reject_callback(GSM * gsm)
{
gsm_is_phone_active(gsm);
}
/* gsm_modem_enter_sim_pin */
static void _modem_enter_sim_pin_callback(GSM * gsm);

View File

@ -47,6 +47,7 @@ int gsm_modem_call_contact(GSMModem * gsmm, GSMCallType calltype,
unsigned int index);
int gsm_modem_call_hangup(GSMModem * gsmm);
int gsm_modem_call_last(GSMModem * gsmm, GSMCallType calltype);
int gsm_modem_call_reject(GSMModem * gsmm);
int gsm_modem_enter_sim_pin(GSMModem * gsmm, char const * code);

View File

@ -323,6 +323,13 @@ void phone_call_hangup(Phone * phone)
}
/* phone_call_reject */
void phone_call_reject(Phone * phone)
{
gsm_call_reject(phone->gsm);
}
/* phone_code_append */
int phone_code_append(Phone * phone, char character)
{
@ -807,6 +814,7 @@ static struct
{ "Phone functional", gsm_is_functional },
{ "Registered", gsm_is_registered },
{ "Registration", gsm_fetch_registration },
{ "Reject call", gsm_call_reject },
{ "Signal level", gsm_fetch_signal_level },
{ "SIM PIN status", gsm_is_pin_needed },
{ "SIM PIN valid", gsm_is_pin_valid },
@ -1496,7 +1504,9 @@ static void _phone_set_status(Phone * phone, GSMStatus status)
GSM_OPERATOR_FORMAT_LONG);
gsm_fetch_operator(phone->gsm);
gsm_fetch_signal_level(phone->gsm);
#ifndef DEBUG
_phone_track(phone, PHONE_TRACK_SIGNAL_LEVEL, TRUE);
#endif
return;
}
_phone_track(phone, PHONE_TRACK_REGISTRATION, track_registration);
@ -1573,8 +1583,10 @@ static int _phone_gsm_event(GSMEvent * event, gpointer data)
GSM_OPERATOR_MODE_AUTOMATIC);
gsm_set_registration_report(phone->gsm, report);
gsm_is_phone_active(phone->gsm);
#ifndef DEBUG
_phone_track(phone, PHONE_TRACK_CONTACT_LIST, TRUE);
_phone_track(phone, PHONE_TRACK_MESSAGE_LIST, TRUE);
#endif
return 0;
case GSM_EVENT_TYPE_INCOMING_CALL:
phone_show_call(phone, TRUE, PHONE_CALL_INCOMING, "",

View File

@ -76,6 +76,7 @@ void phone_show_write(Phone * phone, gboolean show);
/* calls */
void phone_call_answer(Phone * phone);
void phone_call_hangup(Phone * phone);
void phone_call_reject(Phone * phone);
/* code */
int phone_code_append(Phone * phone, char character);