Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
TheLord45 edited this page Dec 24, 2019 · 5 revisions

Welcome to the AMXpanel wiki!

What is it for?

This software is able to emulate any G4 panel of AMX. AMXPanel is able to take the original configuration files of a real panel, and emulate this panel. It connects to an AMX controller and authenticate itself as the panel defined in the configuration files. The big difference to an original panel is, that you don't need any special hardware or software. All you need is a device with a browser installed. Therefore it doesn't matter what OS you use or which hardware. It works on every device with a modern browser.

Prerequisites

To use the software, you need a server running Linux (a Raspberry PI will do it). On this server you need a WEB server running, and the C++ part of the software in this repository. You can use any WEB server you like, as long as it can deliver static HTML pages. If you want to use dynamic images or need access to a camera, you need a WEB server who can run a small PHP script.

Compile the software

To successfully compile the software you need a C++17 compatible C++ compiler GCC9 is able to compile the code. If you use GCC8, you've to add experimental to the include of #include <filesystem> in the files expand.cpp and directory.cpp. With older compilers you may out of luck.

Make sure you've installed the following libraries:

  • Boost 1.62 (or newer)
  • libxml++-3.0
  • freetype
  • iconv
  • pthread
  • ssl
  • crypto
  • gd
  • png
  • z
  • jpeg
  • cidr
  • zlib

After you've downloaded the software, enter the directory where you've saved it. Create a directory called build. Enter this directory and type the following commands:

cmake ..
make
sudo make install

Configuring

In order to use the daemon called amxpanel, you need a configuration file. You can place this file at several different places. The following list will show you where:

  • /etc/amxpanel.conf
  • /usr/etc/amxpanel.conf
  • /etc/amxpanel/amxpanel.conf

Additionally you can place a file called .amxpanel.conf in the home directory of the user the daemon is running under. This may be useful in case you want to start it as a normal user.

Configuration options

The following shows an example for a configuration file:

Listen=x.x.x.x
HTTP_Root=/home/user/public_html/amxpanel
PidFile=/var/run/amxpanel.run
LogFile=/home/user/public_html/amxpanel/amxpanel.log
FontPath=/home/user/public_html/amxpanel/fonts
WebLocation=/~user/amxpanel
AMXPanelType=MVP-5200i
AMXController=x.x.x.x
AMXPort=1319
AMXChannel=10001
AMXChannel=10002
AMXChannel=10003
AMXChannel=10004
AMXSystem=1
WebSocketServer=<FQDN>
AllowedNets=<IP1>/24,<IP2>/24,<IP3>/24
SidePort=11012
SSHServer=/home/user/amxpanel/server.pem
SSHDH=/home/user/amxpanel/dh.pem
WSStatus=true
Debug=0

Rules for the configuration file

Blank lines are ignored, as well as lines starting with a # sign. All label names are not case sensitive. A valid line must have exactly 1 = sign. Spaces in front and after this sign are truncated as well as blanks after the last letter in a line.

Listen

This is the IP address the daemon should listen on, for connections of a WEB browser.

SidePort

This is the port number the daemon is listening on.

User

This defines the user name the daemon is running under. By default the user nobody is used. It is recommended to set this the same user the WEB server is using. For example on Debian with apache this would be the user www-data.

Group

This defines the group name the daemon is running under. By default the group nobody is used. It is recommended to set this the same group the WEB server is using. For example on Debian with apache this would be the group www-data.

HTTP_Root

The path to the directory where all the HTML files are. The content of this directory is mostly created by the daemon at the moment it starts the first time. This is also the directory the WEB server needs access to.

PidFile

The directory where the daemon should write the PID file. This file contains only the PID (the process number) of the daemon and is used to kill the daemon.

LogFile

This is an optional parameter. If it is set, and debugging is set to 1 (look at debug), than the daemon writes very fine granulated debug informations into this file. If you are not a developer, you would not need this. Beside that it slows down the daemon.

FontPath

This is the path where all the fonts are located, the panel may use. This fonts are part of the original panel configuration files of an AMX panel.

WebLocation

This is the relative URL you need to type into the browser to access the panel files and start the emulation.

AMXPanelType

This is the type of the panel to simulate. The name defined here is send to the controller and will show up when you list all devices connected to the controller.

AMXController

This is the IP address of the AMX controller.

AMXPort

This is the port number where the AMX controller is listening for connections of peripheral devices. As long as this number is not changed on the AMX controller, it is always 1319.

AMXChannel

This is the channel number of the AMX panel. These numbers start at 10001. Everything less is not a panel. You can emulate more than one panel. Therefore you can use this parameter as often you like. But every channel number must be distinct!

AMXSystem

This is the system number of the controller.

WebSocketServer

This is the full qualified domain name of the server the daemon is running. In case you configure the daemon to use encrypted websockets, this domain must match the domain in the server certificate. It must be the same certificate the WEB server uses. If your WEB server uses encryption (SSH), the websocket connection must use it also. If the WEB server don't use encryption than the websockets shouldn't use it either. This is a restriction of modern browsers.

AllowedNets

This is a list of comma separated IP addresses or IP ranges, who are allowed to connect to the daemon. This is only for the websocket connection and not for the access to the browser. Because the application doesn't run without a websocket connection, it should be enough to restrict the websocket connection.

SSHServer

This is the path to the file containing the certificate for the daemon. In case you want to use encrypted websockets, you need a valid certificate. It must be the same certificate you use for the WEB server!

SSHDH

This is the DH file and contains the D-H algorithm. The D-H algorithm enables two systems to exchange a symmetric key securely without requiring a previous relationship or prior arrangements. Shortly: The daemon needs it to create a secure channel.

WSStatus

This configures, whether an encrypted websocket channel is used or not. If this is set to false, than the websocket will not be encrypted. If it is set to true, an encrypted websocket channel will be used. In this case you need also a certificate.

Debug

This can switch on the debugging mode. By default it is set to 0, which means that debugging is switched off. If this is set to 1, debugging is switched on. In case there is a logfile given (parameter LogFile), all the debugging is written into that file. Otherwise it is written to syslog. Then it depends on the configuration of syslog whether you can see the messages or not. If you see them, they may be in a separate file.

Using the software

Once you've successfully compiled and installed everything, you can start the daemon by typing:

amxpanel

The program immediately disconnects from the console and you should have the normal prompt. You may see some messages in the logfiles of your machine. Now start a browser and type the URL of the machine the URL line. If everything was ok, you should see a page and you should be able to type on the button the same as you would on a real panel.

Configuring the directory of the WEB server

Because you'll need a WEB server too, you've to define a directory where are all the files for the browser. In this directory create the following subdirectories as shown below:

mkdir images
mkdir sounds
mkdir fonts
mkdir scripts
mkdir __system
mkdir __system/graphics

Copy now the files of the surface you've created with TPDesign4 into this directory.

Extract the files from a .TP4 file.

Download or clone the command line utility FSFReader. Of course you can clone it too with the following command:

git clone https://github.com/TheLord45/fsfreader.git

Read the README file to find out how to compile and use the software.

FSFReader extracts all the files in a .TP4 file into a directory. Move all files with the extensions .xma and .xml into the main directory. Move all graphic files with the extensions .png and .jpg into the subdirectory images. The sound files with the extensions .mp3 and .wav into the subdirectory sounds and the fonts with the extension .ttf into the directory fonts. At this point you're ready to start using the software.