Exemple #1
0
        /// <summary>
        /// Discover and create all RIOT nodes for the host server
        /// </summary>
        public static IotClientNode Discover(string serverAndPort, string userAndPassword)
        {
            IotHttpClient client = new IotHttpClient(serverAndPort, userAndPassword);
            IotClientNode root   = new IotClientNode("", client, null);
            IList <HttpServiceEndpoint> endpoints = client.DiscoverAvailableEndpoints();

            if (endpoints?.Count > 0)
            {
                foreach (IotClientFactory factory in Factories)
                {
                    IotClientNode node = factory.CreateClientNode(endpoints, client);
                    if (node != null)
                    {
                        root.AddNode(node);
                    }
                }
            }
            return(root);
        }
Exemple #2
0
 /// <summary>
 /// create client node (and possible subnodes) based on the endpoints
 /// </summary>
 /// <param name="endpoints">the list of endpoints</param>
 /// <returns>returns the root client node that may contain all the child nodes</returns>
 protected abstract IotClientNode CreateClientNode(IList <HttpServiceEndpoint> endpoints, IotHttpClient client);
Exemple #3
0
 /// <summary>
 /// constructor
 /// </summary>
 public IotClientNode(string id, IotHttpClient client, IotNode parent)
     : base(id, parent)
 {
     Client = client;
 }