AMX

From SpinetiX Support Wiki

Jump to: navigation, search

Introduction

The HMP can be integrated in installation driven by AMX controller very easily thanks to the various API provided by SpinetiX.

The AMX controller can be used in various scenario such as:

  • Switching the media displayed on the screen connected to the HMP
  • Sending message to the HMP (such as welcome messages) from the AMX control panel.
  • Monitoring the HMP status and sending maintenance actions to the player such as restarts ad shutdown

The following API can be used to communicate between the AMX controller and the HMP.

  • TCP Shared Variable API using port 1234
  • High level RPC API for monitoring and getting feedback from the player
  • Advanced node.js programming on the HMP for complex interaction between the HMP and the controller.

The example bellow uses the TCP Shared Variable API for communicating with the HMP as this is the simplest way to update a shared variable from the network. For more advanced network scenario or interaction, the RPC API should be used.

Setup

Setup

The setup is composed of the following material:

  • AMX Controller (NI700 was used in our setup)
  • AMX touch panel (MXT-1000 was used in our setup)
  • HMP (HMP200 was used in our setup)
  • Laptop in the setup phase with the following softwares:
    • Elementi (for the content displayed on the screen)
    • NetLinx Studio (for the code)
    • TPDesign (for the touch panel)

All examples have been realized together with our partner: ControlDesign – AMX Valued Independent Partner

Switching media

Controlling the media displayed by the HMP can be done using the TCP Shared Variable API and the Action to Switch widget from Elementi.

The AMX controller will be used to send commands to the HMP using raw TCP sockets similar to the way explained in the Tutorial: Send commands to the HMP using a Telnet client.

When commands are send from the AMX controller, a special Project published on the HMP is used to react on the command and display the new media.

Example

The following sample can be used to switch between 2 media using the AMX controller.

  1. Make sure that the HMP and the controller are in the LAN
  2. Download the HMP Project and the AMX controller file
  3. Open the HMP Project in Elementi and publish it to the player
  4. Enable the Network API on the HMP Control Center.
  5. Open the file "SpinetiX Test vWiki CtrlDsgn Rev0.axs" and change the IP of the player (line 29)
    CHAR cIPAddrSpx[] = '172.21.3.163' // IP Adress SpinetiX
  6. Compile an load the code into the AMX controller
  7. Load the screen file (SpinetiX TEST X1000.TP4) into the touch panel

Clicking on any of the button will switch the media on the screen.

HMP

Configuring the Action to Switch widget

The HMP Project is using the Action to Switch widget. The widget is configured to display one of the two image when the shared variable media is updated.

  1. Create a new Project
  2. Drag&drop the Action to Switch widget from the Library into yout main layout
    In this example we also use a clock.
  3. Change the name of the Shrared Variable to ‘media@localhost’
  4. Update the Mapping tabs with the media to be displayed.
    Make sure the Action name is set to 1, 2, …

Enabling the Network API on the player let the controller update the shared variable using the TCP API. It is also possible to test the published project without an AMX controller, using the following URI:

http://[ip_of_the_player]:1234/update?media=1

AMX

AMX Control panel

The sample AXS file provided in the downloadable AMX file uses the following piece of code to send commands to the HMP:

BUTTON_EVENT[dvTP___1_1, 1]	// button #1
{
  PUSH:
  {
    TO[BUTTON.INPUT]
    IF(nConnectedToServer == nDisconnect)
    {
      fnCommIP( nConnect)
      WAIT 2
      {
        SEND_STRING dvSpineX_1, "'UPDATE "', 'media', '" "', '1', '"', $0D, $0A"
        fnCommIP( nDisconnect)
      }
    }
  }
}

With the following:

  • fnCommIP( )
    This is a local function defined in the code used to open and close the socket to the player.
  • SEND_STRING dvSpineX_1, "'UPDATE "', 'media', '" "', '1', '"', $0D, $0A"
    Sends the update of the shared variable called "media" to the value of "1"

Note that the same kind of code can be found for the second button.

Sending messages

It is also possible the send more complex messages to the HMP to be displayed on the screen.

Example

The following sample can be used to send a message to the HMP using the AMX controller.

  1. Make sure that the HMP and the controller are in the LAN
  2. Download the HMP Project and the AMX controller file
  3. Open the HMP Project in Elementi and publish it to the player
  4. Enable the Network API on the HMP Control Center.
  5. Open the file "SpinetiX Test vWiki CtrlDsgn Rev0.axs" and change the IP of the player (line 29)
    CHAR cIPAddrSpx[] = '172.21.3.163' // IP Adress SpinetiX
  6. Compile an load the code into the AMX controller
  7. Load the screen file (SpinetiX TEST X1000.TP4) into the touch panel

Clicking on any of the button will change the message displayed on the screen.

HMP

Configuring the Slideshow widget

Elementi X is needed to prepare the Project.

In this example we use the RSS Slideshow widget, but any other feed widgets can be used to display the message.

  1. Create a new Project
  2. Drag&drop the RSS Slideshow from the Library into your project and rename it to SV Slideshow
  3. Open the Data source configuration dialog (Data Feed Properties)
  4. Change the Type to ‘Shared variable’
  5. Change the variable name to ‘message@localhost’
  6. Change the Parser to ‘RegExp’
  7. Change the layout of the widget so that it is composed of a single text layer, filling up all the area, using the smart text ‘Headline – Uniform’ and whose text content is [[title]]

AMX

The sample AXS file provided in the downloadable AMX file uses the following piece of code to send commands to the HMP:

BUTTON_EVENT[dvTP___1_1, 1]	// button #1
{
  PUSH:
  {
    TO[BUTTON.INPUT]
    IF(nConnectedToServer == nDisconnect)
    {
      fnCommIP( nConnect)
      WAIT 2
      {
        SEND_STRING dvSpineX_1, "'UPDATE "', 'message', '" "', 'sample message', '"', $0D, $0A"
        fnCommIP( nDisconnect)
      }
    }
  }
}

With the following:

  • fnCommIP( )
    This is a local function defined in the code used to open and close the socket to the player.
  • SEND_STRING dvSpineX_1, "'UPDATE "', 'message', '" "', 'sample message', '"', $0D, $0A"
    Sends the update of the shared variable called "message" to the value of "sample message"

Note that the same kind of code can be found for the second button.

Monitoring

It is possible to monitor the status of the HMP using the AMX controller. Typically the following information can be retrieved from the player:

  • serial number, name, temperature, disk space, CPU, ...

It is also possible to use the controller to restart or shutdown the player.

There are no specific project to be published to the HMP and the RPC API needs to be used. The complete explanation of this process is outside the scope of this wiki, but the main guideline are shown below.

  • Use the AMX controller to send HTTP request to the player.
    Make sure to change the target port to 80:
    INTEGER nPortSpx = 80 // Port SpinetiX
    Modify the string to be send. For instance:
SEND_STRING dvSpineX_1, "'POST /rpc HTTP/1.0', $0D, $0A,
                         'Host: ', ServerInfo.cServerAddress, $0D, $0A,
                         'Content-Type: application/json', $0D, $0A,
                         'Content-Length: ', '40', $0D, $0A,
                         $0D, $0A,
                         '{"method": "restart","params":[],"id":1}'"
Check the RPC documentation for the list of possible commands that can be sent to the player.
Note that the size set in the ‘Content-Length’ header depends on the size of the HTTP content.
  • If needed parse the response from the player to extract the desired information and set it into some variables
  • Use the variables to show the desired information using the control panel

For more details on this subject it is recommended to contact your AMX dealer or our partner ControlDesign – AMX Valued Independent Partner –

For more Support

AMX Valued Independent Partners (VIP) represent an elite level of AV control system programming and user interface design expertise. VIPs maintain yearly ACE certification, hold certification by at least one AV trade organization, and meet stringent business practice criteria to be hand-selected for AMX's VIP program. (sic AMX website)

What does this mean to AV and IT dealers? Reliable, reputable, and thoroughly knowledgeable service for any project. SpinetiX Team recommends ControlDesign to guide you on your interoperability requests and services.

This tutorial has been written, checked and tested under the help and expertise of ControlDesign

Contact Details

ControlDesign: AMX VIP and SpinetiX Certified Application Partner (CAP)

Switzerland

www.controldesign.ch

info@controldesign.ch

This page was last modified on 16 October 2015, at 15:41.