Home AMX User Forum NetLinx Studio

IP Control of a Device

I have spent 2 hours searching and I can't seem to find a comprehensive beginner's guide to control a device over IP. I finished P2 a few months ago and we just barely touched on this subject. I am trying to control both a surround processor and a projector with IP. How do I set up the communication for the devices? How do I define the devices? Where do I tell the master the IP addresses of the devices I am controlling?

I would really appreciate some basic example code of what I need to get started. Any help would be much appreciated.

Comments

  • GarretGarret Posts: 27
    I'm quite new to this and last weekend went through figuring out the same thing. There was a forum post that helped me and this is what I got out of it. If I find the post again I'll link to it.



    PROGRAM_NAME='VANTAGE'

    DEFINE_DEVICE
    dvVANTAGE = 0:3:0 //VANTAGE SYSTEM ip device


    DEFINE_CONSTANT //Constants for opening the port used below

    CHAR sIPVANTAGE [] = '10.0.0.16' //The vantage IP address
    svPORT = 3001 //Vantage port number
    IP_TCP = 1 //this means be TCP instead of UDP


    DEFINE_START //This is where I open the port so I can send strings to it
    WAIT 25
    {
    IP_CLIENT_OPEN (dvVANTAGE.PORT, sIPVANTAGE,svPORT,IP_TCP)
    }
  • Do you have to open a server?
  • DHawthorneDHawthorne Posts: 4,584
    remeolb wrote: »
    Do you have to open a server?

    Your device is the server, so you only have to open a client. Unless, of course, you are writing the device end too. You would only need to open a server if you are putting your master in a "listen" type of mode, and the devices are taking the initiative to connect to it.
  • HedbergHedberg Posts: 671
    Tech note #621 gives an example of how to program an IP client. Other tech notes cover related topics -- TN#407 is a good one. . Search for IP client among the tech notes. Also, if you start up the help facility from Netlinx Studio and select Netlinx keyword help, you will, in short order, find good stuff about "IP Communications."
  • Thanks guys, so far this is helping. I've set up a client to connect to my surround processor using 0:4:1. The client comes online. When I control the surround processor with its remote the surround processor sends feedback strings to the AMX controller so I know I am properly connected.

    The problem I am now running into is I can't seem to send the surround processor strings. If I send it a string that I know works through RS-232 it does nothing. And the send string 0 I have set up in the string event does not send the string I sent it to diagnostics. Should I not be able to use control a device and send a string to 0:4:1? Am I doing something wrong? What is the correct way to send the surround processor strings to control it once I have my client set up?
  • Netlinx Studio help also has several examples of how to set up a client and a server connection.
  • DHawthorneDHawthorne Posts: 4,584
    remeolb wrote: »
    Thanks guys, so far this is helping. I've set up a client to connect to my surround processor using 0:4:1. The client comes online. When I control the surround processor with its remote the surround processor sends feedback strings to the AMX controller so I know I am properly connected.

    The problem I am now running into is I can't seem to send the surround processor strings. If I send it a string that I know works through RS-232 it does nothing. And the send string 0 I have set up in the string event does not send the string I sent it to diagnostics. Should I not be able to use control a device and send a string to 0:4:1? Am I doing something wrong? What is the correct way to send the surround processor strings to control it once I have my client set up?

    That is the correct method: send_string 0:4:1, <string goes here>. Send_string 0 just goes to your terminal screen, that won't go to the device at all. However, there is no guarantee that the IP protocol is the same as the RS-232 protocol. If often is, but there are sometimes subtle differences, and sometimes they aren't even remotely the same. What device are you controlling? Maybe someone here knows. If it's a Lutron, for example, a simple CR at the end of the command (Hex $0D) works for the RS-232 port, but if you are using IP, it requires a CRLF pair (hex $0D, $0A) ... just the CR alone won't do anything.

    It's those little things that always get you. By the way, that might be a good thing to try, adding an LF to your terminator.
  • I am controlling a B&K Ref 70 surround processor. I've spoken with B&K tech support and they informed me that the protocol is identical for IP and RS-232 control.
  • I figured out the problem. I was sending the IP device strings from "Control a Device". You can't communicate over IP with "Control a Device". I attached some send string commands to some buttons on a touch panel and now it works great. It would be super cool if NetLinx Studio would remind you that "Control a Device" does not work over IP every time you put a 0 in for your device number. Oh well, I won't make that mistake again. Thanks for your help everyone.
Sign In or Register to comment.