From: Pavel Machek <pavel@ucw.cz>
To: ofono@ofono.org
Subject: atmodem: introduce send_clcc() to reduce code duplication
Date: Fri, 16 Aug 2019 22:27:04 +0200 [thread overview]
Message-ID: <20190816202704.rfp6gviv3pl4lta2@devuan> (raw)
In-Reply-To: <e8eec1b5-1762-8fae-f6dd-b687cad5b425@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2903 bytes --]
Reduce code duplication by introducing send_clcc function.
---
> > Yes, you should have it separate in your inbox ;-). If not, let me
> > know and I'll resend.
>
> Doesn't look like I do?
sorry about that. Here you go...
Best regards,
Pavel
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index d55cf008..e22d412c 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -264,14 +264,17 @@ poll_again:
poll_clcc, vc);
}
+static void send_clcc(struct voicecall_data *vd, struct ofono_voicecall *vc)
+{
+ g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix, clcc_poll_cb, vc, NULL);
+}
+
static gboolean poll_clcc(gpointer user_data)
{
struct ofono_voicecall *vc = user_data;
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
- g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
- clcc_poll_cb, vc, NULL);
-
+ send_clcc(vd, vc);
vd->clcc_source = 0;
return FALSE;
@@ -297,8 +301,7 @@ static void generic_cb(gboolean ok, GAtResult *result, gpointer user_data)
}
}
- g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
- clcc_poll_cb, req->vc, NULL);
+ send_clcc(vd, req->vc);
/* We have to callback after we schedule a poll if required */
req->cb(&error, req->data);
@@ -316,8 +319,7 @@ static void release_id_cb(gboolean ok, GAtResult *result,
if (ok)
vd->local_release = 1 << req->id;
- g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
- clcc_poll_cb, req->vc, NULL);
+ send_clcc(vd, req->vc);
/* We have to callback after we schedule a poll if required */
req->cb(&error, req->data);
@@ -962,8 +975,7 @@ static void no_carrier_notify(GAtResult *result, gpointer user_data)
struct ofono_voicecall *vc = user_data;
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
- g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
- clcc_poll_cb, vc, NULL);
+ send_clcc(vd, vc);
}
static void no_answer_notify(GAtResult *result, gpointer user_data)
@@ -971,8 +983,7 @@ static void no_answer_notify(GAtResult *result, gpointer user_data)
struct ofono_voicecall *vc = user_data;
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
- g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
- clcc_poll_cb, vc, NULL);
+ send_clcc(vd, vc);
}
static void busy_notify(GAtResult *result, gpointer user_data)
@@ -984,8 +995,7 @@ static void busy_notify(GAtResult *result, gpointer user_data)
* or UDUB on the other side
* TODO: Handle UDUB or other conditions somehow
*/
- g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
- clcc_poll_cb, vc, NULL);
+ send_clcc(vd, vc);
}
static void cssi_notify(GAtResult *result, gpointer user_data)
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2019-08-16 20:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-12 8:22 [rfc] Motorola Droid 4 voice: integrate into atmodem or completely separate? Pavel Machek
2019-08-11 14:31 ` Denis Kenzior
2019-08-13 20:59 ` Pavel Machek
2019-08-16 15:56 ` Denis Kenzior
2019-08-16 20:27 ` Pavel Machek [this message]
2019-08-19 19:46 ` atmodem: introduce send_clcc() to reduce code duplication Denis Kenzior
2019-08-18 8:33 ` [rfc] Motorola Droid 4 voice: integrate into atmodem or completely separate? Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190816202704.rfp6gviv3pl4lta2@devuan \
--to=pavel@ucw.cz \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox