Exemple #1
0
        //#######DEVICE CONFIGURATION######//

        private void Set_Idle()
        {
            try
            {
                zmien_richTextBox1(" Set to Idle");

                mscl.SetToIdleStatus status = node.setToIdle();

                while (!status.complete(300))
                {
                    Console.Write(".");
                }

                switch (status.result())
                {
                case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_success:
                    break;

                case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_canceled:
                    break;

                case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_failed:
                default:
                    break;
                }
            }
            catch (mscl.Error err)
            {
                zmien_richTextBox1("Error: " + err.Message);
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                //create a Serial Connection with the specified COM Port, default baud rate of 921600
                mscl.Connection connection = mscl.Connection.Serial(COM_PORT);

                //create a BaseStation with the connection
                mscl.BaseStation baseStation = new mscl.BaseStation(connection);

                //create a WirelessNode with the BaseStation we created
                mscl.WirelessNode node = new mscl.WirelessNode(NODE_ADDRESS, baseStation);

                //call the set to idle function and get the resulting SetToIdleStatus object
                mscl.SetToIdleStatus status = node.setToIdle();

                Console.Write("Setting Node to Idle");

                //using the SetToIdleStatus object, check if the Set to Idle operation is complete.
                //	Note: we are specifying a timeout of 300 milliseconds here which is the maximum
                //		  amount of time that the complete function will block if the Set to Idle
                //		  operation has not finished. Leaving this blank defaults to a timeout of 10ms.
                while (!status.complete(300))
                {
                    //Note: the Set to Idle operation can be canceled by calling status.cancel()
                    Console.Write(".");
                }

                //at this point, the Set to Idle operation has completed

                //check the result of the Set to Idle operation
                switch (status.result())
                {
                //completed successfully
                case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_success:
                    Console.WriteLine("Successfully set to idle!");
                    break;

                //canceled by the user
                case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_canceled:
                    Console.WriteLine("Set to Idle was canceled!");
                    break;

                //Failed to perform the operation
                case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_failed:
                default:
                    Console.WriteLine("Set to Idle has failed!");
                    break;
                }
            }
            catch (mscl.Error e)
            {
                Console.WriteLine("Error: " + e.Message);
            }

            Console.WriteLine("Press Enter to quit...");
            Console.Read();
        }
        private void Set_Idle()
        {
            do
            {
                switch (num_node)
                {
                case 1:
                    node = node1;
                    break;

                case 2:
                    node = node2;
                    break;

                case 3:
                    node = node3;
                    break;

                case 4:
                    node = node4;
                    break;

                case 5:
                    node = node5;
                    break;
                }
                try
                {
                    zmien_richTextBox1(" Set to Idle");

                    mscl.SetToIdleStatus status = node.setToIdle();
                    while (!status.complete(300))
                    {
                        Console.Write(".");
                    }

                    switch (status.result())
                    {
                    case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_success:
                        break;

                    case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_canceled:
                        break;

                    case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_failed:
                    default:
                        break;
                    }
                }
                catch (mscl.Error err)
                {
                    zmien_richTextBox1("Error: " + err.Message);
                }
                num_node++;
            } while (num_node < 6);
        }
Exemple #4
0
        public static void setToIdle(mscl.WirelessNode node)
        {
            //call the set to idle function and get the resulting SetToIdleStatus object
            mscl.SetToIdleStatus status = node.setToIdle();

            Console.Write("Setting Node to Idle");

            //using the SetToIdleStatus object, check if the Set to Idle operation is complete.
            //	Note: we are specifying a timeout of 300 milliseconds here which is the maximum
            //		  amount of time that the complete function will block if the Set to Idle
            //		  operation has not finished. Leaving this blank defaults to a timeout of 10ms.
            while (!status.complete(300))
            {
                //Note: the Set to Idle operation can be canceled by calling status.cancel()
                Console.Write(".");
            }

            //at this point, the Set to Idle operation has completed

            //check the result of the Set to Idle operation
            switch (status.result())
            {
            //completed successfully
            case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_success:
                Console.WriteLine("Successfully set to idle!");
                break;

            //canceled by the user
            case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_canceled:
                Console.WriteLine("Set to Idle was canceled!");
                break;

            //Failed to perform the operation
            case mscl.SetToIdleStatus.SetToIdleResult.setToIdleResult_failed:
            default:
                Console.WriteLine("Set to Idle has failed!");
                break;
            }
        }