Can now sometimes determine voice calls among incoming calls

This commit is contained in:
Pierre Pronchery 2010-05-02 02:09:11 +00:00
parent 4204bd82f9
commit f57a3d7846
3 changed files with 26 additions and 5 deletions

View File

@ -731,6 +731,8 @@ static int _gsm_event(GSM * gsm, GSMEventType type, ...)
event->functional.functional = va_arg(ap, unsigned int); event->functional.functional = va_arg(ap, unsigned int);
break; break;
case GSM_EVENT_TYPE_INCOMING_CALL: case GSM_EVENT_TYPE_INCOMING_CALL:
event->incoming_call.calltype = va_arg(ap,
unsigned int);
break; break;
case GSM_EVENT_TYPE_MESSAGE_LIST: case GSM_EVENT_TYPE_MESSAGE_LIST:
event->message_list.start = va_arg(ap, unsigned int); event->message_list.start = va_arg(ap, unsigned int);
@ -1400,7 +1402,8 @@ static int _gsm_parse_line(GSM * gsm, char const * line, gboolean * answered)
return 0; return 0;
if(strcmp(line, "RING") == 0) if(strcmp(line, "RING") == 0)
{ {
_gsm_event(gsm, GSM_EVENT_TYPE_INCOMING_CALL); _gsm_event(gsm, GSM_EVENT_TYPE_INCOMING_CALL,
GSM_CALL_TYPE_UNKNOWN);
return 0; return 0;
} }
if(strcmp(line, "OK") == 0) if(strcmp(line, "OK") == 0)
@ -1825,8 +1828,15 @@ static int _gsm_trigger_creg(GSM * gsm, char const * result)
/* gsm_trigger_cring */ /* gsm_trigger_cring */
static int _gsm_trigger_cring(GSM * gsm, char const * result) static int _gsm_trigger_cring(GSM * gsm, char const * result)
{ {
/* FIXME implement the call type */ GSMCallType calltype = GSM_CALL_TYPE_UNKNOWN;
return _gsm_event_send(gsm, GSM_EVENT_TYPE_INCOMING_CALL);
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s(\"%s\")\n", __func__, result);
#endif
/* XXX implement the other call types */
if(strcmp(result, "VOICE") == 0)
calltype = GSM_CALL_TYPE_VOICE;
return _gsm_event(gsm, GSM_EVENT_TYPE_INCOMING_CALL, calltype);
} }

View File

@ -23,7 +23,9 @@
/* types */ /* types */
typedef enum _GSMCallType typedef enum _GSMCallType
{ {
GSM_CALL_TYPE_DATA, GSM_CALL_TYPE_VOICE GSM_CALL_TYPE_UNKNOWN = 0,
GSM_CALL_TYPE_DATA,
GSM_CALL_TYPE_VOICE
} GSMCallType; } GSMCallType;
typedef enum _GSMEventType typedef enum _GSMEventType
@ -82,7 +84,7 @@ typedef enum _GSMOperatorMode
GSM_OPERATOR_MODE_MANUAL_WITH_FALLBACK = 4 GSM_OPERATOR_MODE_MANUAL_WITH_FALLBACK = 4
} GSMOperatorMode; } GSMOperatorMode;
typedef enum _GSMRegisrationReport typedef enum _GSMRegistrationReport
{ {
GSM_REGISTRATION_REPORT_DISABLE_UNSOLLICITED = 0, GSM_REGISTRATION_REPORT_DISABLE_UNSOLLICITED = 0,
GSM_REGISTRATION_REPORT_ENABLE_UNSOLLICITED = 1, GSM_REGISTRATION_REPORT_ENABLE_UNSOLLICITED = 1,
@ -147,6 +149,13 @@ typedef union _GSMEvent
unsigned int functional; unsigned int functional;
} functional; } functional;
/* GSM_EVENT_TYPE_INCOMING_CALL */
struct
{
GSMEventType type;
GSMCallType calltype;
} incoming_call;
/* GSM_EVENT_TYPE_MESSAGE_SENT */ /* GSM_EVENT_TYPE_MESSAGE_SENT */
struct struct
{ {

View File

@ -1100,6 +1100,8 @@ static int _phone_gsm_event(GSMEvent * event, gpointer data)
event->contact_list.end); event->contact_list.end);
return 0; return 0;
case GSM_EVENT_TYPE_FUNCTIONAL: case GSM_EVENT_TYPE_FUNCTIONAL:
/* FIXME implement */
return 0;
case GSM_EVENT_TYPE_INCOMING_CALL: case GSM_EVENT_TYPE_INCOMING_CALL:
/* FIXME implement */ /* FIXME implement */
return 0; return 0;