On Wed, May 23, 2018 at 5:56 PM, George Nash <george.n...@intel.com> wrote:
> Does anyone know how to get a list of remote endpoints for an IoTivity C > client? > > > > In C++ I call > > OC::OCPlatfrom::findResource() with /oic/res and a callback to catch the > found resources (OCResource in C++). > > > > Once I have a resource I can call myResource.getAllHosts() to get a C++ > vector showing all the hosts (endpoints) for that resource. > > > > I can then change it to a different endpoint by passing one of the > endpoints from the getAllHosts() into the setHost member function. > > > > I can now call myResource.get(…) to call get using the new endpoint. > > > > In C is a little different but the basic flow is the same. > > > > Call OCDoResource(…,OC_REST_DISCOVER, uri, .. callback,..) to get a list > of the resources. > > > > Now I have the resource in the form of a OCClientResponse > > > > How do I get a list of all the servers endpoints (aka OCDevAddr). I know > how to get the OCDevAddr from the OCClientResonce that was a result of the > OC_REST_DISCOVER call. I don’t know how to get the other endponts so I can > then switch to a different endpoint when making the OCDoResource(.., > OC_REST_POST, …). > > > > Basically in C how do I get the same information as calling getAllHosts() > in C++? > > > I don't know about the C++ API, but the remote endpoints are in the discovery payload. In octypes.h: OCDiscoveryPayload -> OCResourcePayload -> OCEndpointPayload HTH, Gregg