Esempio n. 1
0
        public static void Main(string[] args)
        {
            //change this to your server's IP or hostname
            String owServer = "blue";

            // change this to your server's PORT
            int owServerPort = 4304;

            // change the following to a valid attribute to read from server
            String owAttribute = "/28.0E67C0000000/temperature";



            OWNet ow = new OWNet(owServer, owServerPort);

            ow.Debug = true;
            ow.PersistentConnection = true;

            ow.Connect();

            String[] folders = ow.DirAll("/");
            foreach (String s in folders)
            {
                Console.WriteLine(s);
            }

            Console.WriteLine(ow.Read(owAttribute));


            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
            Console.WriteLine();
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            //change this to your server's IP or hostname
            String owServer = "192.168.2.150";

            // change this to your server's PORT
            int owServerPort = 4304;

            // change the following to a valid attribute to read from server
            String owAttribute = "/28.93A413000000/temperature";



            OWNet ow = new OWNet(owServer, owServerPort);

            ow.Debug = true;
            ow.PersistentConnection = false;


            try
            {
                ow.Connect();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }



            String[] folders = ow.DirAll("/");
            foreach (String s in folders)
            {
                try
                {
                    Console.WriteLine(s.Substring(1));
                }
                catch
                {
                    Console.WriteLine(s);
                }
            }
            string temp1 = "8585";

            try
            {
                temp1 = ow.Read(owAttribute);
                Console.WriteLine(temp1);
            }
            catch
            {
                Console.WriteLine("Can't read");
                // Console.WriteLine(temp1);
            }

            //Console.WriteLine(ow.Read(owAttribute));

            //Console.WriteLine(ow.Read(owAttribute));


            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
            Console.WriteLine();
        }