Hi,
Is anybody working on SRM support in obexd ? I might be able to spend
some time on this but would like to avoid duplication of effort if
it's in the pipeline.
Cheers,
Piotr
Am Donnerstag, 23. Juni 2011, 10:31:26 schrieb Luiz Augusto von Dentz:
> I guess he meant that to make this work properly the socket must be
> non-blocking so that OpenOBEX needs to detected when a packet could
> not be written and somehow wake-up the application whenever it can
> resume.
I mean that currently OpenOBEX uses non-blocking sockets like blocking socket
by busy-looping until all data of one packet is written. On slow devices, this
is maybe not wanted, especially when using non-blocking sockets in the first
place :)
The control of re-calling OpenOBEX is still on the application side.
HS
Hi Nami,
On Thu, Jun 23, 2011 at 11:23 AM, Li, Nami <[email protected]> wrote:
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Hendrik Sattler
> Sent: 2011年6月22日 19:18
> To: Luiz Augusto von Dentz
> Cc: Li, Nami; Piotr Zgórecki; [email protected]; Liu, Haijun; Fan, Hong
> Subject: Re: SRM support in OBEX
>
> Zitat von Luiz Augusto von Dentz <[email protected]>:
>
>> Hi Nami,
>>
>> 2011/6/22 Li, Nami <[email protected]>:
>>> Hi, Piotr
>>> I worked on SRM several weeks ago but finally stopped.
>>> It`s easy to set and check SRM header, as well as set the response
>>> mode to OBEX_RSP_MODE_SINGLE. And it is already well supported in
>>> obex_work function when the response mode is SRM, client and server
>>> can continue send data without remote side response or request. The
>>> obex_work callback relationship is:
>>> obex_session_start()
>>> ...
>>> g_io_add_watch_full(io, G_PRIORITY_DEFAULT,
>>> G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
>>> obex_handle_input, obex, obex_handle_destroy);
>>> ...
>>> obex_handle_input()
>>> ...
>>> OBEX_HandleInput(obex, 1)
>>> ...
>>> OBEX_HandleInput()
>>> ...
>>> obex_work(self, timeout);
>>>
>>> The problem in SRM is:
>>> If remote side doesn`t send any data to local side, then the G_IO_IN
>>> condition couldn`t be set. So how obex_work can be called?
>>>
>>> I haven`t found any good solution for this issue. So if you can spend
>>> some time on SRM, I`ll be very happy:)
>>
>> No top posting in this list, please.
>>
>> So back to the topic, we probably need to add another watch with
>> G_IO_OUT when using SRM so that it wake ups whenever we can write to
>> the socket/fd, obviously this should only be active when we are
>> sending data (GET) and there is no need to call OBEX_HandleInput.
>
> You have to call OBEX_HandleInput() for sure. It does the work also for the SRM case. I am also redesigning the state machine in OpenOBEX so that incomplete writes on non-blocking sockets are possible. This feature will be protected by a flag because it creates a small problem like for SRM.
> If you need a function in OpenOBEX that tells you if input-independent writes are needed, just tell me or create one :-)
>
> HS
>
> What do you mean "incomplete writes on non-blocking sockets " and " input-independent writes "? Do you mean to write lots of data one time and use G_IO_OUT to wakeup obex_work?
I guess he meant that to make this work properly the socket must be
non-blocking so that OpenOBEX needs to detected when a packet could
not be written and somehow wake-up the application whenever it can
resume.
--
Luiz Augusto von Dentz
DQoNCi0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQpGcm9tOiBsaW51eC1ibHVldG9vdGgtb3du
ZXJAdmdlci5rZXJuZWwub3JnIFttYWlsdG86bGludXgtYmx1ZXRvb3RoLW93bmVyQHZnZXIua2Vy
bmVsLm9yZ10gT24gQmVoYWxmIE9mIEhlbmRyaWsgU2F0dGxlcg0KU2VudDogMjAxMeW5tDbmnIgy
MuaXpSAxOToxOA0KVG86IEx1aXogQXVndXN0byB2b24gRGVudHoNCkNjOiBMaSwgTmFtaTsgUGlv
dHIgWmfDs3JlY2tpOyBsaW51eC1ibHVldG9vdGhAdmdlci5rZXJuZWwub3JnOyBMaXUsIEhhaWp1
bjsgRmFuLCBIb25nDQpTdWJqZWN0OiBSZTogU1JNIHN1cHBvcnQgaW4gT0JFWA0KDQpaaXRhdCB2
b24gTHVpeiBBdWd1c3RvIHZvbiBEZW50eiA8bHVpei5kZW50ekBnbWFpbC5jb20+Og0KDQo+IEhp
IE5hbWksDQo+DQo+IDIwMTEvNi8yMiBMaSwgTmFtaSA8bmFtaUBxY2EucXVhbGNvbW0uY29tPjoN
Cj4+IEhpLCBQa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EdfSU9fT1VUIHRvIHdha2V1
cCBvYmV4X3dvcms/DQoNClJlZ2FyZHMsDQpOYW1pDQoNCg0KDQotLQ0K
Zitat von Luiz Augusto von Dentz <[email protected]>:
> Hi Nami,
>
> 2011/6/22 Li, Nami <[email protected]>:
>> Hi, Piotr
>> ?I worked on SRM several weeks ago but finally stopped.
>> ?It`s easy to set and check SRM header, as well as set the response
>> mode to OBEX_RSP_MODE_SINGLE. And it is already well supported in
>> obex_work function when the response mode is SRM, client and server
>> can continue send data without remote side response or request. The
>> obex_work callback relationship is:
>> obex_session_start()
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?...
>> ? ? ? ? ? ? ? ? ? ? ? ?g_io_add_watch_full(io, G_PRIORITY_DEFAULT,
>> ? ? G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, ? ?
>> ?obex_handle_input, obex, obex_handle_destroy);
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?...
>> obex_handle_input()
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?...
>> ? ? ? ? ? ? ? ? ? ? ? ?OBEX_HandleInput(obex, 1)
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?...
>> OBEX_HandleInput()
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?...
>> ? ? ? ? ? ? ? ? ? ? ? ?obex_work(self, timeout);
>>
>> The problem in SRM is:
>> If remote side doesn`t send any data to local side, then the
>> G_IO_IN condition couldn`t be set. So how obex_work can be called?
>>
>> I haven`t found any good solution for this issue. So if you can
>> spend some time on SRM, I`ll be very happy:)
>
> No top posting in this list, please.
>
> So back to the topic, we probably need to add another watch with
> G_IO_OUT when using SRM so that it wake ups whenever we can write to
> the socket/fd, obviously this should only be active when we are
> sending data (GET) and there is no need to call OBEX_HandleInput.
You have to call OBEX_HandleInput() for sure. It does the work also
for the SRM case. I am also redesigning the state machine in OpenOBEX
so that incomplete writes on non-blocking sockets are possible. This
feature will be protected by a flag because it creates a small problem
like for SRM.
If you need a function in OpenOBEX that tells you if input-independent
writes are needed, just tell me or create one :-)
HS
Hi Nami,
2011/6/22 Li, Nami <[email protected]>:
> Hi, Piotr
> ?I worked on SRM several weeks ago but finally stopped.
> ?It`s easy to set and check SRM header, as well as set the response mode to OBEX_RSP_MODE_SINGLE. And it is already well supported in obex_work function when the response mode is SRM, client and server can continue send data without remote side response or request. The obex_work callback relationship is:
> obex_session_start()
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?...
> ? ? ? ? ? ? ? ? ? ? ? ?g_io_add_watch_full(io, G_PRIORITY_DEFAULT, ? ? G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, ? ? ?obex_handle_input, obex, obex_handle_destroy);
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?...
> obex_handle_input()
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?...
> ? ? ? ? ? ? ? ? ? ? ? ?OBEX_HandleInput(obex, 1)
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?...
> OBEX_HandleInput()
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?...
> ? ? ? ? ? ? ? ? ? ? ? ?obex_work(self, timeout);
>
> The problem in SRM is:
> If remote side doesn`t send any data to local side, then the G_IO_IN condition couldn`t be set. So how obex_work can be called?
>
> I haven`t found any good solution for this issue. So if you can spend some time on SRM, I`ll be very happy:)
No top posting in this list, please.
So back to the topic, we probably need to add another watch with
G_IO_OUT when using SRM so that it wake ups whenever we can write to
the socket/fd, obviously this should only be active when we are
sending data (GET) and there is no need to call OBEX_HandleInput.
--
Luiz Augusto von Dentz
SGksIFBpb3RyDQogIEkgd29ya2VkIG9uIFNSTSBzZXZlcmFsIHdlZWtzIGFnbyBidXQgZmluYWxs
eSBzdG9wcGVkLg0KICBJdGBzIG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