Control Ports for SVSI with external Control Systems

SVSI Encoders and Decoders typically have both a Serial port and an IR port available to control the attached device.  These ports are designed for a control system of some kind to be able to inject the appropriate command to the device.  This distribution of control IO ports allows for flexible designs, and less requirements for cabling and controller IO port requirements. 

Control Options:

Direct Control -  this method indicates that the control system will be in direct communication with the end device. 

N-Command - this method utilizes the SVSI Control Server - the N-Command (there are several versions available, read more on models available HERE)

There are pros and cons for both methods, which typically come down to the capabilities of the control system utilized.  Sockets (or ports) should be thought of as a resource, of which any control system (from any manufacturer) is in limited supply.  If doing direct control, careful socket management needs to be utilized.  Most sockets are not designed to be opened and held opened.  Best practice recommendation is to open a network connection, send the command, get the response, and then close the connection.  The N-Command is designed to handle this process automatically and takes no additional programming to operate in this fashion. If a direct connection is established, this is the same thing as connecting an RS-232 cable from the device to the processor, and if required to be maintained all the time, the recommendation is to close the connection to the SVSI device at a minimum of once ever 24 hours for a period of 3-5 seconds before re-establishing the direct connection.

The SVSI control sockets will only accept a single connection at a time.  If multiple connections are attempted, the first device to establish the connection will gain access and all others (including SVSI internal web pages and other software products) will be rejected.  

For Direct control, the SVSI serial ports are isolated to their own port (and single external connection) on TCP port 50004. There is no support for UDP connections to port 50004.  

For N-Command control, the SVSI serial command will follow the same process as all other commands, and will be directed through TCP port 50020.  Port 50020 is different from the direct control ports in several key ways:

1) the socket is designed to be maintained 24/7.  Besst practice is still to close the connection at a minimum of once ever 24 hours for a period of 3-5 seconds before re-establishing

2) This port is designed to communicate with multiple devices at the same time.  

 

For the purposes of the following tutorial, a free program called "Hercules Terminal" is utilized, but can be thought of in this case as the control processor.  

 

DIRECT CONTROL:

With direct control there are two options for injecting a control command, these options are essentially the same for Serial operation or for IR command operation.  Both are detailed below

Option 1: recalling a stored command:

  1. Connect to the SVSI device via a web browser or N-ABLE software, and navigate to either the Serial or IR page.
  2. Insert the command into the appropriate area.
    1. For Serial command there are two options, ASCII or HEX.  
    2. SVSI uses SPACE DELIMITED hex, ASCII can be entered as normal, and hex bytes should be "\" delimited. 
      1. The system will automatically convert HEX to ASCII (and the reverse). 
    3. Verify the command is correct by clicking the EXECUTE button. This will cause the command to execute. Verify device operation at this time.
      1. If the command is a serial command, response data should be populated below.  If "NO DATA" is returned, this means:
        1. The command is incorrect - and the end device did not respond with a serial string (data).
        2. The command is correct - but the end device did not respond with a serial string (data).
        3. The command is incorrect or correct - but the serial port connection is currently opened by another external device and the connection was rejected.
          1. You can verify this by looking at the unit Settings page and the status of the serial port.
    4. SAVE the Command.  The recall stored method will use this name to execute the appropriate command.  it is CaSE and SP ACE specific.  Use a common naming practice to help eliminate problems later on
    5. For IR, the above process is the same - but the command will be a long form pronto hex code and there is no ASCII to HEX conversion.

Serial_Page_withResponse.JPGIR_PAGE.JPG

 

FROM HERCULES TERMINAL/CONTROL PROCESSOR:

  1. Connect to the SVSI device at the units IP address, and TCP port 50002
  2. Add the appropriate command to the send line,  end the line with a semi-colon or a CRLF (\0d\0a)
    1. Serial command:  sendser:commandName;
    2. IR commands: sendir:commandName;
  3. Click send. The command should execute and a response packet should return.  The beginning of the packet will have a verbose response indicating the command has been executed. 
    1. For SERIAL commands the verbose response will be: "sendser sent 'commandName'
    2. For INFRARED commands the verbose response will be: IR Command: commandName queued for transmission
  4. Once the confirmation is returned, the connection should be closed for the controller.

hercules_Terminal.JPG

 

Option 2: Direct Injection of Command:

Serial Method:

This does not require a command to be prestored on the encoder/decoder.  

  1. Connect to the SVSI device on TCP Port 50004, keeping in mind the socket connection limitations
  2. Send the serial command as specified by the manufacturer.  Terminate the serial string as needed and specified by the manufacturer.
  3. The response is returned automatically (if returned by the device)

direct_serial.JPG

IR Method:

This does not require a command to be prestored on the encoder/decoder.  

  1. Connect to the SVSI device on TCP Port 50002, keeping in mind the socket connection limitations
  2. The command: sendirraw: <hex code>;
  3. The response from the unit: "IR Command: <hex code> queued for transmission"

direct_irraw.JPG

 

 

 

N-Command CONTROL:

With the N-Command, there are several methods for IR and SERIAL control.  Connection to the N-Command is on TCP Port 50020. Follow best practices in the N-Command API documentation for connection.

Option 1: recalling a stored IR command:

This method requires the command to be stored on the encoder/decoder.  

  1. the N-Command scripting language can be found in Build > Scripts
  2. Using the drop downs, select "Send IR command" in the action drop down
  3. Select the appropriate encoder/decoder and click ADD
  4. This generates a commnad:
    1. sendir <ip> IR_NAME_FROM_UNIT
    2. modify the IR_NAME_FROM_UNIT to the stored command name (Case/Space specific)
    3. Example: sendir 169.254.34.55 pON_LG_IR

Option 2: injecting a raw IR Command:

 

  1. the N-Command scripting language can be found in Build > Scripts
  2. Using the drop downs, select "Send RAW IR command" in the action drop down
  3. Select the appropriate encoder/decoder and click ADD
  4. This generates a commnad:
    1. sendirraw <ip> PASTE_IR_PRONTO_CODE_HERE
    2. modify the PASTE_IR_PRONTO_CODE_HERE to the IR command
    3. Example: sendirraw 169.254.34.55 0000 006d 0022 0002 0157 00ac 0015 0016 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0041 0015 0016 0015 0041 0015 0016 0015 0016 0015 0016 0015 0041 0015 0041 0015 0016 0015 0041 0015 0016 0015 0041 0015 0041 0015 0041 0015 0016 0015 0016 0015 0689 0157 0056 0015 0e94

Option 3: injecting the serial command:

  1. the N-Command scripting language can be found in Build > Scripts
  2. Using the drop downs, select "Serial Command Hex" in the action drop down
  3. Select the appropriate encoder/decoder.
  4. If the command is stored in the N-Command SERIAL database (legacy toolset available at Admin > Third Party > Serial Library) you can select it from the dropdown, otherwise click add
  5. This generates a command:
    1. serialhex <time> <ip> <commandINhex> or NULL
    2. <time> is the time to wait after executing the serial to get the response from the device.  This value is required and has a minimum value of 1.
    3. <commandINhex> can also be a command in ASCII, but will need to be notated by Quotes;
    4. Example 1: serialhex 1 169.254.34.55 "ka 0 01\0d" 
      1. Because the command is contained within quotes, many control systems will need to have hex characters modified.  The N-Command accepts Hex (in an ascii format) when delimited by a "\".  Other control processors may delimit with a "\x" or "$"
      2. When sending the command in quotes as needed, if the command receives "ka 0 01\x0d" or "ka 0 01$0d" the end transmission will not be a CR, it will be the hex value of the individual characters - ie - "\x0d" will be sent as HEX "5c 78 30 64"
      3. To resolve this, modify the serial command to have "\\".  so the command becomes: serialhex 1 169.254.34.55 "ka 0 01\\0d" when sent from the external control system.  
    5. Example 2: serialhex 1 169.254.34.55 6b 61 20 30 20 30 31 0d
      1. This command uses the HEX values.  Depending on the control system, it may need to change delimiters to another character:
      2. serialhex 1 169.254.34.55 \x6b\x61\x20\x30\x20\x30\x31\x0d
      3. serialhex 1 169.254.34.55 $6b$61$20$30$20$30$31$0d
  6. To get the serial response, the system must wait <time> before sending:
    1. readresponse <IP>
    2. Example: readresponse 169.254.34.55
    3. The response is returned as:
    4. <IP>:<DATA>
    5. Example: 169.254.34.55:61 20 30 31 20 4f 4b 30 30 78
    6. If no data is returned from the end device, this will contain "NO DATA"

Option 4: using the Third Party Command Library for either Serial or IR (or IP):

This method requires a file to be created and stored on the N-Command containing all the appropriate commands, and a numeric number as the command ID.  This can be created on the N-Command or externally with a spreadsheet program.

TPCLibrary.JPG

once the command is created in the Library, it is referenced by it's ID number.  The advantage of the TPC library is setup and programming.  During the setup process, the command is identified as serial, ir, or network (along with type and port).  Once imported, the command is referenced by the ID number and the Control server determined what type of command it is, and where it needs to be sent to be executed.  This process is the same for serial.

  1. the N-Command scripting language can be found in Build > Scripts
  2. Using the drop downs, select "TPC Library" in the action drop down
  3. Select the appropriate encoder/decoder.
  4. Select the appropriate command, click ADD
  5. This generates a command:
    1. tpc <ip> <commandID>
    2. Example:  tpc 169.254.34.55 49 //Execute Apple TV Menu Button on IR port for SVSI device 169.254.34.55
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk