scieee AI-readable full text Open interactive document viewer

Qt-set-up for Texas Instruments AM335x ARM Cortex-A8 using Linux: Application for an industrial scale

Cholbi Alenda, Pablo

Abstract

[ES] En los últimos años, ha habido un gran aumento de los productos de consumo basado en ARM. Este incremento ha sido motivado por la eficiencia y el bajo costo de estos procesadores, que los hacen adecuados para dispositivos de baja potencia y aplicaciones que no hacen un uso intensivo de la CPU. Este trabajo examina la viabilidad de implementar una aplicación con interfaz gráfica táctil para una báscula industrial en una placa de desarrollo Texas Instruments AM335x ARM Cortex-A a diferencia de los sistemas basados en x86. Este trabajo también tiene la intención de servir como una referencia general para la implementación de aplicaciones multiplataforma con las bibliotecas Qt para sistemas Linux embebido que se ejecuta en un hardware basado en AM335x. En concreto, la aplicación a desarrollar es una aplicación con una interfaz gráfica táctil intuitiva que interactúa con una báscula industrial Microgram EI21 de Microgram Instrumentos Española SA a través de RS-232 y una base de datos relacional SQLite para el comercio de productos a granel al peso. La información sobre el producto y las ventas se recupera y se almacena en la base de datos.

Full text

