Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Using FSUIPC from within a gauge

Featured Replies

  • Commercial Member

I tried to use FSUIPC from within a gauge as described in the FSUIPC SDK. The gauge I created works fine but most times when I change from an aircraft with this gauge installed to another aircraft (without this gauge) FS2K2 crashes. This seems to be related to FSUIPC because if take out from the gauge code the parts that have to do with FSUIPC the problem does not exist. I am not experienced in C so it is very likely that I may have overlooked/misunderstood something. The part of the gauge code that interfaces FSUIPC follows (sorry I cannot make the identation show correctly). If you have any ideas pls let me know. Thanks, Michael BYTE FsuipcMem; BOOL FsuipcOK = FALSE; BYTE OnState = 1; // 0=off, 1=active, 2=no spd hld, 3=Fsuipc error SHORT FsuipcLev; .................... ///////////////////////////////////////////////////////////////////////////// // Gauge update callback function ///////////////////////////////////////////////////////////////////////////// void FSAPI syncthrottle_update (PGAUGEHDR pgauge, int service_id, UINT32 extra_data) { DWORD dwResult; switch(service_id) { case PANEL_SERVICE_PRE_UPDATE: { ............. if (FsuipcOK) //FSUIPC is already connected { if ( !FSUIPC_Read(0x332E, 2, &FsuipcLev, &dwResult) || !FSUIPC_Process(&dwResult) ) { OnState=3; } else { OnState=1; } } else // FSUIPC is not connected yet: connect now, indication will be updated in next cycle { FsuipcOK=FSUIPC_Open2(SIM_ANY, &dwResult, &FsuipcMem, 64); FsuipcLev=-16193; } ........ break; } case PANEL_SERVICE_PRE_KILL: { FSUIPC_Close(); FsuipcOK = FALSE; } break; } }

Michael Frantzeskakis
Precision Manuals Development Group
http://www.precisionmanuals.com


devteam.jpg

I use FSUIPC_Open() with gauges not .._Open2(). Works fine.Arne Bartels

  • Author
  • Commercial Member

Thanks for the reply Arne.According to the FSUIPC SDK the use of FSUIPC_Open() is not recommended - see extract below.Anyway, there was an obvious error in my code that probably caused parts of the programme to be overwritten. FsuipcMem is declared as a single byte while in FSUIPC_Open2 the size is 64 bytes - the declaration should have been BYTE FsuipcMem[64].MichaelFrom the FSUIPC SDK:IMPORTANT NOTE FOR FS GAUGE AND MODULE WRITERS==============================================If you are wanting to access FSUIPC's facilities from INSIDE FS, rather than from an external application, please PLEASE note that using the external users library is most definitely NOT recommended. It is VERY inefficient. You are inside the FS process, so why use complex inter-process communications? (IPC == Inter-Process Communication!).Also, if you do use this slow method, you may get failures on Open which will recover, eventually, on retries. This is because, ollowing Adam Szofran's original method, the "unique" ID string, used to identify the mapped memory, is generated using the Process ID. This ID is unique for all separate Processes, but obviously it is the same for ALL gauges and modules running inside FS.FSUIPC deliberately provides an entry for Gauges and Modules to use. It is very efficient, it uses a simple message with no memory mapping. YOU, the user, have to provide the memory for the data, but there are simple rules for calculating how much. The code is almost identical to using the external library -- only the Open call is changed to provide the memory pointer and size!Please see the "C library for FS Internal Access" ZIP.

Michael Frantzeskakis
Precision Manuals Development Group
http://www.precisionmanuals.com


devteam.jpg

  • Author
  • Commercial Member

Yes it did.>I use FSUIPC_Open2 with no problems. Did making fsuipcMem an>array fix the problem?>>Matt

Michael Frantzeskakis
Precision Manuals Development Group
http://www.precisionmanuals.com


devteam.jpg

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.