You are on page 1of 4

Custom Datarefs for interfacing with XFMC

New Dataref Input (to XFMC)

Version 2.3 dd 26/03/2013

"xfmc/Keypath" Type : int Range 0-72


LSK1-6 [05}
RSK1-6 [6-11]
INIT12
RTE13
AP14
DEP/ARR15
VNAV16
FIX17
LEG18
HOLD19
FMC20
PROG21
EXE22
MENU23
NAV24
PageDwn25
Pageup26
AZ[27.52]
Not used 53
DEL54
/ 55
CLR 56
1..9 [57-65]
. 66
0 67
+ 68
MANSPD 69
MCP 70
KBRD 71
Not used 72
Dataref Output (from XFMC)
"xfmc/Version" Type byte array [80] Reading actual version of XFMC
"xfmc/Status" Int (R) XFMC active 0=off 1=on (bit0)
LNAV 1=0ff;1=on (bit 1)
VNAV 1=off;1=on (bit 2)
ATH 0=off;1=on(bit 3)
KEYB 0=off;1=on(bit 4)
Execute 0=off;1=on(bit 5)

"xfmc/Panel_1" Type byte array [80] Reading line 1


"xfmc/Panel_2" Type byte array [80] Reading line 2
"xfmc/Panel_3" Type byte array [80] Reading line 3
"xfmc/Panel_4" Type byte array [80] Reading line 4
"xfmc/Panel_5" Type byte array [80] Reading line 5
"xfmc/Panel_6" Type byte array [80] Reading line 6
"xfmc/Panel_7" Type byte array [80] Reading line 7
"xfmc/Panel_8" Type byte array [80] Reading line 8
"xfmc/Panel_9" Type byte array [80] Reading line 9
"xfmc/Panel_10" Type byte array [80] Reading line 10
xfmc/Panel_11" Type byte array [80] Reading line 11
"xfmc/Panel_12" Type byte array [80] Reading line 12
"xfmc/Upper" Type byte array [80] Reading Upper LCD message
"xfmc/Scratch" Type byte array [80] Reading scratchpad
"xfmc/Messages Type byte array [80] Reading flightdisplay

Compressed output format:


ii/c,pp,text1 ;c,pp,text2;c,pp,text3; etc etc
ii= indexnumber of displayed page
c=Big(0) Fonts, Small(1) Fonts. **
pp=colomn position of embedded string
text=string to be displayed
Small fonts have a offset of 128(d) 0x80(hex).
The asterix char (*) has been translated from 176(d) to 30(d).
The box char [] has been translated to 31 (d)
To detect small fonts,test on char>=128=Small font
<128 = Big Fonts

**Remark, this has not been fully tested. I might be that some text has the wrong parameter

NOTE: bufferlength : for plaintext format always max 37 bytes


For compressed format max length can be calculated with 3+(6+textlength)*nr_of_messages
For 4 messages to be displayed the buflength has to be at least 63 bytes
Save values is thus 80 bytes
example compressed string 1

NOTEBeware of init the datarefs AFTER XFMC has been loaded.


NOTE this guide is only as reference. No examples are given how to process the data from XFMC
Testing of these datarefs can been done via Xplane SDK utility DatarefInspector

Appendix
How to setup your plugin for hardware support
1) Define the Datarefs. Be sure you define them after XMC is loaded. You must find a way
to check XFMC is alive.
2) Read the Datarefs one by one. Maximum is 80 chars to be read in. Alignment of the
strings is already done in XFMC. There is a small difference in position of the strings due
the fact that XFMC writes on pixels, the data to the hardware FMC is recalculated to a
string of maximum 36 byte. A NULL char is inserted to be sure you wont read out of
memory, but better is to do your own checks
3) Example to reading the scratchpad
XPLMGetDatab(gScratch,buffer,0,XP_Buflengte); Make buffer more
then 80 chars long to be shure.
4) Sending data back to XFMC: XPLMSetDatai(gKeyPath,posx); where posx is
the byte you want to control the keypath.
After here you are on your own. We cannot help you setting up your plug-in .
A test plug-in will be provided as soon this work is completed. With this testplugin we checked all the
data going to a 2nd plug-in and coming back from that plug in, so we are sure our part of the work is
ok. You will be able to check it yourself as guide to trace problem.

Success!
example orignal and slave 1

example dataref showing datainspector 1

You might also like