Brenchen Posted August 22, 2009 Report Posted August 22, 2009 Hi all, 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 #include #include #include #include #include #include #include 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
Pete Dowson Posted August 25, 2009 Report Posted August 25, 2009 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. Error 10 cannot occur on the _Open request, only on the _Process request. As you can see, it is defined in FSUIPC_User.h as follows #define FSUIPC_ERR_NODATA 10 // Call cannot execute: no requests accumulated so it simply means you are executing an FSUIPC_Process() call before adding any Reads or Writes. This is confirmed immediately on inspection of your code: if (FSUIPC_Open(SIM_ANY, &dwResult)) { FSUIPC_Process(&dwResult); What do you expect that Process call to do, immediately after the Open and no Reads or Writes to process? Please do think more about the meanings of the error numbers. It will help you understand your bugs. Regards Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now