<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Errors while connecting to FSUIPC]]></title><description><![CDATA[<p dir="auto">[4_1531226685797_tserial.cpp](Uploading 100%) [3_1531226685797_mainwindow.ui](Uploading 100%) [2_1531226685797_mainwindow.cpp](Uploading 100%) [1_1531226685797_main.cpp](Uploading 100%) [0_1531226685796_fsinterface.cpp](Uploading 100%)</p>
<p dir="auto">#include "mainwindow.h"<br />
#include &lt;QApplication&gt;<br />
#include &lt;QDebug&gt;</p>
<p dir="auto">#include &lt;windows.h&gt;<br />
#include &lt;conio.h&gt;<br />
#include &lt;stdio.h&gt;<br />
#include &lt;string.h&gt;<br />
#include &lt;math.h&gt;</p>
<p dir="auto">// Universal data<br />
#include "universal.h"</p>
<p dir="auto">// FS interface<br />
#include "FSinterface.h"</p>
<p dir="auto">#include "FSUIPC_User.h"</p>
<p dir="auto">// for setting the timer<br />
#include "timer.h"</p>
<p dir="auto">// for Serial RS232<br />
#include "tserial.h"<br />
#include"universal.h"<br />
#include "types.h"</p>
<p dir="auto">const char *pszErrors[] =<br />
{	"Okay",<br />
"Attempt to Open when already Open",<br />
"Cannot link to FSUIPC or WideClient",<br />
"Failed to Register common message with Windows",<br />
"Failed to create Atom for mapping filename",<br />
"Failed to create a file mapping object",<br />
"Failed to open a view to the file map",<br />
"Incorrect version of FSUIPC, or not FSUIPC",<br />
"Sim is not version requested",<br />
"Call cannot execute, link not Open",<br />
"Call cannot execute: no requests accumulated",<br />
"IPC timed out all retries",<br />
"IPC sendmessage failed all retries",<br />
"IPC request contains bad data",<br />
"Maybe running on WideClient, but FS not running on Server, or wrong FSUIPC",<br />
"Read or Write request cannot be added, memory for Process is full",<br />
};</p>
<p dir="auto">char buffer_fsupc[25000];<br />
char buffer_reception[12];<br />
char bufftx[40];<br />
int main(int argc, char *argv[])<br />
{</p>
<pre><code>    QApplication a(argc, argv);
    MainWindow w;
    double Attitude[NROT];
        FSAttitudeType FSAtt;
        DWORD dwResult;// a pointer to receive an error number if the operation fails.
        Tserial *com; // Serial declaration
        int SampleTime; // Sample Time in ms
        Timer timer;
        int capsam=0;
        int pousseeL, pousseeR;
        int pousseeOldL = 0, pousseeOldR = 0;
        char car;
        int vret,index=0;
        int oktrame=0;
        int pousseeTmp;
        char   x[]=" \\\\.\\com3";

        if(FSUIPC_Open(SIM_ANY,&amp;dwResult)){
            // Declaration des variables locales
             const char *pFS[] = { "FS98", "FS2000", "CFS2", "CFS1", "Fly!", "FS2002", "FS2004" };  // Change made 060603

            // Okay, we're linked, and already the FSUIPC_Open has had an initial
            // exchange with FSUIPC to get its version number and to differentiate
            // between FS's.
            printf ("CapSim: Link established to FSUIPC\n") ;
        //	printf ("Sim is %s,FSUIPC Version = %c.%c%c%c%c\r%s\n",(FSUIPC_FS_Version &amp;&amp; (FSUIPC_FS_Version &lt;= 7)) ? pFS[FSUIPC_FS_Version - 1] : "Unknown FS",'0' + (0x0f &amp; (FSUIPC_Version &gt;&gt; 28)),'0' + (0x0f &amp; (FSUIPC_Version &gt;&gt; 24)),'0' + (0x0f &amp; (FSUIPC_Version &gt;&gt; 20)),'0' + (0x0f &amp; (FSUIPC_Version &gt;&gt; 16)),(FSUIPC_Version &amp; 0xffff) ? 'a' + (FSUIPC_Version &amp; 0xff) - 1 : ' ');


            /* ///////////////////////////// une autre maniere de faire ///////////////////////////// */

            // Timer

            //printf("\nEnter the Sample Time in miliseconde\n");
            //scanf("%d",&amp;SampleTime);
           SampleTime=100;

            // RS232
                    com=new Tserial();
                    if( com!=0 )
                        com-&gt;connect (x,9600,spNONE); // com Initialisation
                    else
                        printf("Error Setting COM");
           }else{  //Openninig FSUIPC failed
            printf ("CapSim: Failed to open link to FSUIPC:%s\n", pszErrors[dwResult]) ;
            FSUIPC_Close(); // Closing when it wasn't open is okay, so this is safe here
        //    com-&gt;disconnect(); // Closing the port
            return 0;
        }
        while(true) {
                  Sleep(40);
                    //if(timer.elasped((clock_t)SampleTime))
                if(1){

                        /* -------------------------------------- Sending Data --------------------------------------  */

                        // Read from FS data structure
                        FSUIPC_Read(0x000,25000,buffer_fsupc,&amp;dwResult);
                        FSUIPC_Process(&amp;dwResult); // Process all the request(s)

                //		sprintf(bufftx,"%4u %3u %6u %3u",*((unsigned int*)(buffer_fsupc+0x2BC))/128,(unsigned int)(*((double*)(buffer_fsupc+0x2CC))),
            //				(unsigned int)floor((double)(((unsigned int)*((__int64 *)(buffer_fsupc+0x570))*(double)3.2808)/((double)65536.)+0.5)),0);
                            /*(unsigned int)floor(((unsigned int)*((unsigned short  int*)(buffer_fsupc+0xcc))*360.)/65536.+0.5),(unsigned int)*((unsigned short  int*)(buffer_fsupc+0xe2)),
                                (unsigned int)floor((double)(((unsigned int)*((unsigned int*)(buffer_fsupc+0xd4))*3.2808)/65536.+0.5)));*/

                /*		sprintf(bufftx,"%6u  %01u  %01u\n", *((unsigned short*)(buffer_fsupc+0x5682))&amp;0xffff,
                                                            *((unsigned char*)(buffer_fsupc+ 0x568A))&amp;0xff,
                                                            *((unsigned char*)(buffer_fsupc+ 0x568E))&amp;0xff);
                        printf("%s\n",bufftx);*/
                        if(_kbhit()){
                            car=_getch();
                            switch(car) {
                            case ui-&gt;Alt : printf("To change Altitude turn the Dial");
                                capsam= (capsam*(65536./3.2808));
                                *((unsigned int*)buffer_fsupc)= capsam;
                                 FSUIPC_Write(0x7D4,4,buffer_fsupc,&amp;dwResult);
                                   FSUIPC_Process(&amp;dwResult);
                                      break;
                            case ui-&gt; Spd:
                                                        printf("To change Speed turn the Dial:");
                                                        scanf("%u",&amp;capsam);
                                                        capsam = (capsam*16384)/100;
                                                        *((unsigned int*)buffer_fsupc)= (unsigned short int) capsam;
                                                        FSUIPC_Write(0x88C,2,buffer_fsupc,&amp;dwResult);
                                                        FSUIPC_Process(&amp;dwResult);
                                                        break;
                            case ui-&gt; Hdg :
                                                            printf("To Change Heading , turn the Dial");
                                                            scanf("%u",&amp;capsam);
                                 capsam= (capsam*65536)/36;
                          capsam += ((capsam%10)&gt;=5 ? 10 : 0);
                      capsam= capsam/10;

    *((unsigned short int*)buffer_fsupc)= (unsigned short int )capsam;
                                                            FSUIPC_Write(0x7CC,2,buffer_fsupc,&amp;dwResult);
                                                            FSUIPC_Process(&amp;dwResult); // Process all th
                                                            break;

                            }}




   w.show();

   return a.exec();
                            }
</code></pre>
<p dir="auto">}<br />
}</p>
<p dir="auto">Getting these errors: Tserial, com,spNONE, ui, Alt, Spd, Hdg undeclared identifier[0_1531226890354_main.cpp](Uploading 100%)</p>
]]></description><link>https://forum.qt.io/topic/92466/errors-while-connecting-to-fsuipc</link><generator>RSS for Node</generator><lastBuildDate>Sun, 15 Nov 2026 02:34:56 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/92466.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 10 Jul 2018 12:45:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Errors while connecting to FSUIPC on Tue, 10 Jul 2018 13:53:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mohammad_palwala">@<bdi>mohammad_palwala</bdi></a> shouldn't you asked in some FSUIPC mailing list? Your issue seems not related to Qt...</p>
]]></description><link>https://forum.qt.io/post/468635</link><guid isPermaLink="true">https://forum.qt.io/post/468635</guid><dc:creator><![CDATA[Pablo J. Rogina]]></dc:creator><pubDate>Tue, 10 Jul 2018 13:53:21 GMT</pubDate></item></channel></rss>