4 releases (breaking)
|0.4.0||Dec 17, 2017|
|0.3.0||Apr 7, 2016|
|0.2.0||Sep 15, 2015|
|0.1.0||Sep 14, 2015|
#4 in Simulation
14 downloads per month
FSUIPC library is based on the following two traits:
fsuipc::Handle, which represents a handle to FSUIPC. It cannot be used to read of write FSUIPC offsets but to instantiate
fsuipc::Session, which represents a session comprised of a sequence of read and write requests that are executed when
process()method is invoked.
There are two different implementations for this pair of traits.
fsuipc::local::LocalHandlerepresents a handler using the local mode of FSUIPC. In this mode, the communication to FSUIPC is made using local memory addressing. It requires the client code to run in the same process as FSUIPC does. In other words, your code must be a FS/P3D module or gauge to use this mode.
fsuipc::user::UserHandlerepresents a handler using the user mode of FSUIPC. In this mode, the communication is made using disk mapped memory. This makes possible to run your code in a separate process.
Let's see some examples:
// First we create both handle & session using a local IPC. let mut fsuipc = try!(fsuipc::local::LocalHandle::new()); let mut session = fsuipc.session(); // This variable will be use to store the result of reading the altitude let mut altitude: u32 = 0; // This is the value of QNH that we are gonna write to FSUIPC let qnh: u16 = 1020 * 16; // We request to read from offset 0x3324 and save the result in `altitude`. // The length of the offset to read is inferred from the variable type // (`altitude` is u32, so 4 bytes are requested). try!(session.read(0x3324, &mut altitude)); // We request to write to offset 0x0330 from the contents of `qnh`. // The length of the offset to write is inferred from the variable type // (`qnh` is u16, so 2 bytes are requested). try!(session.write(0x0330, &qnh)); // Now all the requests are processed. After that, `altitude` will receive // the value read from FSUIPC, and offset 0x0330 will be updated with the // value of `qnh`. This call consumes the `session` object. For further // reads and writes, another session must be created. try!(session.process());
The code for user mode is almost the same. Just change the way the handle is instantiated:
let mut fsuipc = try!(fsuipc::user::UserHandle::new());
The rest of the code would work for user mode as well.
You may also have a look to the Hello World example.
- It only works in Windows platform with x86 32 bits architecture. This is due to limitations of IPC protocol implemented in FSUIPC.
- It has not been tested with WideFS. It is supposed to fail since it uses a different window identifier than FSUIPC.
This code is published under Mozilla Public License v2 terms.