Great and cheap RFID writer / reader long distance


Some time ago we were making a powerbank renting system with standalone kiosk. One of our goals was to make powerbank return process as easy as it can be and we figured out that we were able to achieve this by using wireless RFID communication between powerbank and kiosk. The problem occurred when we started looking for RFID sensor. Most of the devices available on the market were either too big, worked on a very small distance, or simply cost too much. We found only 1 device that, on paper, satisfied all our requirements – Chafon CF-RU5202.
We tested it and basically:

• Producent advertises that reading distance is 1m, when the device was inside the kiosk we could easily read tags from the distance between 50cm and 70cm, what is a very good result
• Device comes with detailed documentation – what is not a norm for devices in the same price range, bought using Aliexpress
– Documentation includes datasheet, user manual, detailed protocol description, sample code in C# and Delphi and SDK in the form of well documented .dll

• Some other features:
– Serial communication is used with the device
– 2 interfaces are available: RS232 and USB
– Protocol supports CRC16 error detection
– Protocol includes about 40 commands that allows us to process and setup all possible things in the device (from reading / writing / killing tags, to setting single GPIO value); moreover these commands were actually working
– It was possible to change reading distance by manipulating RF power
– There is other version of the device (RU5102) – more compact, but only with USB interface, and with much shorter reading distance (up to 20cm)


Remember to visit our website – to stay up to date, follow us on our LinkedIn and Facebook.
Let us know, what do you think or share with us your knowledge – send a message to us or leave a comment:

Author: webgo

Date: 13 April 2022

Using map in Qt mobile application with OpenStreetMap – advanced map uses


Routing engines

Vector map data
In the previous post we have described how to prepare functioning map with some overlays added to it. Now, it would be nice to add some other options to it, for example finding a route to your POI’s, or converting addresses to coordinates and back. This is when you need a first data format introduced in the first post (which is vector data), and a pathfinding server (commonly called routing engine). Again, you can use paid solutions, because almost all map providers also provide a routing engine, but of course you can also use open source solution.

Setting your own routing engine
An example of open source routing engine is OSRM (Open Source Routing Machine). It works on the same OpenStreetMap data that you downloaded for your tileserver. You can find build instruction on OSRM project’s webpage: https://github.com/Project-OSRM/osrm-backend. After installing, OSRM provides REST API for all map queries, documented here: http://project-osrm.org/docs/v5.23.0/api/#

Using OSRM in Qt application
Having configured the OSRM server, integrating it with your Qt application is as easy as adding one parameter to the OSM map plugin:

    PluginParameter {
        name: "osm.routing.host"
        value: "http://insert.your.address.here.com/"
    }

When routing host is set up, you gain access to geocoding (using classes GeocodeModel and Address) and routing (using classes RouteModel, Route, RouteSegment and RouteManeuver).

Geocoding and reverse geocoding
Geocoding is a process of finding coordinates of a specified address. Reverse geocoding is a process of finding nearest address of specified coordinates. Both of these processes are done via GeocodeModel. You need to set up query property of the model (if you set it to String or Address instance, and it will perform geocoding, while if you will set it to coordinate instance, it will perform reverse geocoding). After setting query, you simply need to call update() method. GeocodeModel will then make a query to the OSRM server and will emit a locationsChanged() signal when finished. To show these results, you could use MapItemView or ListView, with GeocodeModel as their model.

Path finding and navigating

Basic map components available in Qt don’t have navigation – you have to implement your own solution for this. When writing your own navigating algorithm there can be multiple issues that you will need to solve. Here we focus on describing some of the most common problems that may occur when implementing navigation algorithm in Qt.

1. Segments
In QML after the route is found (for RouteModel==1), the route generated in RouteModel consists of longer segments (lets call them paths) that contains shorter segments. The route is stored as a list of paths. Path is a structure containing:
– direction (QString)
– distance to the next instruction (int)
– coordinates of the beginning of the path (QGeoCoordinate)
– instruction (QString)
– list of the consecutive geographical coordinates marking beginnings and ends of the segments in the path (QVariantList).
The problem is that the list can be incorrect. Automatic method of assigning consecutive geographic coordinates to segments is based on the assumption that if there are 2 same consecutive points, they are the end point of one segment and the starting point of the next. And such a situation (2 the same points in a row) also takes place at every intersection. To handle it properly you should write your own method for defining starting and ending points of the segments.
This can be done by checking two conditions:

– are there the same coordinates twice in a row?
– are these coordinates equal to the beginning of the next segment recorded earlier?

If only condition 1 is met, it means that it is not a new segment, but an intersection. If both conditions are met, we start writing to a new segment.

2. BEARING
Takes values between 0 and 359 degree. The problem is that map rotation should be visualized in a way proper for human eye and this process takes some time. If a new bearing was set, the map started to rotate, but if at this time we entered the next section and another bearing value was coming, then the previous one was rotating to the end anyway, and, moreover, the rotation angle for the new segment was counted relative to that previous value which was not set.
To overcome these issues you can use timers and fully control how the map rotates. We used two timers: bearingAddTimer (clockwise rotation) i bearingSubtractTimer (counterclockwise rotation).
Thanks to this:
a) the map was rotating at some normal pace (originally it was too fast),
b) in the solution with timers, in case of a new bearing value, if the previous bearing of the map had not yet been set, the rotation was stopped and the next angle was calculated with respect to the actually set value.

