* [PATCH 0/2] Manage multiparty list in emulator CHLD calls
@ 2011-06-29 19:38 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-06-29 19:38 ` [PATCH 1/2] voicecall: manage multiparty list in AT+CHLD=3 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-06-29 19:38 ` [PATCH 2/2] voicecall: manage multiparty list in AT+CHLD=2X =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
0 siblings, 2 replies; 4+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-06-29 19:38 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 440 bytes --]
These patches will manage the multiparty list in emulator CHLD calls.
This allow the mpty field of +CLCC to be set to 1 or 0 depending if there is a multiparty call or not.
Frédéric Dalleau (2):
voicecall: manage multiparty list in AT+CHLD=3
voicecall: manage multiparty list in AT+CHLD=2X
src/voicecall.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 122 insertions(+), 3 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] voicecall: manage multiparty list in AT+CHLD=3
2011-06-29 19:38 [PATCH 0/2] Manage multiparty list in emulator CHLD calls =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-06-29 19:38 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-06-29 21:09 ` Denis Kenzior
2011-06-29 19:38 ` [PATCH 2/2] voicecall: manage multiparty list in AT+CHLD=2X =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
1 sibling, 1 reply; 4+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-06-29 19:38 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2528 bytes --]
---
src/voicecall.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 64 insertions(+), 1 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 9620838..8e4ab58 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -94,6 +94,12 @@ struct voicecall {
ofono_bool_t remote_multiparty;
};
+struct mpty_cb_info {
+ struct ofono_voicecall *vc;
+ struct ofono_emulator *em;
+ int id;
+};
+
struct dial_request {
struct ofono_voicecall *vc;
char *message;
@@ -2710,6 +2716,48 @@ static void emulator_generic_cb(const struct ofono_error *error, void *data)
ofono_emulator_send_final(em, error);
}
+static void emulator_mpty_join_cb(const struct ofono_error *error, void *data)
+{
+ struct mpty_cb_info *mp = data;
+ GSList *old;
+
+ ofono_emulator_send_final(mp->em, error);
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ g_free(mp);
+ return;
+ }
+
+ /*
+ * We just created a multiparty call, gather all held
+ * active calls and add them to the multiparty list
+ */
+ old = mp->vc->multiparty_list;
+ mp->vc->multiparty_list = 0;
+
+ mp->vc->multiparty_list = g_slist_concat(mp->vc->multiparty_list,
+ voicecalls_held_list(mp->vc));
+
+ mp->vc->multiparty_list = g_slist_concat(mp->vc->multiparty_list,
+ voicecalls_active_list(mp->vc));
+
+ mp->vc->multiparty_list = g_slist_sort(mp->vc->multiparty_list,
+ call_compare);
+
+ if (g_slist_length(mp->vc->multiparty_list) < 2) {
+ ofono_error("Created multiparty call, but size is less than 2"
+ " panic!");
+
+ return;
+ }
+
+ voicecalls_multiparty_changed(old, mp->vc->multiparty_list);
+ g_slist_free(old);
+ g_free(mp);
+}
+
+}
+
static void emulator_ata_cb(struct ofono_emulator *em,
struct ofono_emulator_request *req, void *userdata)
{
@@ -2900,12 +2948,27 @@ static void emulator_chld_cb(struct ofono_emulator *em,
emulator_generic_cb, em);
return;
case 3:
+ {
+ struct mpty_cb_info *mp;
+
if (vc->driver->create_multiparty == NULL)
goto fail;
+ if (!voicecalls_have_held(vc)
+ || !voicecalls_have_active(vc))
+ goto fail;
+
+ mp = g_try_malloc0(sizeof(struct mpty_cb_info));
+ if (!mp)
+ goto fail;
+
+ mp->vc = vc;
+ mp->em = em;
+
vc->driver->create_multiparty(vc,
- emulator_generic_cb, em);
+ emulator_mpty_join_cb, mp);
return;
+ }
case 4:
if (vc->driver->transfer == NULL)
goto fail;
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] voicecall: manage multiparty list in AT+CHLD=2X
2011-06-29 19:38 [PATCH 0/2] Manage multiparty list in emulator CHLD calls =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-06-29 19:38 ` [PATCH 1/2] voicecall: manage multiparty list in AT+CHLD=3 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-06-29 19:38 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
1 sibling, 0 replies; 4+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-06-29 19:38 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2108 bytes --]
---
src/voicecall.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/src/voicecall.c b/src/voicecall.c
index 8e4ab58..e55f44b 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -2756,6 +2756,38 @@ static void emulator_mpty_join_cb(const struct ofono_error *error, void *data)
g_free(mp);
}
+static void emulator_mpty_private_chat_cb(const struct ofono_error *error,
+ void *data)
+{
+ struct mpty_cb_info *mp = data;
+ GSList *old;
+ GSList *l;
+
+ ofono_emulator_send_final(mp->em, error);
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ g_free(mp);
+ return;
+ }
+
+ old = g_slist_copy(mp->vc->multiparty_list);
+
+ l = g_slist_find_custom(mp->vc->multiparty_list,
+ GINT_TO_POINTER(mp->id), call_compare_by_id);
+
+ if (l) {
+ mp->vc->multiparty_list =
+ g_slist_remove(mp->vc->multiparty_list, l->data);
+
+ if (mp->vc->multiparty_list->next == NULL) {
+ g_slist_free(mp->vc->multiparty_list);
+ mp->vc->multiparty_list = 0;
+ }
+ }
+
+ voicecalls_multiparty_changed(old, mp->vc->multiparty_list);
+ g_slist_free(old);
+ g_free(mp);
}
static void emulator_ata_cb(struct ofono_emulator *em,
@@ -2990,11 +3022,35 @@ static void emulator_chld_cb(struct ofono_emulator *em,
}
if (chld >= 21 && chld <= 27) {
+ GSList *l;
+ struct mpty_cb_info *mp;
+ unsigned int id = chld - 20;
+
if (vc->driver->private_chat == NULL)
goto fail;
- vc->driver->private_chat(vc, chld - 20,
- emulator_generic_cb, em);
+ for (l = vc->multiparty_list; l; l = l->next) {
+ struct voicecall *v = l->data;
+ if (v->call->id == id)
+ break;
+ }
+
+ if (l == NULL)
+ goto fail;
+
+ if (voicecalls_have_held(vc))
+ goto fail;
+
+ mp = g_try_malloc0(sizeof(struct mpty_cb_info));
+ if (!mp)
+ goto fail;
+
+ mp->vc = vc;
+ mp->em = em;
+ mp->id = id;
+
+ vc->driver->private_chat(vc, id,
+ emulator_mpty_private_chat_cb, mp);
return;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] voicecall: manage multiparty list in AT+CHLD=3
2011-06-29 19:38 ` [PATCH 1/2] voicecall: manage multiparty list in AT+CHLD=3 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
@ 2011-06-29 21:09 ` Denis Kenzior
0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2011-06-29 21:09 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3339 bytes --]
Hi Frédéric,
On 06/29/2011 02:38 PM, Frédéric Dalleau wrote:
> ---
> src/voicecall.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 64 insertions(+), 1 deletions(-)
>
> diff --git a/src/voicecall.c b/src/voicecall.c
> index 9620838..8e4ab58 100644
> --- a/src/voicecall.c
> +++ b/src/voicecall.c
> @@ -94,6 +94,12 @@ struct voicecall {
> ofono_bool_t remote_multiparty;
> };
>
> +struct mpty_cb_info {
> + struct ofono_voicecall *vc;
> + struct ofono_emulator *em;
> + int id;
> +};
> +
> struct dial_request {
> struct ofono_voicecall *vc;
> char *message;
> @@ -2710,6 +2716,48 @@ static void emulator_generic_cb(const struct ofono_error *error, void *data)
> ofono_emulator_send_final(em, error);
> }
>
> +static void emulator_mpty_join_cb(const struct ofono_error *error, void *data)
> +{
> + struct mpty_cb_info *mp = data;
> + GSList *old;
> +
> + ofono_emulator_send_final(mp->em, error);
> +
> + if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
> + g_free(mp);
> + return;
> + }
> +
> + /*
> + * We just created a multiparty call, gather all held
> + * active calls and add them to the multiparty list
> + */
> + old = mp->vc->multiparty_list;
> + mp->vc->multiparty_list = 0;
> +
> + mp->vc->multiparty_list = g_slist_concat(mp->vc->multiparty_list,
> + voicecalls_held_list(mp->vc));
> +
> + mp->vc->multiparty_list = g_slist_concat(mp->vc->multiparty_list,
> + voicecalls_active_list(mp->vc));
> +
> + mp->vc->multiparty_list = g_slist_sort(mp->vc->multiparty_list,
> + call_compare);
> +
> + if (g_slist_length(mp->vc->multiparty_list) < 2) {
> + ofono_error("Created multiparty call, but size is less than 2"
> + " panic!");
> +
> + return;
> + }
> +
> + voicecalls_multiparty_changed(old, mp->vc->multiparty_list);
> + g_slist_free(old);
> + g_free(mp);
> +}
> +
> +}
> +
Something is wrong with your git-foo here:
src/voicecall.c:2759: error: expected identifier or ‘(’ before ‘}’ token
> static void emulator_ata_cb(struct ofono_emulator *em,
> struct ofono_emulator_request *req, void *userdata)
> {
> @@ -2900,12 +2948,27 @@ static void emulator_chld_cb(struct ofono_emulator *em,
> emulator_generic_cb, em);
> return;
> case 3:
> + {
> + struct mpty_cb_info *mp;
> +
> if (vc->driver->create_multiparty == NULL)
> goto fail;
>
> + if (!voicecalls_have_held(vc)
> + || !voicecalls_have_active(vc))
> + goto fail;
> +
> + mp = g_try_malloc0(sizeof(struct mpty_cb_info));
> + if (!mp)
> + goto fail;
> +
> + mp->vc = vc;
> + mp->em = em;
> +
> vc->driver->create_multiparty(vc,
> - emulator_generic_cb, em);
> + emulator_mpty_join_cb, mp);
So unfortunately you cannot do this, the current oFono driver framework
does not have a mechanism to guarantee the destruction of userdata you
pass to the driver method. There was never a reason to have it...
Since atoms can and are forcefully removed at any time, you would
potentially be leaking memory here.
Can you re-use the existing pending_em member of ofono_voicecall for
this purpose?
> return;
> + }
> case 4:
> if (vc->driver->transfer == NULL)
> goto fail;
Regards,
-Denis
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-29 21:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-29 19:38 [PATCH 0/2] Manage multiparty list in emulator CHLD calls =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-06-29 19:38 ` [PATCH 1/2] voicecall: manage multiparty list in AT+CHLD=3 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
2011-06-29 21:09 ` Denis Kenzior
2011-06-29 19:38 ` [PATCH 2/2] voicecall: manage multiparty list in AT+CHLD=2X =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.