//*** /// <summary> /// Does this location contain this port? /// </summary> public bool ContainsPort(HomeOS.Hub.Platform.Views.VPortInfo portInfo) { foreach (var childPort in ChildPorts) { if (childPort.Equals(portInfo)) { return(true); } } foreach (var childLocation in ChildLocations) { if (childLocation.ContainsPort(portInfo)) { return(true); } } return(false); }
/// <summary> /// Constructor for the Port object /// </summary> /// <param name="info">The PortInfo object that this port corresponds to</param> /// <param name="owner">The owning module that is initializing the port</param> /// <param name="status">The status of the port (mostly unused right now)</param> /// <param name="logger">The default logging object for log messages from this port</param> /// <param name="handler">The function to call when notifications are received by the port</param> public Port(HomeOS.Hub.Platform.Views.VPortInfo info, HomeOS.Hub.Platform.Views.VModule owner, PortStatus status, HomeOS.Hub.Platform.Views.VLogger logger, OperationReturnHandler handler) { this.portInfo = info; this.Status = status; this.logger = logger; this.handler = handler; this.subscribedPorts = new Dictionary <OperationKey, List <SubscriptionInfo> >(); this.operationDelegates = new Dictionary <OperationKey, OperationDelegate>(); foreach (HomeOS.Hub.Platform.Views.VRole role in info.GetRoles()) { foreach (HomeOS.Hub.Platform.Views.VOperation operation in role.GetOperations()) { this.operationDelegates[new OperationKey(operation.Name())] = null; } } currentCapabilities = new Dictionary <HomeOS.Hub.Platform.Views.VCapability, bool>(); }