Skip to contentSkip to conversation

API v2 for MAP client in obex-client

RFC Bartosz Szatkowski 3 participants 3 messages Nov 8, 2011 – Nov 14, 2011 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Hi,
below tweaked proposal for MAP client API.

Messages Access hierarchy
=========================

Service org.openobex.client
Interface org.openobex.MessagesAccess
Object path [variable prefix]/{session0,session1,...}

Methods dict(uint8 tag, variant value) GetAppParams()

Retrieve application parameters connected to the last MSE response. Application parameters corresponding to given call are accessible until next request is sent.

Parameters are converted to unsigned integers of corresponding sizes (MAP specification section 6.3.1) or NULL-terminated strings. In case of parameters not mentioned in MAP specification value becomes struct of (uint8 length, array{uint8}).

See MAP specification (section corresponding to given function) for more details on returned parameters.

void SetFolder(boolean cdup, string name)

Set working directory for current session.

| cdup | folder name | operation |
|=====================================|
| FALSE | empty | cd / |
|--------+-------------+--------------|
| FALSE | name | cd name |
|--------+-------------+--------------|
| TRUE | [name] | cd ..[/name] |
+-------------------------------------+

array{dict(string property, string value)} GetFolderListing(dict(uint8 tag, uint16 value))

Retrieve list of names (and all other properties returned by MSE) for directories in CWD.

Parameters as in MAP specification section 5.4.

array{dict(string property, string value)} GetMessageListing(string folder, array{uint8 tag, variant value})

Return message listing for given subfolder of CWD or directly CWD if folder field is empty, format of each dict entry corresponds to the message listing format (MAP specification section 3.1.6).

Parameters as in MAP specification section 5.5.

object_path
GetMessage(string handle, dict(uint8 tag, variant value), string filename)

Retrieve message (in BMSG format) from remote device and save it to a file *filename* (filename should be an absolute path and the file would be overwritten if it already exists).

A new Transfer object is created to represent this transaction and object_path pointing to it is returned.

Parameters as in MAP specification section 5.6.

void SetMessageStatus(string handle, uint8 indicator, uint8 value)

Modify status of a message on remote device.

Parameters as in MAP specification section 5.7.

void UpdateInbox()

Initiate update of inbox status on remote device.

Signature · 2 lines
Pozdrowienia - Cheers,
Bartosz Szatkowski
#1 lore raw

Hi Bartosz,

Quoted 16 lines · Bartosz Szatkowski

Hi,
below tweaked proposal for MAP client API.

Messages Access hierarchy
=========================

Service         org.openobex.client
Interface       org.openobex.MessagesAccess Object path     [variable prefix]/{session0,session1,...}

Methods         dict(uint8 tag, variant value) GetAppParams()

                       Retrieve application parameters connected to the last MSE response. Application parameters corresponding to given call are accessible until next request is sent.

Quoted 7 lines

                       Parameters are converted to unsigned integers of corresponding sizes (MAP specification section 6.3.1) or NULL-terminated strings. In case of parameters not mentioned in MAP specification value becomes struct of (uint8 length, array{uint8}).

                       See MAP specification (section corresponding to given function) for more details on returned parameters.

Can't we have the tags as Properties, the direct mapping of the spec is bad because then each application needs to know about every tag, besides I don't want to have each of the clients polling this values so there got to be a better way to deal with it.

Quoted 4 lines

               void SetFolder(boolean cdup, string name)

                       Set working directory for current session.

Quoted 8 lines
                       |  cdup  | folder name | operation    |
                       |=====================================|
                       | FALSE  | empty       | cd /         |
                       |--------+-------------+--------------|
                       | FALSE  | name        | cd name      |
                       |--------+-------------+--------------|
                       | TRUE   | [name]      | cd ..[/name] |
                       +-------------------------------------+

I thought we agree to have it just with name to make it less complicated and aligned with what we do for other profiles.

Quoted 7 lines

               array{dict(string property, string value)} GetFolderListing(dict(uint8 tag, uint16 value))

                       Retrieve list of names (and all other properties returned by MSE) for directories in CWD.

                       Parameters as in MAP specification section 5.4.

IMO this is too low level and potentially creates a need of a header/library to export what values can tag and value can assume.

Quoted 9 lines

               array{dict(string property, string value)} GetMessageListing(string folder, array{uint8 tag, variant value})

                       Return message listing for given subfolder of CWD or directly CWD if folder field is empty, format of each dict entry corresponds to the message listing format (MAP specification section 3.1.6).

                       Parameters as in MAP specification section 5.5.

Same as GetFolderListing, also we should probably only list Message of the current folder otherwise we don't need ChangeFolder.

Quoted 11 lines

               object_path
               GetMessage(string handle, dict(uint8 tag, variant value), string filename)

                       Retrieve message (in BMSG format) from remote device and save it to a file *filename* (filename should be an absolute path and the file would be overwritten if it already exists).

                       A new Transfer object is created to represent this transaction and object_path pointing to it is returned.

                       Parameters as in MAP specification section 5.6.

Where this handle comes from? Also Im not sure what the second parameter is for apparently it is use as a filter in other Methods but here you want to read one single message so what this filter is for?

Quoted 6 lines

               void SetMessageStatus(string handle, uint8 indicator, uint8 value)

                       Modify status of a message on remote device.

                       Parameters as in MAP specification section 5.7.

What application will be using this? Can any application update the status of a message? Again by using a binary format defined in the spec it gonna create either duplicated code to define them in each client or a need for a header/library.

