Open() Invalid Argument

C, C++, and Visual C++
Starwalker298
Fresh meat
Posts: 2
Joined: Mon Jun 04, 2018 7:47 am
Contact:

Open() Invalid Argument

Postby Starwalker298 » Mon Jun 04, 2018 8:31 am

I'm attempting to create a class that enables pressure sensing using the Phidgets Interface Kit and a few different pressure sensors.

When I go to open the channel, I keep getting the error: Invalid Argument

Code: Select all

prc = Phidget_openWaitForAttachment((PhidgetHandle)sensors[0].ch, 5000);
         if (prc != 0)
         {
            std::cout << prc << std::endl;
            fprintf(stderr, "Runtime Error -> Attachment Failed: \n\t");
            DisplayError(prc);
         }


What are some of the things that could make the opening invalid? The Voltage Ratio Input Example works, however I'm not sure what could be missing to cause this error. I don't get any errors when setting the parameters. I've attached my .cpp as it's a bit big to show inline.

Any help would be greatly appreciated :D
PressureSensor.cpp
(11.2 KiB) Downloaded 55 times

Starwalker298
Fresh meat
Posts: 2
Joined: Mon Jun 04, 2018 7:47 am
Contact:

Re: Open() Invalid Argument

Postby Starwalker298 » Tue Jun 05, 2018 5:09 am

Solved it. Apparently attempting to create the channel handle using:

Code: Select all

this->prc = PhidgetVoltageRatioInput_create(&this->ch);
doesn't actually work if it is placed in the constructor. Moved it out to a different class member and it works a treat.

I would be grateful if someone could shed some light on this, as running functions in a constructor is usually quite alright.


Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 2 guests