Search in sources :

Example 1 with ManufacturerDetails

use of org.jupnp.model.meta.ManufacturerDetails in project smarthome by eclipse.

the class HueBridgeDiscoveryParticipantOSGITest method setUp.

@Before
public void setUp() {
    discoveryParticipant = getService(UpnpDiscoveryParticipant.class, HueBridgeDiscoveryParticipant.class);
    assertThat(discoveryParticipant, is(notNullValue()));
    try {
        final RemoteService remoteService = null;
        hueDevice = new RemoteDevice(new RemoteDeviceIdentity(new UDN("123"), 60, new URL("http://hue"), null, null), new DeviceType("namespace", "type"), new DeviceDetails(new URL("http://1.2.3.4/"), "Hue Bridge", new ManufacturerDetails("Philips"), new ModelDetails("Philips hue bridge"), "serial123", "upc", null), remoteService);
        otherDevice = new RemoteDevice(new RemoteDeviceIdentity(new UDN("567"), 60, new URL("http://acme"), null, null), new DeviceType("namespace", "type"), new DeviceDetails("Some Device", new ManufacturerDetails("Taiwan"), new ModelDetails("$%&/"), "serial567", "upc"), remoteService);
    } catch (final ValidationException | MalformedURLException ex) {
        Assert.fail("Internal test error.");
    }
}
Also used : DeviceDetails(org.jupnp.model.meta.DeviceDetails) ModelDetails(org.jupnp.model.meta.ModelDetails) MalformedURLException(java.net.MalformedURLException) ValidationException(org.jupnp.model.ValidationException) HueBridgeDiscoveryParticipant(org.eclipse.smarthome.binding.hue.internal.discovery.HueBridgeDiscoveryParticipant) UpnpDiscoveryParticipant(org.eclipse.smarthome.config.discovery.upnp.UpnpDiscoveryParticipant) RemoteDeviceIdentity(org.jupnp.model.meta.RemoteDeviceIdentity) URL(java.net.URL) ManufacturerDetails(org.jupnp.model.meta.ManufacturerDetails) DeviceType(org.jupnp.model.types.DeviceType) RemoteService(org.jupnp.model.meta.RemoteService) RemoteDevice(org.jupnp.model.meta.RemoteDevice) UDN(org.jupnp.model.types.UDN) Before(org.junit.Before)

Example 2 with ManufacturerDetails

use of org.jupnp.model.meta.ManufacturerDetails in project smarthome by eclipse.

the class FSInternetRadioDiscoveryParticipantJavaTest method createUnknownRemoteDevice.

private RemoteDevice createUnknownRemoteDevice() throws ValidationException, MalformedURLException {
    int deviceIdentityMaxAgeSeconds = 60;
    RemoteDeviceIdentity identity = new RemoteDeviceIdentity(new UDN("unknownUDN"), deviceIdentityMaxAgeSeconds, new URL("http://unknownDescriptorURL"), null, null);
    URL anotherBaseURL = new URL("http://unknownBaseUrl");
    String friendlyName = "Unknown remote device";
    ManufacturerDetails manifacturerDetails = new ManufacturerDetails("UnknownManifacturer");
    ModelDetails modelDetails = new ModelDetails("unknownModel");
    String serialNumber = "unknownSerialNumber";
    DeviceDetails deviceDetails = new DeviceDetails(anotherBaseURL, friendlyName, manifacturerDetails, modelDetails, serialNumber, DEFAULT_UPC, DEFAULT_URI);
    final RemoteService remoteService = null;
    return new RemoteDevice(identity, DEFAULT_TYPE, deviceDetails, remoteService);
}
Also used : DeviceDetails(org.jupnp.model.meta.DeviceDetails) ModelDetails(org.jupnp.model.meta.ModelDetails) RemoteService(org.jupnp.model.meta.RemoteService) RemoteDeviceIdentity(org.jupnp.model.meta.RemoteDeviceIdentity) RemoteDevice(org.jupnp.model.meta.RemoteDevice) UDN(org.jupnp.model.types.UDN) URL(java.net.URL) ManufacturerDetails(org.jupnp.model.meta.ManufacturerDetails)

Example 3 with ManufacturerDetails

use of org.jupnp.model.meta.ManufacturerDetails in project smarthome by eclipse.

the class FSInternetRadioDiscoveryParticipant method getThingUID.

/**
 * If <code>device</code> is a supported device, a unique thing ID (e.g. serial number) must be returned. Further
 * supported devices should be added here, based on the available UPnP information.
 */
@Override
public ThingUID getThingUID(RemoteDevice device) {
    final DeviceDetails details = device.getDetails();
    if (details != null) {
        final ManufacturerDetails manufacturerDetails = details.getManufacturerDetails();
        final String manufacturer = manufacturerDetails == null ? null : manufacturerDetails.getManufacturer();
        final ModelDetails modelDetails = details.getModelDetails();
        if (modelDetails != null) {
            // check manufacturer and model number
            final String modelNumber = modelDetails.getModelNumber();
            if (modelNumber != null) {
                if (manufacturer != null) {
                    final Set<String> supportedRadios = SUPPORTED_RADIO_MODELS.get(manufacturer.trim().toUpperCase());
                    if (supportedRadios != null && supportedRadios.contains(modelNumber.toUpperCase())) {
                        return new ThingUID(THING_TYPE_RADIO, details.getSerialNumber());
                    }
                }
                // check model name and number
                final String modelName = modelDetails.getModelName();
                if (modelName != null) {
                    final Set<String> supportedRadios = SUPPORTED_RADIO_MODELS.get(modelName.trim().toUpperCase());
                    if (supportedRadios != null && supportedRadios.contains(modelNumber.toUpperCase())) {
                        return new ThingUID(THING_TYPE_RADIO, details.getSerialNumber());
                    }
                }
            }
        }
    // maybe we can add further indicators, whether the device is a supported one
    }
    // device not supported
    return null;
}
Also used : DeviceDetails(org.jupnp.model.meta.DeviceDetails) ModelDetails(org.jupnp.model.meta.ModelDetails) ThingUID(org.eclipse.smarthome.core.thing.ThingUID) ManufacturerDetails(org.jupnp.model.meta.ManufacturerDetails)

Example 4 with ManufacturerDetails

use of org.jupnp.model.meta.ManufacturerDetails in project smarthome by eclipse.

the class FSInternetRadioDiscoveryParticipantJavaTest method createDefaultFSInternetRadioDevice.

private RemoteDevice createDefaultFSInternetRadioDevice(URL baseURL) throws ValidationException {
    ManufacturerDetails manifacturerDetails = new ManufacturerDetails(DEFAULT_RADIO_MANIFACTURER);
    ModelDetails modelDetails = new ModelDetails(DEFAULT_RADIO_MODEL_NAME, DEFAULT_RADIO_MODEL_DESCRIPTION, DEFAULT_RADIO_MODEL_NUMBER);
    DeviceDetails deviceDetails = new DeviceDetails(baseURL, DEFAULT_RADIO_NAME, manifacturerDetails, modelDetails, DEFAULT_RADIO_SERIAL_NUMBER, DEFAULT_UPC, DEFAULT_URI);
    final RemoteService remoteService = null;
    return new RemoteDevice(DEFAULT_RADIO_IDENTITY, DEFAULT_TYPE, deviceDetails, remoteService);
}
Also used : DeviceDetails(org.jupnp.model.meta.DeviceDetails) ModelDetails(org.jupnp.model.meta.ModelDetails) RemoteService(org.jupnp.model.meta.RemoteService) RemoteDevice(org.jupnp.model.meta.RemoteDevice) ManufacturerDetails(org.jupnp.model.meta.ManufacturerDetails)

Aggregations

DeviceDetails (org.jupnp.model.meta.DeviceDetails)4 ManufacturerDetails (org.jupnp.model.meta.ManufacturerDetails)4 ModelDetails (org.jupnp.model.meta.ModelDetails)4 RemoteDevice (org.jupnp.model.meta.RemoteDevice)3 RemoteService (org.jupnp.model.meta.RemoteService)3 URL (java.net.URL)2 RemoteDeviceIdentity (org.jupnp.model.meta.RemoteDeviceIdentity)2 UDN (org.jupnp.model.types.UDN)2 MalformedURLException (java.net.MalformedURLException)1 HueBridgeDiscoveryParticipant (org.eclipse.smarthome.binding.hue.internal.discovery.HueBridgeDiscoveryParticipant)1 UpnpDiscoveryParticipant (org.eclipse.smarthome.config.discovery.upnp.UpnpDiscoveryParticipant)1 ThingUID (org.eclipse.smarthome.core.thing.ThingUID)1 Before (org.junit.Before)1 ValidationException (org.jupnp.model.ValidationException)1 DeviceType (org.jupnp.model.types.DeviceType)1