ISSUE-129: Simplify Network Service Discovery API

Simplify Network Service Discovery API

State:
CLOSED
Product:
Network Service Discovery
Raised by:
Jean-Claude Dufourd
Opened on:
2013-07-09
Description:
from email: http://lists.w3.org/Archives/Public/public-device-apis/2013Jun/0015.html


The current NSD API is used in this sequence:
- NSD.getNetworkServices( "type", callback, errorcb)
- then in callback, you immediately set the onserviceavailable callback
and you return, because usually, the first NetworkServices object you
get is empty
- then onserviceavailable is called, and in there you call
NSD.getNetworkServices( "type", callback, errorcb) again
- then in callback, you immediately set the onserviceavailable callback
and you do the actual work.

You need to define:
- a function calling NSD.getNetworkServices( "type", successcallback,
errorcb)
- a onserviceavailable callback that calls NSD.getNetworkServices(
"type", successcallback, errorcb)
- the successcallback.

It is possible to define a wrapper around this to deal with the
onserviceavailable process transparently for the author, on top of the
existing API.
Thus, I avoid the need for the definition of onserviceavailable.

The actual code does the same as above, but the process that the webapp
author sees is:
- discover( "type", callback, errorcb)
- then in callback, you immediately do the actual work.

Why not simplify the API and get rid of the need for onserviceavaible ?
Why make the API more complex than it needs to be ?
Why expose a more intricate process that brings no advantage ?

Best regards
JC

Note: here is a possible implementation of the wrapper avoiding the need
for onserviceavailable:

function discover(serviceType, callBack, errcb) {

var thisFunction = function (services) {

services.onserviceavailable = function () {

NSD.getNetworkServices(serviceType, thisFunction, errcb);

};

if (services.length > 0) {

callBack.call(this, services);

}

};

NSD.getNetworkServices(serviceType, thisFunction, errcb);

}
Related Actions Items:
No related actions
Related emails:
  1. RE: DAP-ISSUE-130 (was: Draft Minutes 21 August 2013 teleconference) (from Cathy.Chan@nokia.com on 2013-08-28)
  2. Re: Draft Minutes 21 August 2013 teleconference (from Frederick.Hirsch@nokia.com on 2013-08-27)
  3. Re: Draft Minutes 21 August 2013 teleconference (from jean-claude.dufourd@telecom-paristech.fr on 2013-08-22)
  4. Draft Minutes 21 August 2013 teleconference (from Frederick.Hirsch@nokia.com on 2013-08-21)
  5. Agenda - Distributed Meeting 21 August 2013 (from Frederick.Hirsch@nokia.com on 2013-08-20)
  6. Agenda - Distributed Meeting 14 August 2013 (from Frederick.Hirsch@nokia.com on 2013-08-13)
  7. Agenda - Distributed Meeting 7 August 2013 (from Frederick.Hirsch@nokia.com on 2013-08-05)
  8. [admin] Draft Minutes 24 July 2013 (from Frederick.Hirsch@nokia.com on 2013-08-05)
  9. Re: DAP-ISSUE-129: Simplify Network Service Discovery API [Network Service Discovery] (from Frederick.Hirsch@nokia.com on 2013-07-24)
  10. Re: DAP-ISSUE-129: Simplify Network Service Discovery API [Network Service Discovery] (from Frederick.Hirsch@nokia.com on 2013-07-24)
  11. Agenda - Distributed Meeting 24 July 2013 (corrected date) (from Frederick.Hirsch@nokia.com on 2013-07-23)
  12. Agenda - Distributed Meeting 23 July 2013 (from Frederick.Hirsch@nokia.com on 2013-07-23)
  13. [admin] Cancel DAP teleconference 17 July 2013 (from Frederick.Hirsch@nokia.com on 2013-07-16)
  14. Re: DAP-ISSUE-129: Simplify Network Service Discovery API [Network Service Discovery] (from jean-claude.dufourd@telecom-paristech.fr on 2013-07-16)
  15. RE: DAP-ISSUE-129: Simplify Network Service Discovery API [Network Service Discovery] (from Cathy.Chan@nokia.com on 2013-07-15)
  16. Draft minutes 10 July 2013 (from jsoref@blackberry.com on 2013-07-10)
  17. Agenda - Distributed Meeting 10 July 2013 (from Frederick.Hirsch@nokia.com on 2013-07-10)
  18. [network-discovery] Open Issues for Network Discovery (from Frederick.Hirsch@nokia.com on 2013-07-09)
  19. DAP-ISSUE-129: Simplify Network Service Discovery API [Network Service Discovery] (from sysbot+tracker@w3.org on 2013-07-09)

Related notes:

[fjh]: Simplify Network Service Discovery API ;http://www.w3.org/2009/dap/track/issues/129

24 Jul 2013, 14:09:33

Display change log ATOM feed


Anssi Kostiainen <anssi.kostiainen@intel.com>, Reilly Grant <reillyg@google.com>, Chairs, Fuqiao Xue <xfq@w3.org>, Staff Contact
Tracker: documentation, (configuration for this group), originally developed by Dean Jackson, is developed and maintained by the Systems Team <w3t-sys@w3.org>.
$Id: 129.html,v 1.1 2019/11/08 08:57:58 carcone Exp $