Re: Discovery API proposals: call for comments

Clarke Stevens wrote:
> Is there any reason to limit this to one type per protocol or to two
> protocols? I think it would be very useful to look (for example) for both
> UPnP CDS devices and UPnP Renderer devices with one call. I think we could
> do this just by understanding the size of the array and using the type
> value to deduce the protocol. Also, this would support any arbitrary
> number of protocols.

This is what has been added in the update below so now a web page can 
request multiple service types up front and receive multiple service 
types in the callback (and you can deduce the processing required with 
the type attribute in the callback).

- Rich

>
> On 9/22/11 7:36 AM, "Rich Tibbett"<richt@opera.com>  wrote:
>
>> N.V.Balaji wrote:
>>>>> 2. As I understand the type to be used in getNetworkServices depends
>>>>> on
>>>>> the external standards being used by the service provider. As a web
>>>>> programmer, how do I detect a TV without knowing specific protocol
>>>>> being
>>>>> used by the service provider. Am I supposed to invoke
>>>>> getNetworkServices
>>>>> twice with different types?
>>>> Currently, that is the expected behavior.
>>>>
>>>> We _could_ allow web pages to request more than one service type in
>>>> the getNetworkServices 'type' argument. So you could request multiple
>>>> service types from the network. In the NetworkService result we would
>>>> echo the service type that the user selected in a 'type' attribute.
>>>>
>>>> Something like the follows:
>>>>
>>>> navigator.getNetworkServices(['_boxee-jsonrpc._tcp',
>>>> '_xbmc-jsonrpc._tcp'], success);
>>>>
>>>> function success( services ) {
>>>> for(var i in services) {
>>>> var serviceType = services[i].type;
>>>> if(serviceType == '_boxee-jsonrpc._tcp') {
>>>> // communicate with Boxee's JSON-RPC API via services[i].url
>>>> } else {
>>>> // communicate with XBMC's JSON-RPC API via services[i].url
>>>> }
>>>> }
>>>> }
>>>>
>>> [NVB]: This works given that we have only 2 discovery protocols.
>> I've updated the Opera proposal to include this behavior.
>>
>> Many thanks,
>>
>> Rich
>>
>

Received on Friday, 23 September 2011 09:34:17 UTC