3. Leaving the route
There is a parameter that determines what is the minimal distance from the calculated route that is considered as a point of leaving it. The parameter should be set very carefully. If, for example, we set it at 20m, then when trying to calculate the route, if we were further than 20m from the nearest point at the route, then the new route was not recalculated. For larger values the problem disappeared. How much value is too small? It probably depends, but at 100m it was ok, and at 20m there were big problems. Verify it yourself for your case.

4. Accuracy problems
High accuracy must be turned on, because on some phones (Samsung S7 for example) the GPS location was not enough and the route was reloading all the times with different locations showed up. High location had to be set in Java using JNI.

5. Segment’s filtering
You have to manually remove segments with length equal to 0 if you want rotating to work properly.

Stay tuned as in the next post we will introduce more advanced use of maps in Qt!

Author: webgo

Date:

Using map in Qt mobile application with OpenStreetMap map data with your own tileserver – basics


Using a map in your app

Many applications need a map. There is a multitude of possibilities of how the map can be used in an application, especially in a mobile app. Some apps need map to show real-world information for their users, like some kind of Points Of Interest (POIs) or the shortest path to them. Other apps may need map as a playing field in many kinds of games, from AR games like Pokemon, to a LARP games or Treasure Hunt-like games and many others. Yet another apps can use map to allow some social interactions between users or to organize sport activities.

Qt, as of version 5.0, comes with Qt Location API, including QML Map object. It is ready solution to display map in your application. You can just select your map plugin, type some plugin parameters and it is done… well, not so fast. It would be great if it would be as simple as that, but in reality you need one more thing: a data source for your map.

Map data

Map data is generally available in two formats. First format is a vector data, stored usually as objects in some database. This format is great for pathfinding, navigating, geolocation and other similar services. But it is much harder to display it as a map.

Second format are map tiles. Map tiles are prerendered fragments of a map with each tile having specific known coordinates. These prerendered tiles come in sets for many zoom levels – each zoom level has its own set of tiles, giving you flexibility which zoom levels include in your app and which not.

There are many sources of tiles, especially when you are developing free app. But when you develop commercial app, your choice is limited to:
– using paid options (the most popular are Google Maps and HereWeGo),
– creating your own tile server, using open source software and open source data.

Using paid options is actually almost as simple as using QML Map object and setting up some parameters (after buying and paying for this service), but payments for using external map data source can be high, especially for a startup or when creating an app with large map traffic. The other reason to not use commercial maps is when you simply want to have a control on your data and do not depend on external services. This is where open source software comes to help.

Pros and cons for using your own tileserver

Having your own tileserver can be a great solution for many startups, but it comes at a price.

Pros:
– makes you independent of third party solutions,
– gives you control of your data (for example – Google Maps have some advertisements rendered directly on maps, you cannot get rid of them),
– gives you control on how your map will look like,
– it is free (but you will still have to pay for infrastructure: server(s) and connection).

Cons:
– you need to have some good hardware: for serving a map of the whole world it is recommended to have a machine with at least 32Gb RAM and 2TB SSD storage, with at least 8 cores, but it won’t be enough for larger traffic,
– you need to maintain your tileserver infrastructure yourself,
– you need to regularly update your maps,
– when your traffic grows, you need to scale up your simple server – for example by caching generated tiles on many fileservers and using some load balancing,
– serving tiles generates large network traffic and depending on your pricing plan, this network load can also be very costly,
– you have to credit OSM with notice “© OpenStreetMap contributors” on your map.

Setting your own tileserver

The most mature open source map data and software projects is OpenStreetMap. This project collects map data as open source input from its volunteers, pretty much like a Wikipedia. It is free to download its map data and to use it in your apps as you want. The problem is that this data is a vector data. Fortunately, there is a full compatible open source software stack that can convert this data into a tileset. This stack includes:
– Ubuntu server (you could use other Linux distribution as well, but Ubuntu has most of other tools already included),
– Postgres GIS database extension – to deal with vector map data,
– osm2pgsql – scripts to convert data from OSM format to GIS database,
– Mapnik – app that renders some chunk of map data as a tile, using predefined stylesheet,
– Renderd – daemon to supervise rendering map tiles,
– mod_tile – an Apache module converting requests for a tile into renderd calls and manages cache of prerendered tiles.

If you want exact instructions of how to install and configure each of these components, there are excellent step-by-step tutorials for different Ubuntu versions at Switch2Osm project page: https://switch2osm.org/serving-tiles/. You simply need to follow these instructions (beware, it can be a veeeeryyyy looooong process, and sometimes needs some tweaking and/or troubleshooting).

It is worth noting that, contrary to paid map tiles, you can have complete control of how your map will look:
– you can use one of ready-to-use stylesheets downloaded from any source mentioned here: https://wiki.openstreetmap.org/wiki/Stylesheets,
– you can modify any of these stylesheets changing the lookout of any element, using different fonts for inscriptions, etc.,
– you can even create your own stylesheet from scratch (only for advanced users, it is a long and tedious work, but gives the most complete option).

How does it work

Generating tiles is a time-consuming operation. Moreover, tileservers don’t generate all tiles at once, but rather the tiles are generated on demand. When some tile is requested, mod_tile looks for it in the cache. If it doesn’t find the tile, it simply asks renderd to render it. If it finds the tile, it checks when the tile was rendered. Files that are not too old are served from cache, but files old enough to consider them as expired are deleted and generated again. This way tiles of most of the areas that are frequently visited are served mostly from cache and regenerated occasionally only when necessary. Tiles for areas not visited at all (for example lakes or forests on maximum zoom level) are not generated at all.

You can use this mechanism to set up some prerendering script, which will force prerendering of tiles of selected areas (for example, cities) when server load is low, for example in the middle of the night and, even further, it can cache them on load-balanced fileservers. Given that tile counts rise exponentially with zoom level (count of tiles = 4zoom level), it is reasonable to prerender all tiles up to zoom level 12 when you need to cover whole world, up to zoom level 15 or 16 for cities, and higher zoom levels only on demand (or exclude them at all – it depends on your use case). When prerendering map of a smaller area of the world you can prerender larger part of tiles – you can estimate how much storage you need for your tileset with this calculator: http://tools.geofabrik.de/calc/.

So, now you have a working tileserver, what’s next?

When you have a working tileserver you can use it in any way you want: you can use tiles in a Qt app, you can embed a map (using the same tiles) on your website using Leaflet library, or even start serving these tiles commercially.

Using a map in QML application

Setting up a QML Map object

Integrating a basic map in QML application is relatively easy. We need to set up a Plugin object, where we have to define what type of map tiles we are using (OSM, HereWeGo etc.), set up address, authorization data, copyrights and other plugin properties. Then we need to add Map object, where we have to define start coordinates and zoom level, and it is ready – we have a working browsable map in our application.

Minimal working example:

import QtQuick 2.12
import QtQuick.Window 2.12
import QtLocation 5.12
import QtPositioning 5.12
Window
{
visible: true
    width: 640
    height: 480
    title: qsTr(“Hello World”)
    Plugin
    {
        id: mapPlugin
        name: “osm”
        PluginParameter
        {
            name: “osm.mapping.custom.host”
            value: “YOUR_TILESERVER_ADDRESS”
        }
    }
    Map
    {
        id: map
        plugin: mapPlugin
        anchors.fill: parent
      activeMapType: supportedMapTypes[supportedMapTypes.length – 1]
        zoomLevel: 12
        minimumZoomLevel: 5
        maximumZoomLevel: 17
        center: QtPositioning.coordinate(54.2,16.2)
    }
}

Interacting with a map

Basic map allows only basic operations: browsing, zooming and tilting. To make map more usable, we need to add some other data to it. All items that you can add to map are collectively called overlays.

Adding overlays to a map

There are some simple types of overlays, such as:
– MapCircle – draws a circle on a map, for example to show range,
– MapRectangle – draws a rectangle on a map, for example to mark some area,
– MapPolygon – draws a polygon on a map, for example to precisely show borders and area of a city,
– MapIconObject – draws an icon on a map, for example to mark some point of interest,
– MapPolyline – draws a polyline on a map,
– MapRoute – special case of a polyline, where line data is a result of route query and shows route from start to destination,
– MapQuickObject – which gives us a possibility to add any Qt Quick object to a map, offering almost limitless possibilities to decorate our map with data.

All overlay items can be made clickable, by adding MouseArea to them.

There is also a couple of complex types for a map: such as MapItemView or MapObjectView, giving us possibility to populate map with items and objects generated from a model. These types are really helpful when showing a list of points of interest on a map.

Showing user’s position

When GPS position is available (for example when building app for mobiles), you can add user’s current position to your map with PositionSource object. It updates its position property regularly, giving you opportunity to set some marker on current user position. It is really convenient because it allows us to find the closest items to user’s current position or to find a route from user’s position to some other point.

Example:

file Map.qml:

import QtQuick 2.12
import QtQuick.Window 2.12
import QtLocation 5.12
import QtPositioning 5.12
Window
{
    visible: true
    width: 640
    height: 480
    title: qsTr(“Hello World”)
    id: top
    property real marker_base_height: 60
    Plugin
    {
        id: mapPlugin
        name: “osm”
        PluginParameter
        {
            name: “osm.mapping.custom.host”
            // INSERT YOUR HOST HERE, OpenStreetMap tileserver is for limited testing only
            value: “https://c.tile.openstreetmap.org/”
        }
    }
    ListModel
    {
        id:dataModel
        ListElement { lat: 54.196; lon: 16.234; name: “test1”; }
        ListElement { lat: 54.209; lon: 16.192; name: “test2”; }
        ListElement { lat: 54.229; lon: 16.215; name: “test3”; }
    }
    Map
    {
        id: map
        plugin: mapPlugin
        anchors.fill: parent
        zoomLevel: 12
        activeMapType: supportedMapTypes[supportedMapTypes.length – 1]
        minimumZoomLevel: 5
        maximumZoomLevel: 17
        center: QtPositioning.coordinate(54.2,16.2)
        MapItemView
        {
            id: mapItemView
            model: dataModel
            delegate: Component
            {
                Marker
                {
                    id: m
                    visible: true
                    coordinate: QtPositioning.coordinate(lat, lon)
                    z: 90 – lat
                    marker_height: marker_base_height
                    marker_mouse.propagateComposedEvents: true
                    marker_mouse.onPressed:
                    {
                        // output name to console
                        console.log(name)
                    }
                }
            }
        }
        MapQuickItem
        {
            id: pos_marker
            anchorPoint.x: marker_base_height / 6
            anchorPoint.y: marker_base_height / 6
            z: 91
            sourceItem: Image
            {
                height: marker_base_height / 2.5
                width: marker_base_height / 2.5
                fillMode: Image.PreserveAspectFit
                source: “qrc:/qml/img/pos.svg”
                sourceSize.height: height
                sourceSize.width: width
            }
        }
    }
    PositionSource
    {
        id: pos_src
        updateInterval: 1000
        active: true
        onPositionChanged:
        {
            pos_marker.coordinate=position.coordinate
        }
    }
}

file Marker.qml:

import QtQuick 2.6
import QtLocation 5.11
import QtPositioning 5.11MapQuickItem
{
    property alias marker_mouse: marker_mouse_area
    property real marker_height: parent.width * 0.1156
    property string src
    id: marker
    anchorPoint.x: marker_height / 4
    anchorPoint.y: marker_height
    sourceItem: Image
    {
        id: marker_image
        height: marker_height
        width: marker_height / 2
        fillMode: Image.PreserveAspectFit
        source: “qrc:/markerGray.svg”
        sourceSize.height: height
        sourceSize.width: width
        MouseArea
        {
            id: marker_mouse_area
            anchors.fill: parent
        }
    }
}

Stay tuned as in the next post we will introduce more advanced use of maps in Qt!

Author: webgo

Date:

Qt – application deployment on Android (3/3)


In the previous post we have presented process of deploying an application on the iOS mobile platform. The deployment process was divided into two stages: building the application and putting it on the store. On Android, the process will look very much the same. The first stage is building the application on the selected operating system (Linux, Windows), and the next is publishing the application on the Google Store. In the case of the Android mobile platform, it is important to choose the system on which the application will be built. In this post we will show you how to build an Android application with Qt for Windows.

Building an Android application with Qt

At the beginning, you should prepare an environment that allows you to build Android applications on Windows. To do this, download the necessary dependencies that allow to make it. Before it, you have to download Qt installer from Qt official website and install it on your system. Then, install dependencies required to build the application:
Android Software Development Kit Tools
Java Development Kit
Android Native Development Kit – package that allows you to create applications using C++
Gradle – for building application packages (APK) and app bundles (AAB) for Android devices
Links to download all the necessary packages for the proper version of Qt for Android can be found by launching Qt Creator and then entering Tools, Options, Device, Android.

There is an arrow on the network on each path to replace items, for easy download. In the case of SDK, after it has been downloaded, the SDK Manager exits program and start to update data and download missing components. It should be ensured that we do not run out of elements such as: Android SDK Platform-Tools, Android SDK Build-Tools and Google USB Driver. If we have all the tools downloaded and set up correctly, we can try to compile our application. If you are using a physical device instead of simulator, remember to turn on USB debugging.
If your environment is correctly set up, you should find Kit definitions for at least installed Qt Android versions in the Kits section in the configuration dialog of Qt Creator. Building an application for the Android mobile platform is complicated, but with Qt it becomes much easier as Qt script carries out all the steps automatically. If you want to know what the steps for compiling and building an application package look like, please see this link:
https://doc.qt.io/qt-5/deployment-android.html#androiddeployqt
If you want to build an application using the command line, you must refer to the documentation and read the steps to complete this process. All the steps are described at this link:
https://doc.qt.io/qt-5/deployment-android.html#building-the-android-application

The last step is to build the application with Qt Creator. To do this, select appropriate compiler that we have defined earlier and press the green arrow, i.e., the Run button.
A modal window will appear with all available Android devices compatible with the compiler you are using listed. Select the appropriate equipment and click OK. At this point, a notification should appear on the phone regarding the installation of a new application via USB debugging. We grant installation permission, and we can fully enjoy your working Android application.

Android Manifest

AndroidManifes.xml is a very important file in the project, because it gives detailed meta-information about your application. This information is used to customize the application package and is used by the target device to decide which features to enable, for example: default application orientation and so on. Also, it is used by the Google Play Store to retrieve version code information, device support, package name, and more.

The default file contains special parameters that Qt uses to configure the application and load all necessary libraries for Qt. Make sure all default parameters are set correctly before adjusting the file. This is necessary for the application to function properly. The Android manifest is used to define Android services and custom Android actions.

AAB and APK file

When building an Android application, you’ll be facing a myriad of different file formats and terminology. Particularly when exporting the final version of the application, you will see two main output formats. In this paragraph we will explain the difference between APK and AAB formats.
The more known format is that with the APK extension. It has been around for a long time and is the most commonly used format when building an application as it is suitable for direct installation on the device with Android system. The APK format is also used when debugging an application due to its installation speed.
AAB, which stands for Android Application Bundle, is a more recent format for Android distribution. The AAB format is newer than APK, it was introduced in 2018. App Bundles are publishing formats, whereas APK (Android application PacKage) is the packaging format which eventually will be installed on the device. This format became the official format for publishing Android apps.

Comparison of APK and App Bundle formats
– AAB format provides higher conversion rates than APK format
– AAB format provides faster downloads than APK format
– AAB format provides higher update rates than APK format
– AAB format provides lower uninstall time than the APK format
– AAB format provides 35% smaller size than the APK format
– AAB format should be used to avoid unnecessary copying of native libraries

Publishing to Google Play

If you want to publish your app on Google Store, you can do so by using Qt Creator. Most of the tasks required to finish publishing in the shop, especially packaging and deploying of the application, are handled by Qt Creator. Whenever you run the application using Qt Creator, an Android Application Package (APK) is created and deployed on the target of your choice (device or emulator). If you want to publish your application on Google Play you have to make several minor changes to packaging settings. The steps for publishing your app to Google Store are listed below.
1. Open your project with Qt Creator 4.11 or later choosing Release Build.
2. Select Projects > Build > Build Android APK > Create Templates to create Android package template files, such as AndroidManifest.xml, which is the main file of concern here.
3. Check for the following settings in AndroidManifest.xml:
– set Minimum required SDK to API 21 or later,
– set Application name and Application icon,
– verify if Permissions list has all of the required permissions,
– verify if Features list has the software or hardware features that your application depends on, such as GPS or NFC, etc.
4. Set up a keystore to sign your .apk file. You can create a new keystore if you do not have one.
5. Locate the generated package:
– For APK packages, the path is:
<$BUILD_DIR>/android-build/build/outputs/apk/release/android-build-release.apk
– For AAB packages, the path is:
<$BUILD_DIR>/android-build/build/outputs/apk/release/android-build-release.abb
6. Log into Google Play Developer Console and upload either, .apk or .aab files, along with a description and screen captures resembling the usage of your application.

Remember that if you want to submit application to Google Play, you need to create Google Play developer account and Google Wallet Merchant Center account before uploading files. The guide explaining how to add the application to the Google Store is also available at this link:
https://help.swiftic.com/hc/en-us/articles/201581812-Submit-Your-App-to-Google-Play

Summary

Process of deploying application to the Android mobile platform is simpler than with iOS, as the entire deployment process takes place in Qt Creator. The only difficulty is in installing all the necessary add-ons and configuring the runtime environment. In the case of Android, the deployment process can take place on different systems, it is not limited as in the case of iOS, where the deployment must take place on a computer with macOS. In the case of Android, all configuration is in Qt Creator, while iOS configuration is in XCode. Another great advantage is the possibility to add Android applications to the Google Store via Qt Creator. The process of adding an app to the store is very similar for both cases – it requires creating accounts and supplementing all the basic information about the application.

Author: webgo

Date: 11 April 2022

Qt – application deployment on iOS platform (2/3)


In the first post, we have shortly described what is software deployment and shortly introduced methods to deploy an application using Qt tool along with listing advantages and disadvantages of these methods. In this article we will focus on deployment process on the first specific mobile platform – iOS. The deployment process will consist of several stages, the first being building an iOS application, and the last being publishing it on the App Store.

Building an iOS application with Qt and Xcode

At the beginning, the development environment should be properly prepared and configured. Development and deployment are done using Xcode. The supported workflow is to maintain a .pro file based project, which generates an Xcode project. You will need Qt 5 and Xcode to build the application. The first thing you need to do is to install Xcode, you have to make it before installing Qt5. You will find it in the Mac App Store at this link: https://apps.apple.com/us/app/xcode/id497799835?ls=1&mt=12

Next, you can download the Qt 5 installers from the downloads page and install Qt5 on the Mac computer.
You can use any version of macOS to build the application, but if you want to make it public on the App Store, you should have the latest version of Xcode. The latest Xcode is also available on the latest macOS – this way is recommended by Apple. That’s all that you need to run Qt applications on your Mac or in the simulator that comes with Xcode.Another important thing is the Xcode configuration. If you want to publish applications on the App Store or run it on a mobile device, you must remember to configure developer certificates and provisioning profiles. We will describe this process further. If you already have a development environment set up, you can move on to building the app. There are two approaches to build an application on iOS. The first one is to build it from the command line. The second is to build it with QtCreator. If you want to use the first way, remember to install Command Line Tools for Xcode proper for your version of Xcode. After installing all the necessary tools and configuring them, we can build the project. In the console, go to the directory with your application, where the .pro project file is placed and run the qmake command in the console. After completing this step, Xcode project will be created in your project folder. Then, open the Xcode project by opening a file with .xcodeproj extension. The final step is to build your application in Xcode after selecting target device. If the compilation process is successful, you will have the application installed on your device. In case of the changes to the source files, you have to repeat the process of building the application again. If you want to build an application using QtCreator, you need to follow this guide https://doc.qt.io/qtcreator/creator-developing-ios.html .

Setting up Xcode configuration

During building of the iOS app, you don’t need to create the project in Xcode. Follow the instructions in the previous paragraph, and the XCode project for your application will be created automatically. Then you need to configure the project in Xcode properly. You will need the information needed by Xcode to identify your app and you as a developer:

Product name – name of your app as it will appear in the App Store and on a device when installed. The product name must be at least 2 characters long and have no more than 255 bytes, and should be similar to the app name that you enter later in App Store Connect
Organization identifier – A reverse DNS string that uniquely identifies your organization. If you don’t have a company identifier, use com.example. followed by your organization name and replace it before you distribute your app.
Organization name – The name that appears in a boilerplate text throughout your project folder. The organization name in your project isn’t the same as the organization name that appears in the App Store. If you don’t belong to any organization, enter your name.
We make all of these settings in the Xcode project as shown below.

Ustawienia projektu Xcode

To obtain the developer certificates and provisioning profiles you have to first enroll in the Apple Developer Program. The first step is to create an Apple ID. To do this, go to the website https://appleid.apple.com/account#!&page=create and create it. With just an Apple ID, you can access Xcode.

Preparing Your App for Distribution

In this step we make all the necessary steps needed for Xcode to publish your app to the App Store. Before you upload the already built application to App Store Connect or export or distribute it outside the App Store, you have to provide all the required information about your app – such as unique bundle ID, build string, app icon, and launch screen.

Setting Bundle ID (CFBundleIdentifier)
To distribute your app through TestFlight and the App Store, you have to create an app record in App Store Connect and enter a bundle ID that matches the one in your project. After you upload your first application to App Store Connect, you can’t change the bundle ID, so choose carefully your organization ID when you create the project or edit the bundle ID afterward. You can edit the name of the app only until you submit the app to App Review. Link to help https://help.apple.com/xcode/mac/current/#/deve21d0239c

Setting Version Number (CFBundleShortVersionString) and Build String (CFBundleVersion)
The version number and build string uniquely identify version of your app throughout the system. The version number also appears in the App Store, and for macOS apps the version number and build string appear in the About window. Both keys are required by the App Store. Set the version number and build string after you create the project by command line and Qt. Set the version number and build string under the bundle ID on the General pane of the project editor. Link to help https://help.apple.com/xcode/mac/current/#/devba7f53ad4

Setting App Category
Categories help users discover your app on the App Store. You have to set both, primary and secondary categories, under which your app is listed on the App Store, in App Store Connect. For macOS apps, you also set the app’s primary category in the project, and it must match the primary category that you set in App Store Connect. Link to help:
https://developer.apple.com/app-store/categories

Assigning Project to a Team
If you haven’t already done so, assign the project to a team. For example, if you want to distribute your app using TestFlight or through the App Store, assign all the target groups in a project to a team that belongs to the Apple Developer Program. When you upload or export your build, Xcode creates the necessary signing assets in the associated developer account. Link to help:https://help.apple.com/xcode/mac/current/#/dev23aab79b4

Editing Deployment Info Settings
You should edit deployment info settings because some settings, such as the operating systems and devices that your app supports, are used by the App Store later. Link to help:
https://help.apple.com/xcode/mac/current/#/deve69552ee5

Adding App Icon and App Store Icon
Add an icon to represent your app in various locations on a device and on the App Store. Link to help: https://help.apple.com/xcode/mac/current/#/dev10510b1f7?sub=dev8df242dec

If you want to distribute the app through the App Store, you also should add an icon specific to the App Store. Link to help:
https://help.apple.com/xcode/mac/current/#/dev4b0ebb1bb

All the above-mentioned settings are necessary to publish your application on the App Store or TestFlight.

Release your app on TestFlight

TestFlight allows developers to push their apps to internal and external testers. This optional step covers releasing your build on TestFlight. If you want to put your app in TestFlight and make it available externally, there are a few steps you need to take:
1. Navigate to the TestFlight tab of your app’s application details page on App Store Connect.
2. Select Internal Testing in the sidebar.
3. Select the build to publish to testers, then click Save.
4. Add the email addresses of any internal testers that you want. You can add additional internal users in the Users and Roles page of App Store Connect, available from the dropdown menu at the top of the page.
If you need more information, you can take a look at this page https://help.apple.com/xcode/mac/current/#/dev2539d985f

Releasing your app on App Store

When you’re ready to release your app to the world, follow these steps to submit your app for review and release to the App Store:
1. Select Pricing and Availability from the sidebar of your app’s application details page on App Store Connect and complete the required information.
2. Select the status from the sidebar. If this is the first release of this app, its status is 1.0 Prepare for Submission. Complete all required fields.
3. Click Submit for Review.
Apple notifies you when their app review process is complete. Your app is released according to the instructions you specified in the Version Release section.
If you need more information, you can take a look at this page: https://help.apple.com/xcode/mac/current/#/dev067853c94

Summary

The process of deploying application to the iOS mobile platform can be divided into two stages. The first step is building the application using Qt and Xcode on macOS operating system. As mentioned earlier, you should deploy the app using the latest version of macOS which includes the latest version of Xcode. This reduces further problems with publishing the application in the App Store.
The second stage of deployment of the application is publishing it on the App Store. This process requires lots of configuration and parameterization of the project opened with Xcode. In addition, this process is associated with the creation of identifiers and certificates that must be used in the project.
The next post will present the process of deploying the application on the Android mobile platform.

Author: webgo

Date:

Qt deployment – Introduction (1/3)


This is the first post of the series of 3 posts regarding deployment process in Qt.
Deployment is one of the major steps in creating cross-platform applications. Generally speaking, deployment of the application is defined by a set of all actions or activities that makes a software system available for use. The general deployment process consists of several interrelated activities with possible transitions between them. Every software system is unique, the precise processes or procedures within each activity can hardly be defined. The deployment process is a general process that has to be customized according to the particular environment and specific requirements or characteristics.
Nowadays, there exist a lot of tools that allow to deploy cross-platform applications. For instance, according to DNSstuff, the top four software deployment tools in 2020 are:

– SolarWinds Patch Manager
– Octopus Deploy
– Jenkins
– Bamboo

In this series we will focus on the cross-platform application deployment tool that can be used in Qt.

Qt as a deployment tool

Qt is a full development framework with tools designed to streamline the creation of applications and user interface for desktop, embedded, or even mobile platforms. Qt consists of three main parts:

Qt Framework -intuitive APIs for C++ and JavaScript-like programming with Qt Quick for rapid UI creation.
Qt Creator IDE -a powerful cross-platform integrated development environment, including UI designer tools and on-device debugging.
Tools and Toolchains – internationalization support, embedded 
toolchains, build with CMake, and more.

There are two ways to deploy an application in Qt:

Static Linking
Shared Libraries (Frameworks on Mac)

Qt deployment – Static Linking

Deploy the application through static linking results in a stand-alone executable. The advantage is that you will only have a few files to deploy.
The disadvantages are that the executables are large and with no flexibility, because if you will have a new version of the application or new version of Qt, it will require the entire deployment process to be repeated. Another disadvantage with this type of deployment is that you cannot deploy plugins. The pros and cons of this approach are summarized below.

Qt deployment – Shared Libraries

Deploy of the application through shared libraries is the second way to deploy your application offered by Qt tool. It is more flexible and independent type of deployment. The shared library approach allows deploying plugin-based applications. Using this way, the user is able to independently upgrade the Qt library used by the application. If you want to use the same Qt libraries for a family of applications you must use the shared library approach.  The disadvantage with the shared library approach is that you will get more files to deploy. If your application uses Qt libraries, remember that Qt libraries should be re-distributed with the application. The same situation appears when application uses Qt QML, because it also needs to ship the QML modules it uses. While deploying an application using the shared library approach you must ensure that the Qt libraries use the correct path to find Qt plugins, documentation, translation, and so on. To do this, you can use a qt.conf file.

Supported platforms by Qt

The procedure of deploying Qt applications is different for various platforms and depends on a chosen platform. Using Qt, you can write GUI applications once and deploy them across desktop, mobile and embedded operating systems without rewriting source code. Qt supports both, mobile and desktop platforms.

Supported desktop platforms

Linux/X1
macOS
Windows

Supported mobile platforms

Android
iOS/tvOS/watchOS
Universal Windows Platform (UWP)
Qt for WebAssembly

Summary

In conclusion, the application deployment process is one of the basic step on the road to application usability. There are many tools available to carry out this process. In a series of posts, we will focus on the open source Qt tool.
This post provides a general definition of the application deployment process along with basic description of the ways to deploy the application using the Qt tool and their advantages and disadvantages. The following posts will present the application deployment using the Qt tool on the iOS and Android platforms.

Author: webgo

Date:

Why do we need kiosk software? Running application in kiosk mode


What is a Kiosk and what do you need it for?

At the beginning let’s explain what is a Kiosk application. Nowadays the need for application protection is critical, but unfortunately it is usually an afterthought. Kiosk system software ensures that your application is secured and always running, preventing misuse and allowing kiosks to remain unattended. These devices, while using kiosk software, tend to run on very stripped down or limited version of the Operating System (OS), only allowing a single application to run. Thanks to that, kiosk system software protects the application by blocking access to OS functionality or desktop and limiting browser use. This prohibits users from changing system settings, surfing the Internet, overwriting files stored locally on the kiosk or accessing sensitive company, employee and user information.
It is also important to note that computers with Kiosk software are often in public places such as libraries, public transport or vending machine where users have easy access to it. The most common devices that have a kiosk operating system are touchscreen devices. Kiosk software is used to manage touchscreen, allowing users to touch the monitor screen to make selections. A virtual keyboard eliminates the need for a computer keyboard.

Two types of kiosk software

The Kiosk operating system has two types of software. These include application software and system software. The first of them is responsible for interacting with users and providing kiosk functionality, while the system software protects the application. The kiosk system software wraps the application, rendering everything in a way that is inaccessible to
users, while providing kiosk managers access to the entire system with a passcode, mouse sequence or key combination.

Security and security features

The most important thing about the Kiosk system is security. Kiosk needs to be kept safe from users making malicious attacks or trying to break into it. Software must be able to prevent misuse of the provided features. Also, it is important that software preserves the ability to restrict normal users to certain predetermined actions so that the device can be used for testing, communication, operation, or function. One way to do so it to prevent the user from reaching the desktop or file system. Depending on the kiosk system, there are different security features that will be presented below:

Keyboard Filtering – for applications that have a keyboard available to the user, it is critical to disable certain specialty keys and key combinations. In the kiosk the keyboard keys shouldn’t open a new window, dialog box, menu or allow users to exit the application. The absence of key locking and key combinations prevents access to the operating system where users can easily go to anywhere in the kiosk.

Virtual Keyboard – the virtual keyboard, which is on the touch screen, prevents entering key combinations and excludes keys that allow for unauthorized operation.
Furthermore, the virtual keyboard reduces the susceptibility to hardware damage by eliminating the need for a physical keyboard and mouse.

Attract Screens / Session End Features – attract screens essentially replace the Windows screen saver, which would allow access to the OS, by rotating through images, ads or URLs instead. This feature can also be used to end a user’s session, by logging a user off after a certain period of idle time and beginning to attract screen loop.

File Download Blocking – kiosk system software should block dialog boxes from being shown and files from downloading.

External Device Support – kiosk system software also supports the integration of external devices for added security. The system should block unauthorized devices that have been connected to the computer. The system should also properly manage devices that are integrated with the system, depending on the logged-in user, so that the user’s data processed by external devices is safe after logging out or leaving the standalone application by the user.

Remote monitoring – a computer with kiosk software should be able to be remotely updated and monitored by central unit. From the central unit level, it should be possible to remotely control multiple computers working in kiosk mode. Remote monitoring supervises the kiosk’s health by sending regular heartbeats to ensure that kiosk is up and running, as well as alerts for anomalies. Kiosk software should also produce usage statistics and survey data for analysis.

Compatibility with Operating System and Browsers

Kiosk software is available for most operating systems: Windows, Chrome OS, Android, iOS, Linux, etc. It can also support various browsers, most commonly Internet Explorer, Safari, Firefox and Google Chrome.

How to set up kiosk mode in Linux operating system?

There are several steps that need to be done to make kiosk application on the Linux operating system. The first step is installing Ubuntu Minimal without window manager as a main operating system of the computer. Detailed instructions for installing Ubuntu Minimal along with the installation file can be found here:

https://help.ubuntu.com/community/Installation/MinimalCD

In the beginning, it’s a good idea to install ssh server on your system to allow the machine to be accessed from outside via an external device. To do this, you need to enter the following command in the terminal:

sudo apt update
sudo apt upgrade
sudo apt install openssh-server

After installing Ubuntu Minimal and opening ssh server, you should install xorg manually. To do this, you need to enter the following command in the terminal:

sudo apt install xorg

Next, in the user’s directory, create an .xinitrc file with the following content:

!/bin/bash
exec standaloneApp

Where we replace the standaloneApp with the call of our executable file.
In the next part, in the user’s directory, create/edit the .bash_profile file with the following content:

if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
startx
fi

This allows X to automatically turn on with your application as soon as you log in into the system.
The last step is to change the getty @ .service file, which can be found under following path /lib/systemd/system/getty@.service. Find the following line in the specified file:

ExecStart=costamcostam

and replace it with:

ExecStart=-/sbin/agetty –noclear -a kjosk-user %I $TERM

Changes presented in the last step allow for automatic login after starting the system. After performing all the steps mentioned above, restart the system. After restarting the system, your application should start in kiosk mode. The above guide shows how to run applications in very basic version of kiosk mode. You may increase security level of your application by using additional mechanisms, some of them are described in Security and security features section of this post.

Summary

This article discusses kiosk software and the applications that run on this software. We indicate main benefits from using this software and the situations in which you should use consider using it. Last paragraph contains several steps that show how to prepare such software on Linux Ubuntu Minimal. There are many ready-made systems of this type offered by different companies. However, this comes at a cost that must be paid for them. Remember that if you consider purchasing such software (instead of preparing it oneself), you should read system documentation to adjust the choice to your needs.

Author: webgo

Date:

Qt Designer – (Qt)Quick Overview


Have you ever wondered what type of programmer you are, which way of coding will you choose, or even what design method suits you best? Talking about UI (User Interface) development is an ever-changing subject. The way frontend developers build windows, dialogs, pages or the custom items is completely different from how we used to do it a couple of years ago. It is hard to imagine how the views were created using low-level procedural languages like C, which requires tremendous effort to create multi-window applications. Certain ways of coding have been improved over time and new languages have been introduced providing a standard way to build and deploy applications, called frameworks afterward.

Nowadays, while many application operations are being handled on the client-side, frontend developer is undoubtedly needed. Such a person is expected to know one of many declarative languages, especially JavaScript, even when programming in languages like C++ – it is JavaScript that constitutes an integral part of the QtQuick framework and handles imperative aspects under the Qt Modeling Language (QML) layer.

Focusing on the Qt, it should be emphasized that this cross-platform and full-featured IDE (Integrated Development Environment) allows users to scale above the code and make connected UIs, applications, or even devices. One of its noteworthy features is Qt Designer. Built-in Qt Creator application view offers to create Forms, Integrated GUI layouts, and drag-and-design UI creation. Moreover, combined with a visual debugging and profiling tools, appears to become a dream utility for the frontend developers.

User interface designed in such a way is transformed into generic code, according to the chosen language – QML or C++, and it is called (in case of C++) a widget. Code generation modules are being constantly maintained and improved. For those, who don’t have enough experience in coding such views directly, there is a graphical interface that supports this process. Moreover, documentation provides a significant amount of detailed examples, and the environment encourages us to work with them. The left panel contains categorized UI elements, text labels, bars, buttons, checkboxes, and so on. In the center of the window, the playground is positioned. One can easily drag-n-drop stuff and create one’s own application view with the preferences that are situated on the right panel. What other way would there be to be better off?

Of course, we are still talking about C++ – so there will be developers for whom such development, and that kind of work, is beginning to resemble building the castles in the sandbox. For them, there are sophisticated debugging and profiling features in Qt Designer, which still should be a default steps of the GUI implementation process. We think that experienced programmers more often choose the direct way of developing application views. It may also be the case that performance plays an important role in the application runtime and then, code optimizations may turn out to be unavoidable. We do not believe that this process can be rate as effortless, but only that way developers could customize every variable with an appropriate name and organize the code with a surgical precision according to their wishes.

In conclusion, QtDesigner presents a user-friendly environment to create complete application UI. With the help of code generation modules, developers can easily create customized views, even with low programming skills. Summarizing, QtDesigner has some limitations, but still can provide robust solutions.

Author: webgo

Date: