[][src]Function pfly_rust::send_message

pub fn send_message(pfly_socket: Socket, data: PflyIpcData) -> bool

Sends a message to the projectFly socket with a PflyIpcData payload converted into u8.

Returns false if any errors ocurred when sending

Arguments

  • pfly_socket - The socket object from init()
  • data - Information to be sent in the form of PflyIpcData

Example

let pfly_socket = pfly_rust::init();

pfly_rust::send_message(pfly_socket, pfly_rust::PflyIpcData{
    altitude: 569,
    agl: 0,
    groundspeed: 0,
    ias: 0,
    headingTrue: 0,
    headingMagnetic: 0,
    latitude: 43.6772222,
    longitude: -79.6305556,
    verticalSpeed: 0,
    landingVerticalSpeed: 0,
    gForce: 1000, // Divided by 1000 by projectFly
    fuel: 20000,
    transponder: 1425,
    bridgeType: 3, // From projectFly: bridgeTypes = ['simconnect', 'fsuipc', 'if', 'xplane']
    isOnGround: 1,
    isSlew: 0,
    isPaused: 0,
    pitch: 0,
    roll: 0,
    time: 0, // This is calculated by projectFly
    fps: 120,
    aircraftType: "B77W" // Unused by projectFly, still required just in case
});