DeviceWindow::DeviceWindow(QWidget *parent) : QMainWindow(parent), m_ui(new Ui::DeviceWindow), m_deviceHost(0), m_testDevice() { m_ui->setupUi(this); HDeviceHostConfiguration hostConfiguration; Creator creator; hostConfiguration.setDeviceModelCreator(creator); HDeviceConfiguration config; config.setPathToDeviceDescription( "./descriptions/hupnp_testdevice.xml"); // the path to the device description file we want to be instantiated config.setCacheControlMaxAge(30); hostConfiguration.add(config); m_deviceHost = new HDeviceHost(this); if (!m_deviceHost->init(hostConfiguration)) { qWarning() << m_deviceHost->errorDescription(); Q_ASSERT(false); return; } m_testDevice = m_deviceHost->rootDevices().at(0); // since we know there is at least one device if the initialization succeeded... HServerService* service = m_testDevice->serviceById(HServiceId("urn:herqq-org:serviceId:HTestService")); // our user interface is supposed to react when our actions are invoked, so // let's connect the signal introduced in HTestService to this class. // (note that the connection works although the static type of our "service" // is not HTestService during the connect() call) bool ok = connect( service, SIGNAL(actionInvoked(QString, QString)), this, SLOT(actionInvoked(QString, QString))); Q_ASSERT(ok); Q_UNUSED(ok) }
MediaRendererManager::MediaRendererManager(Herqq::Upnp::Av::HAvControlPoint *cp) : QObject(), m_pDeviceHost(0), m_pControlPoint(cp), m_pMediaRenderer(0), m_pConnectionMgr(new MediaRendererConnectionManager(this)), m_displayWindows(), // m_pCurWindow(0), m_pNetworkMgr(new QNetworkAccessManager(this)) { HMediaRendererDeviceConfiguration mediaRendererConfig; mediaRendererConfig.setRendererConnectionManager(m_pConnectionMgr, false); HAvDeviceModelCreator creator; creator.setMediaRendererConfiguration(mediaRendererConfig); HDeviceConfiguration config; config.setPathToDeviceDescription("./descriptions/herqq_mediarenderer_description.xml"); HDeviceHostConfiguration hostConfig; hostConfig.setDeviceModelCreator(creator); hostConfig.add(config); m_pDeviceHost = new HDeviceHost(); if (!m_pDeviceHost->init(hostConfig)) { qWarning() << m_pDeviceHost->errorDescription(); Q_ASSERT(false); } // bool ok = connect( // m_pControlPoint, // SIGNAL(mediaRendererOnline(Herqq::Upnp::Av::HMediaRendererAdapter*)), // this, // SLOT(mediaRendererOnline(Herqq::Upnp::Av::HMediaRendererAdapter*))); // Q_ASSERT(ok); // Q_UNUSED(ok); // HServerStateVariable* currentConnectionIDs = // m_pMediaRenderer->connectionManager()-> // stateVariables().value("CurrentConnectionIDs"); }