Home AMX User Forum NetLinx Studio

Telnet control of Gefen Matrix Controller over IP

Hey guys,

New to programming AMX systems.

I'm trying to control this Gefen EXT-CU-Lan matrix controller via Telnet over IP. It seems pretty straight forward. I'm just trying to route inputs to outputs. I have the device defined and right now i have the IP_CLIENT_OPEN command in my BUTTON_EVENT which I believe is working. I'm not sure if the strings that I'm sending it are correct. The message I receive back is SendString to socket-local port (5) invalid. If I send the command again I receive IP_CLIENT_OPEN failed - port 5 already in use which makes me think that I am connected to the Gefen controller but I am sending the wrong command strings.

The last string command I have tested is this: SEND_STRING dvGefen,"'r 1 2'"; I'm not sure if I need to add a line fee or carriage return at the end of it as well?


When I telnet into the Gefen controller from my computer I can type the route command r 1 2 hit enter and the switch happens without a problem.

From the manual the commands for routing are:
r 1 2 // Basically route input 1 to output 2


Gefen product:
http://www.gefen.com/kvm/ext-cu-lan.jsp?prod_id=26226

Gefen manual:
http://www.gefen.com/kvm/ext-cu-lan.jsp?prod_id=26226


Any help would be appreciated.

Comments

  • ericmedleyericmedley Posts: 4,177
    Sounds like your thoughts are correct in that you might need to send an LF because that's exactly what you're doing when you hit the return key on your computer's telnet client. so just add:
    SEND_STRING dvGefen,"'r 1 2',13 ";
    to your statement and see if it works for yo.

    Also, as a side on your comment about hitting the button and seeing "Port already In use"... That's probably because it is still in use. A lot of the IP Telnet conversations that are non-http leave the connection live until either you or the device decided to terminate it. So, you might want to cobble together a port shut down routine (IP_CLIENT_CLOSE()) for your testing and/or your program to manage the connection. for example, if the device decides to terminate/hangs up on you, you'll need some method to try and re-establish the connection.
  • [USER="1623"]ericmedley[/USER] Thanks for your help. The LF was what was missing. I have control of the switcher now. To keep the connection online I wrote this out, I'm not sure if it's the best use but it seemed to work all day in the office for testing. I was also starting to try and capture some of the feedback from the Gefen.

    Browsing the the forums you seem to be everywhere. I appreciate your input. How am I able to paste my code in the reply so that it is formatted correctly with the tabs in place?



    DEFINE_VARIABLE

    volatile integer nGefenStatus; // For testing to see if Gefen was online, I had it tied to a button on an iPad

    volatile char cGefenMessages_Buffer[512]; // For the feedback coming from the Gefen.


    DEFINE_START

    IP_CLIENT_OPEN(dvGefen.Port,'192.168.30.74',23,1); // Connect to Gefen

    Create_Buffer dvGefen, cGefenMessages_Buffer; // Feedback from Gefen


    DEFINE_EVENT

    data_event[dvGefen]
    {
    online:
    {
    send_string 0,"'Gefen Online',data.text";
    nGefenStatus=1;
    }
    offline:
    {
    send_string 0,"'Gefen Offline'";
    nGefenStatus=0;
    IP_CLIENT_OPEN(dvGefen.Port,'192.168.30.74',23,1); // Connect to Gefen
    }
    string:
    {
    cGefenMessages_Buffer=data.text;
    }
    }

    button_event[dvTP_Keypad,3]
    {
    push:
    {
    send_string dvGefen,"'r 1 1',13"; // Route input 1 to output 1
    }
    }

    button_event[dvTP_Keypad,4]
    {
    push:
    {
    send_string dvGefen,"'r 1 2',13"; // Route input 2 to output 1
    }
    }




  • zack.boydzack.boyd Posts: 94
    Square brackets with CODE to start, and /CODE to finish. Use the preview function to test.
  • MLaletasMLaletas Posts: 226
    Since your using CREATE_BUFFER you do not need that line in your string block. Also since your not removing anything in the string block that variable will outgrow it's size that you declared it with eventually.
  • ericmedleyericmedley Posts: 4,177
    jkranz286 wrote: »
    [USER="1623"]ericmedley[/USER] Thanks for your help. The LF was what was missing. I have control of the switcher now. To keep the connection online I wrote this out, I'm not sure if it's the best use but it seemed to work all day in the office for testing. I was also starting to try and capture some of the feedback from the Gefen.

    Browsing the the forums you ,,,


    Yeah, I've been around for a long time. There's a few of us old timers who have been here since the beginnings..

    one thing i see right off off the bat is the opening of the IP port in define_start. (IP_CLIENT_OPEN)

    although you you can get away with this in this case it's not a good practice. For example: a common mistake by noobs is to put the Set Baud command in define start to set up a serial port only to find the command is being ignored. The reason is that when define start runs a lot of devices have yet to come online. For serial ports it's best to put the set baud command in the online event of the serial port itself. That way you know the port is alive to get the command.

    it is true that the IP port is indeed ready at the time of Define Start. However, other things that might come into play may not. In General it is a best practice to avoid any active running code in define start. I'd advise just using it to set initial states or whatnot and use events to start running your code. The way I do this is I happen to always have a virtual device called vdv_debug that I use for internal debugging and messaging. I use this device's online event to trigger my Startup function. In that function is a timing method to wait for everything to come online. That's what triggers my startup routines.

    having said all this... does your code work with the device?
Sign In or Register to comment.