Created
April 17, 2009 06:59
-
-
Save careo/96894 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'pp' | |
| require 'rubygems' | |
| require 'eventmachine' | |
| module XplaneServer | |
| def post_init | |
| end | |
| def data_struct | |
| "l f8" | |
| end | |
| def pack_str | |
| "a4 C #{data_struct} a*" # message internal-index data-index 8-floats other | |
| end | |
| def receive_data data | |
| # unpacks the first element. further unpack(data_struct) calls will grab each additional | |
| p data.unpack(pack_str) #.last.unpack("l f8") | |
| end | |
| end | |
| EM.run { | |
| EM.open_datagram_socket('127.0.0.1', 48000,XplaneServer) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment