Latest post Fri, Aug 28 2015 6:05 PM by robg. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • Thu, Aug 27 2015 8:41 AM

    • predat
    • Not Ranked
    • Joined on Tue, Apr 1 2014
    • Posts 6
    • Points 60

    Send command to an Airspeed through python

    Hello,

     

    I'm trying to send xml command to an Airpseed with python. The message i try to send is quite simple:

    <?xml version="1.0" encoding="utf-8"?>
    <AMS>
    <Configuration>
    <Initialize />
    </Configuration>
    </AMS>

    And the response is always:

    <?xml version="1.0" encoding="utf-8"?>
    <AMS>
    <Reply Status="ERROR" Msg="Error loadXML(API)" ErrNum="3"  />
    </AMS>

    I've try with curl too:

    curl -H "Content-Type: application/xml" -d "<?xml version="""1.0""" encoding="""UTF-8"""?><AMS><Configuration><GetConfigInfo/></Configuration></AMS>" http://192.168.43.50:59451

    but i got the same response from airspeed.

     

    Is there a doc where i can find all errors code ? Is my xml is in a wrong format ?

     

    Thank you for your response.

    Filed under:
  • Thu, Aug 27 2015 10:18 PM In reply to

    • robg
    • Top 200 Contributor
    • Joined on Fri, Nov 4 2005
    • Tewksbury, MA
    • Posts 494
    • Points 5,605
    • Avid Developer Moderator
      Avid Employee

    Re: Send command to an Airspeed through python

    predat,

    I asked the developer to look into this.

    In the mean-time, I figured out how to call the AirSpeed API using netcat (nc) in Cygwin:

     

    $ echo '<AMS><Configuration><GetConfigInfo/></Configuration></AMS>' | nc.exe 10.105.216.188 59451

    <?xml version="1.0" encoding="utf-8"?>

    <AMS>

    <Reply Status="OK" />

      <NumChannels>4</NumChannels>

      <VidStandard>SD_NTSC_4x3_29_970</VidStandard>

      <CompatibleVidStandards>SD_NTSC_4x3_29_970;HD_1280x720p_59_940;HD_1920x1080i_29_970</CompatibleVidStandards>

      <ProxyRecordingEnabled>true</ProxyRecordingEnabled>

      <TransferEngineEnabled>true</TransferEngineEnabled>

      <DropFrame>true</DropFrame>

      <SystemType>2</SystemType>

      <SystemMode>Interplay</SystemMode>

      <Dnx220Enabled>false</Dnx220Enabled>

     <ChnInfo>

      <Channel Num="1" Name="Channel 1" OSDName="G2-5-CH1-OSD" VidStandard="SD_NTSC_4x3_29_970" VitcRecord="16" VitcPlay="16" OutputFormatBehavior="UDX" EEModeEnabled="false" />

      <Channel Num="2" Name="Channel 2" OSDName="G2-5-CH2-OSD" VidStandard="SD_NTSC_4x3_29_970" VitcRecord="16" VitcPlay="16" OutputFormatBehavior="UDX" EEModeEnabled="false" />

      <Channel Num="3" Name="Channel 3" OSDName="G2-5-CH3-OSD" VidStandard="SD_NTSC_4x3_29_970" VitcRecord="16" VitcPlay="16" OutputFormatBehavior="UDX" EEModeEnabled="false" />

      <Channel Num="4" Name="Channel 4" OSDName="G2-5-CH4-OSD" VidStandard="SD_NTSC_4x3_29_970" VitcRecord="16" VitcPlay="16" OutputFormatBehavior="UDX" EEModeEnabled="false" />

     </ChnInfo>

    </AMS>

     

    But I don't know how to do this with curl nor Python.

    - Rob

     

  • Fri, Aug 28 2015 3:56 PM In reply to

    • predat
    • Not Ranked
    • Joined on Tue, Apr 1 2014
    • Posts 6
    • Points 60

    Re: Send command to an Airspeed through python

    Thank you for your response. Your command is working for me and that point me to the right direction.

    The solution is to send raw message with socket in python.

    Thank you.

  • Fri, Aug 28 2015 6:05 PM In reply to

    • robg
    • Top 200 Contributor
    • Joined on Fri, Nov 4 2005
    • Tewksbury, MA
    • Posts 494
    • Points 5,605
    • Avid Developer Moderator
      Avid Employee

    Re: Send command to an Airspeed through python

    predat,

    So other developers can see it, here is a python script to send a command to AirSpeed:

    import socket
    #set the address and port of the AirSpeed system
    HOST = '10.105.216.188'
    PORT = 59451
    #create and initializae the socket object
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((HOST, PORT))
    #set the output buffer with the command for AirSpeed
    output_buffer = b"<?xml version=\"1.0\" encoding=\"UTF-8\"?><AMS><Configuration><GetConfigInfo/></Configuration></AMS>"
    #send the commnad
    s.send(out_buffer)
    #get amd print the result
    input_buffer = s.recv(2048)
    s.close()
    print (input_buffer.decode("utf-8"))

    Here are the results of running the script:

    1. C:\Python34>python send_airspeed_command.py
    2. <?xml version="1.0" encoding="utf-8"?>
    3. <AMS>
    4. <Reply Status="OK" />
    5.   <NumChannels>4</NumChannels>
    6.   <VidStandard>SD_PAL_4x3_25_000</VidStandard>
    7.   <CompatibleVidStandards>SD_PAL_4x3_25_000;HD_1280x720p_50_000;HD_1920x1080i_25_000</CompatibleVidStandards>
    8.   <ProxyRecordingEnabled>true</ProxyRecordingEnabled>
    9.   <TransferEngineEnabled>true</TransferEngineEnabled>
    10.   <DropFrame>false</DropFrame>
    11.   <SystemType>2</SystemType>
    12.   <SystemMode>Interplay</SystemMode>
    13.   <Dnx220Enabled>false</Dnx220Enabled>
    14.  <ChnInfo>
    15.   <Channel Num="1" Name="Channel 1" OSDName="G2-5-CH1-OSD" VidStandard="HD_1920x1080i_25_000" VitcRecord="NONE" VitcPlay="NONE" OutputFormatBehavior="UDX" EEModeEnabled="false" />
    16.   <Channel Num="2" Name="Channel 2" OSDName="G2-5-CH2-OSD" VidStandard="HD_1920x1080i_25_000" VitcRecord="NONE" VitcPlay="NONE" OutputFormatBehavior="UDX" EEModeEnabled="false" />
    17.   <Channel Num="3" Name="Channel 3" OSDName="G2-5-CH3-OSD" VidStandard="HD_1920x1080i_25_000" VitcRecord="NONE" VitcPlay="NONE" OutputFormatBehavior="UDX" EEModeEnabled="false" />
    18.   <Channel Num="4" Name="Channel 4" OSDName="G2-5-CH4-OSD" VidStandard="HD_1920x1080i_25_000" VitcRecord="NONE" VitcPlay="NONE" OutputFormatBehavior="UDX" EEModeEnabled="false" />
    19.  </ChnInfo>
    20. </AMS>

     

    - Rob

     

Page 1 of 1 (4 items)

© Copyright 2011 Avid Technology, Inc.  Terms of Use |  Privacy Policy |  Site Map |  Find a Reseller