/// <summary> /// Removes an Application Framework message listener that was previously added with the addAFMessageListener method /// /// <param name="listener">a class that implements the <see cref="ApplicationFrameworkMessageListener"> interface</param> /// <returns>true if the listener was added</returns> /// </summary> public bool RemoveAFMessageListener(IApplicationFrameworkMessageListener listener) { bool result; lock (_messageListeners) { result = _messageListeners.Remove(listener); } if (_messageListeners.Count == 0 && IsHardwareReady()) { if (_commandInterface.RemoveAsynchronousCommandListener(_afMessageListenerFilter)) { Log.Verbose("Removed AsynchrounsCommandListener {Type} to ZigBeeSerialInterface", _afMessageListenerFilter.GetType().Name); } else { Log.Warning("Could not remove AsynchrounsCommandListener {} to ZigBeeSerialInterface", _afMessageListenerFilter.GetType().Name); } } if (result) { Log.Verbose("Removed ApplicationFrameworkMessageListener {}:{}", listener, listener.GetType().Name); return(true); } else { Log.Warning("Could not remove ApplicationFrameworkMessageListener {}:{}", listener, listener.GetType().Name); return(false); } }
/** * Clean up asynchronous command listener from command interface. */ public void Cleanup() { lock (_getCommandLockObject) { _commandInterface.RemoveAsynchronousCommandListener(this); _commandSync.Reset(); } }