Quoted 3 lines

               void UpdateInbox()

                       Initiate update of inbox status on remote device.

Again what application want to use this? This looks like a notification from the server, which should be done by obexd not obex-client.

Signature · 1 line
Luiz Augusto von Dentz
#2 lore raw
Quoted 24 lines · Luiz Augusto von Dentz

Hi Bartosz,

Quoted 21 lines · Bartosz Szatkowski

Hi,
below tweaked proposal for MAP client API.

Messages Access hierarchy
=========================

Service         org.openobex.client
Interface       org.openobex.MessagesAccess Object path     [variable prefix]/{session0,session1,...}

Methods         dict(uint8 tag, variant value) GetAppParams()

                       Retrieve application parameters connected to the last MSE response. Application parameters corresponding to given call are accessible until next request is sent.

                       Parameters are converted to unsigned integers of corresponding sizes (MAP specification section 6.3.1) or NULL-terminated strings. In case of parameters not mentioned in MAP specification value becomes struct of (uint8 length, array{uint8}).

Quoted 5 lines
Quoted 2 lines

                       See MAP specification (section corresponding to given function) for more details on returned parameters.

Can't we have the tags as Properties, the direct mapping of the spec is bad because then each application needs to know about every tag,

Even though I'd rather go for tag names in strings instead of numerical form, I do not see a problem with this. Application does not need to know about each and every tag. It is enough to know the tags that the application is interested in and skip the rest.

Quoted 2 lines

besides I don't want to have each of the clients polling this values so there got to be a better way to deal with it.

Well, as those can also be received after finished GetMessage, which seems to be asynchronous in this proposal, I guess this polling is quite reasonable.

Quoted 13 lines
Quoted 4 lines

               void SetFolder(boolean cdup, string name)

                       Set working directory for current session.

Quoted 8 lines
                       |  cdup  | folder name | operation    |
                       |=====================================|
                       | FALSE  | empty       | cd /         |
                       |--------+-------------+--------------|
                       | FALSE  | name        | cd name      |
                       |--------+-------------+--------------|
                       | TRUE   | [name]      | cd ..[/name] |
                       +-------------------------------------+
Quoted 2 lines

I thought we agree to have it just with name to make it less complicated and aligned with what we do for other profiles.

Not really complicated and allowing for full original functionality - i.e. one can go backwards and to subdirectory in one request. This is much easier than allowing for some "../subdir" as the only accepted path form (as no any other paths would be appropriate). Also there are no restrictions upon what characters could be used for folder name in MAP server implementation (even "..").

Quoted 19 lines
Quoted 7 lines

               array{dict(string property, string value)} GetFolderListing(dict(uint8 tag, uint16 value))

                       Retrieve list of names (and all other properties returned by MSE) for directories in CWD.

                       Parameters as in MAP specification section 5.4.

IMO this is too low level and potentially creates a need of a header/library to export what values can tag and value can assume.

Quoted 8 lines

               array{dict(string property, string value)} GetMessageListing(string folder, array{uint8 tag, variant value})

                       Return message listing for given subfolder of CWD or directly CWD if folder field is empty, format of each dict entry corresponds to the message listing format (MAP specification section 3.1.6).

Quoted 4 lines
Quoted 1 line

                       Parameters as in MAP specification section 5.5.

Same as GetFolderListing, also we should probably only list Message of the current folder otherwise we don't need ChangeFolder.

In every place in MAP specification "folder" is a name of subfolder, no path is acceptable. This is the same here. This parameter is guaranteed by MAP specification, so you can list messages one level below your cwd (which is convenient). Same feature is also present in folder listing in OBEX specification in general, however MAP specification does not mandate name parameter for giving child dir in GetFolderListing - probably someone forgot about it...

Quoted 7 lines
Quoted 7 lines

               object_path
               GetMessage(string handle, dict(uint8 tag, variant value), string filename)

                       Retrieve message (in BMSG format) from remote device and save it to a file *filename* (filename should be an absolute path and the file would be overwritten if it already exists).

Quoted 8 lines
Quoted 4 lines

                       A new Transfer object is created to represent this transaction and object_path pointing to it is returned.

                       Parameters as in MAP specification section 5.6.

Where this handle comes from? Also Im not sure what the second parameter is for apparently it is use as a filter in other Methods but here you want to read one single message so what this filter is for?

Handle is one of key terms in MAP. Those are unique in whole tree representation (i.e. getting message is independent from cwd). Those are retrieved in messages listing. For me (as I actually know MAP) also second parameter looks obvious - it's for setting optional parameters in request, and GetMessage can take those.

Quoted 9 lines
Quoted 6 lines

               void SetMessageStatus(string handle, uint8 indicator, uint8 value)

                       Modify status of a message on remote device.

                       Parameters as in MAP specification section 5.7.

What application will be using this? Can any application update the status of a message?

Yes it can. This is used for setting read status and (un)deleting messages.

Quoted 6 lines

Again by using a binary format defined in the
spec it gonna create either duplicated code to define them in each client or a need for a header/library.

Quoted 2 lines

               void UpdateInbox()

Quoted 7 lines
Quoted 1 line

                       Initiate update of inbox status on remote device.

Again what application want to use this? This looks like a notification from the server, which should be done by obexd not obex-client.

From MAP specification:

<quote>
5.9 UpdateInbox function
This function allows the MCE to initiate an update of the MSE's inbox, i.e. the MSE shall
contact the network (e.g. its mailbox) to retrieve new messages if available. </quote>

MCE is obex-client.

Signature · 1 line
Slawomir Bochenski