/// <summary> /// This constructor is called with the UPnPDevice that contains the services of a MediaRenderer device. /// </summary> /// <param name="device">The UPnPDevice</param> public AVRenderer(UPnPDevice device) { OpenSource.Utilities.InstanceTracker.Add(this); this.ConnectionMonitor.OnExpired += new LifeTimeMonitor.LifeTimeHandler(ConnectionMonitorSink); MainDevice = device; ConnectionManager = new CpConnectionManager(device.GetServices(CpConnectionManager.SERVICE_NAME)[0]); ConnectionManager.OnStateVariable_CurrentConnectionIDs += new CpConnectionManager.StateVariableModifiedHandler_CurrentConnectionIDs(ConnectionIDEventSink); ConnectionManager._subscribe(90); //TODO: Fails to compile after using generated code from DeviceBuilderV23. Seems like CpConnectionManager.PeriodicRenewFailedHandler is no longer defined? //ConnectionManager.OnPeriodicRenewFailed += new CpConnectionManager.PeriodicRenewFailedHandler(PeriodicRenewFailedSink); // Grab initial state of the ConnectionManager Service if(ConnectionManager.HasAction_GetProtocolInfo) { ConnectionManager.GetProtocolInfo(null,new CpConnectionManager.Delegate_OnResult_GetProtocolInfo(GetProtocolInfoSink)); } if(ConnectionManager.HasAction_GetCurrentConnectionIDs) { ConnectionManager.GetCurrentConnectionIDs(null,new CpConnectionManager.Delegate_OnResult_GetCurrentConnectionIDs(IDSink)); } if(ConnectionManager.HasAction_PrepareForConnection==false) { lock(InstanceList) { AVConnection ac = new AVConnection(MainDevice,0,0,0,new AVConnection.OnReadyHandler(ReadySink), null); ac._Parent = this; DontEverDelete = true; if(InstanceList.Count==0) InstanceList.Add(ac); } /* Wait for Ready if(InstanceList.Count>0) { if(OnCreateConnection!=null) OnCreateConnection(this,(AVConnection)InstanceList[0],Guid.NewGuid().GetHashCode()); } */ } }