Universitat Politècnica de València Escuela Técnica Superior de Ingeniería del Diseño Bachelor's Degree in Industrial Electronics and Automation Engineering Final Year Engineering Project QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Documents: 1 - Report 2 - Specifications 3 - Budget 4 - User Manual Appendix 1 - Source Code Documentation Appendix 2 - Source Code Annex 1 - Documentation License Annex 2 - Software License Annex 3 - IE 21 Scale Manual Author: Pablo Cholbi Alenda Supervisor: Dr. Àngel Perles Ivars May 2014 Dedicated to my parents, for their love, endless support and encouragement. Acknowledgements I am grateful and would like to express my sincere gratitude to my supervisor Dr. Àngel Perles Ivars for his invaluable guidance, continuous encouragement and constant support as a teacher and as a supervisor, which made this project possible. Without his advice and assistance it would have been a lot tougher to complete. I would also like to thank Dr. Francisco José Gimeno Sales for taking me as an intern during my third and fourth year of my undergraduate degree. I found that the practical experience I obtained at the Laboratory of Renewable Energies to be very valuable and eye-opening. My sincere thanks go to all lecturers and members of the staff at the ETSID, UPV, who helped me in many ways and made my educational journey at UPV unforgettable. These four years have not only provided my with an excellent education but also a broader and inter-disciplinary view on science, engineering and the world. I will remember fondly this period as I face this new chapter in life as an engineer. Lastly, I would like to thank any person who contributed to my final year project directly or indirectly. I would like to acknowledge that all comments and suggestions were crucial for the successful completion of this project. Abstract In recent years, there has been a large increase of ARM based consumer products. This surge has been motivated by the efficiency and low cost of these processors, which make them appropriate for low power devices and applications that are not CPU intensive. This work examines the viability of implementing a graphical touchscreen application for an industrial scale on a Texas Instruments AM335x ARM Cortex-A development board as opposed to x86 based systems. This work also intends to serve as a general reference for implementing cross-platform applications with the Qt framework targeted to an embedded Linux system running on an AM335x based hardware. Specifically, the application to be developed is an intuitive graphical touchscreen application that interacts with a Microgram IE21 industrial scale from Microgram Instruments Española S.A. over RS-232 and a SQLite relational database for bulk product commerce by weight. Product and sales information is retrieved and stored in the database. Keywords: embedded Linux, ARM Cortex-A, Qt, industrial scale. Resumen En los últimos años, ha habido un gran aumento de los productos de consumo basado en ARM. Este incremento ha sido motivado por la eficiencia y el bajo costo de estos procesadores, que los hacen adecuados para dispositivos de baja potencia y aplicaciones que no hacen un uso intensivo de la CPU. Este trabajo examina la viabilidad de implementar una aplicación con interfaz gráfica táctil para una báfscula industrial en una placa de desarrollo Texas Instruments AM335x ARM Cortex-A a diferencia de los sistemas basados en x86. Este trabajo también tiene la intención de servir como una referencia general para la implementación de aplicaciones multiplataforma con las bibliotecas Qt para sistemas Linux embebido que se ejecuta en un hardware basado en AM335x. En concreto, la aplicación a desarrollar es una aplicación con una interfaz gráfica táctil intuitiva que interactua con una báscula industrial Microgram EI21 de Microgram Instrumentos Española SA a través de RS-232 y una base de datos relacional SQLite para el comercio de productos a granel al peso. La información sobre el producto y las ventas se recupera y se almacena en la base de datos. Palabras Clave: Linux embebido, ARM Cortex-A, Qt, báscula industrial. PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 5. Detailed Description of the Adopted Solution................................................................................29 5.1. Application................................................................................................................29 5.1.1 External Relations..............................................................................................29 5.1.2 Application Structure.........................................................................................30 5.1.3 Application Flowcharts......................................................................................32 5.1.3.1 Main...........................................................................................................32 5.1.3.2 Main Window.............................................................................................33 5.1.3.3 Product Dialog............................................................................................35 5.1.3.4 Message Dialog..........................................................................................37 5.1.3.5 Table Dialog...............................................................................................39 5.1.3.6 Options Dialog...........................................................................................40 5.1.3.7 About Dialog..............................................................................................41 5.1.3.8 License Dialog............................................................................................42 5.1.4 Text Fonts for Internationalization.....................................................................43 5.1.5 Application Start on Boot...................................................................................44 5.2. SQLite Database.......................................................................................................47 5.2.1 Database Design.................................................................................................47 5.2.2 Database Creation..............................................................................................48 5.2.3 Database Management.......................................................................................50 5.3. QtSerialPort..............................................................................................................51 6. Conclusions and Future Work........................................................................................................53 7. Bibliography...................................................................................................................................55 21 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Illustration Index Figure 1-1: Energy-efficiency vs. CPU Utilization Level [Ou 2012]..................................................5 Figure 1-2: Power Performance Trade-offs [Blem 2013].....................................................................6 Figure 3.1-1: Major Functional Blocks of the TMDSSK3358...........................................................10 Figure 4.1-1: Configuring qmake.......................................................................................................17 Figure 4.1-2: Configuring Compiler...................................................................................................18 Figure 4.1-3: Configuring Debugger..................................................................................................19 Figure 4.1-4: Configuring Device......................................................................................................20 Figure 4.1-5: Kit Configuration..........................................................................................................21 Figure 4.3-1: Application Arguments.................................................................................................27 Figure 4.3-2: Test Application............................................................................................................28 Figure 5.1-1: Application Interface....................................................................................................29 Figure 5.1-2: Application Structure....................................................................................................30 Figure 5.1-3: main Flowchart.............................................................................................................32 Figure 5.1-4: MainWindow Flowchart...............................................................................................33 Figure 5.1-5: MainWindow UI...........................................................................................................34 Figure 5.1-6: productDialog Flowchart..............................................................................................35 Figure 5.1-7: productDialog UI..........................................................................................................36 Figure 5.1-8: messageDialog Flowchart.............................................................................................37 Figure 5.1-9: messageDialog UI.........................................................................................................38 Figure 5.1-10: tableDialog Flowchart................................................................................................39 Figure 5.1-11: tableDialog UI.............................................................................................................39 Figure 5.1-12: optionsDialog Flowchart............................................................................................40 Figure 5.1-13: optionsDialog UI........................................................................................................40 Figure 5.1-14: aboutDialog Flowchart...............................................................................................41 Figure 5.1-15: aboutDialog UI...........................................................................................................41 Figure 5.1-16: licenseDialog Flowchart.............................................................................................42 Figure 5.1-17: licenseDialog UI.........................................................................................................42 Figure 5.1-18: Application Using Japanese Database........................................................................44 Figure 5.2-1: Database Schema..........................................................................................................48 Figure 5.2-2: SQLite Database Browser............................................................................................51 1 - Report 3 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 41 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 1. Background In recent years there has been an increase in the number of smartphones and tablets. This change has not only brought new types of applications and programming philosophy to meet the new needs of the population, but it has also pushed the development of embedded processors. Users demand relatively high computational power with a low energy consumption maintain a long battery life. ARM processors now dominate the mobile phone space due to their lower power requirements with 98% of mobile phones having an ARM processor [Roberts-Hoffman 2009], and is expanding its market in set-top boxes ans smart TVs. ARM processors dominate these markets because they are more efficient than their x86 counterparts and have a very competitive price. It should also be noted that, at the moment, ARM processors cannot achieve the performance levels of some x86 systems, which still have the majority of the market share in laptops, desktops and servers. The following graph, extracted from [Ou 2012], compares the power efficiency with CPU utilization of a ARM A9 cluster and an Intel dual core x86 workstation for web server application at different file sizes. Figure 1-1: Energy-efficiency vs. CPU Utilization Level [Ou 2012] With CPU utilization higher than 20%, the ARM A9 processor presents an advantage in efficiency over Intel processor. 1 - Report 5 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS The following graph, extracted from [Blem 2013], compares power consumption with performance of 2 ARM processors and 2 Intel x86 processors. Figure 1-2: Power Performance Trade-offs [Blem 2013] Regardless of ISA or energy-efficiency, high-performance processors require more power than lowerperformance processors. They follow well established cubic power/performance trade-offs [Blem 2013]. The previous graphs suggest that if the task a computer must perform is not CPU intensive and/or can be subdivided into smaller tasks to run concurrently, it is advantageous, from the point of view of efficiency, to use an ARM based distributed system or cluster. This hypothesis has been analysed in various studies in recent years. [Ou 2012] and [Vidal 2012] both conclude that ARM based clusters for server applications (web and web, file and database respectively) is a viable and power efficient solution. Likewise, [Abdurachmanov 2014] concludes that an ARM based cluster is a viable and power efficient solution for scientific computation at the CERN. The results of the aforementioned studies suggest that the use of ARM processors in industrial computers could also be advantageous. It is worth noting that ARM processors are not only efficient, but there are cost-effective solutions on the market. A good example of this is the BeagleBone Black, a 45$ community-supported development platform with 512MB of RAM, TI AM3359 1.0GHz processor and a power consumption <2W. The disadvantage that ARM based systems present versus x86 industrial PCs is binary incompatibility, x86 systems are well established and have been the standard for many years. Much software has been developed for these systems, most of which can not be easily ported to the ARM architecture due to copyright reasons and/or framework incompatibility. By developing cross-platform applications, it is possible to use ARM based systems as industrial computes and benefit from the advantages of this platform over traditional x86 systems while developing applications that can easily be ported to said systems. Therefore, this work does not only present the implementation of an application for an industrial scale for an ARM development board, but it is also intended to serve as reference on how to develop cross-platform application for ARM embedded Linux systems that x86 computers can also benefit from. By developing cross platform applications, the hardware and OS range of possibilities becomes larger and a more optimal solution can be found for a given problem. 61 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 2. Factors to Consider 2.1 Initial Specifications •Touchscreen graphical open source application for an industrial scale using the Qt framework. •Texas Instruments Sitara AM335x processor running Linux. •System shall receive the output of a Microgram IE21 industrial scale from Microgram Instruments Española S.A. industrial scale over RS-232. •Simple and intuitive software, such that the users are able to deduce how to use the application without any prior knowledge or help. •The scale is intended to weigh fruit and vegetables, but the database should be generic such that it can be used for commerce of other goods by weight. The image, name, index, price and accumulated sales shall be stored in a relational database. •The Application must automatically update the GUI when a product is added, removed or updated in the database. •The system shall be network connected and have a fixed IP address assigned for easy maintenance and database access. •Critical errors and non-critical errors should be handled differently. The application should exit immediately when a critical error is encountered. A warning system is allowed for noncritical errors. •The application shall launch on system boot. •The application shall have a system shutdown and system restart under the advanced options menu. •The application shall be as modular as possible for simplicity and source code reuse. •A low-cost and low-power solution should be favoured as the adopted solution. •The application shall be cross-platform, developed under a framework which allows for the code to be easily compiled to run on different processor architectures and operational system. 1 - Report 7 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 2.2 Needs Study The system is requires to have a touchscreen graphical user interface. The hardware platform should either come with such screen or have the possibility of adding one via off-the-shelf products via additional I/O such as GPIOs and/or HDMI + USB or any combination of these or any other valid media interface (VGA, DVI, etc.). In any case, the hardware platform must have the I/O capability for the selected screen. It is worth noting that the touchscreen can be a generic screen or one made specifically for the hardware platform. An example of the later are the many third party BeagleBone LCD “capes” for the Texas Instruments BeagleBone Black. The system is also required to interface with an industrial scale over RS-232. Modern embedded systems are likely to not have a RS-232 ±15V DB-9 (or DB-25) port present, therefore, a USB-to- serial adapter shall be used in this project. This implies that the hardware platform must have at least 1 available USB (host) port. As the data transfer rates of RS-232 is much smaller than that of the USB protocol, a USB 1.1 or USB 2.0 port is sufficient. A USB 3.0 or USB 3.1 port is not required. As the system is required to have a static IP address for easy database management and system maintenance, it is implied that the hardware platform must have at least 1 Ethernet Port. The purpose of this port is to establish an SSH or SFTP. For the expected loads, high data transfer rate is not required and therefore, a Gigagit Ethernet port is not required. A 100Mb/s Ethernet port is sufficient. The software shall be designed to be cross-platform from the standpoint of the operating system and the hardware architecture. The application shall have a “native appearance” on all the platforms it is executed. Finally, for the development of the application, the use of open source tools, libraries and compilers shall be favoured over closed source alternatives as they, amongst other advantages, improves the maintainability of the software and it grants independence from the supplier. It is worth noting that the use of open source tools in the development and documentation of the project are also favoured because of the client's and the author's philosophy. 81 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 3. Alternative Solutions 3.1 Alternatives for the Hardware In this section, some of the most popular single-board ARM computers that are Linux capable shall be compared. Raspberry Pi B A10-OLinuXino BeagleBone Black ODROID-U3 Cubieboard 2 Processor ARM11 700MHz Cortex-A8 1GHz Cortex-A8 1GHz Cortex-A9 Quad 1.7GHz Cortex-A7 Dual 1GHz GPU Video Core IV Mali-400 SGX530 Mali-400 Mali-400 RAM 512MB 512MB 512MB 2GB 1GB Flash 0MB 0MB 2GB 0MB 4GB USB 2 2 host + 1 OTG 1 host + 1 OTG 3 host + 1 OTG 2 host + 1 OTG Ethernet 1×10/100M 1×10/100M 1×10/100M 1×10/100M 1×10/100M WiFi ✗ ✗ ✗ ✗ ✗ Bluetooth ✗ ✗ ✗ ✗ ✗ SATA ✗✓✗ ✗ ✓ GPIO 17 160 65 Expansion 96 SPI ✓ ✓ ✓ Expansion ✓ I2C ✓ ✓ ✓ Expansion ✓ Price $35 USD 30€ (≈ $41 USD) $45 USD $59 USD $65 USD Comment Large Community Large Community ODROID-U3 offers the best value, but it is clear that with its specifications and lack of stock GPIOs it is intended as a lightweight workstation. Nevertheless, it can be considered for industrial computer applications. On the other hand, the ODROID-U3 is overpowered for the application described in this work. The BeagleBone Black or the A10-OLinuXino are better suited for the intended application in this sense. Out of the two previously mentioned development boards, the BeagleBone Black is considered the best solution for the intended application. Despite the BeagleBone Black having slightly less features than the ODROID-U3, it has a larger community and more support, which should not be overlooked when choosing a hardware platform as it can reduce development times and ease operating system and package support. 1 - Report 9 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS It should be noted that the BeagleBone Black is considered the best hardware solution for this project, the application shall be develop on a Texas Instruments TMDSSK3358 AM335x Starter Kit, as this board was physically available for use at the Universitat Politècnica de València at the time of writing. The Texas Instruments TMDSSK3358 AM335x Starter Kit has more features overall and has a higher price, but the BeagleBone Black and the TMDSSK3358 AM335x Starter Kit both have an AM335x processor, and therefore, the procedures to develop applications and the resulting binaries are the same in both platforms. Figure 3.1-1: Major Functional Blocks of the TMDSSK3358 3.2 Alternatives for the Programming Language There are a lot options for selecting a programming language, but this section will focus on comparing three of the most popular and predominant languages used to develop cross-platform applications. 3.2.1 Java Pros •Simple and powerful. •Very popular. Cons •Slower than low level languages. •Less efficient than native compiled languages. •Many vulnerabilities. •Requires a virtual machine. 10 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Java applications run on top of virtual machines, which makes them slower and much more resource hungry than native compiled languages. Aside from efficiency, there are many security risks involved in using Java’s virtual environment. Because of the aforementioned reasons, Java has not been considered an appropriate solution for this project, although it is a valuable option. The rise of the android operating system in recent years is a good example of the potential of Java for the industry as the are a wide rage of hardware architectures running Android and they all use the same package system and binaries, which may simplify the maintainability and distribution of applications. 3.2.2 Python Pros •Simple. •Very popular. Cons •Slower than low level languages. •Less efficient than native compiled languages. •Prone to errors at development stage. Python is currently a very popular language that has a large community, but it was designed to be used as a scripting language, which inherently makes it much slower than compiled languages. Also, being an interpreted language, many common error, which would otherwise be detected at compile time, are not detected until the application is run and debugged, this makes development times longer for large applications. Because of the aforementioned reasons, like Java, Python has not been considered an appropriate solution for this project, but is also a valuable option. 3.2.3 C++ Pros •Very efficient. •Many libraries. Cons •Applications compiled for a specific architecture and operating system. •Complex syntax C++ is widely accepted in the field of programming, and given the amount of documentation and the efficiency of the resulting applications, C++ is a good alternative with which to develop the application described in this work. There are interesting frameworks on top of C++ such as GTK, wxWidgets, Qt, etc. that may be used for the development of the application. With the C++ Qt framework it is possible to develop cross-platform applications that can easily compiled to target various architectures and operating systems without modification of the source code. Specifically, there is a branch of the framework intended for Embedded Linux. This branch allows to create graphical applications that use a virtual frame buffer. The application itself provides the frame buffer, and a Qt application for embedded Linux is already running, other applications will connect to the first application's frame buffer, This saves on memory usage and does not require a fully fledged X11 server to be running on the target system. 1 - Report 11 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 4.1.3.2 Configuring Compiler •Click on the Tools → Options from the top menubar. •On the left side vertical menubar click Build & Run. •Click the Compilers tab under Build & Run. •Click Add in the top right and add a GCC. •Change the name to arm-arago-GCC. This can be done by modifying the “Name” field. •To set the Compiler Path select Browse. •Navigate to /opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin. •Select arm-linux-gnueabihf-gcc and click on Open. •Click Apply to save your changes. Figure 4.1-2: Configuring Compiler 18 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 4.1.3.3 Configuring Debugger •Click on the Tools → Options from the top menubar. •On the left side vertical menubar click Build & Run. •Click the Debugger tab under Build & Run. •Click Add. •Change the name to arm-arago-GDB. This can be done by modifying the “Name” field. •To set the Debugger Path select Browse. •Navigate to /opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin. •Select arm-linux-gnueabihf-gdb and click on Open. •Click Apply to save your changes. Figure 4.1-3: Configuring Debugger 1 - Report 19 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 4.1.3.4 Set-up Target •Click on the Tools → Options from the top menubar. •On the left side vertical menubar click Devices. •Click Add... in the top right and select Generic Linux device and click on Start Wizard •Change the name to AM335x EVM. This can be done by modifying the “Name” field. •Type in the IP address of the embedded Linux device. •Type in the password of the user. •Type in the user (on the target) for SSH connection. •Click Next and click Finish. •Qt creator will attempt to connect to the embedded Linux device to check if correctly configured. Figure 4.1-4: Configuring Device 20 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 4.1.3.5 Kit Configuration •Click on the Tools → Options from the top menubar. •On the left side vertical menubar click Build & Run. •Click the Kits tab under Build & Run. •Click Add. •Change the name to Sitara Qt 4.8.3. This can be done by modifying the “Name” field. •In the rest of the fields, select the previously configured components. •To set the Sysroot Path select Browse. •Navigate to /opt/ti-sdk-am335x-evm-06.00.00.00/linux-devkit/sysroots/i686-arago-linux. • Click Choose. •Click Apply to save your changes. Figure 4.1-5: Kit Configuration 1 - Report 21 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 4.2. Target System This section focuses on creating and configuring a bootable image for the target system such that the target system is set-up and ready to be developed on. The board used in this work is a Texas Instruments TMDSSK3358 AM335x Starter Kit. But the setup and configuration described in this section is valid for other TI systems based around the AM335x processor family. 4.2.1 Creating SD Card Image TI provides a straightforward script with which to create SD card images within the SDK. To create a bootable SD card, insert a mini SD card of at least 2GB of capacity into a card reader on the host computer and execute the following commands. user@debian:~$ cd /opt/ti-sdk-am335x-evm-06.00.00.00/bin/ user@debian:/opt/ti-sdk-am335x-evm-06.00.00.00/bin$ ./createsdcard.sh The script allows for various combinations, but the following options are suggested in this work given set-up. •Select SD card drive. •Select the 2 partition scheme. •Yes, continue. •Install pre-built images from SDK Finally, before removing the mini SD card, the following command should be executed to force changed blocks to disk and update the super block. user@debian:/opt/ti-sdk-am335x-evm-06.00.00.00/bin$ sudo sync 4.2.2 Initial Configuration Before powering up the device, it is necessary to insert the mini SD card and connect a network cable to a router or switch on the same network as the host computer. If using the AM335x Starter Kit, the network cable should be connected to the RJ45 jack farthest from the female micro-USB jack. This, on the TI image created previously, is interface eth0, which is enabled on start-up. The other RJ45 jack is interface eth1, which is neither configured nor enabled on start-up and therefore is not useful at the moment. Once boot-up is complete, the TI Matrix-GUI should be visible on screen. 4.2.2.1 Login To check the IP address of the device tap on Settings →Network Settings. The IP address should be listed under the eth0 interface section. For example, the IP address could be 192.168.1.33. 22 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Once the IP address of the device is know, it is possible to start a SSH session from the host computer. By default, the root user does not have a password. When asked for the password, just hit return to log on. user@debian:~$ ssh 192.168.1.33 -l root [email protected]'s password: root@am335x-evm:~# For security reasons, it is advisable to set a password for the root user. root@am335x-evm:~# passwd 4.2.2.2 Disabling the Default Matrix-GUI Application This section describes how to disable the TI Matrix-GUI from starting on boot if it is not needed or undesired. First it is necessary to determine which is the default runlevel, which varies among different Linux distributions. root@am335x-evm:~# runlevel The previous command returns the current runlevel, which is assumed to be the default on boot. In this case, the default runlevel seems to be runlevel 5. To list the services which are started (or stopped) on runlevel 5, the following command is executed. root@am335x-evm:~# ls -l /etc/rc5.d From the previous command it is possible to determine that S97matrix-gui-2.0 starts the Matrix- GUI service. Finally, to disable the starting of this service on boot on the default runlevel. root@am335x-evm:~# cd /etc/rc5.d root@am335x-evm:/etc/rc5.d# mv S97matrix-gui-2.0 K97matrix-gui- 2.0 4.2.2.3 Static IP Address This section describes how to assign the device a static IP address to make is easily accessible and identifiable over a network. Before modifying the network interface configuration file, it is advisable to make a backup. root@am335x-evm:~# cp /etc/network/interfaces /etc/network/interfaces.bak Now it is safe configure the network interfaces. root@am335x-evm:~# vi /etc/network/interfaces 1 - Report 23 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS The section that configures the eth0 interface can be replaced with: auto eth0 iface eth0 inet static address 192.168.1.100 gateway 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 Note that with this configuration the device is assigned IP address 192.168.1.100. 4.2.2.4 Directory for Binaries This section describes the creation of a dedicated directory for third party binary files and the inclusion of such directory in the binary search path. The following command is executed to create the directory /usr/local/bin, into which user developed applications shall be copied. root@am335x-evm:~# mkdir -p /usr/local/bin To add this directory automatically to the $PATH variable at login if the directory exist, a profile file is created. root@am335x-evm:~# vi ~/.profile The content of the file being: #f [ -f ~/.bashrc ]; then # . ~/.bashrc #fi # set PATH so it includes third party bin if it exists if [ -d "/usr/local/bin" ] ; then PATH="$PATH:/usr/local/bin" fi #mesg n 4.2.2.5 USB-to-Serial Adapter Support Please, note that this section is included for the TMDSSK3358 AM335x Starter Kit. The BeagleBone Black comes with support for USB-to-serial adapters out-of-the-box. The application to be developed shall communicate with an industrial scale that offers an RS-232 output with a USB-to-serial adapter. However, the kernel currently installed on the target system does not have the drivers for these devices. It is necessary to compile a kernel with USB-to-serial adapter support. There are many adapters on the market with different chips. In this project, the Prolific PL2303 chip is used as it is the integrated circuit used inside the USB-to-serial adapter used in the development of this project. Therefore, this section is centred around obtaining support for this device, but similar steps must be taken with other devices. The following section is a commented extract, with slight modifications of part of the Texas 24 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Instruments Document: AMSDK Linux User's Guide, [TI-Wiki-2]. In order to build the Linux kernel you will need a cross compiler installed on your system which can generate object code for the ARM core in your Sitara device. To add the compiler to the path, the following command is executed. user@debian:~$ export PATH="/opt/ti-sdk-am335x-evm- 06.00.00.00/linux-devkit/sysroots/i686-arago-linux/usr/bin: $PATH" user@debian:~$ cd /opt/ti-sdk-am335x-evm-06.00.00.00/boardsupport/linux-3.2.0-psp04.06.00.11 Prior to compiling the Linux kernel it is often a good idea to make sure that the kernel sources are clean and that there are no remnants left over from a previous build. The command to clean the kernel is: user@debian:~$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper Before compiling the Linux kernel it needs to be configured to select what components will become part of the kernel image, which components will be build as dynamic modules, and which components will be left out all together. This is done using the Linux kernel configuration system. It is often easiest to start with a base default configuration and then customize it for you use case if needed. In the Linux kernel a command of the form: user@debian:/opt/ti-sdk-am335x-evm-06.00.00.00/boardsupport/linux-3.2.0-psp04.06.00.11$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tisdk_am335x-evm_defconfig After the configuration step has run the full configuration file is saved to the root of the kernel tree as .config. Any further configuration changes are based on this file until it is clean-up up by doing a kernel clean as mentioned above. Now, the only modification that need to be done to the configuration file is to set the CONFIG_USB_SERIAL option. user@debian:/opt/ti-sdk-am335x-evm-06.00.00.00/boardsupport/linux-3.2.0-psp04.06.00.11$ sed -i 's/# CONFIG_USB_SERIAL is not set/CONFIG_USB_SERIAL=y/g' .config To compile the kernel, the following command is executed. user@debian:/opt/ti-sdk-am335x-evm-06.00.00.00/boardsupport/linux-3.2.0-psp04.06.00.11$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage At this point, before the compilation begins, as the USB-to-serial flag was set, the make executable will ask whether or not to enable support for a variety of devices. For the purpose of this project, only the USB_SERIAL_PL2303 is enabled. Finally it is necessary to install the kernel. Installation is done by moving the kernel image to the location where it is read on the target system. With the following sequence, a backup of the current kernel is made, the new kernel is transferred over to the target system and the target system is then 1 - Report 25 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS rebooted. root@am335x-evm:~# cp /media/mmcblk0p1/uImage /media/mmcblk0p1/uImage.bak user@debian:/opt/ti-sdk-am335x-evm-06.00.00.00/boardsupport/linux-3.2.0-psp04.06.00.11$ scp arch/arm/boot/uImage [email protected]:/media/mmcblk0p1/uImage root@am335x-evm:/boot# shutdown -r now If everything has gone well, the system will come up as normal. To check if the new kernel is running, the following command can be executed. The date in the output of the command is the compilation date of the kernel that is currently running. root@am335x-evm:~# uname -a At this point, if the USB-to-serial adapter is connected then the following command is executed, the output of the command should inform that the adapter is now attached to ttyUSBx, where “x” is an integer. root@am335x-evm:~# dmesg 4.2.2.6 Touchscreen Calibration and Test TI provides utilities to calibrate and test the touchscreen with the system image. root@am335x-evm:~# ts_calibrate root@am335x-evm:~# ts_test The ts_calibrate command prints the screen resolution. This will be useful to create applications of exactly the screen size. In this case, the touchscreen has a resolution 480×272 pixels. 4.3. Application Template To create a basic project for the target system, the following steps have been followed.: •Click on the File → New File or Project from the top menubar. •At the Top right corner select Embedded Linux Template. •Then select QT Widget Application from the centre list. •Click on Choose. •Name the project Template-Sitara. •Click Next. •Select the previously configured Sitara Kit. •Click Next. •In the Class Information window, select QWidget Base Class. 26 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE •Click Next. •Leave version control to <none>. •Click Finish. With the project created, only some minor configuration remains to be done. The size of the widget should match the screen size of the device. To do this, inside the UI editor, using the property editor, edit the following: QWidget→Geometry→Width→480 and QWidget→Geometry→Height→272. For testing purposes, a label with the text “Hello World!” was added to the widget. As the Matrix-GUI may not be running, the application cannot connect to a running virtual frame buffer and the Qt embedded Linux applications must start one if this is the case. On the left side of the window, click on the Projects tab than select the Run&Build tab and finally the Run tab. In the Arguments field, “-qws” must be added. Figure 4.3-1: Application Arguments Finally, the following lines should be added to the project file to Specify that the binaries should be copied over to the directory /usr/local/bin on the target. target.path += /usr/local/bin INSTALLS += target The template is now ready to be build, deployed and debugged. 1 - Report 27 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS The Qt form mainwindow.ui provides the GUI for this module, a screenshot of which is provided below. Figure 5.1-5: MainWindow UI 34 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 5.1.3.3 Product Dialog The productDialog module is composed of the C++ source code file productdialog.cpp, the C header file productdialog.h and the Qt form productdialog.ui. The flow diagram for this module is as follows: Figure 5.1-6: productDialog Flowchart 1 - Report 35 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS The Qt form productdialog.ui provides the GUI for this module, a screenshot of which is provided below. Figure 5.1-7: productDialog UI 36 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 5.1.3.4 Message Dialog The messageDialog module is composed of the C++ source code file messagedialog.cpp, the C header file messagedialog.h and the Qt form messagedialog.ui. The flow diagram for this module is as follows: Figure 5.1-8: messageDialog Flowchart 1 - Report 37 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS The Qt form messagedialog.ui provides the GUI for this module, a screenshot of which is provided below. Note that this screenshot is warning of a serial communication error, but other errors are also reported. Figure 5.1-9: messageDialog UI 38 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 5.1.3.5 Table Dialog The tableDialog module is composed of the C++ source code file tabledialog.cpp, the C header file tabledialog.h and the Qt form tabledialog.ui. The flow diagram for this module is as follows: Figure 5.1-10: tableDialog Flowchart The Qt form tabledialog.ui provides the GUI for this module, a screenshot of which is provided below. Figure 5.1-11: tableDialog UI 1 - Report 39 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 5.1.3.6 Options Dialog The optionsDialog module is composed of the C++ source code file optionsdialog.cpp, the C header file optionsdialog.h and the Qt form optionsdialog.ui. The flow diagram for this module is as follows: Figure 5.1-12: optionsDialog Flowchart The Qt form optionsdialog.ui provides the GUI for this module, a screenshot of which is provided below. Figure 5.1-13: optionsDialog UI 40 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 5.1.3.7 About Dialog The aboutDialog module is composed of the C++ source code file aboutdialog.cpp, the C header file aboutdialog.h and the Qt form aboutdialog.ui. The flow diagram for this module is as follows: Figure 5.1-14: aboutDialog Flowchart The Qt form aboutdialog.ui provides the GUI for this module, a screenshot of which is provided below. Figure 5.1-15: aboutDialog UI 1 - Report 41 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 5.1.3.8 License Dialog The licenseDialog module is composed of the C++ source code file licensedialog.cpp, the C header file licensedialog.h and the Qt form licensedialog.ui. The flow diagram for this module is as follows: Figure 5.1-16: licenseDialog Flowchart The Qt form licensedialog.ui provides the GUI for this module, a screenshot of which is provided below. Figure 5.1-17: licenseDialog UI 42 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 5.1.4 Text Fonts for Internationalization Taking into account the current level of globalization, which is expected to increase even more in the coming years, the application being developed should have internationalization support. As one of the goals of this project is to create a portable multi-platform (OS and architecture) application, internationalization can be seen as an extension of portability: it will give the application to be executed not only across a variety of operations systems and architectures, but also in a variety of languages and locales. Qt has good support for application internationalization built-in, but in order to represent non- ASCII characters on-screen, the appropriate fonts must be present on the target system. The target system by default only comes with fonts for the English language. This section details the process of adding fonts for the correct representation of alphabets and writing systems of languages other than the default for the target system. Specifically, Japanese fonts shall be added but the process can be extrapolated for other fonts. First of all, it is necessary to download the TrueType files for the desired fonts. The latest Takao Japanese font family shall be downloaded, as it is a free and open source TrueType font as it is suitable for both display and printing and it is a popular font on the Debian and Ubuntu distributions. user@debian:~$ cd Downloads/ user@debian:~/Downloads$ wget https://launchpad.net/takaofonts/003.02/003.02.01/+download/takao-fonts-ttf- 003.02.01.tar.gz user@debian:~/Downloads$ tar -zxvf takao-fonts-ttf- 003.02.01.tar.gz user@debian:~/Downloads$ cd takao-fonts-ttf-003.02.01/ Now the fonts shall be transferred over to the target system. user@debian:~/Downloads/takao-fonts-ttf-003.02.01$ scp *.ttf [email protected]:/usr/lib/fonts/ With this, the target system now has support for representing Japanese text. Finally, some clean-up is required on the host computer. user@debian:~/Downloads/takao-fonts-ttf-003.02.01$ cd .. user@debian:~/Downloads$ rm -rf takao-fonts-ttf-003.02.01 user@debian:~/Downloads$ rm takao-fonts-ttf-003.02.01.tar.gz 1 - Report 43 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS values(23,'Cherry',X'`hexdump -ve '1/1 "%.2x"' Icons/Cherry.png`',3.70,0.0);" | sqlite3 QtScale.sqlite user@debian:~$ echo "INSERT INTO Products(ID,Name,Icon,Price,Accumulated) values(25,'Banana',X'`hexdump -ve '1/1 "%.2x"' Icons/Banana.png`',1.40,0.0);" | sqlite3 QtScale.sqlite user@debian:~$ echo "INSERT INTO Products(ID,Name,Icon,Price,Accumulated) values(37,'Apple',X'`hexdump -ve '1/1 "%.2x"' Icons/Apple.png`',1.60,0.0);" | sqlite3 QtScale.sqlite With this, the database has been created and all the data has been inserted. This database would be a valid database ready to be used by the application to be developed. Please note that this method assumes that there is a subdirectory in the current working directory called “Icons” that contains a PNG image for every product that has the same name as the product it represents followed by a “.png” extension. For a clearer explanation, the content of the subdirectory for this example is as follows. user@debian:~$ ls Icons/ Apple.png Banana.png Cherry.png Grape.png Lemon.png Orange.png Peach.png Pear.png Strawberry.png 5.2.3 Database Management For the management of the database, various options are available but for simplicity of use a GUI application is recommended. A popular standalone, open source, cross-platform GUI application for this purpose is “SQLite Database Browser”. SQLite Database Browser can be obtained from <http://sourceforge.net/projects/sqlitebrowser/>. However, there are many other applications1 that will perform the required task successfully. This application is intuitive and easy to use even for novice users and it allows to browse and modify databases without SQL queries. Although it does support SQL query input for the users who prefer it. Please note that this section refers to the management and updating of existing database records. New records are recommended to be inserted with the aforementioned method as it is the only one where the image insertion has been tested to work successfully. 1 Another popular application to manage SQLite databases come in the form of a Firefox add-on with very similar functionality and UI as the aforementioned application. The add-on can be obtained from <https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/> 50 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Figure 5.2-2: SQLite Database Browser 5.3. QtSerialPort QtSerialPort was introduced as an internal module in Qt 5 as the substitute of QextSerialPort. QtSerialPort is now the default module in Qt to handle serial connections and it is being developed by the same team that worked on QextSerialPort. The QextSerialPort project has been abandoned. In this project, Qt 4.8 libraries are being used as this is what is supplied in the Texas instruments SDK but it is worth noting that the QtSerialPort source code supports Qt 4, which means that the module can be configured, compiled and used in Qt 4. QtSerialPort shall be used in this project as it is officially supported by Qt, no external third party library is required, it is more feature rich than QextSerialPort and, most importantly, because it eases cross-platform compatibility and compatibility with current and future Qt releases. This section details the process of adding the QtSerialPort module to the current set-up such that it can be used in the application being developed. The detailed process is based on the instructions given in [Qt-Wiki]. First, it is necessary to download the source code in the TI SDK directory and set up the build environment. user@debian:~$ source /opt/ti-sdk-am335x-evm-06.00.00.00/linuxdevkit/environment-setup [linux-devkit]:~> cd /opt/ti-sdk-am335x-evm-06.00.00.00/ 1 - Report 51 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS [linux-devkit]:/opt/ti-sdk-am335x-evm-06.00.00.00> git clone git://gitorious.org/qt/qtserialport.git [linux-devkit]:/opt/ti-sdk-am335x-evm-06.00.00.00> mv qtserialport/ qtserialport-src/ [linux-devkit]:/opt/ti-sdk-am335x-evm-06.00.00.00> mkdir qtserialport-build [linux-devkit]:/opt/ti-sdk-am335x-evm-06.00.00.00> cd qtserialport-build/ Now it is possible to proceed and compile and install the shared library. [linux-devkit]:/opt/ti-sdk-am335x-evm-06.00.00.00/qtserialportbuild> qmake ../qtserialport-src/qtserialport.pro [linux-devkit]:/opt/ti-sdk-am335x-evm-06.00.00.00/qtserialportbuild> make [linux-devkit]:/opt/ti-sdk-am335x-evm-06.00.00.00/qtserialportbuild> make install Now the library is present within the TI SDK but it has to be transferred to the target system. [linux-devkit]:/opt/ti-sdk-am335x-evm-06.00.00.00/qtserialportbuild> scp src/serialport/libQtSerialPortE.so.1.0.0 [email protected]:/usr/lib/ Finally, some symbolic links must be created on the target system so that applications can resolve the dynamic library dependency correctly. root@am335x-evm:~# ln -s /usr/lib/libQtSerialPortE.so.1.0.0 /usr/lib/libQtSerialPortE.so root@am335x-evm:~# ln -s /usr/lib/libQtSerialPortE.so.1.0.0 /usr/lib/libQtSerialPortE.so.1 root@am335x-evm:~# ln -s /usr/lib/libQtSerialPortE.so.1.0.0 /usr/lib/libQtSerialPortE.so.1.0 Now it is possible to compile binaries that depend on QtSerialPort on the host computer and executed on the target system. To use QtSerialPort in a Qt 4 project, the following lines must be added to the project file. CONFIG += serialport To use QtSerialPort in a Qt 5 project, the following lines must be added to the project file. QT += serialport And the following lines must be added to the source code files that use functions, structures or classes from QtSerialPort. #include <QtSerialPort/QSerialPort> #include <QtSerialPort/QserialPortInfo> 52 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 6. Conclusions and Future Work Taking into account that in recent years there has been an increase in the number of devices that use an ARM Cortex-A processor, because they are a cost-effective and power efficient solution for applications where the task to be performed is not CPU intensive and that their performance continues to improve year by year. It is possible to conclude that an increase in the number of industrial computers running on ARM processors with embedded Linux will be seen in the coming years due to its advantages for low power applications. This project highlights that with the Qt C++ framework it is possible to easily develop crossplatform applications in C++ for embedded Linux that can be ported to industrial computers running on more traditional x86 processors. This fulfils part of the project requirements, which were to have this report serve as reference as a general reference for developing industrial applications for the TI AM335x processor family running embedded Linux. Having a wider range of hardware options is always an advantage. In the developing of the application for the industrial scale, a greater understanding of SQL databases and industrial communications has been attained as well as the deepening of the knowledge of embedded Linux systems. The project, as a whole, has also served as valuable experience in the development of industrial projects in the fields of industrial computer science and industrial electronics. Overall, it is possible to conclude that all the requirements and objectives set at the start of the project have been fulfilled and valuable academic and professional experience has been acquired in the process of developing Going beyond the specification of the project, 3 upgrades are proposed as future work that would improve the flexibility, functionality and robustness of the application: •Add printing functionality to the system such that when a sale is complete, a ticket is printed with information such as: the name of the product, the weight of the product, the total price, the date and time of the transaction and a bar code (and or QR code) to be later scanned by the cashier. This upgrade provides greater functionality to the project but it would be challenging to configure, compile and set up CUPS on the target system. Making this feature cross-platform might also be an issue. •Upgrade to the database (and the application) and add an attribute to the product entity which would indicate if the product is in stock. This could simplify the database entertainment as the product record would not have to be removed when the product is out of stock to then be reinserted when it is back in stock. This would translate to less maintenance required to be done through the command line. •User defined serial port during execution time instead of having it defined at compile time. The user should be able to select which serial port to use through a command line interface or an option window. In practice, the solution that would make more sense it to have only a command line interface for this function as it is an advanced setting that the average user should not need to be concerned with. A command line argument option, similar to the one implemented to specify the database location, could be implemented to set the serial port at the application start. Much like the database location option, this serial port option would have a default value (/dev/ttyUSB0) in case the user does not explicitly pass the argument. 1 - Report 53 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 54 1 - Report QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 7. Bibliography [Abdurachmanov 2014] D. Abdurachmanov, K. Arya, J. Bendavid, T. Boccali, G. Cooperman, A. Dotti, P. Elmer, G. Eulisse, F. Giacomini, C. Jones, M. Manzali and S. Muzaffar: “Explorations of the Viability of ARM and Xeon Phi for Physics Processing” Arxiv 2014. [Allen 2010] G. Allen, M. Owens: “The Definitive Guide to SQLite” Apress 2010. [Bartholomew 2013] D. Bartholomew: “MariaDB vs. MySQL” ADMIN Magazine 2013, Retrieved from http://www.admin-magazine.com/Articles/MariaDB-vs.-MySQL [Blem 2013] E. Blem, J. Menon and K. Sankaralingam: “A Detailed Analysis of Contemporary ARM and x86 Architectures” University of Wisconsin 2013. [Debian-Wiki] Debian Wiki: “LSBInitScripts”, Retrieved from https://wiki.debian.org/LSBInitScripts (Last edit: 2014-02-07) (as of 2014-04-11, 17:41 GMT). [Ou 2012] Z. Ou, B. Pang, Y. Deng, J. Nurminen and A. Ylä-jääski: “Energy- and Cost- Efficiency Analysis of ARM-Based Clusters” IEEE Computer Society 2012. [Qt-Wiki] Qt Project Wiki: “QtSerialPort”, Retrieved from http://qtproject.org/wiki/QtSerialPort (Last edit: 2014-01-17) (as of 2014-04-11, 12:09 GMT). [Roberts-Hoffman 2009] K. Roberts-Hoffman and P. Hegde: “ARM Cortex-A8 vs. Intel Atom: Architectural and Benchmark Comparisons” University of Texas at Dallas 2009. [TI-Wiki-1] Texas Instruments Wiki: “Sitara Linux Training: Hands on with QT”, Retrieved from http://processors.wiki.ti.com/index.php/Sitara_Linux_Training:_Hands_on_with_QT (as of 2014-03-10, 10:21 GMT). [TI-Wiki-2] Texas Instruments Wiki: “AMSDK Linux User's Guide”, Retrieved from http://processors.wiki.ti.com/index.php/AMSDK_Linux_User's_Guide (as of 2014-03-10, 14:50 GMT). [Vidal 2012] R. Vidal Aroca and L. Garcia Gonçalves: “Towards Green Data Centers: A Comparison of x86 and ARM Architectures Power Efficiency” Academic Press 2012. 1 - Report 55 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 56 1 - Report Universitat Politècnica de València Escuela Técnica Superior de Ingeniería del Diseño Bachelor's Degree in Industrial Electronics and Automation Engineering Final Year Engineering Project QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 2 - Specifications Author: Pablo Cholbi Alenda Supervisor: Dr. Àngel Perles Ivars May 2014 QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Table of Contents 1. Optional Conditions..........................................................................................................................3 1.1. Programming Work.....................................................................................................3 1.2 Poor Performance and Modifications..........................................................................3 1.3 Final Delivery of the Project........................................................................................3 2. Economical Conditions....................................................................................................................4 2.1. Pricing Structure.........................................................................................................4 2.2. Improvements.............................................................................................................4 2.3 Price Review................................................................................................................4 3. Functional Conditions......................................................................................................................5 3.1. Initial Functional Specifications.................................................................................5 3.2. Software Limitations..................................................................................................5 3.3. Hardware Limitations.................................................................................................5 4. Software Package Conditions...........................................................................................................6 4.1. Conditions of Package Content..................................................................................6 4.2. Conditions of Package Maintenance..........................................................................6 4.3. Conditions of Maintenance of the Optical Support....................................................6 5. Conditions of Warranty.....................................................................................................................7 2 - Specifications 1 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 82 - Specifications Universitat Politècnica de València Escuela Técnica Superior de Ingeniería del Diseño Bachelor's Degree in Industrial Electronics and Automation Engineering Final Year Engineering Project QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 3 - Budget Author: Pablo Cholbi Alenda Supervisor: Dr. Àngel Perles Ivars May 2014 QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Table of Contents Factors to Consider...............................................................................................................................3 1. Material Cost....................................................................................................................................5 2. Labour Cost......................................................................................................................................7 2.1. Bare Labour Cost........................................................................................................7 2.2. Costs Derived From Self-Employed Work Under Spanish Legislation.....................7 2.3. Total Cost of Labour...................................................................................................8 3. General Expenses.............................................................................................................................9 4. Amortization...................................................................................................................................11 4.1. General Amortization................................................................................................11 4.2. Hardware Amortization.............................................................................................11 4.3. Software Amortization..............................................................................................11 4.3. Total Cost of Amortization........................................................................................11 5. Total Cost........................................................................................................................................13 3 - Budget 1 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 23 - Budget QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Factors to Consider The calculations for the budget of this project haven been performed under the assumption that the designer is an independent engineer. However, the number of hours devoted to the completion of a project of this nature and the price paid per hour of labour is different if the project was carried out by an engineering student or an experienced professional engineer. The number of hours invested by a student will be higher than the number of hours invested by a professional engineer, but the price per hour of labour is lower for a student than that of a professional engineer. The calculation of time was made assuming that the designer is a professional engineer with experience in the sector, reducing the time spent on design and construction, but charging a superior price per hour rate. As this is a final year engineering project, neither VAT nor profit have been considered in the final cost of the project. 3 - Budget 3 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 43 - Budget QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 1. Material Cost First, the total cost of the material used in the project shall be calculated. In the elaboration of this section, the following assumptions were made: •The end user has a host computer (Windows, Mac OS X or Linux) with which to administrate the target system and the database. •The end user has a Microgram IE21 industrial scale from Microgram Instruments Española S.A. •The end user has an an Ethernet network with or without Internet access. As stated in the report, when studying the alternative hardware solutions, the BeagleBone Black was found to be the best option for this project. However, this project has been developed on a TI AM335x Starter Kit because it was available and it has the same processor. The TI AM335x Starter Kit is more feature rich than the BeagleBone Black, but it also more expensive. This project does not utilize any of these “additional” features, and it is perfectly implementable on the BeagleBone Black. Therefore, for the calculation of the final cost of the project, shall take into account the cost of developing the project with a BeagleBone Black. However, the cost of the TI AM335x Starter Kit is also provided below as additional information or as an optional upgrade for future expansion. Total cost of materials = 80.00€ 3 - Budget 5 Concept Units Cost (€) Quantity Total ea. 35 1 35 ea. 45 1 45 Total Cost 80.00 BeagleBoard BeagleBone Black Beaglebone Black LCD Cape 4.3" Concept Units Cost (€) Quantity Total AM335x Starter Kit ea. 150 1 150 Total Cost 150.00 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 63 - Budget QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 2. Labour Cost 2.1. Bare Labour Cost As stated above, these calculations were made under the assumption that the designer is an independent engineer with experience. The hourly rate has been set at 35 €/hour. The total cost of this section for this project is 5950 €. The total amount of hours is 170 h. Assuming an 8 h workday and 22 workdays a month, 170 h constitutes: 170 h 8h⋅22 days =0.966 months 2.2. Costs Derived From Self-Employed Work Under Spanish Legislation The following characteristics were considered for the self-employed engineer: Age 22 Months of Contributions 12 Spanish National Classification of Economic Activities 6201 - Computer Programming Activities Contingency Basis 1400 €/month The cost derived from self-employed work under Spanish legislation with the aforementioned characteristics is 412.30 €/month. This project constitutes 0.966 months of work and therefore, the total cost of this section for this project is 398.28 €. 3 - Budget 7 Concept Units Cost (€) Quantity Total Tax Contribution % / month 1400 26.5 371 month 41.3 1 41.3 subtotal Cost 412.30 Total Cost 398.28 Coverage for accidents at work, occupational disease and cessation of activity Concept Units Cost (€) Quantity Total Viability study h 35 10 350 Software design h 35 25 875 Software implementation h 35 80 2800 Testing h 35 15 525 Documentation h 35 40 1400 Total Cost 5950.00 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 14 3 - Budget Universitat Politècnica de València Escuela Técnica Superior de Ingeniería del Diseño Bachelor's Degree in Industrial Electronics and Automation Engineering Final Year Engineering Project QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 4 – User Manual Author: Pablo Cholbi Alenda Supervisor: Dr. Àngel Perles Ivars May 2014 QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Table of Contents 1. Requirements....................................................................................................................................3 2. Installation and Management...........................................................................................................5 2.1. Application Installation...............................................................................................5 2.2. Database Management................................................................................................6 3. Application Interface........................................................................................................................7 3.1. Command Line Interface............................................................................................7 3.2. Main Window.............................................................................................................8 3.3. Product Dialog............................................................................................................9 3.4. Message Dialog........................................................................................................10 3.5. Accumulated Sales Dialog........................................................................................11 3.6. Options Dialog..........................................................................................................12 3.7. About Dialog.............................................................................................................13 3.8. License Dialog..........................................................................................................14 4 - User Manual 1 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS Illustration Index Figure 2.2-1: SQLite Database Browser..............................................................................................6 Figure 3.2-1: Main Window Interface..................................................................................................8 Figure 3.3-1: Product Dialog Interface.................................................................................................9 Figure 3.4-1: Message Dialog Interface.............................................................................................10 Figure 3.5-1: Accumulated Sales Dialog Interface.............................................................................11 Figure 3.6-1: Options Dialog Interface..............................................................................................12 Figure 3.7-1: About Dialog Interface.................................................................................................13 Figure 3.8-1: License Dialog Interface...............................................................................................14 24 - User Manual QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 1. Requirements The end user's host computer, used for the installation and management of the application, may run any of the following operational systems: The minimum recommended requirements are listed below: Management •128 MB of RAM •100 MB of free disk space •1 Ethernet port •1 Ethernet network or switch 4 - User Manual 3 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 44 - User Manual QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 2. Installation and Management 2.1. Application Installation This section is a walkthrough of the installation process of the application and the application database. The process of updating the application binary file or the application database is the same as there is no installer or package manager involved, it is a manual process. This section focuses on the installation of a pre-compiled binary of the application and the transfer of an exiting database to the target system. The first step is to make sure that the required directories exist on the target system. To do this, log in as root user on the target system form the host computer with SSH. if the project report was followed, the default IP address of the target system is 192.168.1.100. user@host:~$ ssh [email protected] Once logged in, the following commands shall create the directory for the application binary file and the database if they do not already exist. Please note that these commands create the default directories for these files according the project report; which are /usr/local/bin for the application binary file and /home/root/.QtScale for the database file. root@target:~$ if [[ ! -e /usr/local/bin ]]; then mkdir /usr/local/bin; fi root@target:~$ if [[ ! -e /home/root/.QtScale ]]; then mkdir /home/root/.QtScale; fi After creating the directories, it is possible to close the SSH session as the rest of the process shall be performed from the host computer. root@target:~$ exit To install the application binary file, navigate to the directory where the binary file is located on the host computer and execute the following command. This command will transfer the binary to /usr/local/bin. user@host:~$ scp QtScale [email protected]:/usr/local/bin To transfer the application database file, navigate to the directory where the database file is located on the host computer and execute the following command. This command will transfer the database to /home/root/.QtScale. user@host:~$ scp QtScale.sqlite [email protected]:/home/root/.QtScale With this, the installation or update of the application binary and/or the database is complete. However, that does not mean that the system, as a whole, behaves exactly as the specifications demand. For further configuration, please consult the project report. 4 - User Manual 5 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS As an alternative to the previous process, if the file manager on the host computer supports it, it is possible to start and SFTP session with the target system and manually create and transfer the files through a graphical file manager. To do this, the file manager must be opened and the following line typed into the address bar: sftp://[email protected] 2.2. Database Management This section refers to the management and updating of existing database records. New records are recommended to be inserted according the method described in the project report as it is the only one where the image insertion has been tested to work successfully. For the management of the database, various options are available but for simplicity of use a GUI application is recommended. A popular standalone, open source, cross-platform GUI application for this purpose is “SQLite Database Browser”. SQLite Database Browser can be obtained from <http://sourceforge.net/projects/sqlitebrowser/>. However, there are many other applications that will perform the required task successfully. This application is intuitive and easy to use even for novice users and it allows to browse and modify databases without SQL queries. Although it does support SQL query input for the users who prefer it. Please note that the database should never be modified while in use by the application. Figure 2.2-1: SQLite Database Browser 64 - User Manual QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE 3. Application Interface 3.1. Command Line Interface When starting the application, QtScale accepts some command line arguments to define the execution of the application. A list and a short description of the supported arguments is provided bellow. --help This arguments writes to STDOUT a help message similar to this table and exits successfully. --version This argument writes to STDOUT the version number of the QtScale application and exits successfully. --path=<path> This command sets the path to the database file to <path>. The default is path is ~/.QtScale. The application supports the use of “~”. -qws This argument start the Qt Windowing Server. This makes the application run with its own windowing server. This argument is important in embedded Linux systems as the application will not start if this argument is not passed to the application. This is an internal Qt argument and it is parsed before QtScale starts. Please note that although the location of the database may be set trough command line arguments, the name of the database cannot be set and it it by default QtScale.sqlite. The name of the database that the application expects can only be changed at compile time. If an invalid command is passed to the application, it exits immediately and writes to STDERR an error message. 4 - User Manual 7 PABLO CHOLBI ALENDA SUPERVISOR: DR. ÀNGEL PERLES IVARS 3.8. License Dialog Figure 3.8-1: License Dialog Interface This dialog displays the author, year and licence of the QtScale application. The different parts that constitute this dialog are explains below: •1 License information: This part of the dialog displays information on the licence under which QtScale is distributed, the author and the year. •2 Close button: This button exist from the current dialog and returns to the about dialog. 14 4 - User Manual Universitat Politècnica de València Escuela Técnica Superior de Ingeniería del Diseño Bachelor's Degree in Industrial Electronics and Automation Engineering Final Year Engineering Project QT SET-UP FOR TEXAS INSTRUMENTS AM335X ARM CORTEX-A8 USING LINUX: APPLICATION FOR AN INDUSTRIAL SCALE Appendix 1 - Source Code Documentation Author: Pablo Cholbi Alenda Supervisor: Dr. Àngel Perles Ivars May 2014 Contents 1 Hierarchical Index 1 1.1 Class Hierarchy ............................................ 1 2 Class Index 3 2.1 Class List ............................................... 3 3 File Index 5 3.1 File List ................................................ 5 4 Class Documentation 7 4.1 aboutDialog Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.1.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.1.2.1 aboutDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.1.2.2 ∼aboutDialog ................................... 8 4.2 Command Class Reference ...................................... 8 4.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.2.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.2.2.1 Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.2.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4.2.3.1 databasePath . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4.2.3.2 parseArguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 4.3 Database Class Reference ...................................... 9 4.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.3.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.3.2.1 Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4.3.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.3.3.1 clearAccum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.3.3.2 closeDatabase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.3.3.3 icon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.3.3.4 list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.3.3.5 name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 iv CONTENTS 4.3.3.6 openDatabase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.3.3.7 price . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.3.3.8 setDatabase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.3.3.9 updateAccum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 4.4 licenseDialog Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.4.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.4.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.4.2.1 licenseDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.4.2.2 ∼licenseDialog ................................... 13 4.5 MainWindow Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.5.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.5.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.5.2.1 MainWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 4.5.2.2 ∼MainWindow ................................... 14 4.5.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.5.3.1 redraw . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.5.3.2 setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.6 messageDialog Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.6.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.6.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.6.2.1 messageDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.6.2.2 ∼messageDialog ................................. 16 4.6.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.6.3.1 errorMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.6.3.2 genericMessage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.7 optionsDialog Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.7.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.7.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.7.2.1 optionsDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.7.2.2 ∼optionsDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.8 productDialog Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.8.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.8.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.8.2.1 productDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.8.2.2 ∼productDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.8.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.8.3.1 setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.9 productStruct Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.9.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4.10 serialScale Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen CONTENTS v 4.10.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.10.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.10.2.1 serialScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.10.2.2 ∼serialScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.10.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.10.3.1 buffScan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.10.3.2 closeConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.10.3.3 getWeight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.10.3.4 isStable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.10.3.5 loopbackTest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 4.10.3.6 openConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.10.3.7 process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.10.3.8 receiveData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.10.3.9 sendData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.10.3.10 update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.11 tableDialog Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.11.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.11.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.11.2.1 tableDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.11.2.2 ∼tableDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 5 File Documentation 27 5.1 /home/pablo/Developing/Qt/QtScale/src/aboutdialog.cpp File Reference . . . . . . . . . . . . . . . 27 5.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 5.2 /home/pablo/Developing/Qt/QtScale/src/aboutdialog.h File Reference . . . . . . . . . . . . . . . . 27 5.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 5.3 /home/pablo/Developing/Qt/QtScale/src/commandline.cpp File Reference . . . . . . . . . . . . . . 28 5.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 5.4 /home/pablo/Developing/Qt/QtScale/src/commandline.h File Reference . . . . . . . . . . . . . . . 28 5.4.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.5 /home/pablo/Developing/Qt/QtScale/src/database.cpp File Reference . . . . . . . . . . . . . . . . 29 5.5.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.6 /home/pablo/Developing/Qt/QtScale/src/database.h File Reference . . . . . . . . . . . . . . . . . 29 5.6.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.7 /home/pablo/Developing/Qt/QtScale/src/errorcode.h File Reference . . . . . . . . . . . . . . . . . 30 5.7.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.7.2 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.7.2.1 errorCode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.8 /home/pablo/Developing/Qt/QtScale/src/licensedialog.cpp File Reference . . . . . . . . . . . . . . 31 5.8.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen vi CONTENTS 5.9 /home/pablo/Developing/Qt/QtScale/src/licensedialog.h File Reference . . . . . . . . . . . . . . . 31 5.9.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 5.10 /home/pablo/Developing/Qt/QtScale/src/main.cpp File Reference . . . . . . . . . . . . . . . . . . 32 5.10.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.10.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.10.2.1 main . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.11 /home/pablo/Developing/Qt/QtScale/src/mainwindow.cpp File Reference . . . . . . . . . . . . . . 33 5.11.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.12 /home/pablo/Developing/Qt/QtScale/src/mainwindow.h File Reference . . . . . . . . . . . . . . . . 33 5.12.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.13 /home/pablo/Developing/Qt/QtScale/src/messagedialog.cpp File Reference . . . . . . . . . . . . . 34 5.13.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.14 /home/pablo/Developing/Qt/QtScale/src/messagedialog.h File Reference . . . . . . . . . . . . . . 34 5.14.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.15 /home/pablo/Developing/Qt/QtScale/src/optionsdialog.cpp File Reference . . . . . . . . . . . . . . 35 5.15.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 5.16 /home/pablo/Developing/Qt/QtScale/src/optionsdialog.h File Reference . . . . . . . . . . . . . . . 35 5.16.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.17 /home/pablo/Developing/Qt/QtScale/src/productdialog.cpp File Reference . . . . . . . . . . . . . . 36 5.17.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.18 /home/pablo/Developing/Qt/QtScale/src/productdialog.h File Reference . . . . . . . . . . . . . . . 37 5.18.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.19 /home/pablo/Developing/Qt/QtScale/src/productstruct.h File Reference . . . . . . . . . . . . . . . 37 5.19.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 5.20 /home/pablo/Developing/Qt/QtScale/src/serialscale.cpp File Reference . . . . . . . . . . . . . . . 38 5.20.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 5.21 /home/pablo/Developing/Qt/QtScale/src/serialscale.h File Reference . . . . . . . . . . . . . . . . 38 5.21.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 5.22 /home/pablo/Developing/Qt/QtScale/src/tabledialog.cpp File Reference . . . . . . . . . . . . . . . 39 5.22.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 5.23 /home/pablo/Developing/Qt/QtScale/src/tabledialog.h File Reference . . . . . . . . . . . . . . . . 39 5.23.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 Index 41 Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen Chapter 1 Hierarchical Index 1.1 Class Hierarchy This inheritance list is sorted roughly, but not completely, alphabetically: Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 productStruct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 QDialog aboutDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 licenseDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 messageDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 optionsDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 productDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 tableDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 QMainWindow MainWindow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 serialScale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2 Hierarchical Index Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen Chapter 2 Class Index 2.1 Class List Here are the classes, structs, unions and interfaces with brief descriptions: aboutDialog This class displays "about" information of the application. The information is static and defined in the UI file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Command This class encapsulates the methods and variables necesary to parse the commandline arguments that are supported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Database This class encapsulates the methods and variables necessary to manage the SQLite database 9 licenseDialog This class displays the license information of the application. The information is static and defined in the UI file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 MainWindow This class encapsulates the methods and variables necesary to display the main product selection window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 messageDialog This class encapsulates the methods and variables necesary to display error and information messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 optionsDialog This class encapsulates the methods and variables necesary to display and execute configuration options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 productDialog This class encapsulates the methods and variables necessary to display product weight and information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 productStruct Product data structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 serialScale This class encapsulates the methods and variables necessary to manage the communication with the industrial scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 tableDialog This class encapsulates the methods and variables necessary to display the accumulated sales of all products in the database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 10 Class Documentation •errorCode openDatabase () Open database. • void closeDatabase () Close database. • QList<int >list () List database records. • QIcon icon (int ID) Get product icon. • QString name (int ID) Get product name. • float price (int ID) Get product price. • void updateAccum (float weight, int ID) Get product price. • void clearAccum () Reset accumulated sales. Protected Attributes • QSqlDatabase db Database object. 4.3.1 Detailed Description this class encapsulates the methods and variables necessary to manage the SQLite database. The database file must have a table named "Products" with the following fields: -->Products Table: +--------------------------+-------------+-------------+--------------+--------------------+ | ID (integer primary key) | Name (text) | Icon (blob) | Price (real) | Accumulated (real) | +==========================+=============+=============+==============+====================+ | ID 1 | Product 1 | PNG 1 | Price 1 | Accum 1 | +--------------------------+-------------+-------------+--------------+--------------------+ | ID 2 | Product 2 | PNG 2 | Price 2 | Accum 2 | +--------------------------+-------------+-------------+--------------+--------------------+ | ... | ... | ... | ... | ... | +--------------------------+-------------+-------------+--------------+--------------------+ For more information, please consult the project report. Definition at line 58 of file database.h. 4.3.2 Constructor & Destructor Documentation 4.3.2.1 Database::Database ( ) Class constructor of Database. This function creates an instance of Databaseand initializes the class member. Definition at line 47 of file database.cpp. Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 4.3 Database Class Reference 11 4.3.3 Member Function Documentation 4.3.3.1 void Database::clearAccum ( ) Reset accumulated sales. This function updates the accumulated sales of all products in the database and sets them to 0. This function does not take parameters as it relies on other Database class functions. Definition at line 213 of file database.cpp. 4.3.3.2 void Database::closeDatabase ( ) Close database. This function closes the database. Definition at line 93 of file database.cpp. 4.3.3.3 QIcon Database::icon ( int ID ) Get product icon. This function returns as a QIcon the icon for the specified product ID in the database. Parameters ID Product index number (ID field in database). Returns Icon of specified product. Definition at line 129 of file database.cpp. 4.3.3.4 QList<int >Database::list ( ) List database records. This function returns a QList object with all the ID numbers of the products in the database in ascending order. Returns List of product IDs. Definition at line 106 of file database.cpp. 4.3.3.5 QString Database::name ( int ID ) Get product name. This function returns the name of the specified product ID in the database. Parameters ID Product index number (ID field in database). Returns Name of specified product. Definition at line 151 of file database.cpp. Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 12 Class Documentation 4.3.3.6 errorCode Database::openDatabase ( ) Open database. This function opens the database to be able to interact with it. If the SQLite database failed to open, the function returns databaseError error code. Otherwise, it returns SUCCESS. Returns Error code, being SUCCESS if the database was opened or databaseError otherwise. Definition at line 75 of file database.cpp. 4.3.3.7 float Database::price ( int ID ) Get product price. This function returns the Price of the specified product ID in the database. Parameters ID Product index number (ID field in database). Returns Price of specified product. Definition at line 171 of file database.cpp. 4.3.3.8 void Database::setDatabase ( QString database ) Set database path. This function sets the path the SQLite database. Parameters database Path to SQLite database. Definition at line 59 of file database.cpp. 4.3.3.9 void Database::updateAccum ( float weight, int ID ) Get product price. This function updates the accumulated sales in the product database record. Parameters weight Sale to add to accumulated sales. ID Product index number (ID field in database). Definition at line 189 of file database.cpp. The documentation for this class was generated from the following files: • /home/pablo/Developing/Qt/QtScale/src/database.h • /home/pablo/Developing/Qt/QtScale/src/database.cpp Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 4.4 licenseDialog Class Reference 13 4.4 licenseDialog Class Reference this class displays the license information of the application. The information is static and defined in the UI file. #include <licensedialog.h> Inheritance diagram for licenseDialog: licenseDialog QDialog Public Member Functions •licenseDialog (QWidget ∗parent=0) Class constructor of licenseDialog object. •∼licenseDialog () Class destructor of licenseDialog object. 4.4.1 Detailed Description this class displays the license information of the application. The information is static and defined in the UI file. Definition at line 40 of file licensedialog.h. 4.4.2 Constructor & Destructor Documentation 4.4.2.1 licenseDialog::licenseDialog ( QWidget ∗parent = 0)[explicit] Class constructor of licenseDialog object. This function creates an instance of licenseDialog class and initializes the widget. Definition at line 38 of file licensedialog.cpp. 4.4.2.2 licenseDialog::∼licenseDialog ( ) Class destructor of licenseDialog object. This function destroys an instance of licenseDialog class. Definition at line 58 of file licensedialog.cpp. The documentation for this class was generated from the following files: • /home/pablo/Developing/Qt/QtScale/src/licensedialog.h • /home/pablo/Developing/Qt/QtScale/src/licensedialog.cpp 4.5 MainWindow Class Reference this class encapsulates the methods and variables necesary to display the main product selection window. #include <mainwindow.h> Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 14 Class Documentation Inheritance diagram for MainWindow: MainWindow QMainWindow Public Member Functions •MainWindow (QWidget ∗parent=0) Class constructor of MainWindow object. •∼MainWindow () Class destructor of MainWindow object. • void setup (QApplication ∗a) Setup main window. • void redraw () Redraw main window. Protected Attributes • int page Current page being displayed. •Database db Product database file. • QList<int >vector ID numbers of the products. •productStruct item Structure with product information. 4.5.1 Detailed Description this class encapsulates the methods and variables necesary to display the main product selection window. Definition at line 49 of file mainwindow.h. 4.5.2 Constructor & Destructor Documentation 4.5.2.1 MainWindow::MainWindow ( QWidget ∗parent = 0)[explicit] Class constructor of MainWindow object. This function creates an instance of MainWindow class, initializes the class variables and the widget. Definition at line 51 of file mainwindow.cpp. 4.5.2.2 MainWindow::∼MainWindow ( ) Class destructor of MainWindow object. This function destroys an instance of MainWindow class. Definition at line 79 of file mainwindow.cpp. Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 4.6 messageDialog Class Reference 15 4.5.3 Member Function Documentation 4.5.3.1 void MainWindow::redraw ( ) Redraw main window. This function updates the main window interface according to the information recorded on the database and the current "page" that is being viewed. Up to 6 products can be viewed at a time. Definition at line 123 of file mainwindow.cpp. 4.5.3.2 void MainWindow::setup ( QApplication ∗a) Setup main window. This function attempts to parse incoming command line arguments and open the database specified by these arguments (or default). Application exits with fail status if any of these actions fail. This function must be called after the class object has been created and before the dialog is executed. Parameters ∗aPointer to QApplication object. Definition at line 96 of file mainwindow.cpp. The documentation for this class was generated from the following files: • /home/pablo/Developing/Qt/QtScale/src/mainwindow.h • /home/pablo/Developing/Qt/QtScale/src/mainwindow.cpp 4.6 messageDialog Class Reference this class encapsulates the methods and variables necesary to display error and information messages. #include <messagedialog.h> Inheritance diagram for messageDialog: messageDialog QDialog Public Member Functions •messageDialog (QWidget ∗parent=0) Class constructor of messageDialog object. •∼messageDialog () Class destructor of messageDialog object. • void errorMessage (errorCode error) Show error message. • void genericMessage (QString msg) Show generic message. Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 16 Class Documentation 4.6.1 Detailed Description this class encapsulates the methods and variables necesary to display error and information messages. Definition at line 42 of file messagedialog.h. 4.6.2 Constructor & Destructor Documentation 4.6.2.1 messageDialog::messageDialog ( QWidget ∗parent = 0)[explicit] Class constructor of messageDialog object. This function creates an instance of messageDialog class and initializes the widget. Definition at line 42 of file messagedialog.cpp. 4.6.2.2 messageDialog::∼messageDialog ( ) Class destructor of messageDialog object. This function destroys an instance of messageDialog class. Definition at line 58 of file messagedialog.cpp. 4.6.3 Member Function Documentation 4.6.3.1 void messageDialog::errorMessage ( errorCode error ) Show error message. This function displays an error message for the defined errors in errorCode. Parameters error Error to me informed of. Definition at line 70 of file messagedialog.cpp. 4.6.3.2 void messageDialog::genericMessage ( QString msg ) Show generic message. This function displays a generic message on screen. Parameters msg Message to be displayed. Definition at line 112 of file messagedialog.cpp. The documentation for this class was generated from the following files: • /home/pablo/Developing/Qt/QtScale/src/messagedialog.h • /home/pablo/Developing/Qt/QtScale/src/messagedialog.cpp 4.7 optionsDialog Class Reference this class encapsulates the methods and variables necesary to display and execute configuration options. #include <optionsdialog.h> Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 4.8 productDialog Class Reference 17 Inheritance diagram for optionsDialog: optionsDialog QDialog Public Member Functions •optionsDialog (QWidget ∗parent=0) Class constructor of optionDialog object. •∼optionsDialog () Class destructor of optionsDialog object. 4.7.1 Detailed Description this class encapsulates the methods and variables necesary to display and execute configuration options. Definition at line 42 of file optionsdialog.h. 4.7.2 Constructor & Destructor Documentation 4.7.2.1 optionsDialog::optionsDialog ( QWidget ∗parent = 0)[explicit] Class constructor of optionDialog object. This function creates an instance of optionsDialog class and initializes the widget. Definition at line 41 of file optionsdialog.cpp. 4.7.2.2 optionsDialog::∼optionsDialog ( ) Class destructor of optionsDialog object. This function destroys an instance of optionsDialog class. Definition at line 70 of file optionsdialog.cpp. The documentation for this class was generated from the following files: • /home/pablo/Developing/Qt/QtScale/src/optionsdialog.h • /home/pablo/Developing/Qt/QtScale/src/optionsdialog.cpp 4.8 productDialog Class Reference this class encapsulates the methods and variables necessary to display product weight and information. #include <productdialog.h> Inheritance diagram for productDialog: Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 18 Class Documentation productDialog QDialog Public Member Functions •productDialog (QWidget ∗parent=0) Class constructor of productDialog object. •∼productDialog () Class destructor of productDialog object. • bool setup (productStruct ∗item) Product dialog. 4.8.1 Detailed Description this class encapsulates the methods and variables necessary to display product weight and information. Definition at line 45 of file productdialog.h. 4.8.2 Constructor & Destructor Documentation 4.8.2.1 productDialog::productDialog ( QWidget ∗parent = 0)[explicit] Class constructor of productDialog object. This function creates an instance of productDialog class and initializes the widget. Definition at line 50 of file productdialog.cpp. 4.8.2.2 productDialog::∼productDialog ( ) Class destructor of productDialog object. This function destroys an instance of productDialog class. Definition at line 72 of file productdialog.cpp. 4.8.3 Member Function Documentation 4.8.3.1 bool productDialog::setup ( productStruct ∗item ) Product dialog. This function initializes the widget elements according to the productStruct and prepares the serial connections to weigh the product. This function must be called after the class object has been created and the dialog should only be executed if the setup exits successfully. Parameters Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 4.9 productStruct Struct Reference 19 ∗item Pointer to productStruct object. Returns TRUE is setup exited successfully or FALSE otherwise. Definition at line 90 of file productdialog.cpp. The documentation for this class was generated from the following files: • /home/pablo/Developing/Qt/QtScale/src/productdialog.h • /home/pablo/Developing/Qt/QtScale/src/productdialog.cpp 4.9 productStruct Struct Reference Product data structure. #include <productstruct.h> Public Attributes • QString name Name of product. • QIcon icon Icon of product. • int id Id of product. • float price Product price per unit of weight. • float weight Weight received from the scale. 4.9.1 Detailed Description Product data structure. This data structure encapsulated variables to be used in the product dialog. Definition at line 42 of file productstruct.h. The documentation for this struct was generated from the following file: • /home/pablo/Developing/Qt/QtScale/src/productstruct.h 4.10 serialScale Class Reference this class encapsulates the methods and variables necessary to manage the communication with the industrial scale. #include <serialscale.h> Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 26 Class Documentation Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen Chapter 5 File Documentation 5.1 /home/pablo/Developing/Qt/QtScale/src/aboutdialog.cpp File Reference Class implementation of aboutDialog. #include "aboutdialog.h" #include "ui_aboutdialog.h" #include "licensedialog.h" 5.1.1 Detailed Description Class implementation of aboutDialog. This class displays information about the application. Date March, 2014 Author Pablo Cholbi Definition in file aboutdialog.cpp. 5.2 /home/pablo/Developing/Qt/QtScale/src/aboutdialog.h File Reference Class definition of aboutDialog. #include <QDialog> #include "licensedialog.h" Classes • class aboutDialog this class displays "about" information of the application. The information is static and defined in the UI file. 28 File Documentation 5.2.1 Detailed Description Class definition of aboutDialog. Date March, 2014 Author Pablo Cholbi Definition in file aboutdialog.h. 5.3 /home/pablo/Developing/Qt/QtScale/src/commandline.cpp File Reference Class implementation of Command. #include <stdio.h> #include <cstdlib> #include <QDir> #include <QString> #include <QStringList> #include "commandline.h" #include "errorcode.h" 5.3.1 Detailed Description Class implementation of Command. This class contains the methods and members to be able to evaluate the supported command line arguments. The argument list is easily expandable. Date March, 2014 Author Pablo Cholbi Definition in file commandline.cpp. 5.4 /home/pablo/Developing/Qt/QtScale/src/commandline.h File Reference Class definition of Command. #include <QString> #include <QStringList> #include "errorcode.h" Classes • class Command this class encapsulates the methods and variables necesary to parse the commandline arguments that are supported. Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 5.5 /home/pablo/Developing/Qt/QtScale/src/database.cpp File Reference 29 5.4.1 Detailed Description Class definition of Command. Date March, 2014 Author Pablo Cholbi Definition in file commandline.h. 5.5 /home/pablo/Developing/Qt/QtScale/src/database.cpp File Reference Class implementation of Database. #include <stdio.h> #include <QIcon> #include <QList> #include <QSqlDatabase> #include <QSqlQuery> #include <QSqlQueryModel> #include <QVariant> #include "database.h" #include "errorcode.h" 5.5.1 Detailed Description Class implementation of Database. This class contains the methods and members that enable interaction with SQLite databases. Date March, 2014 Author Pablo Cholbi Definition in file database.cpp. 5.6 /home/pablo/Developing/Qt/QtScale/src/database.h File Reference Class definition of Database. #include <QList> #include <QIcon> #include <QString> #include <QSqlDatabase> #include <QSqlQueryModel> #include "errorcode.h" Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 30 File Documentation Classes • class Database this class encapsulates the methods and variables necessary to manage the SQLite database. 5.6.1 Detailed Description Class definition of Database. Date March, 2014 Author Pablo Cholbi Definition in file database.h. 5.7 /home/pablo/Developing/Qt/QtScale/src/errorcode.h File Reference Definition of errorCode data type. Enumerations • enum errorCode { SUCCESS,argumentError,databaseError,queryError, serialError,scaleError } Error code signaling data type. 5.7.1 Detailed Description Definition of errorCode data type. This file contains the implementation of the errorCode enumerated data type. Date March, 2014 Author Pablo Cholbi Definition in file errorcode.h. 5.7.2 Enumeration Type Documentation 5.7.2.1 enum errorCode Error code signaling data type. This data type is used as a return in various functions to signal if the function exited successfully or if an error occurred. If an error occurs, errorCode also gives information on the error type, such that it can be handled accordingly and/or warning can be displayed/printed. Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 5.8 /home/pablo/Developing/Qt/QtScale/src/licensedialog.cpp File Reference 31 Enumerator SUCCESS function exited successfully argumentError failed to parse command line argument databaseError failed to open/close database queryError query failed to execute successfully serialError serial connection could not be established scaleError scale is sending unexpected values. Calibration needed. Definition at line 40 of file errorcode.h. 5.8 /home/pablo/Developing/Qt/QtScale/src/licensedialog.cpp File Reference Class implementation of licenseDialog. #include "licensedialog.h" #include "ui_licensedialog.h" 5.8.1 Detailed Description Class implementation of licenseDialog. This class displays the license of the application. Date March, 2014 Author Pablo Cholbi Definition in file licensedialog.cpp. 5.9 /home/pablo/Developing/Qt/QtScale/src/licensedialog.h File Reference Class definition of licenseDialog. #include <QDialog> Classes • class licenseDialog this class displays the license information of the application. The information is static and defined in the UI file. 5.9.1 Detailed Description Class definition of licenseDialog. Date March, 2014 Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 32 File Documentation Author Pablo Cholbi Definition in file licensedialog.h. 5.10 /home/pablo/Developing/Qt/QtScale/src/main.cpp File Reference Start QtScale application. #include <QApplication> #include <QStringList> #include <QProcess> #include "mainwindow.h" Functions • int main (int argc, char ∗argv[]) Start application. 5.10.1 Detailed Description Start QtScale application. Date March, 2014 Author Pablo Cholbi Definition in file main.cpp. 5.10.2 Function Documentation 5.10.2.1 int main ( int argc, char ∗argv[] ) Start application. Parameters argc Argument count. argv Argument vector. This function starts the application, creates the main window and handles the the restart of the application if requested by a child. Returns Exit status of the application. Definition at line 43 of file main.cpp. Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 5.11 /home/pablo/Developing/Qt/QtScale/src/mainwindow.cpp File Reference 33 5.11 /home/pablo/Developing/Qt/QtScale/src/mainwindow.cpp File Reference Class implementation of MainWindow. #include <QApplication> #include <QString> #include <QStringList> #include <QList> #include <cstdlib> #include "mainwindow.h" #include "ui_mainwindow.h" #include "errorcode.h" #include "commandline.h" #include "database.h" #include "optionsdialog.h" #include "productdialog.h" #include "tabledialog.h" #include "productstruct.h" 5.11.1 Detailed Description Class implementation of MainWindow. This class displays the main product selection window. Date March, 2014 Author Pablo Cholbi Definition in file mainwindow.cpp. 5.12 /home/pablo/Developing/Qt/QtScale/src/mainwindow.h File Reference Class definition of MainWindow. #include <QMainWindow> #include <QApplication> #include <QList> #include "commandline.h" #include "database.h" #include "optionsdialog.h" #include "productdialog.h" #include "tabledialog.h" #include "productstruct.h" Classes • class MainWindow this class encapsulates the methods and variables necesary to display the main product selection window. Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 34 File Documentation 5.12.1 Detailed Description Class definition of MainWindow. Date March, 2014 Author Pablo Cholbi Definition in file mainwindow.h. 5.13 /home/pablo/Developing/Qt/QtScale/src/messagedialog.cpp File Reference Class implementation of messageDialog. #include <stdio.h> #include <QString> #include "messagedialog.h" #include "ui_messagedialog.h" #include "errorcode.h" 5.13.1 Detailed Description Class implementation of messageDialog. This class displays error and information messages. Date March, 2014 Author Pablo Cholbi Definition in file messagedialog.cpp. 5.14 /home/pablo/Developing/Qt/QtScale/src/messagedialog.h File Reference MessageDialog class definition. #include <QDialog> #include "errorcode.h" Classes • class messageDialog this class encapsulates the methods and variables necesary to display error and information messages. Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 5.15 /home/pablo/Developing/Qt/QtScale/src/optionsdialog.cpp File Reference 35 5.14.1 Detailed Description MessageDialog class definition. Date March, 2014 Author Pablo Cholbi Definition in file messagedialog.h. 5.15 /home/pablo/Developing/Qt/QtScale/src/optionsdialog.cpp File Reference Class implementation of optionsDialog. #include <QProcess> #include "optionsdialog.h" #include "ui_optionsdialog.h" #include "aboutdialog.h" 5.15.1 Detailed Description Class implementation of optionsDialog. This class displays and executes configuration options. Date March, 2014 Author Pablo Cholbi Definition in file optionsdialog.cpp. 5.16 /home/pablo/Developing/Qt/QtScale/src/optionsdialog.h File Reference Class definition of optionsDialog. #include <QDialog> #include "aboutdialog.h" Classes • class optionsDialog this class encapsulates the methods and variables necesary to display and execute configuration options. Generated on Tue May 6 2014 19:45:48 for QtScale by Doxygen 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. Section 4 – Sui Generis Database Rights. Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: a) for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; b) if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and c) You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. Section 5 – Disclaimer of Warranties and Limitation of Liability. a) Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. b) To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. c) The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. Section 6 – Term and Termination. a) This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. b) Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 2. upon express reinstatement by the Licensor. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. c) For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. d) Sections 1, 5, 6, 7, and 8 survive termination of this Public License. Section 7 – Other Terms and Conditions. a) The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. b) Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. Section 8 – Interpretation. a) For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. b) To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. c) No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. d) Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. Annex 2 – Software License Author: Free Software Foundation The software developed in this project is licensed under the GNU General Public License Version 3. The terms and conditions for use, reproduction and distribution of software subject to this license are the following: PREAMBLE The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program-to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program nonfree. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work. )You may place additional permissions on material, added by you to a covered work, for which you have or can give