diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-05-12 21:41:13 -0700 |
---|---|---|
committer | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-05-13 03:00:12 -0700 |
commit | 179f93118b7ecfc50c85c3b8714419ebb3fa2325 (patch) | |
tree | 51d709d27b0cafbb4daf0a756e7717bbc0b1d4f3 /binding/bluetooth-map-api.c | |
parent | 0cf29634f36160c69d2759456315df878793e23f (diff) |
binding: bluetooth-map: add encoder for bMessage composing
Bug-AGL: SPEC-2351 SPEC-2392
Change-Id: I40425ed3dff4aabacfc520e5e3887e93f82a7b5e
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding/bluetooth-map-api.c')
-rw-r--r-- | binding/bluetooth-map-api.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/binding/bluetooth-map-api.c b/binding/bluetooth-map-api.c index df90ae5..5023c5a 100644 --- a/binding/bluetooth-map-api.c +++ b/binding/bluetooth-map-api.c @@ -308,13 +308,11 @@ out_free: call_work_destroy(cw); } - - static void compose(afb_req_t request) { struct map_state *ns = map_get_userdata(request); - const char *message = afb_req_value(request, "bmessage"); GError *error = NULL; + GString *message = NULL; GVariant *params, *reply; gchar *name, *session; struct call_work *cw; @@ -329,6 +327,7 @@ static void compose(afb_req_t request) session = g_strdup(ns->session_path); call_work_unlock(ns); + message = bmessage_encoder(request); if (!message) { afb_req_fail_f(request, "failed", "no valid message provided"); goto err_msg_invalid; @@ -337,7 +336,8 @@ static void compose(afb_req_t request) fd = g_file_open_tmp("obex-clientXXXXXX", &name, NULL); close(fd); - g_file_set_contents(name, message, -1, NULL); + g_file_set_contents(name, message->str, -1, NULL); + g_string_free(message, TRUE); params = g_variant_new("(&s)", "telecom/msg/OUTBOX"); reply = bluez_call(ns, BLUEZ_AT_MESSAGEACCESS, session, "SetFolder", params, NULL); |