Home AMX User Forum AMX Technical Discussion

IP control/format question

I have done a fair amount of 232 control over the years but this is my first stab at IP control. (excluding pre made modules)
At the moment I'm just trying to send out simple cursor commands, not parsing any data.


DATA_EVENT[vdvJetstream]
{
ONLINE:
{
CANCEL_WAIT 'CONNECT'
bConnected = TRUE;
CANCEL_WAIT 'TRYING TO CONNECT'
bBusyConnecting = FALSE;
SEND_STRING 0,"'Jetstream Online'";
}

OFFLINE:
{
CANCEL_WAIT 'CONNECT'
bConnected = FALSE;
CANCEL_WAIT 'TRYING TO CONNECT'
bBusyConnecting = FALSE;
SEND_STRING 0,"'Jetstream Offline'";
}

ONERROR:
{
CANCEL_WAIT 'CONNECT'
bConnected = FALSE;
CANCEL_WAIT 'TRYING TO CONNECT'
bBusyConnecting = FALSE;
SEND_STRING 0,"'error: Jetstream=',ITOA(Data.Number)";
}

STRING:
{
// PARSE XML - using cBuffer
SEND_STRING 0,"'string: Jetstream=',Data.Text";
}
}

BUTTON_EVENT [vdvJetstream_TPs, nJetstreamFunctions]
{
PUSH:
{
STACK_VAR INTEGER nFunctionNumber;


// Grabbing function number
nFunctionNumber = GET_LAST(nJetstreamFunctions);

// Feedback to TP
TO[BUTTON.INPUT.DEVICE, BUTTON.INPUT.CHANNEL];

SWITCH(nFunctionNumber)
{
CASE 1: // Cursor UP
{
SEND_STRING vdvJetstream,"'<JAStalk><Request><Command>Controls.MoveCursor</Command><Action>Up</Action></Request></JAStalk>', 13";
}

CASE 2: // Cursor down
{
SEND_STRING vdvJetstream,"'<JAStalk><Request><Command>Controls.MoveCursor</Command><Action>Down</Action></Request></JAStalk>', 13";
}

CASE 3: // Cursor Left
{
SEND_STRING vdvJetstream,"'<JAStalk><Request><Command>Controls.MoveCursor</Command><Action>Left</Action></Request></JAStalk>', 13";
}

CASE 4: // Cursor Right
{
SEND_STRING vdvJetstream,"'<JAStalk><Request><Command>Controls.MoveCursor</Command><Action>Right</Action></Request></JAStalk>', 13";
}

CASE 5: // Select
{
SEND_STRING vdvJetstream,"'<JAStalk><Request><Command>Controls.MoveCursor</Command><Action>OK</Action></Request></JAStalk>', 13";
}
}
}
}

Using Telnet from my computer I can control the hardware
Example Telnet command:
<JAStalk><Request><Command>Controls.MoveCursor</Command><Action>Right</Action></Request></JAStalk>


When I send a command using telent I see the response in Studios diagnostics window so I'm assuming my connection routine is correct since I'm getting incomming data.

The problem is my outgoing commands from the AMX don't seem to trigger any kind of response from the hardware.
Do I need to format the outgoing commands different?
I'm not sure what Telnet does as far as formatting and protocol.
I'm thinking perhaps I need to change the transport protocol but not sure what determines which one we should use.

Thanks,

Comments

  • Is that all your code?

    I don't see a IP_CLIENT_OPEN anywhere to establish the connection.
  • mainline

    Sorry missed that.

    mainline:

    WAIT 100 'CONNECT'
    {
    IF (bConnected == FALSE && bBusyConnecting != TRUE)
    {
    bBusyConnecting = TRUE;

    IP_CLIENT_OPEN(vdvJetstream.PORT, '192.168.1.109', 5001, IP_TCP);

    WAIT 100 'TRYING TO CONNECT'
    {
    bBusyConnecting = FALSE;
    }
    }
    }


    I figured I was connecting ok since I'm seeing incomming data, I just can't seem to get any commands going out.
    I'm not even seeing any error response.
    If my connection(port) wasn't open correctly would I still be able to see incomming data?
  • Have you tried adding a $0A (or 10) on the end? Some protocols like to see a $0A, $0D (sorry, I'm not familiar with the protocol you're trying to use).
  • That was it

    You nailed it.

    I had a carriage return but the device was looking for $0D, $0A in that order.

    Working like a charm now.

    Thanks
  • I'm getting in kinda late here, but I need some help.

    I'm trying to send text data from my computer to the processor, is there anyway to do that. I can create a connection to my computer using IP_CLIENT_OPEN, but I don't know how to hold that connection open forever to send data back.

    Any ideas on how to do this?

    Thanks,

    Javed
  • DHawthorneDHawthorne Posts: 4,584
    javedwahid wrote: »
    I'm getting in kinda late here, but I need some help.

    I'm trying to send text data from my computer to the processor, is there anyway to do that. I can create a connection to my computer using IP_CLIENT_OPEN, but I don't know how to hold that connection open forever to send data back.

    Any ideas on how to do this?

    Thanks,

    Javed

    Is the master initiating the connection or the computer? If it's the master, your computer has to be set up as a Telnet server and listen for the connection. If the computer is initiating it, the other way around and set the master up as your server.
Sign In or Register to comment.