Module: Toybox::System

Overview

The System module provides basic system information, including access to the clock time, device settings, battery level, and memory use.

Since:

  • 1.0.0

Defined Under Namespace

Classes: AppNotInstalledException, ClockTime, ConnectionInfo, DeviceSettings, Intent, PreviousOperationNotCompleteException, ServiceDelegate, Stats, UnexpectedAppTypeException

Constant Summary

UNIT_METRIC = 0

Display units in metric units

Since:

  • 1.0.0

UNIT_STATUTE = 1

Display units in statute units

Since:

  • 1.0.0

SCREEN_SHAPE_ROUND = 1

Since:

  • 1.2.0

SCREEN_SHAPE_SEMI_ROUND = 2

Since:

  • 1.0.0

SCREEN_SHAPE_RECTANGLE = 3

Since:

  • 1.2.0

BUTTON_INPUT_SELECT = 0x00000001

Since:

  • 1.2.0

BUTTON_INPUT_UP = 0x00000002

Since:

  • 1.2.0

BUTTON_INPUT_DOWN = 0x00000004

Since:

  • 1.2.0

BUTTON_INPUT_MENU = 0x00000008

Since:

  • 1.2.0

BUTTON_INPUT_CLOCK = 0x00000010

Since:

  • 3.1.0

BUTTON_INPUT_DOWN_LEFT = 0x00000020

Since:

  • 3.1.0

BUTTON_INPUT_DOWN_RIGHT = 0x00000040

Since:

  • 3.1.0

BUTTON_INPUT_ESC = 0x00000080

Since:

  • 3.1.0

BUTTON_INPUT_FIND = 0x00000100

Since:

  • 3.1.0

BUTTON_INPUT_LAP = 0x00000200

Since:

  • 3.1.0

BUTTON_INPUT_LEFT = 0x00000400

Since:

  • 3.1.0

BUTTON_INPUT_LIGHT = 0x00000800

Since:

  • 3.1.0

BUTTON_INPUT_MODE = 0x00001000

Since:

  • 3.1.0

BUTTON_INPUT_PAGE = 0x00002000

Since:

  • 3.1.0

BUTTON_INPUT_POWER = 0x00004000

Since:

  • 3.1.0

BUTTON_INPUT_RESET = 0x00008000

Since:

  • 3.1.0

BUTTON_INPUT_RIGHT = 0x00010000

Since:

  • 3.1.0

BUTTON_INPUT_SPORT = 0x00020000

Since:

  • 3.1.0

BUTTON_INPUT_START = 0x00040000

Since:

  • 3.1.0

BUTTON_INPUT_UP_LEFT = 0x00080000

Since:

  • 3.1.0

BUTTON_INPUT_UP_RIGHT = 0x00100000

Since:

  • 3.1.0

BUTTON_INPUT_ZIN = 0x00200000

Since:

  • 3.1.0

BUTTON_INPUT_ZOUT = 0x00400000

Since:

  • 3.1.0

CONNECTION_STATE_NOT_INITIALIZED = 0

Indicates that the connection is not setup or is inactive.

Since:

  • 3.0.0

CONNECTION_STATE_NOT_CONNECTED = 1

Indicates that the connection has been setup but is not in range.

Since:

  • 3.0.0

CONNECTION_STATE_CONNECTED = 2

Indicates that the connection is available for use.

Since:

  • 3.0.0

LANGUAGE_ARA = 8389920

Arabic

Since:

  • 3.1.0

LANGUAGE_BUL = 8389921

Bulgarian

Since:

  • 3.1.0

LANGUAGE_CES = 8389352

Czech

Since:

  • 3.1.0

LANGUAGE_CHS = 8389372

Chinese (Simplified)

Since:

  • 3.1.0

LANGUAGE_CHT = 8389371

Chinese (Traditional)

Since:

  • 3.1.0

LANGUAGE_DAN = 8389353

Danish

Since:

  • 3.1.0

LANGUAGE_DEU = 8389358

German

Since:

  • 3.1.0

LANGUAGE_DUT = 8389354

Dutch

Since:

  • 3.1.0

LANGUAGE_ENG = 8389355

English

Since:

  • 3.1.0

LANGUAGE_EST = 8390796

Estonian

Since:

  • 3.1.0

LANGUAGE_FIN = 8389356

Finnish

Since:

  • 3.1.0

LANGUAGE_FRE = 8389357

French

Since:

  • 3.1.0

LANGUAGE_GRE = 8389359

Greek

Since:

  • 3.1.0

LANGUAGE_HEB = 8389919

Hebrew

Since:

  • 3.1.0

LANGUAGE_HRV = 8389361

Croatian

Since:

  • 3.1.0

LANGUAGE_HUN = 8389360

Hungarian

Since:

  • 3.1.0

LANGUAGE_IND = 8389578

Bahasa Indonesia

Since:

  • 3.1.0

LANGUAGE_ITA = 8389362

Italian

Since:

  • 3.1.0

LANGUAGE_JPN = 8389373

Japanese

Since:

  • 3.1.0

LANGUAGE_KOR = 8389696

Korean

Since:

  • 3.1.0

LANGUAGE_LAV = 8390797

Latvian

Since:

  • 3.1.0

LANGUAGE_LIT = 8390798

Lithuanian

Since:

  • 3.1.0

LANGUAGE_NOB = 8389363

Norwegian

Since:

  • 3.1.0

LANGUAGE_POL = 8389364

Polish

Since:

  • 3.1.0

LANGUAGE_POR = 8389365

Portuguese

Since:

  • 3.1.0

LANGUAGE_RON = 8390799

Romanian

Since:

  • 3.1.0

LANGUAGE_RUS = 8389366

Russian

Since:

  • 3.1.0

LANGUAGE_SLO = 8389367

Slovak

Since:

  • 3.1.0

LANGUAGE_SLV = 8389368

Slovenian

Since:

  • 3.1.0

LANGUAGE_SPA = 8389369

Spanish

Since:

  • 3.1.0

LANGUAGE_SWE = 8389370

Swedish

Since:

  • 3.1.0

LANGUAGE_THA = 8389548

Thai

Since:

  • 3.1.0

LANGUAGE_TUR = 8389774

Turkish

Since:

  • 3.1.0

LANGUAGE_UKR = 8390800

Ukranian

Since:

  • 3.1.0

LANGUAGE_VIE = 8390206

Vietnamese

Since:

  • 3.1.0

LANGUAGE_ZSM = 8389579

Standard (Bahasa) Malay

Since:

  • 3.1.0

Instance Method Summary collapse

Instance Method Details

error(msg) ⇒ Object

Note:

There are never really too many bananas.

Write an error to the console and exit the system.

Examples:

using Toybox.System;
const MAX_BANANAS = 8;
var bananasInBunch = 10;
if (bananasInBunch > MAX_BANANAS) {
    System.error("Too many bananas!")
}

Parameters:

Since:

  • 1.0.0


11253
11254
# File 'Monkeybrains.rb', line 11253

def error(msg)
end

exitObject

End execution of the current app.

This will exit the system cleanly from any point within an app.

Since:

  • 1.0.0


11239
11240
# File 'Monkeybrains.rb', line 11239

def exit()
end

exitTo(intent) ⇒ Object

Exit the current app and launch a new app.

This may only be called by watch-apps and widgets, and may only target watch-apps (both native activities and Connect IQ apps) and widgets. This is an asynchronous request that presents a confirmation dialog to launch the Intent. If confirmed, the current app will exit. Otherwise, the app will continue to run without exiting.

Examples:

using Toybox.System;
var targetApp = new System.Intent(
    "manifest-id://12345678-1234-1234-1234-123412341234",
    {"arg"=>"CurrentAppName"}
);
System.exitTo(targetApp);

Parameters:

Raises:

See Also:

Since:

  • 2.2.0


11279
11280
# File 'Monkeybrains.rb', line 11279

def exitTo(intent)
end

getClockTimeToybox::System::ClockTime

Get the current clock time.

Returns:

Since:

  • 1.0.0


11215
11216
# File 'Monkeybrains.rb', line 11215

def getClockTime()
end

getDeviceSettingsToybox::System::DeviceSetting

Get the current device settings.

Examples:

using Toybox.System;
var mySettings = System.getDeviceSettings();

Returns:

  • (Toybox::System::DeviceSetting)

Since:

  • 1.0.0


11224
11225
# File 'Monkeybrains.rb', line 11224

def getDeviceSettings()
end

getSystemStatsToybox::System::Stats

Get the current system stats.

Returns:

Since:

  • 1.0.0


11232
11233
# File 'Monkeybrains.rb', line 11232

def getSystemStats()
end

getTimerToybox::Lang::Number

Get the current millisecond timer value.

Returns:

Since:

  • 1.0.0


11209
11210
# File 'Monkeybrains.rb', line 11209

def getTimer()
end

Print to the console.

Parameters:

Since:

  • 1.0.0


11203
11204
# File 'Monkeybrains.rb', line 11203

def print(output)
end

println(output) ⇒ Object

Print to the console with a line terminator.

Examples:

using Toybox.System;
System.println("Hello Monkey C!");

Parameters:

Since:

  • 1.0.0


11196
11197
# File 'Monkeybrains.rb', line 11196

def println(output)
end