Can now sometimes determine voice calls among incoming calls
This commit is contained in:
parent
4204bd82f9
commit
f57a3d7846
16
src/gsm.c
16
src/gsm.c
@ -731,6 +731,8 @@ static int _gsm_event(GSM * gsm, GSMEventType type, ...)
|
||||
event->functional.functional = va_arg(ap, unsigned int);
|
||||
break;
|
||||
case GSM_EVENT_TYPE_INCOMING_CALL:
|
||||
event->incoming_call.calltype = va_arg(ap,
|
||||
unsigned int);
|
||||
break;
|
||||
case GSM_EVENT_TYPE_MESSAGE_LIST:
|
||||
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;
|
||||
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;
|
||||
}
|
||||
if(strcmp(line, "OK") == 0)
|
||||
@ -1825,8 +1828,15 @@ static int _gsm_trigger_creg(GSM * gsm, char const * result)
|
||||
/* gsm_trigger_cring */
|
||||
static int _gsm_trigger_cring(GSM * gsm, char const * result)
|
||||
{
|
||||
/* FIXME implement the call type */
|
||||
return _gsm_event_send(gsm, GSM_EVENT_TYPE_INCOMING_CALL);
|
||||
GSMCallType calltype = GSM_CALL_TYPE_UNKNOWN;
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
||||
|
13
src/gsm.h
13
src/gsm.h
@ -23,7 +23,9 @@
|
||||
/* types */
|
||||
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;
|
||||
|
||||
typedef enum _GSMEventType
|
||||
@ -82,7 +84,7 @@ typedef enum _GSMOperatorMode
|
||||
GSM_OPERATOR_MODE_MANUAL_WITH_FALLBACK = 4
|
||||
} GSMOperatorMode;
|
||||
|
||||
typedef enum _GSMRegisrationReport
|
||||
typedef enum _GSMRegistrationReport
|
||||
{
|
||||
GSM_REGISTRATION_REPORT_DISABLE_UNSOLLICITED = 0,
|
||||
GSM_REGISTRATION_REPORT_ENABLE_UNSOLLICITED = 1,
|
||||
@ -147,6 +149,13 @@ typedef union _GSMEvent
|
||||
unsigned int functional;
|
||||
} functional;
|
||||
|
||||
/* GSM_EVENT_TYPE_INCOMING_CALL */
|
||||
struct
|
||||
{
|
||||
GSMEventType type;
|
||||
GSMCallType calltype;
|
||||
} incoming_call;
|
||||
|
||||
/* GSM_EVENT_TYPE_MESSAGE_SENT */
|
||||
struct
|
||||
{
|
||||
|
@ -1100,6 +1100,8 @@ static int _phone_gsm_event(GSMEvent * event, gpointer data)
|
||||
event->contact_list.end);
|
||||
return 0;
|
||||
case GSM_EVENT_TYPE_FUNCTIONAL:
|
||||
/* FIXME implement */
|
||||
return 0;
|
||||
case GSM_EVENT_TYPE_INCOMING_CALL:
|
||||
/* FIXME implement */
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user