This section provides programmers quick access to system function calls, CONFIG.SYS variables, device variables, error codes, download procedures, instructions on erasing flash, keypad key return values, and printer control codes for the Verix V operating system.
Function Calls
The functions listed in Table 3 are arranged by device or purpose. Refer to the function description for associated parameters, valid error conditions, and details on how and when to use the function. In the online version of this manual, the page number can be clicked to jump to the function description.Table 3 Function Calls
Function Call Description Page
Update CONFIG.SYS Entries with Applications
int get_env(const char *key, char *buffer, int bufsize); Access CONFIG.SYS entries. 157
int put_env(const char *key, const char *val, int len); Stores an environment variable in CONFIG.SYS.
158
Miscellaneous Service Calls
int get_component_vars(int handle, char *buffer, int len); Returns information about an OS component (typically a driver).
280
int set_combo_mode(int mode); Sets the module specified by mode.
(either in conventional telephone modem or as a TCP/IP adapter).
281
int SVC_CHK_PASSWORD(char *buffer); Compares the counted string in buffer to the password for the current group.
282
int SVC_FLASH_SIZE(void); Returns the amount of installed
flash memory in kilobytes.
283
int SVC_INFO_COUNTRY(char *buf_12); Stores 12 bytes of factory-defined country variant data in the caller's
284
Function Calls
int SVC_INFO_LOTNO(char *buf_6); Stores a 6-byte factory-defined manufacturing lot number in the caller's buffer.
291
int SVC_INFO_MAG(char *buf_1); Stores a 1-byte magnetic card
reader type code in the caller's buffer.
292
int SVC_INFO_MFG_BLK(char *buf_30); Stores 30 bytes of factory-defined manufacturing data in the caller's buffer.
293
int SVC_INFO_MOD_ID(void); Returns a code indicating the type
of modem installed.
294
int SVC_INFO_MODULE_ID(int port); Detects the type of radio used such as the WiFi, GPRS, CDMA, and Ethernet.
295
int SVC_INFO_MODELNO(char *buf_12); Stores a 12-byte factory-defined model number in the caller's buffer.
297
int SVC_INFO_PARTNO(char *buf_12); Stores a 12-byte factory-defined part number in the caller's buffer.
298
int SVC_INFO_PIN_PAD(char *buf_1); Stores a 1-byte PIN pad type code in the caller's buffer.
299
int SVC_INFO_PORT_IR(void); Returns the serial port number for
infrared communication (if supported).
300
int SVC_INFO_PORT_MODEM(void); Returns the serial port number
connected to the modem.
301
int SVC_INFO_PRNTR(char *buf_1); Stores a 1-byte printer type code in the caller's buffer.
302
int SVC_INFO_RESET(char *buf_12); Stores the time of the last terminal reset in the caller's buffer and returns the total number of resets in the terminal’s lifetime (since the current OS was loaded).
304
int SVC_INFO_SERLNO(char *buf_11); Stores an 11-byte factory-set serial number in the caller's buffer.
305
int SVC_LED(int id, int mode); Sets the light-emitting diode specified by ID on or off.
307
int SVC_RAM_SIZE(void); Returns the amount of installed
RAM in kilobytes.
308
long SVC_INFO_LIFETIME(void); Returns the total number of
seconds the terminal has been in operation.
290
void SVC_INFO_CRASH(struct info_crash_t *results); Retrieves diagnostic information about the most recent fatal exception.
285 Table 3 Function Calls (continued)
Function Call Description Page
PROGRAMMERS QUICK REFERENCE
Function Calls
void SVC_INFO_EPROM(char *buf_9); Stores a counted string that
contains an 8-byte firmware version in the caller's buffer.
287
void SVC_INFO_PTID(char *buf); Stores a counted string that
contains an 8-byte terminal identification number in the caller's buffer.
303
void SVC_VERSION_INFO(char *buf); Stores a counted string that contains the OS version information.
309
int SVC_SHUTDOWN(void); Turns off the Vx610, Vx670, Vx810, and Vx700 terminals.
306
int SVC_INFO_OS_HASH (U8* hashout20, U8* keyin, int keysz); Allows the application to compute a checksum for the entire OS.
310
File Management
File Access Function Calls
int close(int handle); Closes file when access to the file is
no longer needed.
Deletes data from a file opened for write access at the location of the file position pointer.
int get_file_date(int handle, char *yymmddhhmmss); Returns information about the last update to the file.
99
int get_file_size(int handle, long *filesize); Returns information about the file size.
98
int insert(int handle, const char *buffer,int size);
int insert_vlr(int handle, const char *buffer,int size);
int insert_cvlr(int handle, const char *buffer,int size);
Inserts data into a file opened for write access at the location of the file position pointer.
94
int lock(int handle, long reserved1, long reserved2); Locks the open file associated with handle, preventing it from being accessed through any other handle.
104 Table 3 Function Calls (continued)
Function Call Description Page
Function Calls
int _remove(const char *filename); Deletes a specified file in the directory.
102
int _rename(const char *oldname, const char *newname); Points the caller’s pointer to a pair of pointers to ASCII pathnames.
107
int SVC_CHECKFILE(char *filename); Calculates the checksum for the specified file.
100
int unlock(int handle, long reserved1, long reserved2); Removes a lock set by lock() from the open file associated with handle.
105
int write(int handle, const char *buffer, int count);
int write_vlr(int handle, const char *buffer, int count);
int write_cvlr(int handle, const char *buffer, int count);
Transfer data from an application’s buffer to a file that is open for writing.
89
File Attribute Function Calls
int get_file_attributes(int handle); Returns the attribute byte of an open file.
109
long get_file_max(int handle); Returns the maximum file data size set in set_file_max().
110
int reset_file_attributes(int handle, int attributes); Clears attribute flags for an opened file.
111
int set_file_attributes(int handle, int attributes); Sets selected attribute flags for an open file.
112
int set_file_max(int handle, long maxsize); Sets the maximum data size allowed for a file.
113
Keyed File Reads and Writes
int getkey(const char *key, const char *buffer, int size, char *filename);
Retrieves data associated with a given key value.
118
int putkey(const char *key, const char *buffer, int size, char *filename);
Stores the data for a given key. 119 File Directory Function Calls
int dir_get_attributes(const char *filename); Provides access to the file attribute bits that the file system maintains.
121
int dir_get_file_date(const char *filename, char *yyyymmddhhmmss);
Retrieves the file date. 122
long dir_get_file_size(const char *filename); Returns the size of the file. 123
long dir_get_file_sz(const char *filename); Returns the number of data bytes in the file.
124
int dir_get_first(char *drive); Returns a NULL-terminated string containing the name of the first file in the directory (usually
CONFIG.SYS).
125
int dir_get_next(char *buffer); Takes the current filename in the specified directory and retrieves the following filenames.
126 Table 3 Function Calls (continued)
Function Call Description Page
PROGRAMMERS QUICK REFERENCE
Function Calls
int dir_get_sizes(const char *drive, struct fs_size *fs); Returns general information about the specified directory.
int file_copy(const char *source, const char *target); Copies the file named by source to target.
131
int SVC_RAM_SIZE(void); Returns the amount of RAM
memory, in kilobytes, installed in the terminal.
132
int unzip(const char *zipfile); Decompresses a VeriFone zip
format file.
133
Flash File System
int dir_flash_coalesce(void); Erases all flash file system files tagged for deletion and pushes the current files down, recovering memory space.
137
int dir_flash_coalesce_size(long *size); Returns the number of bytes to reclaim with a coalesce.
138
int SVC_FLASH_SIZE(void); Returns the amount of flash
memory, in kilobytes, installed in the device.
139
String Utilities
int dtoa
(double d, char *buf, int buf_size, int format, int precision);
Converts a floating point value to a string.
697
char *ltoa(long value, char *buffer, int radix); Converts a number to a string. 698
char *ultoa
(unsigned long value, char *buffer, int radix);
Converts a number to a string. 699
void SVC_INT2(unsigned int value, char *buffer); Converts a number to a string. 708
unsigned int SVC_2INT(const char *source); Converts a counted ASCII string containing decimal digits to a binary value.
709
int SVC_CS2AZ(char *zstring, const char *cstring); Converts counted string, cstring, 710 Table 3 Function Calls (continued)
Function Call Description Page
Function Calls
void SVC_DSP_2_HEX(const char *dsp, char *hex, int n); Converts ASCII hexadecimal data to binary.
703
int SVC_PACK4(char *dest, const char *source, int size); Compresses ASCII data. 704
int SVC_UNPK4(char *dest, const char *source, int size); Decompresses ASCII data compressed by SVC_PACK4().
705
Event Handling Event Function Calls
int clr_timer(int timer_id); Cancels a timer before it expires. 194
int set_timer(long msecs, long eventmask); Schedules an event to occur after a specified delay.
200
int SVC_WAIT(unsigned int msecs); Suspends the calling task for a specified amount of time.
202
long peek_event(void); Examines pending events. 195
post_user_event(int user_task_id, int user_bits); Allows to post an immediate event from a thread to another thread or task.
196
long read_event(void); Reads and clears pending events. 197
long read_evt(int needed_events); Reads and clears pending events.
This functions is similar to
read_event function except that only events listed in the bit mask needed_events will be reported to the caller.
198
int read_user_event(void); Reads and clears the new “user
events” field for the calling task. It also resets t he new EVT_USER bit in the calling task’s main event.
199
long wait_event(void); Waits for an event to occur. See
Table 7 for event codes returned by wait_event().
203
int wait_evt(int needed_events); Waits for an event to occur. The events that are listed in the bit mask needed events will only cause the task to awake.
204
int set_signal_events(int handle, char *signal); Allows the radio to enable an event to occur when one or more input signal lines changes.
201 Table 3 Function Calls (continued)
Function Call Description Page
PROGRAMMERS QUICK REFERENCE
Function Calls
Console Device
int activate_task(int task_id); Allows the current console owner to pass control of the console to the specified task.
229
int alpha_shift(int c); Returns the character that follows
char in the ALPHA key shift sequence.
230
int close(int handle); Releases ownership of the console
device.
231
int clreol(void); Clears the display line from the
current cursor position to the end of the line, relative to the current window.
232
int clrscr(void); Clears the current display window
and places the cursor in the upper-left corner of the window (column 1, line 1).
int delline(void); Deletes the display line that
contains the cursor and moves all lines below it up one line.
236
int disable_hot_key(void); Disables the hotkey feature. 237
void disable_key_beeps(void); Disables beeps when keys are
pressed.
238
void enable_hot_key(void); Re-enables the hotkey feature after
it is disabled by disable_hot_key().
239
int enable_key_beeps(void); Enables audible key beeps on a
keypress.
240
int get_console(int clear_keys); Returns the handle for the console if the current task owns the console.
246
int get_font(char *font_name); Returns the filename of the current font or the string DEFAULT if the
242 Table 3 Function Calls (continued)
Function Call Description Page
Function Calls
int getscrollmode(void); Returns the current scroll mode
setting.
265
int gotoxy(int x, int y); Positions the cursor at the screen
relative to the character position specified.
250
int insline(void); Inserts a blank line following the line
containing the cursor.
251
int kbd_pending_count(void); Returns the number of keystrokes
available for reading.
253
int kbd_pending_test(int t); Tests if key t is in the keyboard buffer.
254
int key_beeps(int flag); Turns on beeps when keys are
pressed
255
int open(“/dev/console”, int unused); Returns the handle for writing, reading, or closing the console device.
256
int put_graphic(const char *buf, int len, int x1, int y1, int x2, int y2);
Displays graphic images (for example, icons) within a specified area.
258
int putpixelcol(char *buffer, int len); Displays graphic images on a byte-by-byte basis.
257
int read(int handle, char *buffer, int length); Retrieves the keys in the key buffer. 259
int resetdisplay(const char *font, int grid_id); Sets the font. 260
int screen_size(char *buf); Stores the screen size in *buf. 261
int set_backlight(int mode); Turns the backlight on/off . 266
int set_cursor(int flag); Turns the cursor on and off. 267
int set_font(const char *font_name); Sets the font to the specified font file.
263
int set_hot_key(int keycode); Defines the hotkey and who owns it. 269
int setcontrast(int value); Sets the display contrast level to the specified value.
262
int setfont(const char *font); Sets the display font. 263
int setscrollmode(int mode); Sets the scroll mode. 265
int SVC_INFO_DISPLAY(char *buf_6); Stores display type and size information in the caller's buffer.
270
int set_bcm(int mode); Overrides the CONFIG.SYS *BCM
setting.
212
int SVC_INFO_KBD(char *stuff_1x); Fills the caller’s buffer with the one-byte keyboard type from the manufacturing block.
271
int wherecur(int *x, int *y); Returns the current cursor position relative to the physical display not the current window.
272 Table 3 Function Calls (continued)
Function Call Description Page
PROGRAMMERS QUICK REFERENCE
Function Calls
int wherewin(int *x1, int *y1, int *x2, int *y2); Returns the current display window coordinates into the four integer variables.
273
int wherewincur(int *x, int *y); Returns the current cursor position relative to the current window not the physical display.
274
int window(int x1, int y1, int x2, int y2); Defines a logical window within the physical display.
275
int write(int handle, const char *buffer, int count); Writes buffer to display. 276
int write_at(char *buf, int len, int x, int y); Similar to write(), except that the cursor is positioned prior to writing the data in the current font.
277
int getinverse(void); Returns the current video setting. 244
int inverse_toggle(void); Toggles the current inverse video
setting. Equivalent to setinverse(3).
252
int setinverse(int value); Selects the inverse video setting
based on the two LSBs of value.
264
int setAlphaMode(classic); On Vx810, switches the keyboard
operation to classic mode.
223
int setAlphaMode(cell_phone); On Vx810, switches the keyboard operation to cell phone mode.
223
int getAlphaMode(void); On Vx810, returns the current mode
of the keyboard.
224
int alpha_multi_shift(int key, int *shift); On Vx810, switches the keyboard operation to classic mode (default) or cell phone mode.
225
System Devices
Device Management Function Calls
int get_name(int handle, char *name_20); Retrieves the device name associated with handle.
334
int get_owner(const char *id, int *task_id); Retrieves owning task and handle for a device or pipe.
335
int set_owner(int handle, int task); Transfers ownership of an open device to another task.
336 Table 3 Function Calls (continued)
Function Call Description Page
Function Calls
int read(int handle, char *buffer, int size); Transfers data from a card reader scan into the buffer.
342
int SVC_INFO_MAG(char *buf_1); Stores a 1-byte magnetic card
reader type code in the caller's buffer.
345
Clock and Timer Function Calls
int close(int handle); Releases the resources associated
with the clock handle.
340
int clr_timer(int timer_id); Cancels a timer set by
set_timer().
194
void date2days(const char *yyyymmdd, long *days); Sets *days to the number of days elapsed from January 1, 1980, to the specified date.
364
void datetime2seconds(const char *yyyymmddhhmmss, long *secs); Converts a date/time string to the number of seconds since January 1, 1980 (that is, midnight Dec. 31, 1979).
364
int days2date(long *days, char *yyyymmdd); Determines the date that is the given number of days past January 1, 1980.
364
unsigned long read_ticks(void); Returns the number of clock ticks elapsed since the terminal was powered up or reset.
372
int open(const char *id, int); Opens the clock/calendar device, returning its associated device handle.
367
int read(int hClock, char *buffer, int size); Places the system date, time, and day of the week in an application buffer as a 15-byte ASCII character array (not a NULL-terminated string).
368
int read_clock(char *yyyymmddhhmmssw); Stores the current time and date in the caller-provided buffer.
secs2time (const long *secs, char *hhmmss); Converts the number of seconds to a time string.
364
int set_timer(long milliseconds, long eventmask); Schedules an event to occur after the specified number of
milliseconds (ms) elapsed.
200
int SVC_VALID_DATE(const char *yyyymmddhhmmss); Verifies that its argument represents a valid date and time.
364 Table 3 Function Calls (continued)
Function Call Description Page
PROGRAMMERS QUICK REFERENCE
Function Calls
int SVC_WAIT(unsigned int milliseconds); Suspends the calling task for the specified number of milliseconds.
373
time2secs (const char *hhmmss, long *secs); Converts the time into a seconds string.
364
int write(int handle, const char *buffer, int count); Sets the system date and time. 370 Beeper
void beeper_off(void); Squelches the beeper. 376
int close(int handle); Releases the handle associated
with the beeper.
377
int enable_key_beeps(void); Enables audible key beeps on a
keypress.
238
void error_tone(void); Produces a 100-ms tone at 880 Hz. 378
int key_beeps(int flag); Turns on/off keypress beeps. 379
void normal_tone(void); Produces a 50-ms tone at 1245 Hz. 380
int open (const char *id, int unused); Explicitly opens the sound-generating device, returning its associated device handle.
381
void play_RTTTL(char *music); Invokes the RTTTL interpreter and it returns allowing the calling
int sound(int note, int milliseconds); Causes the beeper to generate one of the 96 standard tones at a specified time.
382
Communication Devices FIFOs
void SVC_CLR_FIFO(fifo_t *fifo, int datasize); Initializes the FIFO data structure pointed to by fifo with a capacity of datasize bytes.
313
int SVC_CHK_FIFO(const fifo_t *fifo); Returns the number of bytes currently stored in the FIFO (that is, those written to it, but not yet read).
312
int SVC_GET_FIFO(fifo_t *fifo); Retrieves byte from FIFO. 314
Table 3 Function Calls (continued)
Function Call Description Page
Function Calls
unsigned char SVC_LRC_CALC(void const *buffer, int size, unsigned char seed);
Calculates the LRC (longitudinal redundancy check) value for size bytes of data in buffer.
327
unsigned int SVC_CRC_CRC16_L(void const *buffer, int sz, unsigned int seed);
Calculates a standard CRC16 CRC value for size bytes of data in buffer.
324
unsigned int SVC_CRC_CRC16_M(void const *buffer, int sz, unsigned int seed);
Calculates a standard CRC16 CRC value for size bytes of data in buffer.
325
unsigned int SVC_CRC_CCITT_L(void const *buffer, int sz, unsigned int seed);
Calculates a 16-bit CRC for size bytes of data in buffer using the CCITT polynomial
322
unsigned int SVC_CRC_CCITT_M(void const *buffer, int sz, unsigned int seed);
Calculates a 16-bit CRC for size bytes of data in buffer using the CCITT polynomial
323
unsigned long SVC_CRC_CRC32_L(void const *buffer, int sz, unsigned long seed);
Calculates a 32-bit CRC32 CRC value for size bytes of data in buffer.
326
unsigned int SVC_MEMSUM(const char *buffer, long size); Computes the sum of size bytes from buffer, treating both the bytes and the sum as unsigned, and ignoring overflows.
328
unsigned int SVC_MOD_CK(const char *acct); Generates a Luhn check digit for a sequence of digits or validates a sequence of digits containing a check digit.
329
General Communication Device Functions
Note: The calls listed in this section apply to all COM devices. The calls listed in specific COM sections apply only to that device.
int close(int handle); Disables the device. 572
int download(int handle, void *parms); Receives a download through the open serial port.
573
int get_component_vars(int handle, char *buffer, int len); Returns the nonvolatile data for this communication port.
574
int get_fifo_config(int handle, char *buffer); Gets the current FIFO configuration. 575
int get_opn_blk(int port, struct SetOpnBlk *ob); Copies the current opn_blk structure into the caller’s buffer.
576
int get_port_status(int port, char * bfr); Copies current status information to caller’s 4-byte buffer.
577 Table 3 Function Calls (continued)
Function Call Description Page
PROGRAMMERS QUICK REFERENCE
Function Calls
int open(const char *id, int opentype); Prepares the asynchronous RS-232 interface for operation. Returns the
unsigned long get_usb_device_bits (void) Gets the status of all supported USB devices.
562
int read(int comm_handle, char *buffer, int size); Transfers data from the RS-232 port into the buffer and returns the number of bytes actually read
580
int reset_port_error(int port); Resets error conditions for parity, framing, and overrun.
581
int set_fifo_config(int handle, const char *buffer); Sets the SCC transmit FIFO length. 582
int set_opn_blk(int port, const struct Opn_Blk *ob); Initializes/reinitializes the communication parameters.
583
int set_serial_lines(int handle, char *buffer); Uses the parameters in buffer to set/reset DTR, RTS, and BRK.
584
int write(int handle, const char *buffer, int count); Transfers data from an application buffer into the device driver’s buffer, only if the latter is empty.
586
USB Ethernet (ETH1)
int close(int eth_handle); Releases the Ethernet device. 776
int get_enet_status(int hdl, char *status4); Checks whether Ethernet link is live or not.
777
int get_enet_MAC(int eth_hdl, char *MACbuf); Returns the MAC (Media Access Control) address.
778
int open(“/dev/eth1”, int unused); Returns the handle for reading or writing the Ethernet device.
773
int read(int eth_handle, char *buffer, int count); Allows the user to read one packet from the Ethernet device.
774
int set_enet_rx_control(int hdl, int rx_control); Used to suppress certain packets. 779
int write(int eth_handle, const char *buffer, int count); Allows the user to write one packet for the Ethernet device.
775 Table 3 Function Calls (continued)
Function Call Description Page
Function Calls
Internal PIN Pad Port (COM5)
int PINentryStatus(void); Returns the PIN entry status and
can be used to infer when the console belongs to the PIN-entry background task.
555
int SVC_INFO_PIN_PAD(char *buf_1x); Fills the caller’s buffer with the one-byte internal PIN pad availability information from the manufacturing block.
556
int TerminatePinEntry(void); Ends the PIN entry session. 554
USB Internal WiFi (WLN1) (on Vx670 only)
int USB_WIFI_POWER(int power); Used to power the WiFi on or off. 788
int open(“/dev/wln1”, int unused); Returns the handle for reading or writing.
784
int read(int handle, char *buffer, int count); Allows the current owner tot read one packet from the WiFi device.
785
int write(int handle, const char *buffer, int count); Allows the current owner to write one packet for the WiFi device.
785
int close(int handle); Releases the ownership of the WiFi
device.
787
USB Client (on Vx810 only)
int get_usbd_status(int handle); Checks whether the USB
int get_usbd_status(int handle); Checks whether the USB