void SuiteMsearch::Test() { DviDevice* device = new DviDeviceStandard(iDvStack, gNameDevice1); iDevices[0] = device; device->SetAttribute("Upnp.Domain", "upnp.org"); device->SetAttribute("Upnp.Type", "test1"); device->SetAttribute("Upnp.Version", "1"); AddService(device, new DviService(iDvStack, "upnp.org", "service1", 1)); AddService(device, new DviService(iDvStack, "openhome.org", "service2", 3)); AddService(device, new DviService(iDvStack, "upnp.org", "service3", 1)); DviService* service = new DviService(iDvStack, "upnp.org", "service1", 1); TEST_THROWS(device->AddService(service), AssertionFailed); service->RemoveRef(); device->SetEnabled(); service = new DviService(iDvStack, "upnp.org", "service4", 1); TEST_THROWS(device->AddService(service), AssertionFailed); service->RemoveRef(); device = new DviDeviceStandard(iDvStack, gNameDevice2); iDevices[1] = device; device->SetAttribute("Upnp.Domain", "openhome.org"); device->SetAttribute("Upnp.Type", "test2"); device->SetAttribute("Upnp.Version", "2"); AddService(device, new DviService(iDvStack, "openhome.org", "service4", 2)); AddService(device, new DviService(iDvStack, "openhome.org", "service5", 1)); device = new DviDeviceStandard(iDvStack, gNameDevice2Embedded1); iDevices[1]->AddDevice(device); device->SetAttribute("Upnp.Domain", "openhome.org"); device->SetAttribute("Upnp.Type", "test3"); device->SetAttribute("Upnp.Version", "1"); AddService(device, new DviService(iDvStack, "upnp.org", "service1", 1)); AddService(device, new DviService(iDvStack, "openhome.org", "service6", 1)); AddService(device, new DviService(iDvStack, "openhome.org", "service2", 3)); service = new DviService(iDvStack, "openhome.org", "service5", 1); TEST_THROWS(device->AddService(service), AssertionFailed); service->RemoveRef(); iDevices[1]->SetEnabled(); device->SetEnabled(); device = new DviDeviceStandard(iDvStack, kNameDummy); TEST_THROWS(iDevices[1]->AddDevice(device), AssertionFailed); device->Destroy(); //Wait(); // allow time for initial annoucements to be delivered TestMsearchAll(); TestMsearchRoot(); TestMsearchUuid(); TestMsearchDeviceType(); TestMsearchServiceType(); }
DvProvider::DvProvider(DviDevice& aDevice, const TChar* aDomain, const TChar* aType, TUint aVersion) : iDelayPropertyUpdates(false) , iPropertyChanged(false) { iService = new DviService(aDomain, aType, aVersion); aDevice.AddService(iService); // ownership of service passed to aDevice }