Home Reference Source Test Repository
import {System} from 'nextion/src/system.js'
public class | source

System

Extends:

EventEmitter → System

System-level Nextion device functionality.

Constructor Summary

Public Constructor
public

constructor(uart: UART)

Creates a System instance.

Member Summary

Public Members
public

uart: *

Method Summary

Public Methods
public

Gets a random value, optionally setting the allowed range via System#setRandomRange.

public

Set sleep timer when not touched.

public

Sets the range of results returned by System#random.

public

Sets value of system variable.

public

Puts Nextion to sleep.

public

Wakes Nextion from sleep.

Public Constructors

public constructor(uart: UART) source

Creates a System instance.

Params:

NameTypeAttributeDescription
uart UART

UART instance.

Public Members

public uart: * source

Public Methods

public random(min: number, max: number): Promise<ResponseResult, TypeError> source

Gets a random value, optionally setting the allowed range via System#setRandomRange.

Params:

NameTypeAttributeDescription
min number
  • optional
  • default: 0

Unsigned integer; no greater than max

max number
  • optional
  • default: 0

Unsigned integer; no less than min

Return:

Promise<ResponseResult, TypeError>

Result or error if invalid range supplied

public setNoTouchSleepTimer(ms: number): Promise<ResponseResult, Error> source

Set sleep timer when not touched.

Params:

NameTypeAttributeDescription
ms number

Sleep after ms milliseconds of no touching. Rounded to closest second.

Return:

Promise<ResponseResult, Error>

Result

public setRandomRange(min: number, max: number): Promise<ResponseResult, TypeError> source

Sets the range of results returned by System#random.

Params:

NameTypeAttributeDescription
min number
  • optional
  • default: 0

Unsigned integer; no greater than max

max number
  • optional
  • default: 4294967295

Unsigned integer; no less than min

Return:

Promise<ResponseResult, TypeError>

Response or {@link TypeError} if invalid min or max value

public setSystemVariable(name: string, value: number): Promise<ResponseResult, TypeError> source

Sets value of system variable.

Params:

NameTypeAttributeDescription
name string

Name of system variable; either sys0, sys1, or sys2.

value number

Must be an unsigned integer less than or equal to 4294967295.

Return:

Promise<ResponseResult, TypeError>

Response or TypeError if invalid name or value

public sleep(shouldSleep: boolean): Promise<ResponseResult, Error> source

Puts Nextion to sleep.

Params:

NameTypeAttributeDescription
shouldSleep boolean
  • optional
  • default: true

Sleep if true; wake if false.

Return:

Promise<ResponseResult, Error>

Result

See:

public wake(): Promise<ResponseResult, Error> source

Wakes Nextion from sleep.

Return:

Promise<ResponseResult, Error>

Result

See: