Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] ohNet Java: CpDeviceListUpnpDeviceType Problem
15-06-2014, 03:04 PM (This post was last modified: 18-06-2014 08:18 PM by triplem.)
Post: #1
[solved] ohNet Java: CpDeviceListUpnpDeviceType Problem
Hello,

I try to use the ohNet bindings for Java, and try to get a List of MediaRenderer Devices:

Code:
CpDeviceListUpnpDeviceType list = new CpDeviceListUpnpDeviceType("upnp.org", "MediaRenderer", 1, this);

The Callback-Method deviceAdded is not called at all. If I use

Code:
CpDeviceListUpnpDeviceType list = new CpDeviceListUpnpDeviceType("upnp.org", "MediaServer", 1, this);

Then it is working fine. Now I tried to get the list of all Devices using the following code snippet:

Code:
CpDeviceListUpnpAll list = new CpDeviceListUpnpAll(this);

Which works as well and prints one MediaRenderer (like expected):

Code:
deviceType: urn:schemas-upnp-org:device:MediaRenderer:1

Am I doing something wrong?
Find all posts by this user
16-06-2014, 08:52 AM
Post: #2
RE: ohNet Java: CpDeviceListUpnpDeviceType Problem
(15-06-2014 03:04 PM)triplem Wrote:  I try to use the ohNet bindings for Java, and try to get a List of MediaRenderer Devices:

Code:
CpDeviceListUpnpDeviceType list = new CpDeviceListUpnpDeviceType("upnp.org", "MediaRenderer", 1, this);
..........
Am I doing something wrong?

That's the correct way to discover all MediaRenderer devices. The code works for me. Is it possible there was a typo (incorrect domain or device type string) in your original test?
Find all posts by this user
16-06-2014, 09:24 PM
Post: #3
RE: ohNet Java: CpDeviceListUpnpDeviceType Problem
(16-06-2014 08:52 AM)simonc Wrote:  That's the correct way to discover all MediaRenderer devices. The code works for me. Is it possible there was a typo (incorrect domain or device type string) in your original test?

Hm, I copied the above mentioned code, so no Typo. I still wonder why this device is shown with one call, but not the other one. Probably the device is not answering correctly to this query?
Find all posts by this user
16-06-2014, 09:28 PM
Post: #4
RE: ohNet Java: CpDeviceListUpnpDeviceType Problem
(16-06-2014 09:24 PM)triplem Wrote:  Hm, I copied the above mentioned code, so no Typo. I still wonder why this device is shown with one call, but not the other one. Probably the device is not answering correctly to this query?

That sounds quite likely. I got responses from all renderers on my network when I tried. If you've found a device which doesn't respond correctly to searches by device type, you could try searching by service type instead:
Code:
CpDeviceListUpnpServiceType list = new CpDeviceListUpnpServiceType("upnp.org", "AVTransport", 1, this);
Find all posts by this user
16-06-2014, 09:42 PM
Post: #5
RE: ohNet Java: CpDeviceListUpnpDeviceType Problem
Did this using RendererControl. Works like a charm. Can you possibly point me what to adjust on the renderer to answer correctly? Looks like it is a device of correct type.
Find all posts by this user
17-06-2014, 07:53 AM
Post: #6
RE: ohNet Java: CpDeviceListUpnpDeviceType Problem
(16-06-2014 09:42 PM)triplem Wrote:  Did this using RendererControl. Works like a charm. Can you possibly point me what to adjust on the renderer to answer correctly? Looks like it is a device of correct type.

If the renderer uses ohNet, can you post the code you use to create the DvDevice and set its attributes please?

If you didn't write the code for the renderer, I suspect it's just buggy and you won't be able to get it to respond to device type MSEARCHes.
Find all posts by this user
17-06-2014, 03:27 PM (This post was last modified: 17-06-2014 03:27 PM by triplem.)
Post: #7
RE: ohNet Java: CpDeviceListUpnpDeviceType Problem
Sure,

I am developing currently together with Pete on the MediaPlayer for the Raspi. I guess the wanted code is:

Code:
        String iDeviceName = "device-" + friendly_name + "-" + NetworkUtils.getHostName() + "-MediaRenderer";
        iDevice = new DvDeviceFactory(ds).createDeviceStandard(iDeviceName, this);
        log.debug("Created StandardDevice: " + iDevice.getUdn());
        iDevice.setAttribute("Upnp.IconList", this.constructIconList(iDeviceName));

        // iDevice.setAttribute("Upnp.Domain", "openhome-org");
        iDevice.setAttribute("Upnp.Domain", "schemas-upnp-org");
        iDevice.setAttribute("Upnp.Type", "MediaRenderer");
        iDevice.setAttribute("Upnp.Version", "1");
        iDevice.setAttribute("Upnp.FriendlyName", Config.getInstance().getMediaplayerFriendlyName());
        iDevice.setAttribute("Upnp.Manufacturer", "Made in Manchester");
        iDevice.setAttribute("Upnp.ModelName", "Open Home Java Renderer: v" + Config.getInstance().getVersion());
        iDevice.setAttribute("Upnp.ModelDescription", "'We Made History Not Money' - Tony Wilson..");
        iDevice.setAttribute("Upnp.PresentationUrl", "http://" + NetworkUtils.getHostName() + ":" + Config.getInstance().getWebServerPort() + "/MainPage.html");

Thanks for your support.
Find all posts by this user
17-06-2014, 04:09 PM
Post: #8
RE: ohNet Java: CpDeviceListUpnpDeviceType Problem
The domain you're using looks wrong. Can you try
Code:
iDevice.setAttribute("Upnp.Domain", "upnp.org");

instead please?
Find all posts by this user
18-06-2014, 08:17 PM
Post: #9
RE: ohNet Java: CpDeviceListUpnpDeviceType Problem
(17-06-2014 04:09 PM)simonc Wrote:  The domain you're using looks wrong. Can you try
Code:
iDevice.setAttribute("Upnp.Domain", "upnp.org");

instead please?

Works like a charm, thanks for this one ;-)
Find all posts by this user


Forum Jump: