Howto:Implementing custom I/O Protocols
Jump to navigation
Jump to search
This article is a stub. You can help the wiki by expanding it. |
Work in progress This article or section will be worked on in the upcoming hours or days. See history for the latest developments. |
Objective
Demonstrate how to implement a custom I/O protocol using C++
Background
FlightGear supports a plethora of I/O options. Whenever none of the existing protocols works for a particular use-case, people may need to create their own I/O protocol by implemented it in C++ code. For this, FlightGear -and SimGear- provide a handful of APIs and building blocks that allow new protocols to be easily implemented by people familiar with C++.
Hard-coded protocols generally live under $FG_SRC/Network
SGIOChannel
SGSocket
Introducing FGProtocol
- https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Network/protocol.hxx
- https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Network/protocol.cxx
Registering your new protocol
- https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Main/options.cxx#l1615
- https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Main/fg_io.cxx#l109
Exposing FGProtocol to Nasal
Multi-threading
SGSubsystem-based
- Httpd
SGPropertyChangeListener
- FGCom