Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Are there any Samples for C++?
14-03-2014, 09:42 AM
Post: #1
Are there any Samples for C++?
I'm new to the Forum, and I'm new to upnp av.

there are 2 questions:
1.
Are there any Examples for a ControlPoint with OhNet using C++.
I could't find the source at ohNet/OpenHome/Net/Bindings/Cpp/ControlPoint/Test/.

2.
How can I get the service list When getting a CpDevice object?
In another words, how can I get a device's service list with the ohnet api?

Hope someone's reply!

Thank you!!
Find all posts by this user
14-03-2014, 04:48 PM
Post: #2
RE: Are there any Samples for C++?
(14-03-2014 09:42 AM)pz003 Wrote:  I'm new to the Forum, and I'm new to upnp av.

there are 2 questions:
1.
Are there any Examples for a ControlPoint with OhNet using C++.
I could't find the source at ohNet/OpenHome/Net/Bindings/Cpp/ControlPoint/Test/.

Tiny typo in the path you were using - try looking in the Tests directory (i.e. add a trailing s to the last directory in that path.)

(14-03-2014 09:42 AM)pz003 Wrote:  2.
How can I get the service list When getting a CpDevice object?
In another words, how can I get a device's service list with the ohnet api?

You can use CpDeviceListCppUpnpServiceType to obtain CpDevice instances that offer a given service name.

Sometimes you'll know that bearers of that service also offer other services; in these cases you can just use the same CpDevice instance to create proxies for each of the different services.

If you want lists of devices offering a known set of services but don't know which combination of services each device offers, you should create one CpDeviceListCppUpnpServiceType for each service you're interested in.

If you want to write a Device Spy type program which lists all UPnP devices on the network and all the services each offers, you can use CpDeviceListCppUpnpAll to find all devices then fetch an xml description of each device using
Code:
std::string deviceXml;
device.GetAttribute("Upnp.DeviceXml", deviceXml);
Each service a device offers appears in a <service> element inside the <serviceList> element of the device's xml.
(This approach is much more work than the others. Clients who need to take this approach are extremely rare so we decided not to add too many APIs to simplify such an unusual use case).
Find all posts by this user
18-03-2014, 05:16 AM
Post: #3
RE: Are there any Samples for C++?
Thank you very much!
(14-03-2014 04:48 PM)simonc Wrote:  
(14-03-2014 09:42 AM)pz003 Wrote:  I'm new to the Forum, and I'm new to upnp av.

there are 2 questions:
1.
Are there any Examples for a ControlPoint with OhNet using C++.
I could't find the source at ohNet/OpenHome/Net/Bindings/Cpp/ControlPoint/Test/.

Tiny typo in the path you were using - try looking in the Tests directory (i.e. add a trailing s to the last directory in that path.)

(14-03-2014 09:42 AM)pz003 Wrote:  2.
How can I get the service list When getting a CpDevice object?
In another words, how can I get a device's service list with the ohnet api?

You can use CpDeviceListCppUpnpServiceType to obtain CpDevice instances that offer a given service name.

Sometimes you'll know that bearers of that service also offer other services; in these cases you can just use the same CpDevice instance to create proxies for each of the different services.

If you want lists of devices offering a known set of services but don't know which combination of services each device offers, you should create one CpDeviceListCppUpnpServiceType for each service you're interested in.

If you want to write a Device Spy type program which lists all UPnP devices on the network and all the services each offers, you can use CpDeviceListCppUpnpAll to find all devices then fetch an xml description of each device using
Code:
std::string deviceXml;
device.GetAttribute("Upnp.DeviceXml", deviceXml);
Each service a device offers appears in a <service> element inside the <serviceList> element of the device's xml.
(This approach is much more work than the others. Clients who need to take this approach are extremely rare so we decided not to add too many APIs to simplify such an unusual use case).
Find all posts by this user


Forum Jump: