mirror of git://git.sysmocom.de/ofono
common,atmodem: rename & move at_util_call_compare_by_id to common.c
at_util_call_compare_by_id is used by several modem drivers.
This commit is contained in:
parent
528f4838fa
commit
2e83c99617
|
@ -82,20 +82,6 @@ gint at_util_call_compare_by_phone_number(gconstpointer a, gconstpointer b)
|
||||||
sizeof(struct ofono_phone_number));
|
sizeof(struct ofono_phone_number));
|
||||||
}
|
}
|
||||||
|
|
||||||
gint at_util_call_compare_by_id(gconstpointer a, gconstpointer b)
|
|
||||||
{
|
|
||||||
const struct ofono_call *call = a;
|
|
||||||
unsigned int id = GPOINTER_TO_UINT(b);
|
|
||||||
|
|
||||||
if (id < call->id)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (id > call->id)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
GSList *at_util_parse_clcc(GAtResult *result, unsigned int *ret_mpty_ids)
|
GSList *at_util_parse_clcc(GAtResult *result, unsigned int *ret_mpty_ids)
|
||||||
{
|
{
|
||||||
GAtResultIter iter;
|
GAtResultIter iter;
|
||||||
|
|
|
@ -58,7 +58,7 @@ typedef void (*at_util_sim_inserted_cb_t)(gboolean present, void *userdata);
|
||||||
void decode_at_error(struct ofono_error *error, const char *final);
|
void decode_at_error(struct ofono_error *error, const char *final);
|
||||||
gint ofono_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_phone_number(gconstpointer a, gconstpointer b);
|
||||||
gint at_util_call_compare_by_id(gconstpointer a, gconstpointer b);
|
gint ofono_call_compare_by_id(gconstpointer a, gconstpointer b);
|
||||||
GSList *at_util_parse_clcc(GAtResult *result, unsigned int *mpty_ids);
|
GSList *at_util_parse_clcc(GAtResult *result, unsigned int *mpty_ids);
|
||||||
gboolean at_util_parse_reg(GAtResult *result, const char *prefix,
|
gboolean at_util_parse_reg(GAtResult *result, const char *prefix,
|
||||||
int *mode, int *status,
|
int *mode, int *status,
|
||||||
|
|
|
@ -346,7 +346,7 @@ static void conf_notify(GAtResult *result, gpointer user_data)
|
||||||
ofono_info("Call setup: id %d", call_id);
|
ofono_info("Call setup: id %d", call_id);
|
||||||
|
|
||||||
l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(call_id),
|
l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(call_id),
|
||||||
at_util_call_compare_by_id);
|
ofono_call_compare_by_id);
|
||||||
if (l == NULL) {
|
if (l == NULL) {
|
||||||
ofono_error("Received CONF for untracked call");
|
ofono_error("Received CONF for untracked call");
|
||||||
return;
|
return;
|
||||||
|
@ -383,7 +383,7 @@ static void conn_notify(GAtResult *result, gpointer user_data)
|
||||||
ofono_info("Call connect: id %d type %d", call_id, call_type);
|
ofono_info("Call connect: id %d type %d", call_id, call_type);
|
||||||
|
|
||||||
l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(call_id),
|
l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(call_id),
|
||||||
at_util_call_compare_by_id);
|
ofono_call_compare_by_id);
|
||||||
if (l == NULL) {
|
if (l == NULL) {
|
||||||
ofono_error("Received CONN for untracked call");
|
ofono_error("Received CONN for untracked call");
|
||||||
return;
|
return;
|
||||||
|
@ -427,7 +427,7 @@ static void cend_notify(GAtResult *result, gpointer user_data)
|
||||||
call_id, duration, end_status);
|
call_id, duration, end_status);
|
||||||
|
|
||||||
l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(call_id),
|
l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(call_id),
|
||||||
at_util_call_compare_by_id);
|
ofono_call_compare_by_id);
|
||||||
if (l == NULL) {
|
if (l == NULL) {
|
||||||
ofono_error("Received CEND for untracked call");
|
ofono_error("Received CEND for untracked call");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -134,7 +134,7 @@ static void xcallstat_notify(GAtResult *result, gpointer user_data)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(id),
|
l = g_slist_find_custom(vd->calls, GINT_TO_POINTER(id),
|
||||||
at_util_call_compare_by_id);
|
ofono_call_compare_by_id);
|
||||||
|
|
||||||
if (l == NULL && status != CALL_STATUS_DIALING &&
|
if (l == NULL && status != CALL_STATUS_DIALING &&
|
||||||
status != CALL_STATUS_INCOMING &&
|
status != CALL_STATUS_INCOMING &&
|
||||||
|
@ -772,7 +772,7 @@ static void xcolp_notify(GAtResult *result, gpointer user_data)
|
||||||
|
|
||||||
l = g_slist_find_custom(vd->calls,
|
l = g_slist_find_custom(vd->calls,
|
||||||
GINT_TO_POINTER(call_id),
|
GINT_TO_POINTER(call_id),
|
||||||
at_util_call_compare_by_id);
|
ofono_call_compare_by_id);
|
||||||
if (l == NULL) {
|
if (l == NULL) {
|
||||||
ofono_error("XCOLP for unknown call");
|
ofono_error("XCOLP for unknown call");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -461,7 +461,7 @@ static void ecav_notify(GAtResult *result, gpointer user_data)
|
||||||
* If it doesn't exists we make a new one
|
* If it doesn't exists we make a new one
|
||||||
*/
|
*/
|
||||||
l = g_slist_find_custom(vd->calls, GUINT_TO_POINTER(id),
|
l = g_slist_find_custom(vd->calls, GUINT_TO_POINTER(id),
|
||||||
at_util_call_compare_by_id);
|
ofono_call_compare_by_id);
|
||||||
|
|
||||||
if (l)
|
if (l)
|
||||||
existing_call = l->data;
|
existing_call = l->data;
|
||||||
|
|
14
src/common.c
14
src/common.c
|
@ -859,3 +859,17 @@ gint ofono_call_compare_by_status(gconstpointer a, gconstpointer b)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gint ofono_call_compare_by_id(gconstpointer a, gconstpointer b)
|
||||||
|
{
|
||||||
|
const struct ofono_call *call = a;
|
||||||
|
unsigned int id = GPOINTER_TO_UINT(b);
|
||||||
|
|
||||||
|
if (id < call->id)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (id > call->id)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -199,3 +199,4 @@ gboolean gprs_auth_method_from_string(const char *str,
|
||||||
|
|
||||||
gint ofono_call_compare(gconstpointer a, gconstpointer b);
|
gint ofono_call_compare(gconstpointer a, gconstpointer b);
|
||||||
gint ofono_call_compare_by_status(gconstpointer a, gconstpointer b);
|
gint ofono_call_compare_by_status(gconstpointer a, gconstpointer b);
|
||||||
|
gint ofono_call_compare_by_id(gconstpointer a, gconstpointer b);
|
||||||
|
|
Loading…
Reference in New Issue