mirror of git://git.sysmocom.de/ofono
common,atmodem: rename & move at_util_call_compare_by_status to common.c
at_util_call_compare_by_status is used by several modem drivers.
This commit is contained in:
parent
a09aa1c6ea
commit
528f4838fa
|
@ -73,17 +73,6 @@ void decode_at_error(struct ofono_error *error, const char *final)
|
|||
}
|
||||
}
|
||||
|
||||
gint at_util_call_compare_by_status(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
const struct ofono_call *call = a;
|
||||
int status = GPOINTER_TO_INT(b);
|
||||
|
||||
if (status != call->status)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
gint at_util_call_compare_by_phone_number(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
const struct ofono_call *call = a;
|
||||
|
|
|
@ -56,7 +56,7 @@ enum at_util_charset {
|
|||
typedef void (*at_util_sim_inserted_cb_t)(gboolean present, void *userdata);
|
||||
|
||||
void decode_at_error(struct ofono_error *error, const char *final);
|
||||
gint at_util_call_compare_by_status(gconstpointer a, gconstpointer b);
|
||||
gint ofono_call_compare_by_status(gconstpointer a, gconstpointer b);
|
||||
gint at_util_call_compare_by_phone_number(gconstpointer a, gconstpointer b);
|
||||
gint at_util_call_compare_by_id(gconstpointer a, gconstpointer b);
|
||||
GSList *at_util_parse_clcc(GAtResult *result, unsigned int *mpty_ids);
|
||||
|
|
|
@ -660,13 +660,13 @@ static void ring_notify(GAtResult *result, gpointer user_data)
|
|||
/* See comment in CRING */
|
||||
if (g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_WAITING),
|
||||
at_util_call_compare_by_status))
|
||||
ofono_call_compare_by_status))
|
||||
return;
|
||||
|
||||
/* RING can repeat, ignore if we already have an incoming call */
|
||||
if (g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status))
|
||||
ofono_call_compare_by_status))
|
||||
return;
|
||||
|
||||
/* Generate an incoming call of unknown type */
|
||||
|
@ -698,13 +698,13 @@ static void cring_notify(GAtResult *result, gpointer user_data)
|
|||
*/
|
||||
if (g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_WAITING),
|
||||
at_util_call_compare_by_status))
|
||||
ofono_call_compare_by_status))
|
||||
return;
|
||||
|
||||
/* CRING can repeat, ignore if we already have an incoming call */
|
||||
if (g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status))
|
||||
ofono_call_compare_by_status))
|
||||
return;
|
||||
|
||||
g_at_result_iter_init(&iter, result);
|
||||
|
@ -748,7 +748,7 @@ static void clip_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
l = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
if (l == NULL) {
|
||||
ofono_error("CLIP for unknown call");
|
||||
return;
|
||||
|
@ -810,7 +810,7 @@ static void cdip_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
l = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
if (l == NULL) {
|
||||
ofono_error("CDIP for unknown call");
|
||||
return;
|
||||
|
@ -859,7 +859,7 @@ static void cnap_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
l = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
if (l == NULL) {
|
||||
ofono_error("CNAP for unknown call");
|
||||
return;
|
||||
|
@ -913,7 +913,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
|
|||
/* Some modems resend CCWA, ignore it the second time around */
|
||||
if (g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_WAITING),
|
||||
at_util_call_compare_by_status))
|
||||
ofono_call_compare_by_status))
|
||||
return;
|
||||
|
||||
g_at_result_iter_init(&iter, result);
|
||||
|
|
|
@ -84,12 +84,12 @@ static GSList *find_dialing(GSList *calls)
|
|||
GSList *c;
|
||||
|
||||
c = g_slist_find_custom(calls, GINT_TO_POINTER(CALL_STATUS_DIALING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
|
||||
if (c == NULL)
|
||||
c = g_slist_find_custom(calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_ALERTING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -759,7 +759,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
|
|||
/* CCWA can repeat, ignore if we already have an waiting call */
|
||||
if (g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_WAITING),
|
||||
at_util_call_compare_by_status))
|
||||
ofono_call_compare_by_status))
|
||||
return;
|
||||
|
||||
/* some phones may send extra CCWA after active call is ended
|
||||
|
@ -768,7 +768,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
|
|||
*/
|
||||
if (g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status))
|
||||
ofono_call_compare_by_status))
|
||||
return;
|
||||
|
||||
|
||||
|
@ -811,7 +811,7 @@ static gboolean clip_timeout(gpointer user_data)
|
|||
|
||||
l = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
|
||||
if (l == NULL)
|
||||
return FALSE;
|
||||
|
@ -840,12 +840,12 @@ static void ring_notify(GAtResult *result, gpointer user_data)
|
|||
/* RING can repeat, ignore if we already have an incoming call */
|
||||
if (g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status))
|
||||
ofono_call_compare_by_status))
|
||||
return;
|
||||
|
||||
waiting = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_WAITING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
|
||||
/* If we started receiving RINGS but have a waiting call, most
|
||||
* likely all other calls were dropped and we just didn't get
|
||||
|
@ -890,7 +890,7 @@ static void clip_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
l = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
|
||||
if (l == NULL) {
|
||||
ofono_error("CLIP for unknown call");
|
||||
|
@ -1006,7 +1006,7 @@ static void ciev_callsetup_notify(struct ofono_voicecall *vc,
|
|||
|
||||
waiting = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_WAITING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
|
||||
/* This is a truly bizarre case not covered at all by the specification
|
||||
* (yes, they are complete idiots). Here we assume the other side is
|
||||
|
@ -1085,7 +1085,7 @@ static void ciev_callsetup_notify(struct ofono_voicecall *vc,
|
|||
{
|
||||
GSList *o = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_DIALING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
|
||||
if (o) {
|
||||
struct ofono_call *call = o->data;
|
||||
|
|
|
@ -178,7 +178,7 @@ static void cring_notify(GAtResult *result, gpointer user_data)
|
|||
/* CRING can repeat, ignore if we already have an incoming call */
|
||||
if (g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status))
|
||||
ofono_call_compare_by_status))
|
||||
return;
|
||||
|
||||
g_at_result_iter_init(&iter, result);
|
||||
|
@ -217,7 +217,7 @@ static void clip_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
l = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
if (l == NULL) {
|
||||
ofono_error("CLIP for unknown call");
|
||||
return;
|
||||
|
|
|
@ -544,12 +544,12 @@ static void cring_notify(GAtResult *result, gpointer user_data)
|
|||
*/
|
||||
if (g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_WAITING),
|
||||
at_util_call_compare_by_status))
|
||||
ofono_call_compare_by_status))
|
||||
return;
|
||||
|
||||
l = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
if (l == NULL) {
|
||||
ofono_error("CRING received before XCALLSTAT!!!");
|
||||
return;
|
||||
|
@ -588,7 +588,7 @@ static void clip_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
l = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
if (l == NULL) {
|
||||
ofono_error("CLIP for unknown call");
|
||||
return;
|
||||
|
@ -648,7 +648,7 @@ static void cnap_notify(GAtResult *result, gpointer user_data)
|
|||
*/
|
||||
l = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_INCOMING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
if (l == NULL) {
|
||||
ofono_error("CNAP for unknown call");
|
||||
return;
|
||||
|
@ -694,7 +694,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
|
|||
|
||||
l = g_slist_find_custom(vd->calls,
|
||||
GINT_TO_POINTER(CALL_STATUS_WAITING),
|
||||
at_util_call_compare_by_status);
|
||||
ofono_call_compare_by_status);
|
||||
if (l == NULL) {
|
||||
ofono_error("CCWA received before XCALLSTAT!!!");
|
||||
return;
|
||||
|
|
11
src/common.c
11
src/common.c
|
@ -848,3 +848,14 @@ gint ofono_call_compare(gconstpointer a, gconstpointer b)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
gint ofono_call_compare_by_status(gconstpointer a, gconstpointer b)
|
||||
{
|
||||
const struct ofono_call *call = a;
|
||||
int status = GPOINTER_TO_INT(b);
|
||||
|
||||
if (status != call->status)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -198,3 +198,4 @@ gboolean gprs_auth_method_from_string(const char *str,
|
|||
enum ofono_gprs_auth_method *auth);
|
||||
|
||||
gint ofono_call_compare(gconstpointer a, gconstpointer b);
|
||||
gint ofono_call_compare_by_status(gconstpointer a, gconstpointer b);
|
||||
|
|
Loading…
Reference in New Issue