Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
upnp controller
10-10-2014, 06:04 AM
Post: #1
upnp controller
Hi,

i'm newbie in OhNet. I want control upnp renderer from window.i read the control point stack documentation but i don't know how to use these libraries from my project.
can any one guide me. sorry for my english if wrong
Find all posts by this user
10-10-2014, 09:37 AM
Post: #2
RE: upnp controller
Can you be more specific about what you are struggling with?

It might be easiest if you try writing a small program then post a detailed question, ideally with code, when you get stuck.

In case it helps, StackOverflow has some good advice on how to ask technical questions.
Find all posts by this user
10-10-2014, 09:54 AM
Post: #3
RE: upnp controller
Thanks for response.

PHP Code:
#include<stdio.h>
#include<conio.h>
#include<OpenHome/Types.h>
#include<OpenHome/Net/ControlPoint/CpDevice.h>
#include<OpenHome/Net/ControlPoint/FunctorCpDevice.h>
#include<OpenHome/net/ControlPoint/CpDeviceUpnp.h>
#include<OpenHome\Net\Device\DvDevice.h>
int main()
{
    
printf("Hello World!!!");
    
getch();


At first, i wanna print renderer and server list.
How to do the above scenario in OhNet?
Find all posts by this user
27-12-2014, 09:05 PM (This post was last modified: 27-12-2014 09:10 PM by ChriD.)
Post: #4
RE: upnp controller
This will help you for your first step
ohNet_ControlPointStack.pdf

should look like this...
Code:
void YOURCLASS::InitUPNP()
{
    OpenHome::Net::InitialisationParams*        initParams;
    std::vector<OpenHome::NetworkAdapter*>*        subnetList;
    TIpAddress                                    subnet
    OpenHome::Net::CpDeviceListCppUpnpAll* listAll;
    OpenHome::Net::FunctorCpDeviceCpp functorDeviceFound = OpenHome::Net::MakeFunctorCpDeviceCpp(*this, &YOURCLASS::DeviceFound);
    OpenHome::Net::FunctorCpDeviceCpp functorDeviceLost =  OpenHome::Net::MakeFunctorCpDeviceCpp(*this, &YOURCLASS::DeviceLost);

    initParams = OpenHome::Net::InitialisationParams::Create();
    OpenHome::Net::UpnpLibrary::Initialise(initParams);
    subnetList = OpenHome::Net::UpnpLibrary::CreateSubnetList();
    subnet = (*subnetList)[0]->Subnet(); //<-- use first found network adapter (index = 0)    
    OpenHome::Net::UpnpLibrary::DestroySubnetList(subnetList);
    OpenHome::Net::UpnpLibrary::StartCp(subnet);
    listAll = new OpenHome::Net::CpDeviceListCppUpnpAll(functorDeviceFound, functorDeviceLost);
}

void YOURCLASS::DeviceFound(OpenHome::Net::CpDeviceCpp& _device)
{

        std::string friendlyName, location;

        _device.GetAttribute("Upnp.Location", location);
        _device.GetAttribute("Upnp.FriendlyName", friendlyName);

// this will be called if a device is found...
...
}

void YOURCLASS::DeviceLost(OpenHome::Net::CpDeviceCpp& _device)
{
...
}

If you know how to Code c/c++ this will help you for sure.
Find all posts by this user


Forum Jump: