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.
Sign In or Register to comment.