Sorry for late question for this topic.

Antu question is a little bit different from understanding.
IoTivity has the API to create the remote resource object with once
discovered resource information as follows.

        public static OcResource constructResourceObject(
            String host,
            String uri,
            EnumSet<OcConnectivityType> connectivityTypeSet,
            boolean isObservable,
            List<String> resourceTypeList,
            List<String> interfaceList) throws OcException

This is usually used for accessing resource without discovery step which
discovered resource yesterday.
Regardless re-defining exact API naming, here host param will not accept
the address with interface name.

Furthermore, for the discovered resource, interface detail can be stored in
the ifindex.

typedef struct
{
    OCTransportAdapter      adapter;    /** adapter type.*/
    OCTransportFlags        flags;              /** transport modifiers.*/
    uint16_t                port;               /** for IP.*/
    char                    addr[MAX_ADDR_STR_SIZE];    /** address for all
adapters.*/
    uint32_t                ifindex;    /** usually zero for default
interface.*/
} OCDevAddr;

For the C++ or Java API, provide the getter API for ifindex and rename or
redefine the gethost API looks appropriate.

BR, Uze Choi
-----Original Message-----
From: iotivity-dev-boun...@lists.iotivity.org [mailto:iotivity-dev-
bounces at lists.iotivity.org] On Behalf Of Thiago Macieira
Sent: Monday, July 18, 2016 5:04 PM
To: i.mushfiq at samsung.com
Cc: iotivity-dev at lists.iotivity.org
Subject: Re: [dev] OcResource->getHost() api gives a tricky host address in
Android

On segunda-feira, 18 de julho de 2016 05:38:40 PDT Muhammad Mushfiqul Islam
wrote:
> Dear Mr. Thiago,
> I am not any designer nor developer of iotivity, but as a user, as far 
> as I know, that const std::string& host argument is not host name, 
> rather it is ip & port information of the host in coap://IP:Port 
> format([IP]:Port for IPv6).  The const std::string& uri is the 
> relative uri, which should be used after IP & Port. These information 
> are necessary to create the resource object, as Iotivity uses the 
> resource object to send get/put/post/delete requests to a resource.

And, like I said, that makes it a design flaw and current defect in the API.

The current host's addresses (plural!) and the port numbers that IoTivity
used are already known to IoTivity. Repeating them in the registration is
unnecessary and either redudant or just plain wrong.

Users never type host addresses. Ever.

--
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

_______________________________________________
iotivity-dev mailing list
iotivity-dev at lists.iotivity.org
https://lists.iotivity.org/mailman/listinfo/iotivity-dev


Reply via email to