public bool Execute(IExecutionControl executionControl)
        {
            Console.WriteLine("Reconfiguring {0}", ip);
            var awUsbReconfig = new AnywhereUsbReconfig(ip);

            awUsbReconfig.LoadConfig();
            var portToSet  = Convert.ToInt32(port);
            var valueToSet = Convert.ToInt32(value);

            Console.WriteLine("Current {0} value {1}", portToSet, awUsbReconfig.GetParam(portToSet));
            Console.WriteLine("Setting {0} value to {1}", portToSet, valueToSet);
            awUsbReconfig.SetParam(portToSet, valueToSet);
            awUsbReconfig.SaveConfig();
            Console.WriteLine("Checking");
            awUsbReconfig.LoadConfig();
            var newParam = awUsbReconfig.GetParam(portToSet);

            Console.WriteLine("Current {0} value {1}", portToSet, newParam);
            if (newParam == valueToSet)
            {
                Console.WriteLine("Change successfull");
            }
            else
            {
                Console.WriteLine("Unsuccessfull. Aborting");
                return(false);
            }

            return(true);
        }
        public bool Execute(IExecutionControl executionControl)
        {
            Console.WriteLine("Reconfiguring {0}", ip);
            var awUsbReconfig = new AnywhereUsbReconfig(ip);
            awUsbReconfig.LoadConfig();
            var portToSet = Convert.ToInt32(port);
            var valueToSet = Convert.ToInt32(value);

            Console.WriteLine("Current {0} value {1}", portToSet, awUsbReconfig.GetParam(portToSet));
            Console.WriteLine("Setting {0} value to {1}", portToSet, valueToSet);
            awUsbReconfig.SetParam(portToSet, valueToSet);
            awUsbReconfig.SaveConfig();
            Console.WriteLine("Checking");
            awUsbReconfig.LoadConfig();
            var newParam = awUsbReconfig.GetParam(portToSet);
            Console.WriteLine("Current {0} value {1}", portToSet, newParam);
            if (newParam == valueToSet)
            {
                Console.WriteLine("Change successfull");
            }
            else
            {
                Console.WriteLine("Unsuccessfull. Aborting");
                return false;
            }

            return true;
        }
Exemple #3
0
        static void Test1()
        {
            while (true)
            {
                var searchDevice = "VID_2022&PID_0139&MI_00";
                var awUsbReconfig = new AnywhereUsbReconfig("192.168.11.122");
                awUsbReconfig.LoadConfig();

                for (int i = 1; i < AnywhereUsbReconfig.GROUP_COUNT; ++i)
                {
                    Console.WriteLine("Port {0} has group {1}", i, awUsbReconfig.GetParam(i));
                }

                var usbDeviceLookup = new UsbDeviceLookup();
                usbDeviceLookup.Test();

                usbDeviceLookup.WaitForConnection(searchDevice);

                Console.WriteLine("Enter port:");
                var portString = Console.ReadLine();
                Console.WriteLine("Enter group:");
                var groupString = Console.ReadLine();

                if (!String.IsNullOrEmpty(portString) && !String.IsNullOrEmpty(groupString))
                {
                    var portInt = Convert.ToInt32(portString);
                    var groupInt = Convert.ToInt32(groupString);

                    awUsbReconfig.SetParam(portInt, groupInt);

                    awUsbReconfig.SaveConfig();
                }
            }
        }
Exemple #4
0
        static void Test1()
        {
            while (true)
            {
                var searchDevice  = "VID_2022&PID_0139&MI_00";
                var awUsbReconfig = new AnywhereUsbReconfig("192.168.11.122");
                awUsbReconfig.LoadConfig();

                for (int i = 1; i < AnywhereUsbReconfig.GROUP_COUNT; ++i)
                {
                    Console.WriteLine("Port {0} has group {1}", i, awUsbReconfig.GetParam(i));
                }

                var usbDeviceLookup = new UsbDeviceLookup();
                usbDeviceLookup.Test();

                usbDeviceLookup.WaitForConnection(searchDevice);

                Console.WriteLine("Enter port:");
                var portString = Console.ReadLine();
                Console.WriteLine("Enter group:");
                var groupString = Console.ReadLine();

                if (!String.IsNullOrEmpty(portString) && !String.IsNullOrEmpty(groupString))
                {
                    var portInt  = Convert.ToInt32(portString);
                    var groupInt = Convert.ToInt32(groupString);

                    awUsbReconfig.SetParam(portInt, groupInt);

                    awUsbReconfig.SaveConfig();
                }
            }
        }