Code Samples: XML Decode Macros

XML Decode Macros

There are several XML variables that are returned as "flags" in an 8bit format. In order to use them you must "decode" them. This is an easy method to use as all the script is encapsulated in a set of s for quick and simple use. Just copy/paste these definitions to your XML gauge script.

Examples of usage are at the bottom of this entry.

// DO NOT COPY THIS! It is for reference only //
128 BIT7: 0= VOR 1= Localizer
64 BIT6: 1= glideslope available
32 BIT5: 1= no localizer backcourse
16 BIT4: 1= DME transmitter at glide slope transmitter
8 BIT3: 1= no nav signal available
4 BIT2: 1= voice available
2 BIT1: 1 = TACAN available
1 BIT0: 1= DME available

MACRO Definitions for the NAV CODES variable

(A:NAV CODES:1, flags) 128 & 128 !=
(A:NAV CODES:1, flags) 128 & 128 ==
(A:NAV CODES:1, flags) 64 & 64 ==
(A:NAV CODES:1, flags) 32 & 32 !=
(A:NAV CODES:1, flags) 16 & 16 ==
(A:NAV CODES:1, flags) 8 & 8 !=
(A:NAV CODES:1, flags) 4 & 4 ==
(A:NAV CODES:1, flags) 2 & 2 ==
(A:NAV CODES:1, flags) 1 & 1 ==

// DO NOT COPY THIS! It is for reference only //
1 BIT0: 1=back course available
2 BIT1: 1=localizer tuned in
4 BIT2: 1=on course
128 BIT7: 1=station active

MACRO Definitions for the NAV BACK COURSE FLAGS variable

(A:NAV BACK COURSE FLAGS:1, flags) 1 & 1 ==
(A:NAV BACK COURSE FLAGS:1, flags) 2 & 2 ==
(A:NAV BACK COURSE FLAGS:1, flags) 4 & 4 ==
(A:NAV BACK COURSE FLAGS:1, flags) 128 & 128 ==


Panel & Gauge Design

USAGE

Using these s is quite simple once you realize that they are simply substitutions for the exact text they encapsulate!

To determine if the tuned signal is a VOR for example:

@IsVor // this will be TRUE (eg = 1) only if BIT7 contains a zero (0)

To determine if the tuned signal is a Localizer:

@IsLoc // this will be TRUE (eg = 1) only if BIT7 contains a one (1)

If you want to display a bitmap if something is true, then use the format:

@HasDME // this will only show your bitmap if the return is TRUE (eg = 1)

Panel & Gauge Design|Code Samples

This page has been seen 2,934 times.