Module modes

Source
Expand description

Modes.

The ECMA-48 standard is intended to be applicable to a very large range of devices, in which there are variations. Some of these variations have been formalized in the form of modes. They deal with the way in which a device transmits, receives, processes, or images data. Each mode has two states. The reset state, and the set state.

The states of the modes may be established explicitly in the data stream by the control functions SET MODE (SM) and RESET MODE (RM) or may be established by agreement between sender and recipient. In an implementation, some or all of the modes have one state only.

To ensure data compatibility and ease of interchange with a variety of equipment the use of modes is deprecated. If modes have to be implemented for backward compatibility it is recommended that the reset state of the modes be the initial state. Otherwise, explicit agreements will have to be negotiated between sender and recipient, to the detriment of “blind” interchange.

§Usage

Two possibilities exist to use modes.

§Directly invoking SM or RM Control Functions

You can pass modes to the arguments of the control functions SET MODE (SM) and RESET MODE (RM).

use ansi_control_codes::control_sequences;
use ansi_control_codes::modes;

// set the device component select mode to PRESENTATION.
print!("{}", control_sequences::SM(vec![modes::DCSM]));
// set the device component select mode to DATA.
print!("{}", control_sequences::RM(vec![modes::Mode::DeviceComponentSelectMode]));

§Setting or Resetting Modes

You can invoke the set and reset functions of a mode instead.

use ansi_control_codes::modes;

// set the device component select mode to PRESENTATION.
print!("{}", modes::DCSM.set());
// set the device component select mode to DATA.
print!("{}", modes::Mode::DeviceComponentSelectMode.reset());

Enums§

Mode
Device Modes.

Constants§

BDSM
Bi-directional support mode BDSM.
CRM
Control Presentation Mode CRM.
DCSM
Device Component Select Mode DCSM.
ERM
Erasure Mode ERM.
FEAM
Format Effector Action Mode FEAM.
FETM
Format Effector Transfer Mode FETM.
GATM
Guarded Area Transfer Mode GATM.
GRCM
Graphic Rendition Combination Mode GRCM.
HEM
Character Editing Mode HEM.
IRM
Insertion Replacement Mode IRM.
KAM
Keyboard Action Mode KAM.
MATM
Multiple Area Transfer Mode MATM.
PUM
Positioning Unit Mode PUM.
SATM
Selected Area Transfer Mode SATM.
SRM
Send/Receive Mode SRM.
SRTM
Status Report Transfer Mode SRTM.
TSM
Tabulation Stop Mode TSM.
TTM
Transfer Termination Mode TTM.
VEM
Line Editing Mode VEM.
ZDM
Zero Default Mode ZDM.