// ------------------------------------------------------------- #endregion ctor // ------------------------------------------------------------- #region methods // ------------------------------------------------------------- /** * Gibt den Pin wieder frei */ public void Dispose( ) { this.ListenGpio.Dispose( ); this.listenGpio = null; this.pin = null; }
// ------------------------------------------------------------- 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); }
// ------------------------------------------------------------- #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); }