The text of a manual · part 10 of 36
Trakker Antares Application Development Tools System Manual: Part I - Trakker Antares PSK Reference Manual, pages 85 to 94
Pages 85 to 94 of 340, from Trakker Antares Application Development Tools System Manual
The original document is the PDF (1.6 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 Intermec 2420, Intermec 2425, Intermec 2435 and Intermec 2481
Page 85
Chapter 5, PSK Function Descriptions
Example See example for im_file_duplicate on page 63.
im_flush_rcv_buffer Purpose Syntax
This function flushes the receive buffer. #include "imt24lib.h" IM_STATUS far im_flush_rcv_buffer (IM_COM_PORT port_id, IM_PTR_ERROR_LOG errorlog)
IN Parameters port_id
OUT Parameters errorlog
Return Value
Communications port: IM_COM1 COM1 input: 241X, 242X, 243X, and 2455 - Port on bottom end of terminal, 2475 and 248X - Physical port labeled COM1 IM_COM2 COM2 input: 248X - Physical port labeled COM2 on enhanced I/O board IM_COM3 COM3 input: 2420 - Modem IM_SCAN_PORT RS-232 port input: 242X - Serial interface module, 2455 - Adapter cable, 248X - Physical port labeled COM4 on enhanced I/O board Pointer to the log structure.
This function returns one of these codes: IM_SUCCESS IM_NET_PORT_HANDLE
Notes
Success Port handle is unknown
See IM_PTR_ERROR_LOG structure in imt24lib.h for more information on different kinds of errors.
Trakker Antares PSK Reference Manual
65
Page 86
Chapter 5, PSK Function Descriptions im_fmalloc Purpose Syntax
This function allocates a memory block larger than 64K. #include "imt24lib.h" void far *im_fmalloc (IM_ULONG lsize)
IN Parameters lsize
OUT Parameters
None
Return Value
Notes
Size of memory, in bytes, to allocate.
This function returns one of these values: Far void pointer
Allocation was successful. The pointer indicates the allocated space.
NULL
Not enough available free memory to allocate
The system uses 16 bytes of overhead, so if you want to allocate the largest free memory block available, specify lsize as 16 bytes less than the available memory block size. The Application Simulator cannot simulate this function.
Example /* Example of doing a set/get relay digital I/O */ #include #include #include #include #include
<string.h> "imstdio.h" "imt24lib.h" <conio.h> <stdlib.h> void main(void) { IM_ULONG lsize; IM_ULONG ltotal; char *pz1; char c; /* Inquire about system memory */ im_free_mem(&lsize, <otal); printf("Largest size: %ld\nTotalsize:%ld\n", lsize, ltotal); /* Allocate the largest block, it must be 16 bytes less than block size */ pz1 = im_fmalloc(lsize - 16L); if (pz1 == NULL) { printf("Fails to allocate memory\n"); } else { im_free(pz1); } c = getch(); }
66
Trakker Antares PSK Reference Manual
Page 87
Chapter 5, PSK Function Descriptions im_free Purpose
Syntax
This function deallocates space that was allocated by im_fmalloc( ). The number of bytes freed is the number of bytes specified when the block was allocated. #include "imt24lib.h" void im_free (void far *\pmemblk);
IN Parameters \pmemblock OUT Parameters
None
Return Value
None
Notes where pmemblock points to a memory block previously allocated to fmalloc.
The Application Simulator cannot simulate this function.
Example See example for im_fmalloc on page 66.
im_free_mem Purpose Syntax
This function returns free memory block information. #include "imt24lib.h" void im_free_mem (IM_ULONG *largest, IM_ULONG *ltotal);
IN Parameters
None
OUT Parameters largest ltotal
Return Value Notes
Pointer to an unsigned long. This function places the amount of the largest available free memory block here. Pointer to an unsigned long. This function places the amount of the free memory blocks here.
None The Application Simulator cannot simulate this function.
Example See example for im_fmalloc on page 66.
Trakker Antares PSK Reference Manual
67
Page 88
Chapter 5, PSK Function Descriptions im_free_space Purpose Syntax
This function returns the amount of storage space, in bytes, available on the terminal drive you specify. #include "imstdio.h" IM_STATUS im_free_space (IM_CHAR *drive, IM_LONG *freespace);
IN Parameters drive OUT Parameters freespace Return Value
Pointer to IM_CHAR. This variable is a drive letter on the terminal. Pointer to IM_LONG. im_free_space places the amount of drive space available here.
This function returns one of these codes: IM_SUCCESS IM_INVALID_FILE
Success Target drive not found or does not exist
Example See example for im_file_duplicate on page 63.
im_get_config_info Purpose
Syntax
This function retrieves the current terminal configuration information string and its length. The command code is passed in as a string, and the current configuration is returned in the same string. #include "imt24lib.h" IM_STATUS im_get_config_info (IM_UCHAR far *config, IM_USHORT far *length);
IN Parameters
None
IN/OUT Parameters config
OUT Parameters length
68
As input, this parameter is the desired terminal command (two characters). You can pass in several command codes at one time. As output, this parameter contains the requested configuration information string. The first two characters specify the configuration command returned. Any subsequent characters specify the configuration options currently set. For example, to get the beep duration setting, set config to “BD”. The function returns BD and the current configuration for beep duration. Length of the configuration information string.
Trakker Antares PSK Reference Manual
Page 89
Chapter 5, PSK Function Descriptions
Return Value
This function returns one of these codes: IM_SUCCESS IM_PARSE_ERROR
Notes
Successfully parsed and returned command string Unable to parse command string
For a list of the configuration commands, see your Trakker Antares terminal user’s manual. This function differs from im_command in that you only pass the twocharacter command identifier. The im_command function passes an entire command string.
See Also im_command
Example /********************* im_get_config_info ****************************/ #include <string.h> #include "imstdio.h" #include "imt24lib.h" void main(void) { IM_USHORT status; IM_USHORT length; IM_UCHAR config_string[128]; im_clear_screen(); /* Use im_get_config_info to get the Beeper Volume printf("\nim_get_config_info example: \n");
*/
/* Set config request for Beeper Volume */ strcpy(config_string, "BV"); status = im_get_config_info(config_string, &length); /* Print the results */ printf("\nBeeper Volume: %s", config_string); printf("\nlength: %d", length); printf("\nstatus: %d", status); }
Trakker Antares PSK Reference Manual
69
Page 90
Chapter 5, PSK Function Descriptions im_get_cursor_style Purpose Syntax
This function returns the style used to display the cursor. #include "imt24lib.h" IM_CURS_TYPE im_get_cursor_style (void);
IN Parameters
None
OUT Parameters
None
Return Value
This function returns a flag indicating cursor style: IM_BLINKING_BLOCK IM_BLINKING_UNDERLINE IM_BLOCK IM_UNDERLINE IM_NO_CURSOR
Blinking block Single blinking underline Block Single underline No cursor displayed
Example See example for im_get_display_mode on page 72.
im_get_cursor_xy Purpose
Syntax
IN Parameters
This function retrieves the current cursor position. If viewporting is disabled, the cursor position is relative to the terminal display. If viewporting is enabled, the cursor position is relative to the virtual display. #include "imt24lib.h" IM_STATUS im_get_cursor_xy (IM_USHORT far *row, IM_USHORT far *col);
None
OUT Parameters row col Return Value
Pointer to the vertical position. The top of the display is row 0 and the bottom of the display is row 24. Pointer to the horizontal position. The left edge of the display is column 0.
This function returns this code: IM_SUCCESS
Success
Example See example for im_get_display_mode on page 72.
70
Trakker Antares PSK Reference Manual
Page 91
Chapter 5, PSK Function Descriptions im_get_display_mode Purpose Syntax
This function returns the display font, character height and width, and scrolling and wrapping status. #include "imt24lib.h" IM_STATUS im_get_display_mode (IM_FONT_TYPE far *font, IM_UCHAR far *phys_width, IM_UCHAR far *phys_height, IM_BOOL far *scroll, IM_BOOL far *wrap);
IN Parameters
None
OUT Parameters font phys_width phys_height scroll wrap Return Value
Font type code and is one of these constants: IM_FONT_STANDARD
Text is 8 x 8 pixels
IM_FONT_5X6
Text is 5 x 6 pixels
IM_FONT_6X8
Text is 6 x 8 pixels
IM_FONT_8X10
Text is 8 x 10 pixels
IM_FONT_12X16
Text is 12 x 16 pixels
IM_FONT_DOUBLEBYTE IM_FONT_KANA
Double byte text is 16 x 16 pixels Kana text is 8 x 16 pixels
IM_FONT_LARGE
Text is 8 x 16 pixels
IM_FONT_NONE
No text
IM_FONT_SPECIAL
Text is 16 x 16 pixels
Width of the physical display given in the number of characters in the current font that the display can hold. Height of the physical display given in the number of characters in the current font that the display can hold. Status of the flag for scroll at bottom of window/viewport. Status of the flag for wrap at right edge of window/viewport.
This function returns one of these codes: IM_SUCCESS IM_INVALID_ ADDRESS
Notes
Success One of the parameters has an address other than 0 (zero) and is outside of the application address space
To omit a parameter, set it to 0. No information for that parameter is returned.
See Also im_set_display_mode
Trakker Antares PSK Reference Manual
71
Page 92
Chapter 5, PSK Function Descriptions im_get_display_mode (continued)
Example /********************* im_get_display_mode ***************************/ /* This function draws a line somewhere on the screen relative to */ /* the bottom line. */ #include "imt24lib.h" void far status_line(char far * pszStatusLine, IM_BOOL iWait, IM_USHORT iLine) { IM_UCHAR iPhyWidth, iPhyHeight; IM_USHORT iListLine, iRow, iCol, iVpRow, iVpCol; IM_CONTROL iFollowCursor; IM_CURS_TYPE iCursType; /* Get current conditions */ im_get_cursor_xy (&iRow, &iCol); im_get_display_mode (0, &iPhyWidth, &iPhyHeight, 0, 0); iCursType = im_get_cursor_style ( ); im_get_follow_cursor (&iFollowCursor); /* Set temporary conditions */ im_set_cursor_style (IM_NO_CURSOR); /* Don't want to follow cursor while putting up display. */ im_set_follow_cursor (IM_DISABLE); /* Find out where in viewport to put it. */ if ( iLine >= iPhyHeight) iListLine = iPhyHeight-1; /* Get the 0-based offset & keep inside the window. */ else iListLine = iLine; im_viewport_getxy (&iVpRow, &iVpCol); im_set_cursor_xy (iVpRow+iListLine, iVpCol); im_cputs ( (IM_CHAR far *) pszStatusLine, 0); im_standby_wait (3000); /* Sleep 3 seconds. */ /* Restore original conditions. */ im_set_cursor_xy (iRow, iCol); im_set_follow_cursor (iFollowCursor); im_set_cursor_style (iCursType); }
72
Trakker Antares PSK Reference Manual
Page 93
Chapter 5, PSK Function Descriptions im_get_display_size_physical Purpose Syntax
IN Parameters
This function returns the current display size. #include "imt24lib.h" IM_STATUS im_get_display_size_physical (IM_USHORT far *rows, IM_USHORT far *cols);
None
OUT Parameters rows cols
Current setting for the number of rows in the physical display. Current setting for the number of columns in the physical display. Success Return Value IM_SUCCESS Default physical display is 20 columns by 16 rows. Notes 241X, 242X, 243X 2455 Default physical display is 80 columns by 25 rows. 2460/2461 Default physical display is 16 columns by 2 rows. 2475 Default physical display is 40 columns by 25 rows. 2480/2485 Default physical display is 40 columns by 4 rows. 2481/2486 Default physical display is 40 columns by 25 rows. Trakker Antares terminals can also use a virtual display that is 80 columns by 25 rows with the viewport feature. See Also im_get_display_mode, im_get_display_type, im_set_display_mode, im_set_display_type
Example /********************* im_get_display_size_physical ******************/ /* This function draws a line somewhere on the screen relative to */ /* the bottom line. */ #include "imt24lib.h" void far status_line(char far * pszStatusLine, IM_BOOL iWait, IM_USHORT iLine) { IM_UCHAR iPhyWidth, iPhyHeight; IM_USHORT iListLine, iRow, iCol, iVpRow, iVpCol; IM_CONTROL iFollowCursor; IM_CURS_TYPE iCursType;
Trakker Antares PSK Reference Manual
73
Page 94
Chapter 5, PSK Function Descriptions im_get_display_size_physical (continued) /* Get current conditions */ im_get_cursor_xy (&iRow, &iCol); im_get_display_size_physical (&iPhyWidth, &iPhyHeight); iCursType = im_get_cursor_style ( ); im_get_follow_cursor (&iFollowCursor); /* Set temporary conditions */ im_set_cursor_style (IM_NO_CURSOR); /* Don't want to follow cursor while putting up display. */ im_set_follow_cursor (IM_DISABLE); /* Find out where in viewport to put it. */ if ( iLine >= iPhyHeight) iListLine = iPhyHeight-1; /* Get 0-based offset & keep inside window. */ else iListLine = iLine; im_viewport_getxy (&iVpRow, &iVpCol); im_set_cursor_xy (iVpRow+iListLine, iVpCol); im_cputs ( (IM_CHAR far *) pszStatusLine, 0); im_standby_wait (3000); /* Sleep 3 seconds. */ /* Restore original conditions. */ im_set_cursor_xy (iRow, iCol); im_set_follow_cursor (iFollowCursor); im_set_cursor_style (iCursType); } im_get_display_size_virtual Purpose Syntax
This function returns the current size of the virtual display. #include "imt24lib.h" void far im_get_display_size_virtual (IM_USHORT far *rows, IM_USHORT far *cols);
IN Parameters
None
OUT Parameters rows cols
Return Value
None
Notes
Current setting for the number of rows in the virtual display. Current setting for the number of columns in the virtual display.
The default virtual display is 80 columns by 25 rows.
See Also im_get_display_mode, im_get_display_type, im_set_display_mode, im_set_display_type, im_set_viewporting, im_setup_manual_viewporting
Example See example for im_get_display_size_physical on page 73.
74
Trakker Antares PSK Reference Manual