The text of a manual · part 9 of 42
JANUS PSK for C/C++ Reference Manual, Version 2.1, pages 81 to 90
Pages 81 to 90 of 414
The original document is the PDF (690 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Intermec J2020, Intermec J2010 and Intermec J2050
Page 81
im_get_viewport_lock
2 im_get_viewport_lock Purpose:
This function retrieves the current setting of the viewport lock. When the display is in 80 x 25 mode, you can use the viewport in virtual display mode unless the currently running application program restricts it. The application program may require the viewport to be locked or unlocked. The viewport lock only affects the user’s ability to move the viewport with the viewport control keys.
Syntax:
#include "im20lib.h" IM_STATUS im_get_viewport_lock (IM_CONTROL *viewport_lock);
IN Parameters:
None.
OUT Parameters:
The viewport_lock parameter is one of these constants: IM_ENABLE IM_DISABLE
Viewport is locked Viewport is unlocked
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
The display must be in 80 x 25 mode (see im_set_display_mode) to use this function. This function has no effect on the JANUS 2050. When the viewport is “locked,” the viewport movement keys do not move the viewport. The viewport can still move if follow-the-cursor mode is enabled.
See Also:
im_set_viewport_lock, im_set_display_mode, im_get_display_mode, im_get_follow_cursor, im_set_follow_cursor
2-53
Page 82
im_get_viewport_lock
Example /******************** im_get_viewport_lock *******************************/ /* Also with: im_set_viewport_lock */ #include <stdio.h> #include <conio.h> #include <ctype.h> #include <stdlib.h> #include "im20lib.h" #define
ESC_CHAR
0x1B void main (void) { IM_UCHAR ch, user_option; IM_CONTROL current_viewport_lock; clrscr();
/* Clear screen */
/* Get the current status of viewport lock for restore later */ im_get_viewport_lock(¤t_viewport_lock); /* Get user's input option, 'y' for disable viewport lock */ printf("\nEnable viewport\nlock(y)?"); user_option = toupper( getch()); if (user_option == 'Y') { /* Enable viewport lock */ im_set_viewport_lock(IM_ENABLE); printf("\n\n'ESC' to quit!\nType _f and arrow keys\n"); printf("See viewport lock!"); } else { /* Disable viewport lock */ im_set_viewport_lock(IM_DISABLE); printf("\n'ESC' to quit\nType _f and arrow keys\n"); printf("See viewport unlock!"); } /* Enter characters loop to check viewport movement until 'ESC' key. */ while ( (ch = getch()) != ESC_CHAR ) putch(ch); /* Restore viewport lock */ im_set_viewport_lock(current_viewport_lock); }
2-54
Page 83
im_get_warm_boot
2 im_get_warm_boot Purpose:
This function retrieves the current setting of the warm boot status flag. You can enable or disable the Ctrl-Alt-Del warm boot key sequence. When disabled, pressing the Ctrl-Alt-Del sequence does not reboot the reader.
Syntax:
#include "im20lib.h" IM_STATUS im_get_warm_boot (IM_CONTROL *warm_boot);
IN Parameters:
None.
OUT Parameters:
The warm_boot parameter is one of these constants: IM_ENABLE IM_DISABLE
Ctrl-Alt-Del warm boot is enabled Ctrl-Alt-Del warm boot is disabled
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
See Also:
im_set_warm_boot
2-55
Page 84
im_get_warm_boot
Example /******************** im_get_warm_boot *******************************/ /* Also with: im_set_warm_boot */ #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <ctype.h> #include "im20lib.h" void main (void) { IM_UCHAR user_option; IM_CONTROL old_warmboot; IM_CONTROL new_warmboot; clrscr(); gotoxy(1,1);
/* Clear screen */ /* Position message */
/* Get the current status of warn boot */ im_get_warm_boot(&old_warmboot); /* Display warm boot's status */ if (old_warmboot == IM_ENABLE) printf("Warm boot enabled!"); else printf("Warn boot disabled!"); /* Get user's input option, 'y' for enabling warm boot */ printf("\n\nEnable warmboot(y)?"); user_option = getche(); user_option = toupper(user_option); if (user_option == 'Y') { /* Warm boot enable */ im_set_warm_boot(IM_ENABLE); } else { /* Warm boot disable */ im_set_warm_boot(IM_DISABLE); } /* Get new warm boot's status after setting */ im_get_warm_boot(&new_warmboot); /* Display user's input setting */ if (new_warmboot == IM_ENABLE) printf("\nwarm boot enabled!"); else printf("\nWarm boot disabled!"); printf("\nTest it>>\n"); getch(); }
2-56
Page 85
im_increase_contrast
2 im_increase_contrast Purpose:
This function increases the LCD display contrast by one level. The display contrast is the lightness or darkness of the characters against the reader display. The reader display has 32 levels of contrast, where 0 is very light, and 31 is very dark.
Syntax:
#include <im20lib.h> IM_STATUS im_increase_contrast(void);
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
The 0 to 31 scale fine-tunes the contrast more precisely than using the keypad to adjust the contrast. The functions im_set_contrast and im_get_contrast use a scale of 0 to 7 that is related to the scale of 0 to 31 used by im_increase_contrast and im_decrease_contrast. The following table compares the two scales. This Value on Scale 0 to 7
Equates to This Value on Scale 0 to 31
Contrast Level
0 1 2 3 4 5 6 7
10 12 14 16 18 20 22 24
Very light
Very dark
This function has no effect on the JANUS 2050. See Also:
im_get_contrast, im_decrease_contrast, im_set_contrast
2-57
Page 86
im_increase_contrast
Example /******************** im_increase_contrast *******************************/ #include <stdio.h> #include "im20lib.h" #include "immsg.h" void main (void) { IM_STATUS status; status = im_increase_contrast(); /* If the most significant bit is set, there is an error */ if (IM_ISERROR(status)) printf("Inc Contrast error = %x\n", status); }
2-58
Page 87
im_input_status
2 im_input_status Purpose:
This function checks to see if any input buffers have data and returns the buffer identification.
Syntax:
#include <im20lib.h> IM_ORIGIN im_input_status (void);
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
IM_ORIGIN is one or more of these constants: IM_NO_SELECT IM_LABEL_SELECT IM_KEYBOARD_SELECT IM_COM1_SELECT IM_COM2_SELECT IM_COM4_SELECT IM_ALL_SELECT
No input buffer selected Label selected Keypad selected COM1 selected COM2, scanner port selected (2010 and 2050) COM4 selected (RF only) All input buffers are selected
Notes:
You must install the Reader Wedge to use this function. For information on loading RWTSR.EXE, see “Runtime Requirements” earlier in this chapter.
See Also:
im_receive_input
2-59
Page 88
im_input_status
Example /******************** im_input_status /* Also with: im_receive_input */ /* im_get_length */
*******************************/
#include <stdio.h> #include <conio.h> #include <stdlib.h> #include "im20lib.h" #include "immsg.h" void main (void) { IM_UCHAR input[300]; IM_MODE original_mode; IM_ORIGIN source; IM_STATUS status; window(1, 1, 20, 16); clrscr();
/* Set the application text window */ /* Clear the screen */ printf("Demo im_input_status\n"); /* Get the previous input mode for restoring input mode later */ original_mode = im_get_input_mode(); /* Set Reader Wedge mode to program interface */ im_set_input_mode(IM_DESKTOP); /* Loop until some input */ while ( (source = im_input_status()) == IM_NO_SELECT) ; /* See where the input comes from */ if ( source == IM_COM1_SELECT) printf("COM1 input:"); else printf("COM4 input:"); /* Request input from source */ status = im_receive_input(source, IM_INFINITE_TIMEOUT, &source, input); if ( IM_ISGOOD(status) ) printf("\n%s\n", input); else /* input error */ { printf("\n"); im_message(status); }
/* Display input data */
/* Restore original input mode */ im_set_input_mode(original_mode); }
2-60
Page 89
im_irl_a
2 im_irl_a Purpose:
This function returns input from bar code labels or the keypad in the same manner as IRL ASCII input command A. This function returns the input data to the buffer, edits reader commands, and displays input data. For more information on IRL and command A, refer to the IRL Programming Reference Manual.
Syntax:
#include <im20lib.h> IM_STATUS im_irl_a (IM_USHORT timeout, IM_LENGTH_SPEC test_table[], IM_UCHAR mask_string[], IM_UCHAR *instring, IM_USHORT *cmd_count, IM_DECTYPE *symbology);
IN Parameters:
The timeout parameter is the receive timeout period. You can exit the function before data is received or before the timeout occurs by performing an application break sequence (see your JANUS user’s manual). The return status indicates whether the function was successful, a timeout occurred, or the application break was received. The timeout parameter is a number or one of these constants: 1 to 65,534 ms IM_ZERO_TIMEOUT IM_INFINITE_TIMEOUT
Numeric range No wait Wait forever
If IM_INFINITE_TIMEOUT is selected, the function will not return until the end of message character has been received. Data is returned only if its length matches one of the five lengths specified in the test_table. The test_table parameter must be a matrix of the following form: {a, b, c, d}, {a, b, c, d}, {a, b, c, d}, {a, b, c, d}, {a, b, c, d},
2-61
Page 90
im_irl_a
The a position in the matrix is one of the following: IM_NO_LENGTH IM_LENGTH IM_RANGE
Accept data of any length Accept data with a specific length Accept data within a length range
If IM_LENGTH is specified in the a position, the actual length of the data string is placed in the d position (and b and c are not used). If IM_RANGE is specified in the a position, the data length must be within the range of b and c (and d is not used). Set any unused table entries to {IM_NO_LENGTH,0,0,0}. The mask_string parameter sets up a data mask that received data must match. mask_string can accept a string of constants or wildcard characters. For example, use the string ### - #### to accept only phone numbers. You can use one or more of these wildcard characters to define the mask: # @ ? NULL (CHR$(0)) OUT Parameters:
Numeric Alpha Alphanumeric printable No mask
The instring parameter is the input string. You must allocate at least 256 bytes for instring. The cmd_count returned is 0 unless an abort command is passed in the string.
2-62