On Jun 27, 2016 2:20 AM, "Max Kholmyansky" <max001 at gmail.com> wrote:
>
> Hi,
>
> I am confused since I failed to understand how to find the connection
between the "resources" and the "devices".
>
> To my best knowledge of the OCF spec:
> Devices must have unique identifiers set by manufacturers ("di" attribute
value).
> Devices can have multiple resources. For example, Smart Home spec says
"thermostat" device type must contain 2 "temperature" resources.
> I am not aware of any requirement for a unique identifier for a resource.
I'm not an expert but my understanding is that every resource must have a
uri, which is unique by definition.
> So I would expect IoTivity to expose a hierarchy between devices and
resources.
I believe it's a virtual hierarchy. When you register ("create") a
resource you do not associate it with a device. so the oic/res resource is
effectively a resource manager that manages a (local) global list of
uri-resource pairs.
every oic "widget" must have one canonical device but may have more. a
device in this sense is a resource of type oic.wk.d (I think, going from
memory here.) so to get all devices you query for that type.
I'm not so clear about the association of resources and devices, but my
understanding is that the same resource could be associated with multiple
devices. But its hard to say - frankly, the OIC Spec is not exactly a
paragon of clarity.
>
> My "dream logic":
>
> First, the app finds the devices and identify them using the unique ID
(assuming the app logic needs to "remember" something about the devices,
and not just find them).
> Then, find the respective resources of the devices, so the app can
control the device.
>
> Unfortunately, failed to understand from the samples how it can be done.
>
> Looking in the Android code:
> Resource discovery is done via OcPlatform.findResource(),
> Device discovery is done via OcPlatform.getDeviceInfo().
I suspect the idea is that after you do device discovery, you then do
resource discovery to a specific device, but we have now arrived at the
limits of my knowledge.
hope that helps, or prompts Somebody Who Knows to clarify.
gregg
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160627/a09984f5/attachment.html>