Howto:Port I/O from Nasal: Difference between revisions

Jump to navigation Jump to search
Switch to {{fg root file}} and {{fgdata url}} to fix the broken Gitorious links.
(Switched to {{readme file}} to remove the out of date and broken Gitorious links.)
(Switch to {{fg root file}} and {{fgdata url}} to fix the broken Gitorious links.)
Line 147: Line 147:
</syntaxhighlight>
</syntaxhighlight>


See [[generic protocol]] for more info on the generic protocol and have a look in [http://gitorious.org/fg/fgdata/trees/master/Protocol $FG_ROOT/Protocol] for examples  of various protocol configurations. There's also a howto tutorial available here: [[Howto: Create a generic protocol]].
See [[generic protocol]] for more info on the generic protocol and have a look in {{fg root file|Protocol}} for examples  of various protocol configurations. There's also a howto tutorial available here: [[Howto: Create a generic protocol]].


We suggest you just try it, create a simple protocol with a couple properties, explore ways to send and receive those values, and so on. If your serial device is a microcontroller that your programming then you may be able to get away with sending/receiving the values directly to/from flightgear without need of any secondary 'middleware' programs at all. If not you may need a small program to handle marshalling the data between flightgear and your hardware.
We suggest you just try it, create a simple protocol with a couple properties, explore ways to send and receive those values, and so on. If your serial device is a microcontroller that your programming then you may be able to get away with sending/receiving the values directly to/from flightgear without need of any secondary 'middleware' programs at all. If not you may need a small program to handle marshalling the data between flightgear and your hardware.
Line 155: Line 155:
Using a serial device properly requires more than just 'fopen'ing it, except in the most simple of cases, and can be quite tedious and complex using straight C system calls...networking as well. Personally I recommend using a higher level language (I use Python) that will make your life so much easier and allow you to get things done quickly and easily without hassles of low level details.
Using a serial device properly requires more than just 'fopen'ing it, except in the most simple of cases, and can be quite tedious and complex using straight C system calls...networking as well. Personally I recommend using a higher level language (I use Python) that will make your life so much easier and allow you to get things done quickly and easily without hassles of low level details.


For your data processing needs (formatting, conversion, marshalling, compression etc), you can use a combination of the sprintf() library function, and the [http://gitorious.org/fg/fgdata/blobs/master/Nasal/bits.nas bits.nas module in $FG_ROOT/bits.nas].
For your data processing needs (formatting, conversion, marshalling, compression etc), you can use a combination of the sprintf() library function, and the {{fg root file|Nasal/bits.nas}} file.


<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
Line 170: Line 170:
* {{readme file|protocol}}
* {{readme file|protocol}}
* http://flightgear.org/forums/viewtopic.php?f=30&t=15166
* http://flightgear.org/forums/viewtopic.php?f=30&t=15166
* [http://gitorious.org/fg/fgdata/trees/master/Protocol Protocol]
* {{fgdata source|path=Protocol|text=Protocol}}
* [http://gitorious.org/fg/fgdata/blobs/master/Nasal/bits.nas Nasal/bits.nas]
* {{fgdata source|path=Nasal/bits.nas|text=Nasal/bits.nas}}


[[Category:Nasal howto]]
[[Category:Nasal howto]]

Navigation menu