System

Description

The System object provides device and operating system related properties such as clock, cpuLoad and hostname. It also allows changing the system hostname and configure system services required and/or used by the application.

› Inherits:Object

Properties

bootloaderVersion

This property holds the version of the bootloader used for booting the operating system.

› Type:String
› Attributes:Readonly

clock

This property holds the current UTC timestamp used by the system. This value is equivalent to the well-known UNIX time and represents the number of seconds that have elapsed since 00:00:00 Thursday, 1 January 1970 (UTC) minus leap seconds.

› Type:SignedBigInteger
› Attributes:Readonly

cpuLoad

This property holds the system load average for the last minute. The value is equivalent to the well-known UNIX load and indicates how many processes are consuming CPU time and waiting for I/O.

› Type:Double
› Signal:cpuLoadChanged()
› Attributes:Readonly, Requires Polling

cpuUsage

This property holds the average CPU usage in percent. When polled for the first time, it will return the total CPU usage since system start while subsequent polls return the CPU usage since the previous poll.

This property was introduced in InCore 2.5.

› Type:SignedInteger
› Signal:cpuUsageChanged()
› Attributes:Readonly, Requires Polling

deviceHumidity

This property holds the relative humidity measured inside the device.

› Type:Float
› Signal:deviceHumidityChanged()
› Attributes:Readonly, Requires Polling

deviceId

This property holds a worldwide unique ID associated with the running device. The ID is based on the MAC address of the primary network interface and consists of 12 hexadecimal digits.

› Type:String
› Attributes:Readonly

deviceName

This property holds the name of the device. This can be a description with arbitrary UTF-8 characters.

› Type:String
› Signal:deviceNameChanged()
› Attributes:Writable

deviceSubtype

This property holds the subtype of the device which the application currently is running on. The proper values are deviceType-specific and only should be set by the vendor.

This property was introduced in InCore 2.6.

› Type:String
› Signal:deviceSubtypeChanged()
› Attributes:Writable

deviceTemperature

This property holds the temperature measured inside the device in °C. This temperature does not indicate the CPU temperature even though both temperatures correlate with each other.

› Type:Float
› Signal:deviceTemperatureChanged()
› Attributes:Readonly, Requires Polling

deviceType

This property holds the type of the device which the application currently is running on.

› Type:DeviceType
› Signal:deviceTypeChanged()
› Attributes:Readonly

error

This property holds the most recently occurred error or System.NoError if no error occurred. If the same error occurs multiple times this property does not change. Use the errorOccurred() signal to detect multiple occurrences of the same error.

› Type:Error
› Signal:errorChanged()
› Attributes:Readonly

errorString

This property holds the current human readable error string corresponding to the current value in the error property. It may include additional information such as failure reasons or locations.

› Type:String
› Signal:errorStringChanged()
› Attributes:Readonly

hostname

This property holds the hostname of the system. The hostname must follow the usual conventions for allowed characters. Changing this property allows operating multiple devices of the same type in a network and address them through multicast DNS (i.e. <hostname>.local) instead of regular DNS.

› Type:String
› Signal:hostnameChanged()
› Attributes:Writable

memoryAvailable

This property holds the available (unused) memory of the system in MiB.

This property was introduced in InCore 2.5.

› Type:SignedInteger
› Signal:memoryAvailableChanged()
› Attributes:Readonly, Requires Polling

memoryTotal

This property holds the total memory of the system in MiB.

This property was introduced in InCore 2.5.

› Type:SignedInteger
› Signal:memoryTotalChanged()
› Attributes:Readonly

osEdition

This property holds the edition of the operating system currently running on the device.

This property was introduced in InCore 2.7.

› Type:String
› Attributes:Readonly

osVersion

This property holds the version of the operating system currently running on the device.

› Type:String
› Attributes:Readonly

services

This property holds a list of system services to configure and use in the application. See the documentation for SystemService for details.

› Type:List<SystemService>
› Signal:servicesChanged()
› Attributes:Readonly

uptime

This property holds how long the system has been running since last boot. The uptime is provided in days, hours and minutes.

› Type:String
› Signal:uptimeChanged()
› Attributes:Readonly, Requires Polling

Methods

pollCpuLoad()

This method polls the cpuLoad property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.

pollCpuUsage()

This method polls the cpuUsage property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.

pollDeviceHumidity()

This method polls the deviceHumidity property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.

pollDeviceTemperature()

This method polls the deviceTemperature property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.

pollMemoryAvailable()

This method polls the memoryAvailable property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.

pollUptime()

This method polls the uptime property. It is called automatically when using a Polling property modifier on this property and usually does not have to be called manually.

reboot()

This method initiates a full system restart. Since the application will be stopped almost immediately any actions such as logging or closing connections should be performed before calling this method.

This method was introduced in InCore 2.0.

setHardwareClocks()

This method sets all available hardware clocks (RTCs) to the current system time.

This method was introduced in InCore 2.7.

shutdown()

This method initiates a clean system shutdown. Since the application will be stopped almost immediately any actions such as logging or closing connections should be performed before calling this method.

This method was introduced in InCore 2.7.

Signals

errorOccurred()

This signal is emitted whenever an error has occurred, regardless of whether the error property has changed or not. In contrast to the change notification signal of the error property this signal is also emitted several times if a certain error occurs several times in succession.

servicesDataChanged(SignedInteger index)

This signal is emitted whenever the List.dataChanged() signal is emitted, i.e. the item at index in the services list itself emitted the dataChanged() signal.

Enumerations

DeviceType

This enumeration describes the type of the device which the application can be run on.

Name Value Description
System.Other -1 Other/unknown device.
System.GM100 0 A HUB-GM100 (single-core) device.
System.GM200 1 A HUB-GM200 (dual-core) device.
System.GM400 2 A HUB-GM400 (quad-core) device.
System.IM6 3 An IM6-XXNNN device.
System.CCM60 4 A TURCK IM18-CCM60 device.

Error

This enumeration describes all errors which can occur in System objects. The most recently occurred error is stored in the error property.

Name Value Description
System.NoError 0 No error occurred or was detected.
System.EmptyHostname 1 Can’t set empty hostname.
System.InvalidHostname 2 Hostname is invalid, likely due to invalid characters.

Example

import InCore.Foundation 2.5

Application {
    System {
        Polling on cpuUsage { }
        Polling on memoryAvailable { }
        onCpuUsageChanged: console.log("CPU usage:", cpuUsage, "%")
        onMemoryAvailableChanged: console.log(("%1 of %2 MiB used").arg(memoryTotal-memoryAvailable).arg(memoryTotal))
    }
}