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.

How To program XML to C Interfaces

Featured Replies

Hi all of you,basing on the work of Andreas Drawe I wrote a bit down to implement FS9-modules with "C:...:..." style interfaces to XML gauges just like e.g. C:fs9gps:.... or C:fsview:view.Arne Bartels

  • Replies 31
  • Views 7.2k
  • Created
  • Last Reply

Top Posters In This Topic

  • Author
  • Moderator

Shucks, I got all excited because I misread your post...I thought you'd discovered a way to implement some "XML only" functions in C guages......such as loading the terrain map the XML GPS can display... ;(

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Don't you think this way round is not interesting enough <g>? And please have a bit of patience. The other way round is under development .Arne Bartels

Hi Arne,Could this be a way to have variables for strings, the L-var:string doesn't work in xml as you know.Eugen

Yes. E.g. C:xmlinterface:stringval of the example module is read/writeable.Arne Bartels

Arne,Could you create "Str-Vars" in xml like you do with L-vars or do they need to be declarated in the c-module ?Eugen

  • Author
  • Moderator

>Don't you think this way round is not interesting enough>? And please have a bit of patience. The other way>round is under development .Thanks, Arne... If I were into XML gauge coding, yes it would be "interesting enough..." ;)As I am hoping to include the "terrain map" in a GDI+ version of the Garmin G1000 (as well as the Avidyne Entegra Ike Slack is working on), that is of more immediate interest. ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Unfortunetaely I didn't get it to work properly. Here is a bit of sample code. Usage: add ALL .cpp files, but ONLY CCustomDraw.rc as rc file to a new gauge project. "CCustomDraw!custom" is a C implementation of the GDI drawing in my above mentioned example, it works. No wonder, since I set up the methods "on the other side", so I exactly new which parmaters were needed."CCustomDraw!fs9view" implements the "C:fs9view:view" method. It does work in a way, but the position data relative to the FS window is needed. All I could get was the position relative to the panel bitmap, so there is usually an offset to the view (if the panel bitmap isn't upper left aligned). Note: it isn't GDI, it is a new view window at the gauges place, therefore no combination with GDI is psossible."CCustomDraw!fs9gps" implements "C:fs9gps:Rose", it looks wierd, some parameters aren't fixed yet, but at least it shows up. I wanted to implement C:fs9gps:Map, but didn't succeed (IGaugeCDrawable::Draw alwasy returns FALSE, and nothing shows up). If anyone wants to play with it....Arne Bartels

I declared them in C module, that was the point of the exercise.Arne Bartels

  • Author
  • Moderator

>I wanted to implement C:fs9gps:Map, but didn't succeed>(IGaugeCDrawable::Draw alwasy returns FALSE, and nothing shows>up). If anyone wants to play with it....>Arne BartelsThanks, Arne. I'll take a close look at this and see if there's any hope for what we'd like to achieve, although it seems already that it will not be possible... ;(We may have to implement "Plan B" whereby we access and display external georeferenced bitmaps, such as is done by FSM Moving Map...

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Maybe not imporssible, but still something missing. I noticed that C:fs9gps:Map uses some more flags via IGaugeCDrawable::GetFlags(). The other have only TAKES_DC or nothing, but this one also uses NO_TRANSPARENCY and DOUBLE_BUFFER. Maybe the drawing element needs extra info or, I used wrong params in the() Draw call. I abandoned, because I don't really need it and I have other things to do, not that it is impossible!Arne Bartels

  • Author
  • Moderator

>I abandoned, because I>don't really need it and I have other things to do, not that>it is impossible!Thanks, Arne. I appreciate immensely the information provided thus far. I'm certain that it will be useful either to me or others... ;)I fully understand the limitations of one's time, as I have already far more on my plate than I can easily handle myself. With no less than five projects being simultaneously developed by ESDG (and being involved in some capacity with four of 'em directly!), I have precious little time available myself! ;)Thanks again!

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • 2 weeks later...

...>As I am hoping to include the "terrain map" in a GDI+ version>of the Garmin G1000 (as well as the Avidyne Entegra Ike Slack>is working on), that is of more immediate interest. ;)>Hi to all of you,it is possible to get the fs9gps working in a C gauge. You'll have to provide your own IGaugeCDrawableCreateParameters and IGaugeCDrawableDrawParameters classes to provide the necessary parameters and link everything together as shown in Arne's examples.In the PANEL_SERVICE_PRE_DRAW event of the gauge callback I use something likeif (timer == 0){ SetupdrawSuccess = pIGCD->SetupDraw(dim_surf, hdc_surf, NULL); GetdrawSuccess = pIGCD->GetDraw(pIGCD_DrawParams);}timer ++;if (timer >= 18){ SET_OFF_SCREEN(pelement_surf); timer = 0;}I don't know if this is the best way but at least it works.I attached a gauge which will show the terrain map and also the AI traffic based on the TrafficInfo.dllhttp://forums.avsim.net/user_files/110228.zipAlexander Drawe

  • Author
  • Moderator

>I don't know if this is the best way but at least it works.>I attached a gauge which will show the terrain map and also>the AI traffic based on the TrafficInfo.dll>>http://forums.avsim.net/user_files/110228.zip>>Alexander DraweOutstanding! Would it be possible for you to post the source code for that gauge so I can learn more from it? I'm afraid I'm a bit too "green" to manage on my own... ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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.