RobustOS Pro Application Development Getting Started

RobustOS Pro Application Development Getting Started

Preface

Welcome to RobustOS Pro! This guide provides a step-by-step roadmap for understanding, developing, and deploying applications on the platform.

This document is only applicable to RobustOS Pro 2.4.x firmware versions.

System Architecture Overview

RobustOS Pro is an embedded Linux operating system built on Debian 11, designed for industrial-grade reliability and modern IIoT (Industrial Internet of Things) development.

It harnesses the full power of standard Linux, while significantly simplifying the development lifecycledeployment, and maintenance of industrial applications.

Core Concepts

  • No Proprietary SDK Dependency — Develop directly with standard Debian tools, libraries, and workflows, ensuring a seamless learning curve for any experienced Linux developer.

  • Modern Development Experience — Leverage familiar technologies such as Docker, Python, Node.js, and other mainstream frameworks to accelerate innovation.

  • Decoupled Layered Architecture — We enforce a clean, strict separation between your Workloads and the underlying hardware. This enables simplified upgrades, flexible customization, and guarantees long-term maintainability.

System Services You Need to Know

Your applications will run alongside several key system services. Understanding them helps with troubleshooting and avoiding conflicts.

Service NamePrimary PurposeNotes
router.serviceRobustOS Pro core service, coordinating network, configuration, firewall, etc.Prohibition Note: It is strictly prohibited to stop or disable this core service.
NetworkManager.serviceCore Networking Service — Manages and maintains all critical network interfaces and connections.If your application needs to configure networks, please refer to NetworkManager Integration Guide
nginx.serviceSystem's built-in web server. The system's web administration interface uses ports 80/443 by default.If your application needs a web interface, please refer to Web Service Integration Guide for RobustOS Pro
systemdStandard Linux initialization system and service manager.Your application can be packaged as a systemd service for auto-start on boot.
ssh.serviceProvides secure remote command-line access.In production environments, it's recommended to change the default port, disable password login, and use key-based authentication instead.
systemd-journald.serviceCollects and manages system logs.Troubleshooting: The primary method for troubleshooting system issues is by using the journalctl command to view collected logs.
ModemManagerManages cellular network modules (Modem) and connections.Closely related to cellular network functionality.
dbus.serviceProvides system-level inter-process communication (IPC) mechanism.Communication Foundation: Serves as the underlying mechanism for Inter-Process Communication (IPC), enabling many system services (e.g., NetworkManager, ModemManager) to interact.
chirpstack.service chirpstack-gateway-bridge.service chirpstack-rest-api.serviceProvides LoRaWAN network server functionality.Present only on devices equipped with LoRa functionality.
postgresql.serviceRelational database service.Used by specific applications (ChirpStack) for data persistence. Present only on devices equipped with LoRa functionality.
redis-server.serviceIn-memory data storage service.Used by specific applications (ChirpStack) for caching and task queues. Present only on devices equipped with LoRa functionality.
mosquitto.serviceMQTT message broker service.Used by specific applications (ChirpStack), providing publish/subscribe messaging model. Present only on devices equipped with LoRa functionality.

Connecting to the Device

Before you begin development and test, it is essential to correctly set up the physical connections for your device. This includes connecting the power supply, antennas, and any necessary cables (e.g., Ethernet, serial).

For detailed, step-by-step instructions on physical connections, initial power-up procedures, and safety information, please refer to the Hardware Manual specific to your device model. The Hardware Manual provides detail information about your device's physical layout and setup.

How to Develop Your Application

Development Environment

The system itself is a standard Debian 11 environment. You can install development tools and libraries via apt.

# Install C/C++ compilation tools and Python package manager
sudo apt-get update
sudo apt-get install build-essential python3-pip

Development Approaches

Depending on your application's complexity and integration requirements, you can choose from the following two development approaches:

  1. Approach 1: Debian Standard (Most Flexible)
  • Description: Develop directly using languages like Python, C/C++, Go, just as you would on a standard Debian server. This is the simplest and most flexible approach. If you have application source code from other Linux platforms (especially ARM architecture), you can recompile it directly on the device or use a cross-compiler for Debian armhf/arm64.

  • Applicable Scenarios: Rapid prototyping, background services, applications that don't need to integrate with system web UI.

  • How to Start: You can refer to hardware access and status query example code in subsequent chapters and use systemd or Docker for deployment.

Detailed guide: Debian-Based Application Development Guide

  1. Approach 2: Using RobustOS Pro SDK (Deep Integration)
  • Description: Use the officially provided C language SDK, and quickly generate a complete project framework through the scaffolding tool (create_app.sh).

  • Advantages: Automatically handles logging, signals, packaging, and can easily integrate into the system's web UI (through UCI/USI configuration files), greatly simplifying the development process.

  • Applicable Scenarios: Applications that need to provide configuration and status pages in the system web UI, C language applications that need deep interaction with system services.

Detailed guide: RobustOS Pro SDK - Quick Start Guide

How to Debug Your Program

Deployment MethodView StatusView Real-time LogsEnter Environment for Debugging
Debian Package (Systemd)systemctl status my-appjournalctl -u my-app -f-
Docker Containerdocker psdocker logs -f my-containerdocker exec -it my-container /bin/bash

General Tip: Before packaging your application as a service, run your program directly in an SSH terminal to see its output and error messages directly.

⚠️ The system's default admin user is not a standard shell environment. You need to add a sudo user and connect via SSH to execute shell commands.

Steps for adding a sudo user, please refer to: RobustOS Pro Adding Development Users Guide

How to Deploy Your Application

Approach 1: Debian Package (.deb)

This approach is suitable for background services that need to auto-start on boot. The standard process is to create a .deb package containing a systemd service file.

Core Steps:

  1. Write your application.

  2. Write a .service file defining how to start and manage your application.

  3. Create a postinst post-installation script that uses systemctl enable and systemctl start to enable and start your service.

  4. Use debuild or other tools to package the above files into a .deb file.

Detailed guide: Systemd Integration Guide for Robustel Gateway

Approach 2: Docker Container

Docker container deployment provides excellent environment isolation and dependency management.

Core Steps:

  1. Write your application.

  2. Write a Dockerfile to define how to build the application's container image.

  3. (Optional but recommended) Write a docker-compose.yml file to define how to run the container (such as port mapping, device mapping, etc.).

Detailed guide: Deploying Applications with Docker on RobustOS Pro

How to Deploy to Multiple Devices at Scale

For large-scale deployments, the ability to efficiently replicate a mature application and configuration solution across hundreds or thousands of devices is critical to success.. RobustOS Pro provides a system cloning feature to address various bulk deployment scenarios.

The system cloning feature can create a complete system snapshot (clone package) for a configured "template gateway", which includes all installed applications, system configurations, and data.

Using the clone package, you can achieve two deployment scenarios:

This is our strongly recommended bulk deployment method, especially suitable for large-scale production.

After your application is developed and tested on a prototype, you can create a clone package and provide it to Robustel. Your application and configuration will be pre-installed on devices directly during the factory production stage. Devices are ready to use out of the box without requiring manual configuration per device, greatly improving deployment efficiency and reliability.

Scenario 2: Manual Cloning

This approach is suitable for small-batch deployment or unified configuration after devices have been distributed.

You can create a clone package and then use USB recovery to execute recovery commands on target devices one by one, restoring them to the exact same state as the template gateway.

Operation Steps

In either scenario, the first step is to create a clone package.

  1. Prepare Template Gateway: On one gateway, install all necessary applications (e.g., .deb packages, Docker images, etc.) and complete all system configurations.

  2. Create Clone Package: Connect an ext4-formatted USB drive to the gateway, then execute the following command via SSH:

# <usb_mount_point> is usually /media/sda1 or similar path
sudo rbt-system-mgmt clone create -D <usb_mount_point>

This command will generate a .tar.gz format clone package file in the USB drive's root directory.

  • If you choose Scenario 1, please provide this file to Robustel.

  • If you choose Scenario 2, continue to the next step.

  1. Manually Restore Clone Package: On the new target gateway, execute the restore command:
sudo rbt-system-mgmt clone restore <path_to_clone_package.tar.gz>

Detailed operation guide: Creating a System Clone Package Operation Guide

How Applications Access Hardware Interfaces

Applications access hardware through standard Linux file I/O.

InterfaceDevice File PathAccess Method
Serial Port/dev/ttyCOMxStandard serial port programming (e.g., Python's pyserial library)
Digital Input (DI)/dev/DIxRead input events through evdev library
Digital Output (DO)/sys/class/leds/doX/brightnessWrite "1" or "0"

Detailed guide: RobustOS Pro Hardware Interface Quick Usage Guide

⚠️ Docker Container Hardware Access: To grant a Docker container access to hardware, use the --device parameter when starting the container, such as --device=/dev/ttyCOM1:/dev/ttyCOM1.

How Applications Obtain Device Status

The simplest and most reliable way to obtain device status is to use the usi (Unified Status Interface) command.

Core Pattern: First sync (synchronize), then get (retrieve).

Common StatusQuery Command (Example)
Serial Number (SN)sudo usi get system.serial_number
Network IP Addresssudo usi sync wan_links sudo usi get active_link.ip
Cellular Signal Strengthsudo usi sync cellular sudo usi get cellular.status[1].rsrp
GPS Latitudesudo usi sync gps sudo usi get gps.latitude

Detailed guide: RobustOS Pro Device Status Query Manual (USI)

Application-Related System Configuration

Refer to the following sections if your application needs to manage system functions or interact with system services.

Network Configuration

  • Recommended Approach: Always use the uci command for persistent network configuration.
# Example: Set static IP
sudo uci set wan_links.link[1].ipv4.connection_type manual
sudo uci set wan_links.link[1].ipv4.address "192.168.1.100/24"
sudo uci commit
  • Advanced Approach: If uci cannot satisfy a specific advanced network parameter (such as never-default), you can use the nmcli command to modify directly, but you must use a monitoring script to ensure your changes persist and are re-applied if the system's UCI configuration is modified.

Warning: Changes made directly with nmcli or by modifying .nmconnection files are temporary and will be automatically overwritten when system network configuration has uci changes, potentially causing network interruption.

Detailed guide: NetworkManager Integration Guide

Firewall Configuration

  • Recommended Approach: For simple port opening, use uci to add firewall rules.

  • Advanced Approach: For complex iptables rules, it's recommended to create custom scripts in the /tmp/fw.d/ directory.

    • Note: Files in the /tmp directory will be lost after restart. You must create a systemd service that copies your script from a persistent directory (such as /data/my_app/) to /tmp/fw.d/ at boot and executes fw_restart.

Detailed guide: RobustOS Pro Firewall Configuration Guide

Providing Web Services

  • Approach 1: Independent Port: Let your application listen directly on a non-conflicting port (such as 8080), users access via http://:8080. If your application needs to use the default web ports (80/443), you must first reconfigure the system's administration UI to use different ports. Modification method, please refer to RobustOS Pro UCI Configuration Manual

  • Approach 2: Nginx Reverse Proxy (Recommended): Let your application listen on a local port (such as 5000), then configure Nginx to proxy traffic from https:///myapp/ to http://127.0.0.1:5000.

    • Advantages: Unified access point, automatic HTTPS encryption, more secure and professional.

Nginx proxy configuration example (/etc/nginx/server_common_conf/myapp.conf):

location /myapp/ {
    proxy_pass http://127.0.0.1:5000/; # Proxy to your application's address
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
}

Detailed guide: Web Service Integration Guide for RobustOS Pro

All of the above configurations may involve modifying system UCI configuration. For detailed UCI configuration options, please refer to: RobustOS Pro UCI Configuration Manual

    • Related Articles

    • RobustOS Pro Third-Party Application Development Guide

      1. Quick Overview What is RobustOS Pro? RobustOS Pro is an embedded Linux distribution based on Debian 11 (bullseye), designed specifically to meet the demanding requirements of industrial IoT gateways, providing a high degree of customization and ...
    • RobustOS Pro SDK

      Robustel's router allows 3rd party to develop their applications. We provide a Software Development Kit (SDK), which offers a simple and fast way to implement customer-specific functions and applications. This SDK is compatible with EG5100, LG5100, ...
    • RobustOS Pro SDK - Quick Start Guide

      Prerequisites Before you begin, ensure you have: Hardware: One of the supported RobustOS Pro devices (EG5100, LG5100, R1520LG, EV8100, EG5101, EG5200, EG5120, or EG3110) Network Access: SSH access to your device User Account: A sudo user account on ...
    • RobustOS Pro Adding Development Users Guide

      When accessing devices via SSH using the default administrator user (admin) in the RobustOS Pro system, you are not in a standard shell environment and can only execute a limited set of commands. If you need to develop your own applications on the ...
    • Edge Gateway Main Page

      Edge Gateway Configuration & Development Your central hub for mastering Robustel Edge Gateways, tailored for developers and system integrators. From basic device configuration to advanced application development and third-party integration, find the ...