Beispiel #1
0
        /**
         * <summary>
         *   Returns the digital IO port state as an integer with each bit
         *   representing a channel.
         * <para>
         *   value 0 = <c>0b00000000</c> -> all channels are OFF
         *   value 1 = <c>0b00000001</c> -> channel #0 is ON
         *   value 2 = <c>0b00000010</c> -> channel #1 is ON
         *   value 3 = <c>0b00000011</c> -> channels #0 and #1 are ON
         *   value 4 = <c>0b00000100</c> -> channel #2 is ON
         *   and so on...
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   an integer corresponding to the digital IO port state as an integer with each bit
         *   representing a channel
         * </returns>
         * <para>
         *   On failure, throws an exception or returns <c>YDigitalIO.PORTSTATE_INVALID</c>.
         * </para>
         */
        public int get_portState()
        {
            int res;

            if (_func == null)
            {
                throw new YoctoApiProxyException("No DigitalIO connected");
            }
            res = _func.get_portState();
            if (res == YAPI.INVALID_INT)
            {
                res = _PortState_INVALID;
            }
            return(res);
        }