public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH v2] obex: Add messages_get_message() implementation for MAP plugin
@ 2025-02-24 11:10 Amisha Jain
  2025-02-24 12:32 ` [RESEND,v2] " bluez.test.bot
  2025-02-24 14:03 ` [RESEND PATCH v2] " Paul Menzel
  0 siblings, 2 replies; 5+ messages in thread
From: Amisha Jain @ 2025-02-24 11:10 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: quic_mohamull, quic_hbandi, quic_anubhavg

GET Message() operation should be supported for passing below PTS
testcases -

1.MAP/MSE/MMB/BV-12-C
Verify that the MSE can return an email message to the MCE.
2.MAP/MSE/MMB/BV-13-C
Verify that the MSE can return a SMS message in native format to the MCE.
3.MAP/MSE/MMB/BV-14-C
Verify that the MSE can return a SMS message with text trans-coded to UTF-8
to the MCE.

Currently get message operation is not implemented, hence above
testcases are failing.
Added code to send the complete bmessage in response
to the get request for the requested message handle.

---
 obexd/plugins/mas.c            |  4 ++--
 obexd/plugins/messages-dummy.c | 27 ++++++++++++++++++++++++++-
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c
index 10b972d65..f63fcf6c6 100644
--- a/obexd/plugins/mas.c
+++ b/obexd/plugins/mas.c
@@ -612,11 +612,11 @@ static void *message_open(const char *name, int oflag, mode_t mode,
 		return NULL;
 	}
 
+	mas->buffer = g_string_new("");
+
 	*err = messages_get_message(mas->backend_data, name, 0,
 			get_message_cb, mas);
 
-	mas->buffer = g_string_new("");
-
 	if (*err < 0)
 		return NULL;
 	else
diff --git a/obexd/plugins/messages-dummy.c b/obexd/plugins/messages-dummy.c
index e313c6163..665face3f 100644
--- a/obexd/plugins/messages-dummy.c
+++ b/obexd/plugins/messages-dummy.c
@@ -516,7 +516,32 @@ int messages_get_message(void *session, const char *handle,
 					messages_get_message_cb callback,
 					void *user_data)
 {
-	return -ENOSYS;
+	struct session *s =  session;
+	FILE *fp;
+	char *path;
+	char buffer[1024];
+
+	DBG(" ");
+	path = g_build_filename(s->cwd_absolute, handle, NULL);
+	fp = fopen(path, "r");
+	if (fp == NULL) {
+		DBG("fopen() failed");
+		return -EBADR;
+	}
+
+	/* 1024 is the maximum size of the line which is calculated to be more
+	 * sufficient*/
+	while (fgets(buffer, 1024, fp)) {
+		if (callback)
+			callback(session, 0, 0, (const char*)buffer, user_data);
+	}
+
+	if (callback)
+		callback(session, 0, 0, NULL, user_data);
+
+	g_free(path);
+	fclose(fp);
+	return 0;
 }
 
 int messages_update_inbox(void *session, messages_status_cb callback,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [RESEND,v2] obex: Add messages_get_message() implementation for MAP plugin
  2025-02-24 11:10 [RESEND PATCH v2] obex: Add messages_get_message() implementation for MAP plugin Amisha Jain
@ 2025-02-24 12:32 ` bluez.test.bot
  2025-02-24 14:03 ` [RESEND PATCH v2] " Paul Menzel
  1 sibling, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2025-02-24 12:32 UTC (permalink / raw)
  To: linux-bluetooth, quic_amisjain

[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=937009

---Test result---

Test Summary:
CheckPatch                    PENDING   0.29 seconds
GitLint                       PENDING   0.33 seconds
BuildEll                      PASS      21.05 seconds
BluezMake                     PASS      1581.86 seconds
MakeCheck                     PASS      13.35 seconds
MakeDistcheck                 PASS      160.30 seconds
CheckValgrind                 PASS      215.30 seconds
CheckSmatch                   PASS      283.32 seconds
bluezmakeextell               PASS      99.45 seconds
IncrementalBuild              PENDING   0.34 seconds
ScanBuild                     PASS      883.67 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v2] obex: Add messages_get_message() implementation for MAP plugin
  2025-02-24 11:10 [RESEND PATCH v2] obex: Add messages_get_message() implementation for MAP plugin Amisha Jain
  2025-02-24 12:32 ` [RESEND,v2] " bluez.test.bot
@ 2025-02-24 14:03 ` Paul Menzel
  2025-02-26  7:11   ` Amisha Jain (QUIC)
  1 sibling, 1 reply; 5+ messages in thread
From: Paul Menzel @ 2025-02-24 14:03 UTC (permalink / raw)
  To: Amisha Jain; +Cc: linux-bluetooth, quic_mohamull, quic_hbandi, quic_anubhavg

Dear Amisha,


Am 24.02.25 um 12:10 schrieb Amisha Jain:
> GET Message() operation should be supported for passing below PTS
> testcases -
> 
> 1.MAP/MSE/MMB/BV-12-C
> Verify that the MSE can return an email message to the MCE.
> 2.MAP/MSE/MMB/BV-13-C
> Verify that the MSE can return a SMS message in native format to the MCE.

a*n* SMS

> 3.MAP/MSE/MMB/BV-14-C
> Verify that the MSE can return a SMS message with text trans-coded to UTF-8

a*n*

> to the MCE.

I’d add a space after the bullet points (the dot).

> Currently get message operation is not implemented, hence above
> testcases are failing.
> Added code to send the complete bmessage in response

Should this be *message* or is *bmessage* some terminology?

> to the get request for the requested message handle.
> 
> ---
>   obexd/plugins/mas.c            |  4 ++--
>   obexd/plugins/messages-dummy.c | 27 ++++++++++++++++++++++++++-
>   2 files changed, 28 insertions(+), 3 deletions(-)
> 
> diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c
> index 10b972d65..f63fcf6c6 100644
> --- a/obexd/plugins/mas.c
> +++ b/obexd/plugins/mas.c
> @@ -612,11 +612,11 @@ static void *message_open(const char *name, int oflag, mode_t mode,
>   		return NULL;
>   	}
>   
> +	mas->buffer = g_string_new("");
> +
>   	*err = messages_get_message(mas->backend_data, name, 0,
>   			get_message_cb, mas);
>   
> -	mas->buffer = g_string_new("");
> -
>   	if (*err < 0)
>   		return NULL;
>   	else
> diff --git a/obexd/plugins/messages-dummy.c b/obexd/plugins/messages-dummy.c
> index e313c6163..665face3f 100644
> --- a/obexd/plugins/messages-dummy.c
> +++ b/obexd/plugins/messages-dummy.c
> @@ -516,7 +516,32 @@ int messages_get_message(void *session, const char *handle,
>   					messages_get_message_cb callback,
>   					void *user_data)
>   {
> -	return -ENOSYS;
> +	struct session *s =  session;
> +	FILE *fp;
> +	char *path;
> +	char buffer[1024];
> +
> +	DBG(" ");
> +	path = g_build_filename(s->cwd_absolute, handle, NULL);
> +	fp = fopen(path, "r");
> +	if (fp == NULL) {
> +		DBG("fopen() failed");
> +		return -EBADR;
> +	}
> +
> +	/* 1024 is the maximum size of the line which is calculated to be more
> +	 * sufficient*/

I do not fully grok this sentence. Could you please rephrase?

> +	while (fgets(buffer, 1024, fp)) {
> +		if (callback)
> +			callback(session, 0, 0, (const char*)buffer, user_data);
> +	}
> +
> +	if (callback)
> +		callback(session, 0, 0, NULL, user_data);
> +
> +	g_free(path);
> +	fclose(fp);
> +	return 0;
>   }
>   
>   int messages_update_inbox(void *session, messages_status_cb callback,


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [RESEND PATCH v2] obex: Add messages_get_message() implementation for MAP plugin
  2025-02-24 14:03 ` [RESEND PATCH v2] " Paul Menzel
@ 2025-02-26  7:11   ` Amisha Jain (QUIC)
  2025-02-26 20:40     ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 5+ messages in thread
From: Amisha Jain (QUIC) @ 2025-02-26  7:11 UTC (permalink / raw)
  To: Paul Menzel
  Cc: linux-bluetooth@vger.kernel.org, Mohammed Sameer Mulla (QUIC),
	Harish Bandi (QUIC), Anubhav Gupta (QUIC)

Hi Paul,

> -----Original Message-----
> From: Paul Menzel <pmenzel@molgen.mpg.de>
> Sent: Monday, February 24, 2025 7:34 PM
> To: Amisha Jain (QUIC) <quic_amisjain@quicinc.com>
> Cc: linux-bluetooth@vger.kernel.org; Mohammed Sameer Mulla (QUIC)
> <quic_mohamull@quicinc.com>; Harish Bandi (QUIC)
> <quic_hbandi@quicinc.com>; Anubhav Gupta (QUIC)
> <quic_anubhavg@quicinc.com>
> Subject: Re: [RESEND PATCH v2] obex: Add messages_get_message()
> implementation for MAP plugin
> 
> Dear Amisha,
> 
> 
> Am 24.02.25 um 12:10 schrieb Amisha Jain:
> > GET Message() operation should be supported for passing below PTS
> > testcases -
> >
> > 1.MAP/MSE/MMB/BV-12-C
> > Verify that the MSE can return an email message to the MCE.
> > 2.MAP/MSE/MMB/BV-13-C
> > Verify that the MSE can return a SMS message in native format to the MCE.
> 
> a*n* SMS
> 
> > 3.MAP/MSE/MMB/BV-14-C
> > Verify that the MSE can return a SMS message with text trans-coded to
> > UTF-8
> 
> a*n*
> 
> > to the MCE.
> 
> I’d add a space after the bullet points (the dot).
> 
> > Currently get message operation is not implemented, hence above
> > testcases are failing.
> > Added code to send the complete bmessage in response
> 
> Should this be *message* or is *bmessage* some terminology?
> 

This is 'bmessage', message format used by MAP to store messages.
As per Spec, bMessages are application objects used by MAP for message transport. 
Exchanged messages shall use the bMessage format.

> > to the get request for the requested message handle.
> >
> > ---
> >   obexd/plugins/mas.c            |  4 ++--
> >   obexd/plugins/messages-dummy.c | 27 ++++++++++++++++++++++++++-
> >   2 files changed, 28 insertions(+), 3 deletions(-)
> >
> > diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c index
> > 10b972d65..f63fcf6c6 100644
> > --- a/obexd/plugins/mas.c
> > +++ b/obexd/plugins/mas.c
> > @@ -612,11 +612,11 @@ static void *message_open(const char *name, int
> oflag, mode_t mode,
> >   		return NULL;
> >   	}
> >
> > +	mas->buffer = g_string_new("");
> > +
> >   	*err = messages_get_message(mas->backend_data, name, 0,
> >   			get_message_cb, mas);
> >
> > -	mas->buffer = g_string_new("");
> > -
> >   	if (*err < 0)
> >   		return NULL;
> >   	else
> > diff --git a/obexd/plugins/messages-dummy.c
> > b/obexd/plugins/messages-dummy.c index e313c6163..665face3f 100644
> > --- a/obexd/plugins/messages-dummy.c
> > +++ b/obexd/plugins/messages-dummy.c
> > @@ -516,7 +516,32 @@ int messages_get_message(void *session, const
> char *handle,
> >   					messages_get_message_cb callback,
> >   					void *user_data)
> >   {
> > -	return -ENOSYS;
> > +	struct session *s =  session;
> > +	FILE *fp;
> > +	char *path;
> > +	char buffer[1024];
> > +
> > +	DBG(" ");
> > +	path = g_build_filename(s->cwd_absolute, handle, NULL);
> > +	fp = fopen(path, "r");
> > +	if (fp == NULL) {
> > +		DBG("fopen() failed");
> > +		return -EBADR;
> > +	}
> > +
> > +	/* 1024 is the maximum size of the line which is calculated to be more
> > +	 * sufficient*/
> 
> I do not fully grok this sentence. Could you please rephrase?
> 

Sure, this corresponds to max size of a line in a file, as we are reading the file line by line.
Same way it is present in existing function - get_messages_listing().

static gboolean get_messages_listing(void *d)
{

        struct message_listing_data *mld = d;
        /* 1024 is the maximum size of the line which is calculated to be more
         * sufficient*/
        char buffer[1024];
        GMarkupParseContext *ctxt;

> > +	while (fgets(buffer, 1024, fp)) {
> > +		if (callback)
> > +			callback(session, 0, 0, (const char*)buffer, user_data);
> > +	}
> > +
> > +	if (callback)
> > +		callback(session, 0, 0, NULL, user_data);
> > +
> > +	g_free(path);
> > +	fclose(fp);
> > +	return 0;
> >   }
> >
> >   int messages_update_inbox(void *session, messages_status_cb
> > callback,
> 
> 
> Kind regards,
> 
> Paul

Thanks,
Amisha

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RESEND PATCH v2] obex: Add messages_get_message() implementation for MAP plugin
  2025-02-26  7:11   ` Amisha Jain (QUIC)
@ 2025-02-26 20:40     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2025-02-26 20:40 UTC (permalink / raw)
  To: Amisha Jain (QUIC)
  Cc: Paul Menzel, linux-bluetooth@vger.kernel.org,
	Mohammed Sameer Mulla (QUIC), Harish Bandi (QUIC),
	Anubhav Gupta (QUIC)

Hi Amisha,

On Wed, Feb 26, 2025 at 2:11 AM Amisha Jain (QUIC)
<quic_amisjain@quicinc.com> wrote:
>
> Hi Paul,
>
> > -----Original Message-----
> > From: Paul Menzel <pmenzel@molgen.mpg.de>
> > Sent: Monday, February 24, 2025 7:34 PM
> > To: Amisha Jain (QUIC) <quic_amisjain@quicinc.com>
> > Cc: linux-bluetooth@vger.kernel.org; Mohammed Sameer Mulla (QUIC)
> > <quic_mohamull@quicinc.com>; Harish Bandi (QUIC)
> > <quic_hbandi@quicinc.com>; Anubhav Gupta (QUIC)
> > <quic_anubhavg@quicinc.com>
> > Subject: Re: [RESEND PATCH v2] obex: Add messages_get_message()
> > implementation for MAP plugin
> >
> > Dear Amisha,
> >
> >
> > Am 24.02.25 um 12:10 schrieb Amisha Jain:
> > > GET Message() operation should be supported for passing below PTS
> > > testcases -
> > >
> > > 1.MAP/MSE/MMB/BV-12-C
> > > Verify that the MSE can return an email message to the MCE.
> > > 2.MAP/MSE/MMB/BV-13-C
> > > Verify that the MSE can return a SMS message in native format to the MCE.
> >
> > a*n* SMS
> >
> > > 3.MAP/MSE/MMB/BV-14-C
> > > Verify that the MSE can return a SMS message with text trans-coded to
> > > UTF-8
> >
> > a*n*
> >
> > > to the MCE.
> >
> > I’d add a space after the bullet points (the dot).
> >
> > > Currently get message operation is not implemented, hence above
> > > testcases are failing.
> > > Added code to send the complete bmessage in response
> >
> > Should this be *message* or is *bmessage* some terminology?
> >
>
> This is 'bmessage', message format used by MAP to store messages.
> As per Spec, bMessages are application objects used by MAP for message transport.
> Exchanged messages shall use the bMessage format.
>
> > > to the get request for the requested message handle.
> > >
> > > ---
> > >   obexd/plugins/mas.c            |  4 ++--
> > >   obexd/plugins/messages-dummy.c | 27 ++++++++++++++++++++++++++-
> > >   2 files changed, 28 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/obexd/plugins/mas.c b/obexd/plugins/mas.c index
> > > 10b972d65..f63fcf6c6 100644
> > > --- a/obexd/plugins/mas.c
> > > +++ b/obexd/plugins/mas.c
> > > @@ -612,11 +612,11 @@ static void *message_open(const char *name, int
> > oflag, mode_t mode,
> > >             return NULL;
> > >     }
> > >
> > > +   mas->buffer = g_string_new("");
> > > +
> > >     *err = messages_get_message(mas->backend_data, name, 0,
> > >                     get_message_cb, mas);
> > >
> > > -   mas->buffer = g_string_new("");
> > > -
> > >     if (*err < 0)
> > >             return NULL;
> > >     else
> > > diff --git a/obexd/plugins/messages-dummy.c
> > > b/obexd/plugins/messages-dummy.c index e313c6163..665face3f 100644
> > > --- a/obexd/plugins/messages-dummy.c
> > > +++ b/obexd/plugins/messages-dummy.c
> > > @@ -516,7 +516,32 @@ int messages_get_message(void *session, const
> > char *handle,
> > >                                     messages_get_message_cb callback,
> > >                                     void *user_data)
> > >   {
> > > -   return -ENOSYS;
> > > +   struct session *s =  session;
> > > +   FILE *fp;
> > > +   char *path;
> > > +   char buffer[1024];
> > > +
> > > +   DBG(" ");
> > > +   path = g_build_filename(s->cwd_absolute, handle, NULL);
> > > +   fp = fopen(path, "r");
> > > +   if (fp == NULL) {
> > > +           DBG("fopen() failed");
> > > +           return -EBADR;
> > > +   }
> > > +
> > > +   /* 1024 is the maximum size of the line which is calculated to be more
> > > +    * sufficient*/
> >
> > I do not fully grok this sentence. Could you please rephrase?
> >
>
> Sure, this corresponds to max size of a line in a file, as we are reading the file line by line.
> Same way it is present in existing function - get_messages_listing().
>
> static gboolean get_messages_listing(void *d)
> {
>
>         struct message_listing_data *mld = d;
>         /* 1024 is the maximum size of the line which is calculated to be more
>          * sufficient*/
>         char buffer[1024];
>         GMarkupParseContext *ctxt;
>
> > > +   while (fgets(buffer, 1024, fp)) {
> > > +           if (callback)
> > > +                   callback(session, 0, 0, (const char*)buffer, user_data);
> > > +   }
> > > +
> > > +   if (callback)
> > > +           callback(session, 0, 0, NULL, user_data);

Btw, if the callback is NULL then perhaps we shouldn't be looping with
fgets, I also thinking that perhaps the whole think about reading the
messages and copying it over to a buffer perhaps could be avoided,
perhaps using mmap is better here, although this is just the dummy
implementation with perhaps doesn't care so much about doing things in
a 'proper' way.

> > > +
> > > +   g_free(path);
> > > +   fclose(fp);
> > > +   return 0;
> > >   }
> > >
> > >   int messages_update_inbox(void *session, messages_status_cb
> > > callback,
> >
> >
> > Kind regards,
> >
> > Paul
>
> Thanks,
> Amisha



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-02-26 20:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-24 11:10 [RESEND PATCH v2] obex: Add messages_get_message() implementation for MAP plugin Amisha Jain
2025-02-24 12:32 ` [RESEND,v2] " bluez.test.bot
2025-02-24 14:03 ` [RESEND PATCH v2] " Paul Menzel
2025-02-26  7:11   ` Amisha Jain (QUIC)
2025-02-26 20:40     ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox