Jump to content

Tricky usage of AM


raywing

Recommended Posts

When I studied the UDP protocol of AM, I found a tricky usage of AM. AirManager use port 55557 for communicating with the FSXplugin , and 55556 with xplane plugin. when you use xpl_command("string_with_value"), you can receive a string include "string_with_value" on FSX machine @port 55556.

In this case, you can write a LUA script in your FSX/P3D module directory which is created by FSUIPC, and establish a UDP socket to receive the string, and trigger your ipc.writeXXXX functions!!!

 

-- FSX UDP data transfer program

local socket = require "socket"
local udp = socket.udp()
local port = 55556 -- Use this port to receive data from AirManager

udp:settimeout(0)
udp:setsockname('*', port)    --Make the machine with the port for receiving flight data from AM

local data, msg_or_ip, port_or_nil
local running = true
while running do
   data, msg_or_ip, port_or_nil = udp:receivefrom() -- get data from Air Manager

if string.sub(data, "string") == "string" then
               ipc.writeLvar("Lvar name", value)  -- e.g.
               ipc.writeDBL (offset, value)           -- e.g.
       end

elseif msg_or_ip ~= 'timeout' then
            print("Unknown network error: "..tostring(msg_or_ip))
       end

   socket.sleep(0.050) -- pause for 50ms
end

 

I successfully use this trick to write a Instrument (actually is a UI) for Flight Plan control panel and show some flight data.

Link to comment
Share on other sites

  • 1 month later...
Guest sikorsky77

Hi Raywing

 

That means we could also read Offset or Lvar with Ipc.read..(....) and send them to Air Manager ???

 

for example turn a button in cockpit and interact with element of an Air manager gauge

 

Best regards

Thierry

Link to comment
Share on other sites

Hi,

 

 

We have the plan to include LVAR support in the next AM 2.1.1 release.

 

I have the system working, but it still needs tweaking to get it working with all the versions of FSX.

 

Subscribing to a LVAR is exactly the same as subscribing to a normal SimConnect variable:

 

Example:

function callback(value)
   print("value = " .. tostring(value))
end

fsx_variable_subscribe("L:AirspeedIndicatedNeedle", "NUMBER", callback)

 

This way you can also mix and match SimConnect and LVAR's. All within the same callback function.

 

 

Kind regards,

 

Corjan

Link to comment
Share on other sites

  • 2 weeks later...
Hi Raywing

 

That means we could also read Offset or Lvar with Ipc.read..(....) and send them to Air Manager ???

 

for example turn a button in cockpit and interact with element of an Air manager gauge

 

Best regards

Thierry

 

No, AM does not announce the UDP port for receiving data, and also the format of the data, so you can not send data to AM.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...