Download presentation
Presentation is loading. Please wait.
1
www.PeninsulaSims.com ryan@peninsulasims.com 06.12.2019
2
X-Plane Commands and Datarefs TCP vs. UDP
3
UDP Native X-Plane Format Exercise: Turning on the night vision
“Easy!” (not, at least it wasn’t for me)
4
TCP vs. UDP Transmission Control Protocol
Reliable, message acknowledgment, handshaking Ordered Heavyweight Streaming User Datagram Protocol Unreliable, no acknowledgment or handshake Lightweight No congestion control Connectionless Multicast Native X-Plane
5
ExtPlane (TCP) vs. X-Plane UDP
UDP Format requires tracking length of packet and padding out to 509 bytes UDP Format makes use of IEEE Float for values being sent, which is complicated to convert (for novices) TCP via ExtPlane is simple and intuitive TCP does not require conversion to IEEE Float (someone has already done that) TCP does not require understanding the underlying packet TCP reply received with each command sent
6
Laminar’s Instructions for UDP
7
Set a Dataref to a Value
8
Let’s turn on the night vision!
Dataref needs to be set to 1: Dataref: sim/cockpit/electrical/night_vision_on IEEE Float value of 1 (4 byte byte value), LSB First Hex representation of an ASCII space, and how to pad out to 509 bytes Hex representation of an ASCII 0 (zero) Syntax: DREF0+(4byte byte value of 1)+ sim/cockpit/switches/anti_ice_surf_heat_left+0+ spaces to complete to 509 bytes
9
IEEE Float IEEE Floating Point Converter
schmidt.net/FloatConverter/IEEE754.html Your Value: 1 (e.g., dataref set to “1” or “on”) Hex representation: 0x3f800000 4-byte byte value: 3F Least significant bit first: F
10
ASCII Character Table Dec Char Dec Char Dec Char Dec Char
0 NUL (null) SPACE @ ` 1 SOH (start of heading) ! A a 2 STX (start of text) " B b 3 ETX (end of text) # C c 4 EOT (end of transmission) $ D d 5 ENQ (enquiry) % E e 6 ACK (acknowledge) & F f 7 BEL (bell) ' G g 8 BS (backspace) ( H h 9 TAB (horizontal tab) ) I i 10 LF (NL line feed, new line) * J j 11 VT (vertical tab) K k
11
Convert letters D R E F to Hex
Step 1: Convert D to ASCII decimal value using table D = 68 R = 82 E = 69 F = 70
12
Convert Decimal to Hex: D/68
Divide by 16 until there is no remainder Read back remainders bottom to top 68 / 16 = 4 remainder 4 4 / 16 = 0 remainder 4 Result = 44 (remainders read bottom to top)
13
Why in the world Hex? Decimal (base 10): 10 fingers, 10 toes
Inefficient: Decimal: 39,321 Hex: 9999 Binary (bits are ones and zeroes) Hexadecimal (base 16) Natural complement to binary data One hexadecimal value can store 4 pieces of data (e.g., 0101) Good for compression
14
Convert Decimal to Hex: R/82
Divide by 16 until there is no remainder 82 / 16 = 5 remainder 2 5 / 16 = 0 remainder 5 Result = 52
15
Convert letters D R E F to Hex
Step 1: Convert ASCII decimal value using tabulated values Step 2: Convert decimal to hex (base 10 to base 16) MSB first D = 68 = 44 R = 82 = 52 E = 69 = 45 F = 70 = 46
16
Set DREF Night Vision On
DREF0+(4byte byte value)+dref_path+0+spaces to complete the whole message to 509 bytes DREF\00\00\00\80\3Fsim/cockpit/electrical/night_visi on_on\00 f d 2f 63 6f 63 6b f 65 6c c 2f 6e f f 6e 5f 6f 6e
17
Packet sent via UDP f d 2f 63 6f 63 6b f 65 6c c 2f 6e f f 6e 5f 6f 6e D R E F S I M / c o c k p i t / e l e c t r i c a l / n i g h t _ v i s i o n _ o n 0 sp sp sp sp sp sp sp sp sp sp sp sp sp … ( until 509 bytes total)
18
Send in packet to port 49000 Night vision turns on
f d 2f 63 6f 63 6b f 65 6c c 2f 6e f f 6e 5f 6f 6e
19
Why is this important? Understanding the UDP syntax enables me to send commands to X-Plane without the ExtPlane plugin. Plugins can cause simulator instability or crashes. The downside is the difficulty in setting datarefs, e.g., course (0 to 359 degrees). IEEE Float
20
Demonstration Packet Sender Example
21
Via ExtPlane...Stay Tuned!
TCP Via ExtPlane...Stay Tuned!
22
www.PeninsulaSims.com ryan@peninsulasims.com 06.12.2019
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.