Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DvAvOpenhomeOOrgPlaylist1Cpp and error reporting
03-09-2013, 11:43 AM
Post: #1
DvAvOpenhomeOOrgPlaylist1Cpp and error reporting
Hi,

I am new to Openhome, having recently discovered it. I am trying to build an audio renderer app. I have looked at OhMediaPlayer as example, which actually uses a lot of "Core" classes, which according to ohNet README are not supposed to be used externally.

So, I have been implementing play actions by deriving from DvAvOpenhomeOOrgPlaylist1Cpp and could not find any way to report errors from the action implementation functions.

For example, SeekId or SeekIndex, where id is not found or the index is out of boundary I can't see any way of reporting such an error (The example code uses core DvAvOpenhomeOOrgPlaylist1 class, and calls Error on IDvInvocation).

Given these core classes are not part of public API, how can I report an error when deriving from DvAvOpenhomeOOrgPlaylist1Cpp where I only have IDvInvocationStd with no Error method?

Regards,
Kostic
Find all posts by this user
03-09-2013, 12:38 PM
Post: #2
RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting
Thanks for the report. This wasn't a deliberate omission; a future release will add ReportError(TUint aCode, std::string& aDescription) to IDvInvocationStd.

In the meantime, you could either
  • THROW(InvocationError) from an action to indicate failure, sacrificing the ability to set FaultCode, FaultDescription
  • Use the Core APIs, sacrificing the convenience of std::string
Find all posts by this user
03-09-2013, 12:56 PM
Post: #3
RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting
Thanks. This would be cool.

I suppose if one follows usual C++ conventions then throwing a special exception would be a good way to implement this. Also looking at the code behind this class the "Do" methods would have to check for the error condition and should not bother creating normal response upon action method return.

I think catching an exception in the "Do" methods would probably be cleaner. Anyway, just a suggestion.

Regards,
Kostic
Find all posts by this user
15-06-2015, 05:22 PM (This post was last modified: 16-06-2015 09:38 AM by SiMet.)
Post: #4
RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting
I'd like to leave my comment here to give reason to improve this functionality.
Ability of return FaultCode with description from action is important for me.

I've created issue on github: https://github.com/openhome/ohNet/issues/19
Find all posts by this user
16-06-2015, 04:46 PM
Post: #5
RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting
(15-06-2015 05:22 PM)SiMet Wrote:  I'd like to leave my comment here to give reason to improve this functionality.
Ability of return FaultCode with description from action is important for me.

I've created issue on github: https://github.com/openhome/ohNet/issues/19

Thanks for the reminder about this. I'll get something added in the next couple of days.
Find all posts by this user
17-06-2015, 04:21 PM
Post: #6
RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting
(16-06-2015 04:46 PM)simonc Wrote:  
(15-06-2015 05:22 PM)SiMet Wrote:  I'd like to leave my comment here to give reason to improve this functionality.
Ability of return FaultCode with description from action is important for me.

I've created issue on github: https://github.com/openhome/ohNet/issues/19

Thanks for the reminder about this. I'll get something added in the next couple of days.

The latest code should allow for this. IDvInvocationStd (passed to every invoked action) now includes

void ReportError(uint32_t aCode, const std::string& aDescription)

Calling this will result in aCode/aDescription being reported as a UPnP fault code. It will also throw an exception, exiting the current action.
Find all posts by this user
18-06-2015, 10:25 AM
Post: #7
RE: DvAvOpenhomeOOrgPlaylist1Cpp and error reporting
(17-06-2015 04:21 PM)simonc Wrote:  
(16-06-2015 04:46 PM)simonc Wrote:  
(15-06-2015 05:22 PM)SiMet Wrote:  I'd like to leave my comment here to give reason to improve this functionality.
Ability of return FaultCode with description from action is important for me.

I've created issue on github: https://github.com/openhome/ohNet/issues/19

Thanks for the reminder about this. I'll get something added in the next couple of days.

The latest code should allow for this. IDvInvocationStd (passed to every invoked action) now includes

void ReportError(uint32_t aCode, const std::string& aDescription)

Calling this will result in aCode/aDescription being reported as a UPnP fault code. It will also throw an exception, exiting the current action.

Thank you for very quick fix. It's what I needed
Find all posts by this user


Forum Jump: