The program requires the use of the | QtSerialPort package which is included in Qt 5.0+ but can be downloaded for use with QT 4.x versions. Even though the QtSerialPort module is included with Qt 5.0, it does not, when running on Linux, display manufacturer or descriptive info. In order to display this info, it is necessary to install the udevlib-dev packagage (|instructions) and to download the current QtSerialPort source (as of August, 2013). As of November, 2013, the QtSerialPort package included with Qt 5.0 provides the nececessary support.
The program consists of at least 13 sub-projects:
- appslib This module contains base libraries for
the 3 apps that wil lbe built: DecoderPro3,
- AutoIncreaseBuildNr This is a little utility program that is used to automatically increment the build number in a c++ header file.
- DecoderPro3 This is one of the several executables
produced. It is oriented to working with Rosters, and working with
decoders.
- libPr3 This project creates a library that contains classes for accessing LocoNet messages and manages configuration data for LocoIO modules.
- ftdilib This project supports RFID readers that can be obtained from | Spark Fun Electronics
- JavaQt This library
contains classes the map Qt classes to JMRI classes and
other basic classes used thoughout.
- LayoutEditor This project creates a library of routines that are used to create and edit a GUI layout panel.
- libTables This project creates a library that provides a dialog to display and edit various system tables such as turnouts, sensors, blocks, etc.
- libPref This project creates a library with functions relating to setting and viewing preferences.
- LocoIO This project adds panels that I have
developed to program LocoIO, LocoServo and LocoBuffer modules.
- InstallTest This project creates an excutable
that JMRI developed to test an installation.
- PanelPro This project creates an
executable for making Control Panels.
- QtWebApp Provides a web server. Local changes to the original package are now inclused in th source tree.
- QuaZip This package provides
support for creating and reading zip files. For example, the files
creating a roster can be saved as Zip files. The package (version
0.7.3) can be downloaded from https://sourceforge.net/projects/quazip/files/latest/download
- PythonQt This package is
used to support creation and execution of Python scripts. I am using
branch "opencor_r502" which has wrappers for Qt version 5.11. https://sourceforge.net/projects/pythonqt/files/
See: (| Scripting) Because of some problems with the version of PythonQt on SourceForge,
I have made some minor changes: ```Index: generator/main.h
===================================================================
--- generator/main.h (revision 502)
+++ generator/main.h (working copy)
@@ -105,6 +105,12 @@
std::cout << "-------------------------------------------------------------" << std::endl;
std::cout << "Using QT at: " << qtdir.toLocal8Bit().constData() << std::endl;
std::cout << "-------------------------------------------------------------" << std::endl;
+ QDir dir(qtdir);
+ if(!dir.exists())
+ {
+ qWarning("QTDIR environment variable does not exist. This may cause problems with finding the necessary include files.");
+ std::cout << "WARNING! QTDIR environment variable does not exist. This may cause problems with finding the necessary include files.";
+ }
qtdir += "/include";
includes << (qtdir + "/QtXml");
includes << (qtdir + "/QtNetwork");
@@ -111,6 +117,7 @@
includes << (qtdir + "/QtCore");
includes << (qtdir + "/QtGui");
includes << (qtdir + "/QtOpenGL");
+ includes << (qtdir + "/QtWidgets");
includes << qtdir;
}
foreach (QString include, includes) {
Index: generator/shellheadergenerator.cpp
===================================================================
--- generator/shellheadergenerator.cpp (revision 502)
+++ generator/shellheadergenerator.cpp (working copy)
@@ -152,7 +152,8 @@
}
s << "),_wrapper(NULL) {";
writeInjectedCode(s, meta_class, TypeSystem::PyInheritShellConstructorCode, true);
- s << "};" << endl;
+ //s << "};" << endl;
+ s << "}" << endl; // ACK
}
s << endl;
s << " ~" << shellClassName(meta_class) << "();" << endl;
```
- Python The version of Python supported is version 2.7 or later. Python may be included with your OS. There are several Python versions available. For example to install Python 3.4
Add the
deadsnakesPPA (read more about it at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa):<code><span class="pln">sudo add</span><span class="pun">-</span><span class="pln">apt</span><span class="pun">-</span><span class="pln">repository ppa</span><span class="pun">:</span><span class="pln">deadsnakes</span><span class="pun">/</span><span class="pln">ppa</span></code>
Install
python3.4:<code><span class="pln">sudo apt</span><span class="pun">-</span><span class="pln">get update<br>sudo apt</span><span class="pun">-</span><span class="pln">get install python3</span><span class="pun">.</span><span class="lit">4</span></code>
- QtWebApp This package
provides the basic web server functionality. The original QtWebApp
developed by Stefan Frings doesn't suppport WebSockets but there is a
fork available that does: httpss://github.com/samiavasil/QtWebApp
However there are a few minor changes that need to be made. See
QtWebApp.html
- JMRI While this project
does not use any of the original JMRI code, it does require many of the
support files included with JMRI like icons, html files, decoder files,
etc. For this reason, you must have a copy of JMRI on your PC to be
able to use these files. JMRI source can be downloaded from: http://jmri.sourceforge.net/download/index.shtml
- QtZeroConf This package is required to be able to advertise the Web server and the LnOverTcp server.
It can be downloaded from https://github.com/jbagg/QtZeroConf It requires that the libavhi-client-dev package be installed.
- libftd2xx This library is needed to compile the ftdilib sub-project.
You can download the library from FTDI Drivers.
Note, I was unable to use the version for Linux x64 (64-bit), version 1.4.8 but further on down the page, the older version 1.3.6 works fine.
Copy the file libftd2xx.a to /usr/local/lib.
- Select a root directory where the source will reside. In my case, I have a directory called 'Projects' although it can be any name you choose.
- In the 'Projects' directory, create a directory named 'DecoderPro'. Again, the name you choose for this directory is not important.
- Change to the 'DecoderPro' directory.
- Clone the source repository with the command: 'fossil clone http://acksoft.dyndns.biz:1080/cgi-bin/fossil/DecoderPro decoderpro.fossil'. This will create a file named 'decoderpro.fossil' which is your local repository copy.
- Next, issue the command 'fossil open decoderpro.fossil'. This will download the source and other files in the project. It will create a directory 'DecoderPro_app in the '../DecoderPro/' directory containing directories: 'AutoIncreaseBuildNr', 'ftdilib', 'libPr3', 'LocoNetMonitor', 'LayoutEditor', 'Tables' and 'wiki'.
- In QtCreator, open the 'AutoIncreaseBuildNr.pro', 'libPr3.pro' and 'LocoNetMonitor.pro' project files in their respective directories.
- Project AutoIncreaseBuildNr should be built first as it is required by the other projects. If you want the optional RFID support, ftdilib must be |compiled and built. Then likewise, the library, libPr3 must be compiled before LocoNetMonitor.
- The source can be updated at any time with any changes since you created the project or last ran 'fossil update' at any time by running 'fossil update
- QtWebApp is stored in a separate Fossil repository: http://acksoft.dyndns.biz:1080/cgi-bin/fossil/QtWebApp
On Windows, a USB driver is required. There are instructions in the http://users.telenet.be/deloof/Locobuffer/LocoBuffer%20EN.pdf|LocoBuffer Manual on how to do this.
Because many classes refer to classes in other libraries, it will become necessary to take some precautions in order to sucessfully compile the various libraries. At the present time, the only library that does not reference classes in any other library is JavaQT. Therefore, it is recommended that it be compiled first. When compiling the other libraries, the link will fail when another library is referenced which is not yet built. To circumvent this, one should temporarily comment out the references to the libraries that have not yet been built. This will of course produce a host of unresolved link errors. But it will create the necessary .so file or .dll file that other libraries and execuables need. Once a library is built and a .so or .dll file exists, the commented out references in the various .pro files for each sub-project can be un-commented.The Project has been created as several separate project directories as part of an overall Projects directory. In order to avoid extensive changes to the various projects' .pro files, it is recommended that you maintain this structure. When it is necessary for a project to referance another, the ,pro files all can use an environment variable, "PROJ_DIR" to specify the location of the projects directory. This environment variable can be set in Windows environment variables or in Linux as an entry in .bash.rc, e.g. "export PROJ_DIR="/home/allen/Projects".
- Create an Environment variable "PROJ_DIR" that specifies the location of your projects directory where the various packages are kept. The Projects folder well then contain one or more flders/directoried with different projects.
- Make sure you have either an installed copy of the Java JMRI app or have downloaded the source from JMRI. It is needed to provide resources like icons and other resources. It is best to insure that you have an environment variable "JMRI_PROG" set to the location of the JMRI code. (Jmri Code: Getting the Code)
- Make sure that you have a copy of QtZeroConf installed and compiled. (It can be downloaded from https://github.com/jbagg/QtZeroConf It requires that the libavhi-client-dev package be installed.)
- In QtCreator open project "jmri.pro". Make sure that thw shadow build box is not checked!
- Build the JavaQt sub-project.
- Build the QtWebApp sub-project.
- Insure that QuaZip has been installed on your system. (The package (version 0.7.3) can be downloaded from https://sourceforge.net/projects/quazip/files/latest/download)
- Modify the appslib.pro file to comment out each of the parts referencing other libraries: (libPr3, libPref, Tables, LayoutEditor, LocoIO but not JavaQt. DO NOT comment the "INCLUDPATH" or "DEPENDPATH" statements for these libraries! This will allow the initial libappslib.so file to be created although there will be a large number of undefined references to other libraries not built. When the other libraries have been built, the lines commented out here can be restored. Now build sub-project appslib. Verify that the lib file. appslib.so has been created.
- Now do the same for sub-project LayoutEditor.pro; comment out references to other libraries (except JavaQt and appslib which are already built).
- Now, build sub-project libPr3. Comment out references to libraries not yet built, e.g. libPref, LocoIO, Tables.
- Once libPr3 is complete and libPr3.so has been created, proceed to build sub-project libPref, commening out the reference to lib locoio.
- And once libPref is complete, we can build sub-project LocoIO. It won't be necessary to comment any references to any other libs since they should have been built.
- Now build sub-project Tables. No library references to other sub-projects need to be commented out as they should have been built.
- When Tables has been successfully built, go back and un-comment the lib references in appslib, libPr3, LayoutEditor, lipPref .pro files
- After un-commenting the lines in the .pro files that was done earlier, build the sub-projects again to pick up the references to functions and classes in the other lobraries.
- Now, we can build the app PanelPro. Build the sub-project PanelPro.
- After PanelPro has compiled successfully, you can go click on the Qt Creator "Projects" icon in the left side panel and then select PanelPro executable which can then be run using the run button or the debug button.