Home AMX User Forum AMX General Discussion

Formatting HTTP Send_String

Hi All.

I have no experience strings for HTTP devices and am looking for a little help putting together the send_string for a Matrox HDX. All I need to do is start and stop the encoder but it doesn't respond to my first attempts.

According to the API the command is:

http://<username>:<password>@<ipAddress>/Monarch/syncconnect/sdk.aspx?command=<command>.

With my variables it is:

http://admin:admin@192.168.3.200/Monarch?synconnect?sdk.aspx?command=StarttBothEnco ders.

What I am sendind is:

SEND_STRING dvMatrox,"'GET /Monarch/syncconnect/sdk.aspx?command=StartBothEncoders HTTP/1.1',$0D,$0A,'Host: 192.168.0.200:80',$0D,$0A,'Authorization: Basic YWRtaW4:YWRtaW4',$0D,$0A,'Connection: keep-alive',$0D,$0A,$0D,$0A"

Any help would be appreciated.

Comments

  • How are you opening the connection to the device first, before sending the string? Also, it looks like you might be missing a CR/LF between the command string and the HTTP/1.1?
  • DEFINE_FUNCTION Matrox (x) //Start=1,Stop=2
    {
    SWITCH (x)
    {
    Case 1: //Start
    {
    IP_CLIENT_OPEN(dvMatrox.PORT,'192.168.0.200',nIPPort,1)
    SEND_STRING dvMatrox,"'GET /Monarch/syncconnect/sdk.aspx?command=StartBothEncoders HTTP/1.1',$0D,$0A,'Host: 192.168.0.200:80',$0D,$0A,'Authorization: Basic YWRtaW4:YWRtaW4',$0D,$0A,'Connection: keep-alive',$0D,$0A,$0D,$0A"
    IP_CLIENT_CLOSE(dvMatrox.PORT)
    }
    Case 2: //Stop
    {
    IP_CLIENT_OPEN(dvMatrox.PORT,'192.168.0.200',nIPPort,1)
    SEND_STRING dvMatrox,"'GET /Monarch/syncconnect/sdk.aspx?command=StopBothEncoders HTTP/1.1',$0D,$0A,'Host: 192.168.0.200:80',$0D,$0A,'Authorization: Basic YWRtaW4:YWRtaW4',$0D,$0A,'Connection: keep-alive',$0D,$0A,$0D,$0A"
    IP_CLIENT_CLOSE(dvMatrox.PORT)
    }
    }
    nIPPort is 80
  • Might try giving yourself a little wait time before sending the string, or use a flag and the Online/Offline data events as gates to make sure the device has come online before sending the string. Can you get the string to work if you just type it into a browser?
  • viningvining Posts: 4,368
    Might try giving yourself a little wait time before sending the string, or use a flag and the Online/Offline data events as gates to make sure the device has come online before sending the string. Can you get the string to work if you just type it into a browser?
    Agreed, I would never send the string from there and always trigger send strings from the online handler. I probably wouldn't use the IP Close either since that will happen on its own.
  • Hello,
    I am controling a Matrox Monarch and i have the same problem, can you help me? You find a solution?

  • Duncan EllisDuncan Ellis Posts: 162

    You might want to use the 'Postman' Application. you can just fill in the details and it will show you the header etc...

    I use it when I can't get stuff to work. Its quick for changing the info and checking what works and seeing the replies...really helps in development. www.postman.com

  • ernestmusseriiiernestmusseriii Posts: 16
    edited June 17

    Id try sending the string from the data ONLINE event. Populate your string into a global variable and call IP_Client_Open. When the ONLINE data event fires off, send the string(check the length of the string first).
    Do a timed wait_until you recieve a response and then close the connection.

    EDIT: Just realized someone above already said the same thing.

Sign In or Register to comment.