From: Kristen Carlson Accardi <kristen@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 6/7] sim: implement GetIcon dbus interface
Date: Thu, 05 Aug 2010 14:32:39 -0700 [thread overview]
Message-ID: <1281043960-9616-7-git-send-email-kristen@linux.intel.com> (raw)
In-Reply-To: <1281043960-9616-1-git-send-email-kristen@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]
---
src/sim.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/src/sim.c b/src/sim.c
index e19fb06..2b0b20e 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -731,6 +731,50 @@ static DBusMessage *sim_enter_pin(DBusConnection *conn, DBusMessage *msg,
return NULL;
}
+static void ofono_sim_get_image_cb(int ok, const char *xpm, int xpm_len,
+ void *userdata)
+{
+ struct ofono_sim *sim = userdata;
+ DBusMessage *reply;
+
+ if (!ok)
+ reply = __ofono_error_failed(sim->pending);
+ else {
+ reply = dbus_message_new_method_return(sim->pending);
+ dbus_message_append_args(reply, DBUS_TYPE_STRING, &xpm,
+ DBUS_TYPE_INVALID);
+ }
+
+ __ofono_dbus_pending_reply(&sim->pending, reply);
+}
+
+static DBusMessage *sim_get_icon(DBusConnection *conn,
+ DBusMessage *msg, void *data)
+{
+ struct ofono_sim *sim = data;
+ int id;
+
+ /*
+ * change the arg to be a byte
+ * Question: does the icon id start at zero or 1?
+ */
+ if (dbus_message_get_args(msg, NULL, DBUS_TYPE_INT32, &id,
+ DBUS_TYPE_INVALID) == FALSE)
+ return __ofono_error_invalid_args(msg);
+
+ if (sim->pending)
+ return __ofono_error_busy(msg);
+
+ if (sim->efimg == NULL)
+ return __ofono_error_not_implemented(msg);
+
+ sim->pending = dbus_message_ref(msg);
+
+ ofono_sim_get_image(sim, id, ofono_sim_get_image_cb, sim);
+
+ return NULL;
+}
+
static DBusMessage *sim_reset_pin(DBusConnection *conn, DBusMessage *msg,
void *data)
{
@@ -783,6 +827,8 @@ static GDBusMethodTable sim_methods[] = {
G_DBUS_METHOD_FLAG_ASYNC },
{ "UnlockPin", "ss", "", sim_unlock_pin,
G_DBUS_METHOD_FLAG_ASYNC },
+ { "GetIcon", "i", "", sim_get_icon,
+ G_DBUS_METHOD_FLAG_ASYNC },
{ }
};
--
1.7.1.1
next prev parent reply other threads:[~2010-08-05 21:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 21:32 [PATCH 0/7] add support for icons Kristen Carlson Accardi
2010-08-05 21:32 ` [PATCH 1/7] simutil: add fileid for EFimg Kristen Carlson Accardi
2010-08-05 21:32 ` [PATCH 2/7] stkutil: change uint32_t to guint32 Kristen Carlson Accardi
2010-08-05 21:32 ` [PATCH 3/7] sim: read EFimg Kristen Carlson Accardi
2010-08-05 21:32 ` [PATCH 4/7] sim: allow partial reads of files Kristen Carlson Accardi
2010-08-05 21:32 ` [PATCH 5/7] sim: read an image from an EFiidf Kristen Carlson Accardi
2010-08-05 21:32 ` Kristen Carlson Accardi [this message]
2010-08-05 21:32 ` [PATCH 7/7] test: add get-icon script Kristen Carlson Accardi
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=1281043960-9616-7-git-send-email-kristen@linux.intel.com \
--to=kristen@linux.intel.com \
--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