From 91b11b2841f01798830b15bf5f4ca0c64bea246e Mon Sep 17 00:00:00 2001 From: Sunil Kumar Behera Date: Thu, 13 Sep 2012 19:12:25 +0530 Subject: [PATCH] obexd: Add support for MessageStatus Add driver to support x-bt/messageStatus mimetype --- obexd/plugins/mas.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c index 1c9199daa..63d188c9c 100644 --- a/obexd/plugins/mas.c +++ b/obexd/plugins/mas.c @@ -649,6 +649,37 @@ static void *message_update_open(const char *name, int oflag, mode_t mode, return mas; } +static void *message_set_status_open(const char *name, int oflag, mode_t mode, + void *driver_data, size_t *size, + int *err) + +{ + struct mas_session *mas = driver_data; + uint8_t indicator; + uint8_t value; + + DBG(""); + + if (oflag == O_RDONLY) { + *err = -EBADR; + return NULL; + } + + if (!g_obex_apparam_get_uint8(mas->inparams, MAP_AP_STATUSINDICATOR, + &indicator)) { + *err = -EBADR; + return NULL; + } + + if (!g_obex_apparam_get_uint8(mas->inparams, MAP_AP_STATUSVALUE, + &value)) { + *err = -EBADR; + return NULL; + } + + return mas; +} + static ssize_t any_get_next_header(void *object, void *buf, size_t mtu, uint8_t *hi) { @@ -784,7 +815,7 @@ static struct obex_mime_type_driver mime_message_status = { .target = MAS_TARGET, .target_size = TARGET_SIZE, .mimetype = "x-bt/messageStatus", - .open = any_open, + .open = message_set_status_open, .close = any_close, .read = any_read, .write = any_write, -- 2.47.3