The text of a manual · part 15 of 18
Qlarity-Based Terminal Programmer's Reference Manual: Chapter 4 Qlarity API Function Reference, pages 101 to 108
Pages 101 to 108 of 134, from Qlarity-Based Terminal Programmer's Reference Manual
The original document is the PDF (1.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
Filed in the catalog under the QSI Corp QTERM-G70
Page 101
QSI Qlarity-based Terminal Programmer’s Reference
KBDRPTRATE_3_0 KBDRPTRATE_2_7 KBDRPTRATE_2_5 KBDRPTRATE_2_3 KBDRPTRATE_2_1 KBDRPTRATE_2_0
(3.0 cps) (2.7 cps) (2.5 cps) (2.3 cps) (2.1 cps) (2.0 cps)
SYS_KEYRPTDELAY For systems with a keypad interface, change the keypad repeat delay, which is the amount of time after the key is pressed before the first repeat character is generated. “{newvalue}” is an integer indicating the number of milliseconds for the delay. The minimum delay is 20 ms and the maximum delay is 2000 ms. The value is rounded to the nearest 20 ms increment. SYS_KEYRPTPERIOD For systems with a keypad interface, change the keypad repeat period, which is the amount of time between repeat characters after repeat has begun. “{newvalue}” is an integer indicating the number of milliseconds for the delay. The minimum delay is 20 ms and the maximum delay is 2000 ms. The value is rounded to the nearest 20 ms increment. SYS_KEYCLICK For systems with a keypad interface, enable or disable the audible key click, which is a short beep generated whenever a key is pressed. “{newvalue}” must be a boolean; TRUE enables the key click and FALSE disables it. SYS_KEYRPT For systems with a keypad interface, enable or disable the key repeat feature. “{newvalue}” must be a boolean; TRUE enables key repeat and FALSE disables it. SYS_COM1BAUD, SYS_COM2BAUD, SYS_COM3BAUD, SYS_COM4BAUD, SYS_COM5BAUD, SYS_COM6BAUD, SYS_COM7BAUD, SYS_COM8BAUD, SYS_COM9BAUD, SYS_COM10BAUD Set the baud rate for the selected serial interface. “{newvalue}” is of type “syscmd_baud,” which is an enumerated type with the following legal values: BAUD_115200 BAUD_57600 BAUD_38400 BAUD_19200 BAUD_14400
89
BAUD_9600 BAUD_4800 BAUD_2400 BAUD_1200 BAUD_600 SYS_COM1DATABITS, SYS_COM2DATABITS, SYS_COM3DATABITS, SYS_COM4DATABITS, SYS_COM5DATABITS, SYS_COM6DATABITS, SYS_COM7DATABITS, SYS_COM8DATABITS, SYS_COM9DATABITS, SYS_COM10DATABITS Set the number of data bits for the selected serial interface. “{newvalue}” is of type “syscmd_databits,” which is an enumerated type with two legal values: DATABITS_7 DATABITS_8 SYS_COM1PARITY, SYS_COM2PARITY, SYS_COM3PARITY, SYS_COM4PARITY, SYS_COM5PARITY, SYS_COM6PARITY, SYS_COM7PARITY, SYS_COM8PARITY, SYS_COM9PARITY, SYS_COM10PARITY Set the parity for the selected serial interface. “{newvalue}” is of type “syscmd_parity,” which is an enumerated type with three legal values: PARITY_ NONE PARITY_ODD PARITY_ EVEN SYS_COM1STOPBITS, SYS_COM2STOPBITS, SYS_COM3STOPBITS, SYS_COM4STOPBITS, SYS_COM5STOPBITS, SYS_COM6STOPBITS, SYS_COM7STOPBITS, SYS_COM8STOPBITS, SYS_COM9STOPBITS, SYS_COM10STOPBITS Set the number of stop bits for the selected serial interface. “{newvalue}” is of type “syscmd_stopbits,” which is an enumerated type with two legal values: STOPBITS_1 STOPBITS_2 SYS_COM1FLOWCONTROL, SYS_COM2FLOWCONTROL, SYS_COM3FLOWCONTROL, SYS_COM4FLOWCONTROL, SYS_COM5FLOWCONTROL, SYS_COM6FLOWCONTROL, SYS_COM7FLOWCONTROL, SYS_COM8FLOWCONTROL,
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
Page 102
90
QSI Qlarity-based Terminal Programmer’s Reference
SYS_COM9FLOWCONTROL, SYS_COM10FLOWCONTROL Set the flow control for the selected serial interface. “{newvalue}” is of type “syscmd_flowcontrol,” which is an enumerated type with three legal values: FLOWCONTROL_NONE FLOWCONTROL_XON _OFF FLOWCONTROL_RTS_CTS RTS/CTS flow control is only supported for the EIA232 interface. SYS_COM1FLOWTIMEOUT, SYS_COM2FLOWTIMEOUT Set the flow control transmit timeout for the selected serial interface. “{newvalue}” is of type integer and can be any number from 0 to 65535 (zero meaning no timeout). It tells how many 20 ms intervals to wait (if necessary) to send any character before timing out. SYS_IPADDRESS For terminals with an Ethernet interface, set the IP address of the terminal. “{newvalue}” is a 4-byte array containing the new IP address. SYS_IPSUBNET For terminals with an Ethernet interface, set the subnet mask. “{newvalue}” is a 4-byte array containing the new subnet mask. SYS_IPGATEWAY For terminals with an Ethernet interface, set the gateway IP address. “{newvalue}” is a 4-byte array containing the new gateway IP address. SYS_USEDRAWCACHE Change the status of whether the unit uses draw caching to increase draw performance. “{newvalue}” is of type “drawcache_level”. The values are: CACHE_ALL CACHE_OFF CACHE_ENABLED CACHE_EFFECTIVE_ENABLED SYS_PASSWORD Change the password used to enter the Power On Setup utility. “{newvalue}” is a unibyte array containing exactly sixteen elements. To allow the use of multiple input methods to access Power On Setup (on units with some combination of keypad, keyboard, and touch screen), use the following constants in place of the corresponding Power On Setup keys on the input source (i.e., for the Enter key on the keyboard, use POSKEY_ENTER rather than KEY_ENTER). Otherwise, key codes may be used to define the appropriate key sequence. However, all sequences must have a POSKEY_ENTER in them, and keys following this key are ignored. Note that for the keyboard, only the bits in KEY_ASCII_MASK are used. Available POSKEY keys on all input devices are as follows: POSKEY_UP POSKEY_DOWN POSKEY_LEFT POSKEY_RIGHT POSKEY_ENTER The following POSKEY keys are also available on keyboards and some keypads: POSKEY_ESC POSKEY_0 POSKEY_1 POSKEY_2 POSKEY_3 POSKEY_4 POSKEY_5 POSKEY_6 POSKEY_7 POSKEY_8 POSKEY_9 As there is no “current” value for this setting, using SYSACT_DONOW will not do anything, and using SYSACT_ALWAYS will only set the pending save setting. SYS_USEPASSWORD Specify whether or not a password is required to get full functionality in the Power On Setup utility. “{newvalue}” must be of type “syscmd_usepassword.” As there is no “current” value for this setting, using SYSACT_DONOW will not do anything, and using SYSACT_ALWAYS will only set the pending save setting. The values are: USEPASSWORD_OFF USEPASSWORD_ON
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
Page 103
QSI Qlarity-based Terminal Programmer’s Reference
SYS_TEMPERATURE Set this value to the current temperature to calibrate the temperature reported by the terminal. “{newvalue}” must be a float. SYS_FEEDBACK_TYPE Specify the method of feedback that the unit will use to report development information as well as any severe runtime errors through. “{newvalue}” must be of type “syscmd_feedback” and must at least have one of the methods selected. The values are: FBTYPE_SERIAL FBTYPE_VIDEO FBTYPE_UDP The values can be combined together to produce any combination desired (using the “AND” operator as in “FBTYPE_SERIAL AND FBTYPE_VIDEO”). SYS_FEEDBACK_IPADDRESS If the unit is Ethernet enabled and using UDP feedback, this option specifies the IP address to send all UDP feedback information to. “{newvalue}” is therefore a 4byte array containing the IP address. SYS_FEEDBACK_FPORT If the unit is Ethernet enabled and using UDP feedback, this option specifies the foreign port number to send all UDP feedback packets to. “{newvalue}” in this case is an integer and can be any number between 0 and 65535. SYS_FATALREBOOTTIMEOUT This is the number of 20 ms increments to wait after hitting a major system error before rebooting. A value of 0 (the default) is interpreted as indefinitely. Hopefully, you will never need this.
91
Shift Key behaves like any other key. “{newvalue}” must be a boolean; TRUE enables the Auto Shift feature and FALSE turns it off. SYS_SAVE Causes the terminal settings that are pending to be saved to the terminal's non-volatile flash memory. “{newvalue}” is a boolean value that determines whether the system is reset after the new terminal settings are saved. A value of TRUE will cause the system to reset (RESET_NORMAL). The parameter “{action}” is ignored. SYS_CLEAR Clears the terminal settings that are pending without saving them to the terminal's non-volatile flash memory. “{newvalue}” must be set to 0. The parameter “{action}” is ignored. SYS_KEYPADGATEDELAY For systems with a keypad interface, change the keypad hardware gate delay in the keypad scanning routine. This is the delay between writing the row latch and reading the column latch. Some keypads which are highly resistive and/or capacitive may require longer delays to read the proper row and column. The actual value is dimensionless, but higher values will yield longer delays. If your keypad is not working, try setting to a higher value. SETTING THIS TO AN INCORRECT VALUE (USUALLY TOO LOW) MAY PREVENT THE KEYPAD FROM FUNCTIONING PROPERLY! “{value}” is an integer indicating the delay. Values from 1 to 100 are acceptable. SYS_AUTOPOWER For systems with a keypad interface and Auto Power capability (such as the QTERM-G55), set the mode of the Auto Power feature. Value is of type syscmd_powerkeymode. The values are:
Two additional values are also legal for “{cmd}:” SYS_KEYPADBACKLIGHT For systems with a keypad interface and keypad backlight, turn the backlight on or off. “{newvalue}” must be a boolean; TRUE turns the backlight on and FALSE turns it off. SYS_AUTOSHIFT For systems with a keypad interface and Auto Shift capability (such as the QTERM-G55), enable or disable the Auto Shift feature. When Auto Shift is off, the
POWERKEY_NORMALKEY POWERKEY_AUTOPOWER IMPORTANT NOTE: Changes made to the terminal settings via SetSystemSetting() using SYSACT_ALWAYS and SYSACT_ONBOOT are not permanent (saved to the non-volatile flash memory) until SetSystemSetting() is called with the SYS_SAVE command. Many changes may be made via multiple calls to SetSystemSetting() before they are saved to the flash using the SYS_SAVE command.
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
Page 104
92
QSI Qlarity-based Terminal Programmer’s Reference
The intent of this command is two-fold: to allow the creation of a custom terminal configuration facility at the application level (similar to the built-in Power On Setup facility) and to allow changing settings during run-time operation. By creating a custom terminal configuration facility in an application, any desired subset of the terminal settings and other application specific settings can be made available to the user. 4.18.15 GetSystemSetting
SYSREAD_PENDINGSAVE The value of the setting that is pending a save command. SYSREAD_SAVED The value of the setting that is actually saved. The variable “{value}” is passed as a reference and receives the value of the setting. The “{value}” variable must be of the correct data type for each value of “{cmd}” as follows (see also section 4.18.14, “SetSystemSetting”):
Syntax: getsystemsetting(cmd as syscmd, var as -> reference to anytype, which as -> syscmd_readfrom)
Parameters: {cmd} A value of type “syscmd” (see section 4.18.14, “SetSystemSetting.”) that determines which terminal control setting will be returned in “{var}.” {value} The variable that will receive the value of the system setting being retrieved. {which} A value of type “syscmd_readfrom” that determines the mode of the setting that is read. Description: This function retrieves a value for the terminal setting specified by “{cmd}.” This parameter is an enumerated type described in section 4.18.14, “SetSystemSetting.” There are three versions of each setting; the current setting, the pending setting, and the saved setting. The current setting is the setting that the terminal is using. The pending setting is any setting that was changed using SetSystemSetting() and is awaiting a SYS_SAVE command in order to be saved to the flash. The pending setting may or may not be the current setting. The saved setting is the value of the setting that is saved in the non-volatile flash memory. Each of these values is accessible through the “{which}” parameter. This parameter must be of type “syscmd_readfrom” and has the following possible values: SYSREAD_CURRENT The current value of the setting being used by the firmware.
SYS_CONTRAST integer SYS_BACKLIGHT integer SYS_VOLUME integer SYS_NOTEAMPLITUDE integer SYS_MODE syscmd_mode SYS_ORIENT syscmd_orient SYS_KBDRPTDELAY syscmd_kbdrptdelay SYS_KBDRPTRATE syscmd_kbdrptrate SYS_KEYRPTDELAY integer SYS_KEYRPTPERIOD integer SYS_KEYCLICK boolean SYS_KEYRPT boolean SYS_COM1BAUD syscmd_baud SYS_COM1DATABITS syscmd_databits SYS_COM1PARITY syscmd_parity SYS_COM1STOPBITS syscmd_stopbits SYS_COM1FLOWCONTROL syscmd_flowcontrol SYS_COM1FLOWTIMEOUT integer SYS_COM2BAUD syscmd_baud SYS_COM2DATABITS syscmd_databits SYS_COM2PARITY syscmd_parity SYS_COM2STOPBITS syscmd_stopbits SYS_COM2FLOWCONTROL syscmd_flowcontrol SYS_COM2FLOWTIMEOUT integer SYS_IPADDRESS byte array SYS_IPSUBNET byte array SYS_IPGATEWAY byte array SYS_USEDRAWCACHE drawcache_level SYS_PASSWORD unibyte array SYS_USEPASSWORD syscmd_usepassword SYS_TEMPERATURE float SYS_FEEDBACK_TYPE syscmd_feedback SYS_FEEDBACK_IPADDRESS byte array SYS_FEEDBACK_FPORT integer SYS_FATALREBOOTTIMEOUT integer SYS_KEYPADBACKLIGHT boolean SYS_AUTOSHIFT boolean SYS_KEYPADGATEDELAY integer SYS_AUTOPOWER syscmd_powerkeymode
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
Page 105
QSI Qlarity-based Terminal Programmer’s Reference
The following “{cmd}” values are not legal for this function:
93
4.18.17 GetRandomNum Syntax:
SYS_SAVE SYS_CLEAR getrandomnum() returns float
Description: Note that the following values for “{cmd}” have no defined current value: SYS_MODE SYS_PASSWORD SYS_USEPASSWORD 4.18.16 SoftReset
This function returns a pseudo-random number. The return value is always a floating point number between 0 to 1. 4.18.18 SeedRandomNum Syntax: seedrandomnum()
Description:
Syntax: softreset(rst as rstmode)
Parameters: {rst} A value of type “rstmode” indicating how the reset is to be performed. Description:
This function seeds the random number generator with a value from an internal hardware timer. Calling this function at a non-deterministic time (such as a user input event) produces the best pseudo-random numbers (obtained with calls to GetRandomNum()). 4.18.19 SetSeedRandomNum Syntax:
This function causes the terminal to undergo a warm reboot cycle. “{rst}” can take the following values: RESET_NORMAL Causes the unit to perform a reset as if the power had been cycled. If the unit is in development mode, it waits for an application to be loaded. RESET_LOADAPP Causes the unit to perform a reset and go directly into the download application mode. RESET_ENTER_BL Causes the unit to perform a reset, entering into the bootloader where the firmware can be upgraded serially. RESET_ENTER_POS Causes the unit to perform a reset, entering the “Power On Setup” utility upon reboot. RESET_TOUCH_CAL Causes the unit to perform a reset, entering the screens used to calibrate the touch screen.
setseedrandomnum(seed as integer)
Description: This function seeds the random number generator with a specific value, enabling “pseudo-random” sequences to be produced (and reproduced). This is most useful for debugging. 4.18.20 WatchdogEnable Syntax: watchdogenable(enable as boolean, timeout -> as integer)
Parameters: {enable} A boolean value specifying whether to enable (use “true”) or disable (use “false”) the watchdog timer. {timeout} The desired number of 20 ms intervals that should elapse before a system reset occurs (1 = 20ms).
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
Page 106
94
QSI Qlarity-based Terminal Programmer’s Reference
Description:
4.18.24 GetBinaryResource
This function enables/disables the software watchdog timer. The purpose of the watchdog timer is to cause a system reset if something goes fatally wrong in the system software. The time will cause a system reset if the timeout period expires. For normal operation, the timer should be periodically reset using the WatchdogReset() API function.
Syntax: getbinaryresource (resourceID as integer)-> returns byte[]
Parameters: {resourceID}
4.18.21 WatchdogReset
The identifier of the binary resource.
Syntax:
Description:
watchdogreset()
This function returns a byte array containing the data of a binary resource that was included with the application.
Description: This function restarts the timeout period in the watchdog timer. If the watchdog timer is enabled (via the WatchdogEnable() API function), this function must be called periodically to reset the timer or the system will be reset when the timeout period elapses. This function has no effect if the watchdog timer is not enabled.
4.18.25 SetArrayData Syntax: setarraydata(arr[] reference? to -> sametype!, index as integer, srcdata[] -> as reference? to sametype!, srcindex as -> integer, len as integer)
4.18.22 GetProfileTick Parameters: Syntax: getprofiletick() returns integer
{arr} An array variable already holding data.
Description: This function is used to profile execution speed. When this function is called, it returns the number of profiling ticks that have occurred since the last time the function was called. One profile tick is 1/32768 s.
{index} The location in “{arr}” to start inserting the “{srcdata}.”
4.18.23 DelayMS
{srcindex} The index into “{srcdata}” indicating the start of the data to be inserted into “{arr}.”
Syntax: delayms(delay as integer)
Parameters: {delay} The desired delay in milliseconds. Description: This function delays the requested number of milliseconds before returning.
{srcdata} An array containing the data to be inserted into “{arr}.”
{len} The length of the data (or -1 for all) to be copied from “{srcdata}” to “{arr}.” Description: This function copies data from “{srcdata}” into “{arr}.” It is mostly used to improve efficiency when only parts of an array change.
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
Page 107
QSI Qlarity-based Terminal Programmer’s Reference
4.18.26 CreateCRCTable
Parameters:
Syntax:
{table} The CRC table calculated from CreateCRCTable.
createcrctable(width as integer, poly as -> integer, reflect as boolean) returns -> integer[]
Parameters:
95
{width} The number of bits (minus one) used in the polynomial for the desired CRC.
{width} The number of bits (minus one) used in the polynomial for the desired CRC.
{reflect} Whether or not to use a reflected algorithm (reflects incoming data).
{poly} The polynomial to be used in calculating the CRC (the most significant bit is always implicitly set, for example; x^16+x^12+x^5+x^0 is 0x1021).
{crcin} The initial CRC value.
{reflect} Whether or not to use a reflected algorithm (reflects incoming data).
{reflectout} Whether or not to reflect the final CRC before xor-ing it with “{xoronout}.” {xoronout} The value to xor the final CRC to before returning.
Description: This function is used to generate a CRC table, which is used in calculating CRCs. More information on specifying CRC algorithms can be found in “A Painless Guide to CRC Error Detection Algorithms” by Ross N. Williams. Following are examples of some common algorithms: CRC-16/CITT : “{width}” = 16, “{poly}” = 0x1021, “{reflect}” = FALSE CRC-32: “{width}” = 32, “{poly}” = 0x04C11DB7, “{reflect}” = TRUE CRC-16: “{width}” = 16, “{poly}” = 0x8005, “{reflect}” = TRUE Modbus : “{width}” = 16, “{poly}” = 0x8005, “{reflect}” = TRUE 4.18.27 CalculateCRC Syntax: calculatecrc(table[] as reference? to -> integer, width as integer, reflect as -> boolean, crcin as integer, reflectout as -> boolean, xoronout as integer, data[] as -> reference? to byte) returns integer
{data} The array of byte data for which to calculate the CRC. Description: This function calculates the CRC for a set of data using the parameters to describe the algorithm. More information on specifying CRC algorithms can be found in “A Painless Guide to CRC Error Detection Algorithms” by Ross N. Williams. To continue calculating the CRC for a set of data in multiple parts, call the function subsequently with the initial CRC (“{crcin}”) set to the calculated CRC from the previous call. In all but the final call, “{xoronout}” should be 0 and “{reflectout}” should be FALSE. Following are examples of some common algorithms: CRC-16/CITT : “{width}” = 16, “{reflect}” = FALSE, “{crcin}” = 0xFFFF, “{reflectout}” = FALSE, “{xoronout}” = 0x0000 CRC-32 : “{width}” = 32, “{reflect}” = TRUE, “{crcin}” = 0xFFFFFFFF, “{reflectout}” = TRUE, “{xoronout}” = 0xFFFFFFFF CRC-16 : “{width}” = 16, “{reflect}” = TRUE, “{crcin}” = 0x0, “{reflectout}” = TRUE, “{xoronout}” = 0x0
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770
Page 108
96
QSI Qlarity-based Terminal Programmer’s Reference
Modbus : “{width}” = 16, “{reflect}” = TRUE, “{crcin}” = 0xFFFF, “{reflectout}” = TRUE, “{xoronout}” = 0x0
{in} The uncompressed data. Description:
4.18.28 ZlibCompress Syntax: zlibcompress(out[] as reference to byte, -> in[] as reference? to byte)
Parameters: {out} A data array to accept the compressed data. This array is sized to fit the compressed data. {in} The uncompressed data. Description: This function is used to compress data using the zlib library. The zlib format is not fully compatible with other zip formats although it is possible to convert a zlib file to one that is compatible with the gzip file format. For more information visit the zlib web site.
This function is used to compress data using the zlib library. The zlib format is not fully compatible with other zip formats although it is possible to convert a zlib file to one that is compatible with the gzip file format. For more information visit the zlib web site. 4.18.30 SetPalette Syntax: setpalette(red[] as reference? to byte, -> green[] as reference? to byte, blue[] as -> reference? to byte)
Parameters: {red} Eight bit red color palette (256 byte array). {green} Eight bit green color palette (256 byte array).
4.18.29 ZlibDecompress
{blue} Eight bit blue color palette (256 byte array).
Syntax:
Description:
zlibdecompress(out[] as reference to byte,-> in[] as reference? to byte)
This function sets the color palette for many terminal displays. Not all terminals support this API. This function is considered an advanced function. Please contact Technical Support if you need more details on this API.
Parameters: {out} A data array to accept the compressed data. This array is sized to fit the compressed data.
QSI Corporation Fax 801-466-8792 Web www.qsicorp.com Phone 801-466-8770