Jump to content
The simFlight Network Forums

FSUIPC on LabVIEW


Recommended Posts

Has anyone ever managed to call FSUIPC via LabVIEW?

This should generally be possible via the "Call Library Function Node" however VIs including the FSUIPC_Open(), FSUIPC_Readroutines are needed.

One day I want to have my own, fully functional Cockpit, but since I'm a graphical programmer, the first step would be to learn how to access FSUIPC via LabView.

Link to comment
Share on other sites

Has anyone ever managed to call FSUIPC via LabVIEW?

This should generally be possible via the "Call Library Function Node" however VIs including the FSUIPC_Open(), FSUIPC_Readroutines are needed.

I've not heard of LabVIEW (now "VIs"), but FSUIPC.DLL is not a library which you can call from application programs. It is very specifically an FS module, effectively becoming part of FS once installed. If does not export any FSUIPC_ functions, as these are not usable by FS.

There is a C library (a .LIB file) which I provide in the SDK. That can be linked into application programs and it does contain the FSUIPC_Open, Read and Write routines which you would need to call. However, if LabVIEW needs to call routines in DLLs then you would have to make the normally statically-bound library into a DLL first. The source is actually provided in the SDK as well, so this is entirely possible.

Regards,

Pete

Link to comment
Share on other sites

Hi Pete,

LabVIEW is a graphical programming language from National Instruments, a VI is a file containing the code. It is mainly used for test stands and automation of technical processes.

Thanks for the hint, I will try it and post my efforts here.

Greetings

Hexley

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

We are trying the same thing.

Using Data Aquisition Hardware (DAQ) from National Instruments we are trying to find a way to pass the voltage values to FSUIPC, directly if possible. If not using Visual Basic.

However we do not have sufficient knowledge of LabView to know how we can pass the voltage values to visual basic.

Do you have any idea how to do that, or do you have any other knowledge that can help us?

It's for a school final work by the way.

Link to comment
Share on other sites

As Pete has said, there is this FSUIPC_USER Library that can access the FSUIPC library. What we need to do is, to convert the FSUIPC_USER library from the SDK to a DLL library.

There is the problem, that the User-Functions FSUIPC_Read, FSUIPC_Write interact with the *pDest and *pSrce pointer variables, which are declared as void.

However, LabView doesn’t like variant parameters in DLL functions, I’ve tried it, but there are only zeros transferred, so I think we need to convert the void Type is something else, e.g. 1-dimensional values like integer, char, float or anything else, but since I’m no C-Programmer, this is the point where I stuck right now, because I'dont know how to convert a char[1] to a char variable.

To be honest, I assume that I'm doing something wrong with the "Process" command, but I'm really busy, so I may review this problem next week.

As I couldn’t find anything in the MSDN Library, I don’t think that there is a possibility to call functions form a DLL-File created with VisualBasic, so we may need Visual C++ here - but I’m, not sure.

However if we can get this FSUIPC_User library compiled to a DLL file LabView can work with, all our problems with the interface to the Flightsimulator are solved.

The rest should be no problem. Sure, we ca develop some VIs together.

P.S: sorry for not answering your last mail Pete, I’m very busy at the moment. I’m proud to tell you that I do have my full user licence right now.

Link to comment
Share on other sites

What we need to do is, to convert the FSUIPC_USER library from the SDK to a DLL library.

I should think that would be pretty easy. All the source for the static LIB is provided. You just need to add a do-nothing "DllMain" and export the procedures, i.e. add something like this:

extern "C" {
__declspec(dllexport) BOOL FSUIPC_Open(DWORD dwFSReq, DWORD *pdwResult);
__declspec(dllexport) void FSUIPC_Close(void);
__declspec(dllexport) BOOL FSUIPC_Read(DWORD dwOffset, DWORD dwSize, void *pDest, DWORD *pdwResult);
__declspec(dllexport) BOOL FSUIPC_ReadSpecial(DWORD dwOffset, DWORD dwSize, void *pDest, DWORD *pdwResult);
__declspec(dllexport) BOOL FSUIPC_Write(DWORD dwOffset, DWORD dwSize, void *pSrce, DWORD *pdwResult);
__declspec(dllexport) BOOL FSUIPC_Process(DWORD *pdwResult);
}

BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
        return TRUE;
}

I haven't tried this -- I never thought it worthwhile making the LIB into a DLL as it is so small. It is much more efficient built in, or even have its code merged into the user program.

However, LabView doesn’t like variant parameters in DLL functions, I’ve tried it, but there are only zeros transferred, so I think we need to convert the void Type is something else, e.g. 1-dimensional values like integer, char, float or anything else, but since I’m no C-Programmer, this is the point where I stuck right now, because I'dont know how to convert a char[1] to a char variable.

If it cannot handle void pointers, then simply declare the void ones as "char *" or any other sort of pointer, and cast your true data type to that type. If you cannot cast from one type to another you are going to somehow have multiple declarations for the same data (e.g. like C's "unions" which allow one data structure to be utilised in different ways, depending on which union member you reference).

Alternatively, alternative procedure declarations, like C++'s overloading might be possible, though that's outside my knowledge I'm afraid.

Regards

Pete

Link to comment
Share on other sites

Thank's, that doesn't look bad. Finally I was able to transfer some data from the clock and the speed Indicator to LabView, but there is still some fine tuning necessary, and I need a better understanding about the way FSUIPC works, meaning that I sould read the Programmers Guide once again.

I'll keep you posted.

Link to comment
Share on other sites

  • 2 weeks later...
  • 9 months later...

Hello everybody, and thanks for the many mails that I have recieved during the last months.

Unfortunately, I have no time to continue the work at the moment.

However due to the rich feedback, I've decided to open the sourcecode of this project, you can find all you need on this webpage:

http://wg.marxm.de/flightlab

Actually, I'm not really good in C++, so please to not get frighted, when you see my sourcecode. :lol:

In case you know how to do it better, please do not hesitate to improve the DLL that I have created, or add new functions.

If you do so, feel free to send me your modified sourcecode back, so that I can include yor modifications in the next release.

When you like this piece of software, I'd be happy if you left a message in my guestbook.

Best Regards,

Christian

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.