Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Async Search and Query on contentDirectory C++
19-02-2015, 10:51 PM (This post was last modified: 20-02-2015 05:39 PM by ChriD.)
Post: #1
[Solved] Async Search and Query on contentDirectory C++
Hi,

This one is a common question and has literaly nothng to do with the OhNetStack i think.

In C# i can use Lamdas to add extra information for an async method
eg.

Code:
contentDirectory.Browse(..., (asyncHandle) => OnBrowseEnd(asyncHandle, 1));
contentDirectory.Browse(..., (asyncHandle) => OnBrowseEnd(asyncHandle, 2));

private void BrowseSink(IntPtr aAsyncHandle, int aOther)
{
// will be called twice with aOther has one time the value 1 and then the value 2
}

How can i do this in C++ with the OhNet AsyncFunctor?
Code:
OpenHome::Net::FunctorAsync functor = OpenHome::Net::MakeFunctorAsync(*this, &MediaServer::OnBrowseEnd);                    
this->GetContentDirectoryProxy()->BeginBrowse(_containerId, browseFlag, "*", 0, 0, "", functor);
Is this possible?

best regards
Chris
Find all posts by this user
20-02-2015, 09:12 AM
Post: #2
RE: Async Search and Query on contentDirectory C++
It isn't possible to use lambdas in place of FunctorAsync I'm afraid. While I do understand the attraction of this, it's unlikely we'll support this soon. Use of lambdas requires a compiler with support for C++11 - some clients of ohNet run on NASes that use relatively old versions of Linux whose compilers do not support C++11.
Find all posts by this user
20-02-2015, 05:34 PM (This post was last modified: 20-02-2015 05:58 PM by ChriD.)
Post: #3
RE: Async Search and Query on contentDirectory C++
Okay Sad Thats a pity
So there is no chance to know which async method triggered the callback? Not any async handler id or something like that?

Would be nice, but all in all no problem. I can solve my Problem by using threads and call the sync method and make my own callbacks
Find all posts by this user


Forum Jump: