I'm trying to create an application that uses the built-in UDP output capabilities. (I'm aware that there are some pitfalls to the UDP system, but it's by far the most efficient way to get at the data I need.) My plan is to:
1) Use ISET to add the client computer as a destination for UDP data.
2) Use the DSEL command to tell X-Plane what "rows" I need.
3) Receive and process the data.
I've written an application that attempts to do this. The DSEL commands work - I'm able to automatically check the boxes for the proper outputs. The problem seems to be with the ISEL command.
I'm setting the "index" value in the ISET struct to 0, assuming that's the local "main" aircraft. That does initiate a data stream to the IP, but the data is not at all what I'm expecting. I'm expecting the same format you get when you manually assign a "Send network data output" destination in Data Output tab. (Which works as expected.) What I get across the wire is a bunch of zeros and occasional 254:
2019/10/22 01:08:32 Unknown message type: 254
2019/10/22 01:08:32 Data: [-4.2201683e+37 1.7378244e+34 8e-45 0 0 0 0 0]
2019/10/22 01:08:32 Unknown message type: 0
2019/10/22 01:08:32 Data: [0 0 0 0 0 0 0 0]
2019/10/22 01:08:32 Unknown message type: 0
2019/10/22 01:08:32 Data: [0 0 0 0 0 0 0 0]
2019/10/22 01:08:32 Unknown message type: 0
2019/10/22 01:08:32 Data: [0 0 0 0 0 0 0 0]
When I look in the Network tab the connection appears as "Multiplayer machine 1 flying Beechcraft Baron 58 (10.0.1.19)" which is not what I want. I want the "first person" aircraft from this server. The Baron is an AI-flown aircraft.
Does anyone have any sample code that works? Is this another case of the indexes in the ISET command changing? Or am I misunderstanding what you can do with the ISET command?
Thanks in advance,
Steve