Jump to content

You're browsing the 2004-2023 VATSIM Forums archive. All content is preserved in a read-only fashion.
For the latest forum posts, please visit https://forum.vatsim.net.

Need to find something? Use the Google search below.

FSUIPC SDK ERR 10: FSUIPC_ERR_NODATA


Brendan Chen 943434
 Share

Recommended Posts

Brendan Chen 943434
Posted
Posted

Hi all,

 

Not sure if this is the right place to place this post, but I couldn't really see a suitable section for this question. Anyway, I'm just trying to play around and get a basic understanding of this SDK and I've ran into a problem that I cannot solve.

 

As the subject suggests, when I tried to connect using FSUIPC_Open function, error 10 came up. During the first fair few times everything works until a certain point, this message came up and I cannot get it to work again.

 

I'm using Qt to write this in and my code is as below:

#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "FSUIPC_User.h"
#include <windef.h>
#include <iostream>
#include <string>

#include <QLCDNumber>
#include <QPushButton>
#include <QTextEdit>
#include <QString>
#include <QTimer>

static char chOurKey[] = "IKB3BI67TCHE"; // As obtained from Pete Dowson

MainWindow::MainWindow(QWidget *parent)
   : QMainWindow(parent)//, ui(new Ui::MainWindow)
{
   setupUi(this);

   tEngRPM = new QTimer(this);
   connect(tEngRPM, SIGNAL(timeout()), this, SLOT(UpdateRpmReading()));

   Initialisation_Function();
}

void MainWindow::on_Quit_clicked()
{
   FSUIPC_Close();
   close();
}

void MainWindow::on_btnFOpen_clicked()
{
   if (FSUIPC_Open(SIM_ANY, &dwResult))
   {
       FSUIPC_Process(&dwResult);
       tEngRPM->start(200);
       FSUIPC_Read(0x08C8, sizeof(unsigned short), &scalerRPM, &dwResult);
       FSUIPC_Process(&dwResult);
   }

   FSDebugOut->display((int)dwResult);
}

void MainWindow::on_btnKillEng_clicked()
{
   FSUIPC_Write(0x0B6B, sizeof(unsigned char), chOurKey, &dwResult);
   FSUIPC_Process(&dwResult);
   FSDebugOut->display((int)dwResult);
}

void MainWindow::on_btnLights_clicked()
{
   FSUIPC_Write(0x0D0C, sizeof(short), chOurKey, &dwResult);
   FSUIPC_Process(&dwResult);
}

void MainWindow::UpdateRpmReading()
{
   FSUIPC_Read(0x0930, sizeof(short), &RPMval, &dwResult);
   FSUIPC_Process(&dwResult);
   dispRPM->display((int)((RPMval*scalerRPM)/65536));
}

void MainWindow::Initialisation_Function()
{
   dispRPM->display(0);
   FSDebugOut->display(0);
}

 

Any help would be much appreciated.

 

 

Thanks

Brendan

Brendan Chen

VATPRC Tech Support

You make the difference!

672A68079898-1_zps98cef54d.png

Link to comment
Share on other sites

Ernesto Alvarez 818262
Posted
Posted

you might want to remove your key from the post unless thats a different key, then disregard

Link to comment
Share on other sites

Brendan Chen 943434
Posted
Posted

Thanks for your reply, the key was a straight copy from the example since I dont know what to put there.

 

If I don't put the key there, what should I put instead?

 

Cheers

Brendan

Brendan Chen

VATPRC Tech Support

You make the difference!

672A68079898-1_zps98cef54d.png

Link to comment
Share on other sites

Ernesto Alvarez 818262
Posted
Posted

ah k if its just an example key and not a key you paid for then your fine. just so nobody ends up using yours, wouldnt be the first time someone posts theyre private info by mistake

Link to comment
Share on other sites

Brendan Chen 943434
Posted
Posted

Nah it's not my key... It's Pete Dawson's, not sure, I've just taken it out of the example code he provided with all the other stuff in the SDK.

 

I dont actually have a registered version, I'm running free version at the moment, So can I still work on FSUIPC and its SDK even though I dont have a registered version? If I must have a registered version, how do I make sure that my programme is compatible with other users?

 

Thanks

Brendan

Brendan Chen

VATPRC Tech Support

You make the difference!

672A68079898-1_zps98cef54d.png

Link to comment
Share on other sites

Luke Kolin
Posted
Posted
I dont actually have a registered version, I'm running free version at the moment, So can I still work on FSUIPC and its SDK even though I dont have a registered version? If I must have a registered version, how do I make sure that my programme is compatible with other users?

 

You should be fine, key-wise. Looking through my code, an error 10 would seem to be the result of an FSUIPC_Process() call without an FSUIPC_Read() or FSUIPC_Write() call made prior.

 

Cheers!

 

Luke

... I spawn hundreds of children a day. They are daemons because they are easier to kill. The first four remain stubbornly alive despite my (and their) best efforts.

... Normal in my household makes you a member of a visible minority.

Link to comment
Share on other sites

Brendan Chen 943434
Posted
Posted (edited)
... Looking through my code, an error 10 would seem to be the result of an FSUIPC_Process() call without an FSUIPC_Read() or FSUIPC_Write() call made prior.

 

I rechecked my code for the Process errors, but I cannot find any calls to FSUIPC_Process() without Read/Write functions. And that the function I'm getting the error is in the FSUIPC_Open() as I've set a button to activate that function. It's giving me error 10 without even running FSUIPC_Process();

void MainWindow::on_btnFOpen_clicked()
{
   if (FSUIPC_Open(SIM_ANY, &dwResult)) // This is where it failed, and did not enter the if statement.
   {
       FSUIPC_Process(&dwResult);
       tEngRPM->start(200);
   }

   FSDebugOut->display((int)dwResult); // This is where I can see my dwResult, and it outputs 10.

//   FSUIPC_Read(0x08C8, sizeof(unsigned short), &scalerRPM, &dwResult);
//   FSUIPC_Process(&dwResult);
}

 

So still quite blurry on this error. The funny thing is at the beginning it works fine, but after a certain amount of time, suddenly error 10 appears.

Edited by Guest

Brendan Chen

VATPRC Tech Support

You make the difference!

672A68079898-1_zps98cef54d.png

Link to comment
Share on other sites

Brendan Chen 943434
Posted
Posted

Let me add something else; I've tried all other functions in there, and it seems that my programme did connect to FSUIPC because my other function calls still worked as planned. But the question still stands, why - even though it works - the FSUIPC_Open() still returns me ERR 10?

Brendan Chen

VATPRC Tech Support

You make the difference!

672A68079898-1_zps98cef54d.png

Link to comment
Share on other sites

Luke Kolin
Posted
Posted

Let me dig through my FSUIPC code some more. I try and avoid poking around down there.

 

Are you calling FSUIPC_Open() multiple times? If you are, you probably shouldn't be.

 

Cheers!

 

Luke

... I spawn hundreds of children a day. They are daemons because they are easier to kill. The first four remain stubbornly alive despite my (and their) best efforts.

... Normal in my household makes you a member of a visible minority.

Link to comment
Share on other sites

Brendan Chen 943434
Posted
Posted

Nah, just once. When I tried to open it twice (by clicking on the open button twice) it will return me ERR 1, which is expected. But I've only called it once, and ERR 10 came up.

Brendan Chen

VATPRC Tech Support

You make the difference!

672A68079898-1_zps98cef54d.png

Link to comment
Share on other sites

Ivan Kovacevic 920456
Posted
Posted

Hi Brendan,

Looking through your code, I don't see that you've initialized dwResult anywhere, so check that it is indeed initialized as a DWORD variable.

 

Obviously, if you're trying to run the program, you need to have FS running, and have either obtained a developer key from Pete Dowson, or have a registered version of FSUIPC.

 

Also, function 'FSUIPC_open' should only be done once, so you shouldn't tie it to a button on the user interface. Instead, you should put it as soon as the program loads, and then only do FSUIPC_Read and _process on button clicks. Furthermore, the way it works is: you do a few FSUIPC_Read(); calls for a few different offsets (variables you need) and that basically puts them in the 'reading queue' (layman's explanation). Then, once you call FSUIPC_Process, that queue will be processed and all of the variables (used in FSUIPC_Read) will be filled with relevant data.

Link to comment
Share on other sites

Brendan Chen 943434
Posted
Posted

Ivan, very extensive, thank you!

 

The initialisation of dwResult was done in my header file, which I'm not suspecting it to have problems. Apart from the key, I still don't understand where the ERR 10 is coming from??

 

Thank you

Brendan

Brendan Chen

VATPRC Tech Support

You make the difference!

672A68079898-1_zps98cef54d.png

Link to comment
Share on other sites

David Klain 874106
Posted
Posted

This is a forum for general discussion of flight simulation topics, not a programming/debugging forum. Let's take this somewhere more appropriate...

 

Thanks,

Dave

Link to comment
Share on other sites

Luke Kolin
Posted
Posted

Brendan, you may want to ask Peter directly here:

 

http://forums.simflight.com/viewforum.php?f=54

 

I can't see anywhere that an FSUIPC_Open() would return back a 10, but Peter would be the right person to ask.

 

Cheers!

 

Luke

... I spawn hundreds of children a day. They are daemons because they are easier to kill. The first four remain stubbornly alive despite my (and their) best efforts.

... Normal in my household makes you a member of a visible minority.

Link to comment
Share on other sites

Brendan Chen 943434
Posted
Posted

I've posted the question on simFlight already, but no reply at all. Anyway sorry for the interruption, and thanks for all the help. I will say no more on this topic.

 

Regards

Brendan Chen

VATPRC Tech Support

You make the difference!

672A68079898-1_zps98cef54d.png

Link to comment
Share on other sites

 Share