Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unabled to create DvDeviceStdStandard Device - Segmentation Fault
29-10-2015, 06:30 PM (This post was last modified: 30-10-2015 08:44 AM by Trolley01.)
Post: #1
Unabled to create DvDeviceStdStandard Device - Segmentation Fault
I am having some trouble with building a basic Receiver application, however I am falling down at a fairly early hurdle.

I am trying to create a new Device, but when I create one I always get a segmentation fault. The test application that I am using is below.

I have cloned the ohNet repository, which cloned and built successfully, and am using the compiled libraries and headers in my application.

(Apologies here if I have missed something obvious - I am in my early stages of learning C++)

Code:
#include <stdio.h>
#include <OpenHome/Net/Cpp/DvDevice.h>

int main(int argc, char **argv)
{
    printf("Started\n");
    OpenHome::Net::DvDeviceStdStandard* ohDevice = new OpenHome::Net::DvDeviceStdStandard("abcd");
    printf("Created Device\n");
}

Can anyone point me in the right direction?
Find all posts by this user
30-10-2015, 08:18 AM
Post: #2
RE: Unabled to create DvDeviceStdStandard Device - Segmentation Fault
First you have to initialize UpnpLibrary, then startDv and after that you could create device.
Find all posts by this user
30-10-2015, 08:43 AM
Post: #3
RE: Unabled to create DvDeviceStdStandard Device - Segmentation Fault
(30-10-2015 08:18 AM)SiMet Wrote:  First you have to initialize UpnpLibrary, then startDv and after that you could create device.

Amazingly simple. Thank you.

For others looking, this was the code that worked.
Code:
#include <stdio.h>
#include <OpenHome/Net/Cpp/DvDevice.h>
#include <OpenHome/Net/Cpp/DvAvOpenhomeOrgVolume1.h>

int main(int argc, char **argv)
{
    printf("Started\n");
    
    OpenHome::Net::InitialisationParams* init_params = OpenHome::Net::InitialisationParams::Create();
    OpenHome::Net::UpnpLibrary::Initialise(init_params);
    OpenHome::Net::UpnpLibrary::StartDv();
    OpenHome::Net::DvDeviceStdStandard* ohDevice = new OpenHome::Net::DvDeviceStdStandard("abcd");
    
    printf("Created Device\n");
}
Find all posts by this user


Forum Jump: