Appendix 4 - constants, Battery and power management constants – Casio Naurtech CETerm Ver.5.5 Scripting Guide User Manual

Page 143

Advertising
background image

N

AURTECH

W

EB

B

ROWSER AND

T

ERMINAL

E

MULATION FOR

W

INDOWS

CE

AND

W

INDOWS

M

OBILE




CETerm Scripting Guide

Page 143


Appendix 4 - Constants

This appendix contains various constants that are used by CETerm Automation
Objects. Many of these constants are a direct representation of the equivalent
values from the Windows CE system APIs and constants.

These constants are mostly presented as global JavaScript variables for direct
inclusion in scripts. For simple scripts, a few extra global variables are not
harmful, but good programming practices seek to minimize globals to prevent
accidental name collisions. Some constants below are represented more
appropriately as properties of

“constant” objects.


For efficiency, you should not include constant definitions that are not used by
your scripts. One good pattern is to re-express the needed constants as
members of a single CONSTANTS object. Here is a brief example showing how
a single CONTANTS object might contain multiple categories of constants.

// Express constants as object properties.
var CONSTANTS = {
MESSAGEBOX: {FLAG_OK:0x00000000, FLAG_OKCANCEL:0x00000001},
FILE_ATTRIBUTE: {READONLY:0x00000001, HIDDEN:0x00000002},
SERIAL_PORT: {NOPARITY:0x00, ODDPARITY:0x01, EVENPARITY:0x02}
}

// Refer to constants using normal JavaScript syntax
var myparity = CONSTANTS.SERIAL_PORT.ODDPARITY;

B

ATTERY AND

P

OWER

M

ANAGEMENT

C

ONSTANTS


// Power Management and Battery Constants
//
var AC_LINE_OFFLINE = 0x00;
var AC_LINE_ONLINE = 0x01;
var AC_LINE_BACKUP_POWER = 0x02;
var AC_LINE_UNKNOWN = 0xFF;

var BATTERY_FLAG_HIGH = 0x01;
var BATTERY_FLAG_LOW = 0x02;
var BATTERY_FLAG_CRITICAL = 0x04;
var BATTERY_FLAG_CHARGING = 0x08;
var BATTERY_FLAG_NO_BATTERY = 0x80;
var BATTERY_FLAG_UNKNOWN = 0xFF;

var BATTERY_PERCENTAGE_UNKNOWN = 0xFF;

var BATTERY_LIFE_UNKNOWN = 0xFFFFFFFF;

var BATTERY_CHEMISTRY_ALKALINE = 0x01;

Advertising
This manual is related to the following products: