Settings

Application settings and preferences

Settings

Reference for OctoMY™ application settings and configuration options.

Pro Tip

Environment variables override settings files, and command-line options override environment variables. This three-tier system lets you configure defaults in the settings file, environment-specific overrides via variables, and per-run overrides via CLI - perfect for deployment and testing.


Settings overview

OctoMY™ uses Qt's QSettings system for persistent configuration:

Settings Architecture


Settings categories

General settings

Key Type Default Description
personality/name string Generated Node display name
personality/id string Generated Node identity hash
general/firstRun bool true First launch flag
general/lastVersion string "" Last run version

Network settings

Key Type Default Description
network/localPort int 8124-8126 Local UDP port
network/enableDiscovery bool true Enable multicast discovery
network/discoveryInterval int 5000 Discovery interval (ms)
network/enableBluetooth bool false Enable Bluetooth carrier

Connection settings

Key Type Default Description
connection/keepaliveInterval int 5000 Keepalive ping interval
connection/timeout int 15000 Connection timeout
connection/maxRetries int 5 Max reconnection attempts
connection/autoReconnect bool true Auto reconnect on disconnect

Security settings

Key Type Default Description
security/keySize int 2048 RSA key size (bits)
security/requirePairing bool true Require pairing for connections
security/peerTimeout int 45000 Peer verification timeout

UI settings

Key Type Default Description
ui/theme string "auto" Theme: auto, light, dark
ui/language string "en" UI language code
ui/showStatusBar bool true Show status bar
ui/confirmClose bool true Confirm on application close

Node-specific settings

Agent settings

Settings specific to Agent (robot) nodes:

Key Type Default Description
agent/autoStart bool false Auto-start on boot
agent/defaultPlan string "" Default Plan to activate
agent/sensorUpdateRate int 50 Sensor polling rate (ms)
agent/motorSafetyTimeout int 500 Motor stop if no command
agent/enableVoice bool false Enable text-to-speech

Remote settings

Settings specific to Remote (controller) nodes:

Key Type Default Description
remote/joystickDeadzone float 0.1 Joystick deadzone
remote/invertY bool false Invert Y axis
remote/hapticFeedback bool true Enable vibration feedback
remote/showSensorData bool true Display sensor readings

Hub settings

Settings specific to Hub (fleet) nodes:

Key Type Default Description
hub/maxAgents int 100 Maximum managed Agents
hub/logRetention int 7 Log retention (days)
hub/enableAPI bool false Enable REST API
hub/apiPort int 8180 REST API port

Settings API

Reading settings

#include "app/Settings.hpp"

// Get Settings instance
Settings* settings = mContext->settings();

// Read values with defaults
QString name = settings->value("personality/name", "Unknown").toString();
int port = settings->value("network/localPort", 8124).toInt();
bool discovery = settings->value("network/enableDiscovery", true).toBool();

Writing settings

// Write values
settings->setValue("personality/name", "MyRobot");
settings->setValue("network/localPort", 8124);
settings->setValue("network/enableDiscovery", true);

// Force immediate write
settings->sync();

Settings groups

// Use groups for organization
settings->beginGroup("network");
int port = settings->value("localPort", 8124).toInt();
bool discovery = settings->value("enableDiscovery", true).toBool();
settings->endGroup();

Watching settings changes

// Connect to settings changes
connect(settings, &Settings::valueChanged,
        [](const QString& key, const QVariant& value) {
    qDebug() << "Setting changed:" << key << "=" << value;
});

Settings file format

Settings are stored in INI format:

[General]
firstRun=false
lastVersion=1.0.0

[personality]
name=MyRobot
id=abc123def456...

[network]
localPort=8124
enableDiscovery=true
discoveryInterval=5000

[connection]
keepaliveInterval=5000
timeout=15000
autoReconnect=true

[security]
keySize=2048
requirePairing=true

[ui]
theme=dark
language=en

Environment variables

Environment variables override settings:

Variable Override Description
OCTOMY_PORT network/localPort Local UDP port
OCTOMY_PERSONALITY personality/name Personality name
OCTOMY_DATA_DIR Data directory Override data location
OCTOMY_LOG_LEVEL Logging level debug, info, warn, error
OCTOMY_NO_DISCOVERY network/enableDiscovery Disable discovery

Using environment variables

# Override port
export OCTOMY_PORT=9000

# Override personality
export OCTOMY_PERSONALITY=TestBot

# Set log level
export OCTOMY_LOG_LEVEL=debug

# Run application
./octomy-agent

Constants

Application constants defined in Constants.hpp:

Application constants

Constant Value Description
APP_NAME "OctoMY" Application name
APP_VERSION varies Current version
APP_ORGANIZATION "OctoMY™" Organization name

Network constants

Constant Value Description
ZOO_DEFAULT_PORT 8123 Zoo server port
AGENT_DEFAULT_PORT 8124 Agent default port
REMOTE_DEFAULT_PORT 8125 Remote default port
HUB_DEFAULT_PORT 8126 Hub default port
DISCOVERY_ADDRESS "224.0.0.124" Multicast address

Protocol constants

Constant Value Description
MULTIMAGIC "OctoMYM!" Packet magic header
DISCOVERY_MAGIC "OctoMYD!" Discovery magic
PROTOCOL_VERSION 1 Current protocol version
MAX_PACKET_SIZE 65507 Maximum UDP payload

Timing constants

Constant Value Description
KEEPALIVE_INTERVAL_MS 5000 Keepalive interval
CONNECTION_TIMEOUT_MS 15000 Connection timeout
DISCOVERY_INTERVAL_MS 5000 Discovery interval
SENSOR_UPDATE_MS 50 Default sensor rate

Settings migration

Version migration

When updating OctoMY™, settings may need migration:

void migrateSettings(Settings* settings) {
    QString lastVersion = settings->value("general/lastVersion").toString();
    QString currentVersion = APP_VERSION;

    if (lastVersion < "1.1.0") {
        // Migrate old key format
        if (settings->contains("port")) {
            settings->setValue("network/localPort",
                             settings->value("port"));
            settings->remove("port");
        }
    }

    settings->setValue("general/lastVersion", currentVersion);
}

Backup and restore

// Export settings to file
void exportSettings(Settings* settings, const QString& path) {
    QFile file(path);
    if (file.open(QIODevice::WriteOnly)) {
        QTextStream out(&file);
        for (const QString& key : settings->allKeys()) {
            out << key << "=" << settings->value(key).toString() << "\n";
        }
    }
}

// Import settings from file
void importSettings(Settings* settings, const QString& path) {
    QFile file(path);
    if (file.open(QIODevice::ReadOnly)) {
        QTextStream in(&file);
        while (!in.atEnd()) {
            QString line = in.readLine();
            QStringList parts = line.split("=");
            if (parts.size() == 2) {
                settings->setValue(parts[0], parts[1]);
            }
        }
    }
}

Default settings

Reset to defaults

void resetToDefaults(Settings* settings) {
    // Network defaults
    settings->setValue("network/localPort", AGENT_DEFAULT_PORT);
    settings->setValue("network/enableDiscovery", true);
    settings->setValue("network/discoveryInterval", 5000);

    // Connection defaults
    settings->setValue("connection/keepaliveInterval", 5000);
    settings->setValue("connection/timeout", 15000);
    settings->setValue("connection/autoReconnect", true);

    // Security defaults
    settings->setValue("security/keySize", 2048);
    settings->setValue("security/requirePairing", true);

    // UI defaults
    settings->setValue("ui/theme", "auto");
    settings->setValue("ui/language", "en");

    settings->sync();
}

Settings locations

Platform-specific paths

Platform Settings Path
Linux ~/.config/OctoMY™/OctoMY Agent.conf
Windows %APPDATA%\OctoMY™\OctoMY Agent.conf
macOS ~/Library/Preferences/org.octomy.agent.plist
Android App-specific internal storage

Data directory

Platform Data Path
Linux ~/.local/share/OctoMY™/OctoMY Agent/
Windows %APPDATA%\OctoMY™\OctoMY Agent\
macOS ~/Library/Application Support/OctoMY™/
Android App-specific internal storage

Cache directory

Platform Cache Path
Linux ~/.cache/OctoMY™/OctoMY Agent/
Windows %LOCALAPPDATA%\OctoMY™\OctoMY Agent\cache\
macOS ~/Library/Caches/OctoMY™/
Android App-specific cache directory

Troubleshooting

Common issues

Issue Cause Solution
Settings not persisted Permissions Check write access to config dir
Settings reset Corrupt file Delete settings file to reset
Wrong port Override active Check environment variables
Settings conflict Multiple instances Use different personalities

Debugging settings

# View current settings file (Linux)
cat ~/.config/OctoMY™/OctoMY\ Agent.conf

# Watch settings changes
watch -n 1 cat ~/.config/OctoMY™/OctoMY\ Agent.conf

# Clear all settings
rm -f ~/.config/OctoMY™/OctoMY\ Agent.conf

In this section
Topics
reference configuration settings QSettings
See also