Пример #1
0
        // -------------------------------------------------------------

        #endregion ctor

        // -------------------------------------------------------------

        #region methods

        // -------------------------------------------------------------

        /**
         * Gibt den Pin wieder frei
         */
        public void Dispose(  )
        {
            this.ListenGpio.Dispose(  );

            this.listenGpio = null;

            this.pin = null;
        }
Пример #2
0
        // -------------------------------------------------------------

        public bool AddListen(ListenOnGpio listenOnGpio)
        {
            if (listenOnGpio == null)
            {
                return(false);
            }

            if (this.isDisposed)
            {
                return(false);
            }

            while (this.listeVonListenOnGpiosIsUse)
            {
            }

            this.listeVonListenOnGpiosIsUse = true;

            if (this.ListenOnGpios.Contains(listenOnGpio))
            {
                return(this.listeVonListenOnGpiosIsUse = false);
            }

            this.ListenOnGpios.Add(listenOnGpio);

            bool isok = this.ListenOnGpios.Count == 1;

            this.listeVonListenOnGpiosIsUse = false;

            if (isok)
            {
                this.StartListen(  );
            }

            return(true);
        }
Пример #3
0
        // -------------------------------------------------------------

        #endregion ctor

        // -------------------------------------------------------------

        #region methods

        // -------------------------------------------------------------

        public bool RemoveListen(ListenOnGpio listenOnGpio)
        {
            if (listenOnGpio == null)
            {
                return(false);
            }

            if (this.isDisposed)
            {
                return(false);
            }

            while (this.listeVonListenOnGpiosIsUse)
            {
            }

            this.listeVonListenOnGpiosIsUse = true;

            if (!this.ListenOnGpios.Contains(listenOnGpio))
            {
                return(this.listeVonListenOnGpiosIsUse = false);
            }

            this.ListenOnGpios.Remove(listenOnGpio);

            bool isok = this.ListenOnGpios.Count == 0;

            this.listeVonListenOnGpiosIsUse = false;

            if (isok)
            {
                this.StopListen(  );
            }

            return(true);
        }