Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Does ohnet support Embedded devices?
18-06-2015, 11:29 AM
Post: #1
Does ohnet support Embedded devices?
I looked for it in documentation and little in classes code and didn't find anything.

So I'd like to get know does ohNet support Embedded devices. If yes, is there any example how to write such device with two embedded devices.
Find all posts by this user
18-06-2015, 03:19 PM
Post: #2
RE: Does ohnet support Embedded devices?
(18-06-2015 11:29 AM)SiMet Wrote:  I looked for it in documentation and little in classes code and didn't find anything.

So I'd like to get know does ohNet support Embedded devices. If yes, is there any example how to write such device with two embedded devices.

ohNet supports embedded devices internally but doesn't expose this through public APIs. It shouldn't be hard to expose this - we'd simply have to add a wrapper to DviDevice::AddDevice().

Clients would then call deviceA.AddDevice(deviceB) to embed deviceB in deviceA.

I can add this quite soon. Alternatively, I'd be happy to accept a pull request if you wanted to have a go at it yourself Smile.
Find all posts by this user
18-06-2015, 04:09 PM
Post: #3
RE: Does ohnet support Embedded devices?
(18-06-2015 03:19 PM)simonc Wrote:  ohNet supports embedded devices internally but doesn't expose this through public APIs. It shouldn't be hard to expose this - we'd simply have to add a wrapper to DviDevice::AddDevice().

Clients would then call deviceA.AddDevice(deviceB) to embed deviceB in deviceA.

I can add this quite soon. Alternatively, I'd be happy to accept a pull request if you wanted to have a go at it yourself Smile.

"Quite soon" came around quicker than I'd expected... I've pushed a change that adds support for embedded devices to the C++ bindings - see DvDeviceStd::AddDevice().
Find all posts by this user
18-06-2015, 06:02 PM
Post: #4
RE: Does ohnet support Embedded devices?
What is an embedded device? Should there be a Java API to support this?
Find all posts by this user
19-06-2015, 07:44 AM (This post was last modified: 19-06-2015 07:58 AM by SiMet.)
Post: #5
RE: Does ohnet support Embedded devices?
You're so quick Smile Thank you very well

(18-06-2015 06:02 PM)simoncn Wrote:  What is an embedded device? Should there be a Java API to support this?

Embedded device is mechanizm in UPnP that allows you have Device in another device.

For example:
I've my own device which expose two other devices: MediaServer and MediaRenderer.

In opionion my friend that's basic function of Upnp so Java API should support this.


Thank you guys again for good job Smile
Find all posts by this user
19-06-2015, 12:43 PM
Post: #6
RE: Does ohnet support Embedded devices?
One question for whole functionality. Shouldn't be also method to removeDevice?

Use case could be:

I've got my device with MediaServer and MediaRenderer and I'd like to disable play any content on my MediaRenderer.
I could handle it by Enabling device, remove embedded device and Enable device again.
Find all posts by this user
19-06-2015, 04:04 PM
Post: #7
RE: Does ohnet support Embedded devices?
(18-06-2015 06:02 PM)simoncn Wrote:  What is an embedded device? Should there be a Java API to support this?

UPnP allows for a device to be contained by another device. Device XML for the parent will then contain a description of both devices.

I've never used this outside of simple tests so amn't sure how it appears in real world systems.

There should be a Java API for this (plus C and C# APIs too). I will get to this but had assumed there was no big rush when SiMet is the first user to require the feature.
Find all posts by this user
19-06-2015, 04:11 PM
Post: #8
RE: Does ohnet support Embedded devices?
(19-06-2015 12:43 PM)SiMet Wrote:  One question for whole functionality. Shouldn't be also method to removeDevice?

Use case could be:

I've got my device with MediaServer and MediaRenderer and I'd like to disable play any content on my MediaRenderer.
I could handle it by Enabling device, remove embedded device and Enable device again.

I think this use case would be better served by you calling SetDisabled() on both devices then SetEnabled() on the MediaServer. This approach may show up some small bugs (one such bug is that DviProtocolUpnpDeviceXmlWriter needs to check whether embedded devices are enabled before writing their XML); these bugs should be easy to fix.
Find all posts by this user
19-06-2015, 08:11 PM
Post: #9
RE: Does ohnet support Embedded devices?
(19-06-2015 04:04 PM)simonc Wrote:  UPnP allows for a device to be contained by another device. Device XML for the parent will then contain a description of both devices.

I've never used this outside of simple tests so amn't sure how it appears in real world systems.

There should be a Java API for this (plus C and C# APIs too). I will get to this but had assumed there was no big rush when SiMet is the first user to require the feature.

I don't think there is any particular rush for a Java API. Smile I was just trying to clarify the use case and whether this would make sense.
Find all posts by this user
24-06-2015, 10:42 AM
Post: #10
RE: Does ohnet support Embedded devices?
Probably I'm doing something wrong or there is problem with embedded devices.

Code:
// Above is LibraryUpnp::init etc...
//I've created device1 and device2
device1 = new DvDeviceStdStandard(uuid);
device2 = new DvDeviceStdStandard(uuid);
//Add Device to device
device1->SetEnabled();
device2->SetEnabled();

//after 2 seconds in
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2*NSEC_PER_SEC)), dispatch_get_main_queue(),^{
   delete device1;
   delete device2;

   LibraryUpnp::Close();
});

And this code explode with:
ERROR: Lock attempted on uninitialised mutex DDVM from thread ____
libc++abi.dylib: terminating with uncaught exception of type OpenHome::AssertionFailed


I've also tried not to delete device2, but I get error that I'm destroying stack before some owned objects

What am I doing wrong?
Find all posts by this user


Forum Jump: