Jump to content

Archived

This topic is now archived and is closed to further replies.

n4gix

Decoding An Xml "flag" Variable

Recommended Posts

What would be the easiest way to decode the XML flag variable (A:NAV CODES:index,flags)...

BIT7: 0= VOR  1= Localizer  BIT6: 1= glideslope available  BIT5: 1= no localizer backcourse  BIT4: 1= DME transmitter at glide slope transmitter  BIT3: 1= no nav signal available  BIT2: 1= voice available  BIT1: 1 = TACAN available  BIT0: 1= DME available

:(


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556

Interests: Gauge Programming - 3d Modeling for Milviz

Many Thanks to All That Donated To Our Server Drive!

Share this post


Link to post
Share on other sites
What would be the easiest way to decode the XML flag variable (A:NAV CODES:index,flags)...
BIT7: 0= VOR  1= Localizer  BIT6: 1= glideslope available  BIT5: 1= no localizer backcourse  BIT4: 1= DME transmitter at glide slope transmitter  BIT3: 1= no nav signal available  BIT2: 1= voice available  BIT1: 1 = TACAN available  BIT0: 1= DME available

:(

Use a bitwise and process... for example: if (NAV CODES && 0x08)==0x08 (or != 0) then 'no nav signal available'.

Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

Look in sd2gau25(?).zip for the code!!!!! :( -Dai(Sorry Bill - couldn't resist. As Ed says, do a bitwise lookup. The sample I supply checks to see what the type of VOR you've locked onto. Yes, it's C-code and you're after XML, but the principle is there?).

Share this post


Link to post
Share on other sites

I know how to accomplish the task in C... :( There are absolutely NO examples of the XML Script syntax though... that's the problem! :( Well, that's not entirely true if anyone can possibly consider this a reasonable example:

Operator	  Operation	 Arguments	   Example	  Result _____________________________________________________________________			    &		  bitwise AND	  2			5 3 &			1

Oh yeah! That's real clear! :(


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556

Interests: Gauge Programming - 3d Modeling for Milviz

Many Thanks to All That Donated To Our Server Drive!

Share this post


Link to post
Share on other sites
I know how to accomplish the task in C... :( There are absolutely NO examples of the XML Script syntax though... that's the problem! :( Well, that's not entirely true if anyone can possibly consider this a reasonable example:
Operator	  Operation	 Arguments	   Example	  Result _____________________________________________________________________			    &		  bitwise AND	  2			5 3 &			1

Oh yeah! That's real clear! :(

Ok... bitwise means binary... so...5 in binary is 1013 in binary is 011And them together results in 001.

Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites
Ok... bitwise means binary... so...5 in binary is 1013 in binary is 011And them together results in 001.
:( Again, the "math" isn't the question...What is the precise syntax for scripting this in XML... :(

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556

Interests: Gauge Programming - 3d Modeling for Milviz

Many Thanks to All That Donated To Our Server Drive!

Share this post


Link to post
Share on other sites
:( Again, the "math" isn't the question...What is the precise syntax for scripting this in XML... :(
Well, you're the XML guy... not me... but... should be something like this:5 3 & 1 == if{

Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites
Well, you're the XML guy... not me... but... should be something like this:5 3 & 1 == if{
Hey, I ain't no eggspurt at this here ExML stuff! I jist play 'round 'till stuff wurks!This compilicated sequence will work but it doesn't use the bitwise operator "&" at all:
<Macro Name="NavCodes">(A:NAV CODES:1,flags)</Macro><Element Name="Decode NavCodes>	<Select>		<Value>			@NavCodes 128 >= 				if{ 1 (>L:IsLocalizer,bool) }				els{ 1 (>L:IsVor,bool) }			@NavCodes 128 >=				if{ 					@NavCodes 128 - (>@NavCodes)					@NavCodes 64 >=						if{ 1 (>L:IsGlideslope,bool) }						els{ 0 (>L:IsGlideslope,bool) }					}			@NavCodes 64 >=				if{ 					@NavCodes 32 - (>@NavCodes) 					@NavCodes 32 >=						if{ 1 (L:NoBackcourse,bool) }						els{ 0 (L:NoBackcourse,bool) }					)			@NavCodes 32 >=				if{					@NavCodes 16 - (>@NavCodes)					@NavCodes 16 >=						if{ 1 (>L:HasDMEatGS,bool) }						els{ 0 (>L:HasDMEatGS,bool) }					}			@NavCodes 16 >=				if{					@NavCodes 8 - (>@NavCodes)					@NavCodes 8 >=						if{ 1 (>L:NoNavSignal,bool) }						els{ 0 (>L:NoNavSignal,bool) }			@NavCodes 8 >=				if{					@NavCodes 4 - (>@NavCodes)					@NavCodes 4 >=						if{ 1 (>L:HasVoice,bool) }						els{ 0 (>L:HasVoice,bool) }					}			@NavCodes 4 >=				if{					@NavCodes 2 - (>@NavCodes)					@NavCodes 2 >=						if{ 1 (>L:HasTacan,bool) }						els{ 0 (>L:HasTacan,bool) }					}			@NavCodes 2 >=				if{					@NavCodes 1 - (>@NavCodes)					@NavCodes 1 >=						if{ 1 (>L:HasDME,bool) }						els{ 0 (>L:HasDME,bool) }					}		</Value>		</Select></Element>

One could keep subtracting the decimal value of the BITn and thereby decode every flag...But, it's rediculously complex. There has to be a simpler method!


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556

Interests: Gauge Programming - 3d Modeling for Milviz

Many Thanks to All That Donated To Our Server Drive!

Share this post


Link to post
Share on other sites

Bill, forget about that complicated code :( As Ed stated, it's a simple bitwise operationSo:decimal codes for BIT0 to 7128 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 availableThen for example, to test if a VOR has not localizer backcourse:(A:NAV CODES:1, flags) 32 & 32 == To test for glideslope available(A:NAV CODES:1, flags) 64 & 64 == etc etcTom

Share this post


Link to post
Share on other sites
(A:NAV CODES:1, flags) 32 & 32 == To test for glideslope available(A:NAV CODES:1, flags) 64 & 64 ==
Thanks Tom. That's all I needed to know: the SYNTAX of the XML script... :( Sometimes I have problems seeing the obvious... :(Funny that I had written out the same "table" yesterday correlating the decimal values with the BITn values...This will allow me to script some handy <Macro> for later consumption:<Macro Name="IsVor">(A:NAV CODES:1, flags) 128 & 128 !=</Macro><Macro Name="IsLoc">(A:NAV CODES:1, flags) 128 & 128 ==</Macro><Macro Name="HasGS">(A:NAV CODES:1, flags) 64 & 64 ==</Macro>etc.When you have a chance Tom, please review this new Wiki entry to see if I've posted something incorrectly:http://forums.flightsim.com/fswiki/index.p...L_Decode_Macros

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556

Interests: Gauge Programming - 3d Modeling for Milviz

Many Thanks to All That Donated To Our Server Drive!

Share this post


Link to post
Share on other sites

These are some more from past notes I had..VOR ONLY = 32DME only = 41VOR + DME = 33It can also Work with the other flag sets..IE BackCourse Flags 131= Tuned and available 135= Tuned, Avail, & on back course sideRoman


Roman_Full_combo_AVSIM_2.png?dl=1  FS RTWR   SHRS F-111   JoinFS Host/Client 

 

Yamaha CR 1000/JBL 2500, AMD 965 BE OC'd @ 3.88, RipJaw 2x4GB 1600 CL7, Gigabyte GTX-1070 OC 8GB, Asus M4A87TD EVO (AMD 870), Samsung 850 EVO 256GB & 1TB SSDs, WD 1T & 500G Black, 19" & 32" LCD, Win7 Pro 64bit, TMaster T-Flight HOTAS, FSX/FS9, FSUIPC / LUA, FSRealWX Pro, PlanG, JoinFS, LittleNavMap

Copilot - Samantha the "Hound"                EAA Chapter 651
       samantha.jpg?dl=1

 

Share this post


Link to post
Share on other sites
Hi Bill, I checked the Wiki and seems OK. BTW, thank you for taking the effort to maintain the Wikis ( I understand you post on more than one) :( Tom
Yes, I do. Actually, I find them wonderful places to stick stuff I will likely need at some point in the future... ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556

Interests: Gauge Programming - 3d Modeling for Milviz

Many Thanks to All That Donated To Our Server Drive!

Share this post


Link to post
Share on other sites

×
×
  • Create New...