ConnectAPI Docs - v2.0

Hi all, I’ve been working with @Cameron on docs for the new API, which are now live on the official GitHub page: https://github.com/flyingdevelopmentstudio/infiniteflight-api. Docs for v1 are still available at the bottom of the page.

The docs are current as of Infinite Flight 19.4, and contain information on states associated with the 172 (Steam) aircraft. I’ll be working to add more aircraft info to the docs as I have time.

If you have any questions, would like to contribute, or need clarification on any commands please don’t hesitate to shoot me a PM.

Happy app building!

4 Likes

Incredible job! These are so so so detailed! The new API looks great too!

1 Like

That’s great to see! Just recently added that to the Trello board perhaps I should move it to ‘in progress’.

2 Likes

Holy Moly, that’s a lot of info! Thanks so much!

2 Likes

Hey @tomthetank I’ve been trying to get the Connect API V2 to work but I think there’s an issue with how I’m sending data. Are the values (ie 635,false etc) meant to be sent as an array? Or CSV? I’ve tried both to no avail. Thanks!

It’s sent as the data converted to an array of bytes. One way of doing this is using the following method (for C#).

Here’s my own implementation of my sendInt function in Swift:

private func sendInt(val: Int32) {
    var intData = val
    let data = Data(bytes: &intData, count: MemoryLayout.size(ofValue: intData))
    _ = data.withUnsafeBytes {
        guard let pointer = $0.baseAddress?.assumingMemoryBound(to: Byte.self) else {
            print("Error sending command")
            return
        }
        self.outputStream.write(pointer, maxLength: data.count)
    }
}

Call me stupid but what is this data? I’m in Node here, this is what I’ve got;

  1. Command String is 1048616,false but I’ve also tried [1048616, false] and 1048616, false. All produce these results.
  2. Create Uint8Array from data
  3. Create buffer from Uint8Array
  4. Send write that buffer to the socket
  5. No response from IF

The data is what you want to send (an int, bool, whatever…) which you then convert to bytes.

So for your example, you’d send just an int 1048616 converted to bytes, Then a bool false. Your method sounds correct otherwise, but I’m not familiar with node or js.

Are they comma separated on am I sending 2 separate messages?

Two separate messages

1 Like

I see, that’s where I’ve been going wrong. Thanks!

1 Like

After a lot of tinkering I’ve managed to at least get a response from the API, but the bytes don’t seem to result to any sort of string. Here are the bytes. I sent 1048616 for FlapsFullDown then false as instructed.

0, 0, 0, 0, 4, 0, 0, 0
32, 0, 0, 0
0, 0, 0, 0, 4, 0, 0, 0, 32, 0, 0, 0
0, 0, 0, 0, 4, 0, 0, 0, 32, 0, 0, 0

Can anyone make any sense of those? Those are all separate messages I got.