Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 16 of 42

JANUS PSK for C/C++ Reference Manual, Version 2.1, pages 151 to 160

Pages 151 to 160 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 151

im_set_abort_callback

Example /******************** im_set_abort_callback *******************************/ /* Also with: im_clear_abort_callback */ /* im_set_input_mode */ /* im_standby_wait */ /* im_irlv */ /* */ /* Note: When using Microsoft "C" compiler, Inside Abort_Callback routines */ /* avoid to call any run-time routines referring to __iob variable */ /* Since microsoft put __iob into another segment. */ /* Borlandc "C" compiler doesn't have this problem. */ #include <stdio.h> #include <conio.h> #include <dos.h> #include "im20lib.h" #include "immsg.h" /* INTERNAL FUNCTIONS (EXPORTED) */ void _loadds Abort_Callback(unsigned short arg1, unsigned short arg2); /* STATIC FUNCTIONS (KNOWN ONLY BY THIS FILE) static int abort_flag;

*/ void main (void) { IM_UCHAR input[256]; IM_ORIGIN source; IM_USHORT cc; IM_DECTYPE symbol; /* FUNCTION BODY */ window(1, 1, 20, 16); clrscr();

/* Set the application text window */ /* Clear the screen */

/* Display Demo message */ printf("Demo IM_SET_ABORT_CALLBACK\n 'Q' to quit\n"); /* Set Reader Wedge mode to program interface */ im_set_input_mode(IM_PROGRAMMER); /* Set up abort callback notification hook */ im_set_abort_callback(IM_ALL_SELECT, Abort_Callback); /* Clear the abort flag */ abort_flag = 0; /* Demo's input loop */ do { /* Test wait */ printf("Start waiting for 3 seconds\n"); im_standby_wait(3000); printf("Done waiting for 3 seconds\n"); /* Test input IRL V */ printf("IRL V test\n"); /* Set source for labels and keypad */ source = IM_LABEL_SELECT | IM_KEYBOARD_SELECT;

2-122

Page 152

im_set_abort_callback

2

/* Request input from Reader Wedge */ im_irl_v(IM_INFINITE_TIMEOUT, IM_ENABLE, IM_WEDGE_BEEP, IM_ENABLE, &source, input, &cc, &symbol); /* Display the input */ printf("\n%s\n",input); /* Show a message if abort command in IRL was parsed */ if (abort_flag) { printf("\nAbort program parsed.\n%d\n", abort_flag); /* Clear the abort flag */ abort_flag = 0; } } while (input[0] != 'Q'

&& input[0] != 'q' );

/* Clear abort call back notification hook */ im_clear_abort_callback(); /* Switch the Reader Wedge back to virtual Wedge mode im_set_input_mode(IM_WEDGE);

*/

} /* ************************************************************************** * PURPOSE: callback function for abort program reader command detection * * NOTE: Need enable interrupt for this callback function, because * abort program is disable interrupt when it call callback function. ************************************************************************** */ void _loadds Abort_Callback(IM_USHORT arg1, IM_USHORT arg2) { /* Enable interrupt since the caller is disable the interrupt */ _enable(); /* Set the abort flag */ abort_flag = arg1; /**********************************************************************/ /* Note: In Borlandc "C" compiler, printf() routine works */ /* In Microsoft "C" compiler, all routines referring __iob */ /* variable won't work. using routine (like putch()) or */ /* directly output to console routine will work */ /**********************************************************************/ printf("\nabort arg:%d, %d\n", arg1, arg2); /* Does not work in Microsoft "C"*/ }

2-123

Page 153

im_set_contrast im_set_contrast Purpose:

This function sets the reader’s LCD display contrast level. There are eight levels of contrast (0 to 7) from very light to very dark, which are the most frequently used contrast settings.

Syntax:

#include <im20lib.h> IM_STATUS im_set_contrast (IM_UCHAR display_contrast_level);

IN Parameters:

The display_contrast_level parameter is one of these constants: IM_MIN_CONTRAST IM_AVE_CONTRAST IM_MAX_CONTRAST

Level 0 Level 4 Level 7

OUT Parameters:

None.

Return Value:

This function returns one of the standard status codes defined in Appendix A, “Status Codes.”

Notes:

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:

2-124 im_get_contrast, im_decrease_contrast, im_increase_contrast

Page 154

im_set_contrast

2

Example /******************** im_set_contrast *******************************/ /* Also with: im_get_contrast */ #include <stdio.h> #include <conio.h> #include "im20lib.h" #include "immsg.h" void main (void) { IM_STATUS status; IM_UCHAR contrast; IM_UCHAR level; clrscr(); for (level = 0; level < 10; level++) { status = im_set_contrast(level); /* If the most significant bit is set, there is an error */ if (IM_ISERROR(status)) printf("\nSet Contrast error = %x\n", status); else printf("\nContrast set to %d\n", level); status = im_get_contrast(&contrast); /* If the most significant bit is set, there is an error */ if (IM_ISERROR(status)) printf("\nGet Contrast error = %x\n", status); else printf("\nContrast is %d\n", level); /* Pause to see result */ printf("\nAny key to continue"); getch(); } }

2-125

Page 155

im_set_control_key im_set_control_key Purpose:

This function enables or disables the Ctrl key setting. When disabled, none of the key combinations that use the Ctrl key will work. For example, the warm boot key sequence Ctrl-Alt-Del will not work.

Syntax:

#include "im20lib.h" IM_STATUS im_set_control_key (IM_CONTROL control_key);

IN Parameters:

The control_key parameter is one of these constants: IM_ENABLE IM_DISABLE

Enable the Ctrl key Disable the Ctrl key

OUT Parameters:

None.

Return Value:

This function returns one of the standard status codes defined in Appendix A, “Status Codes.”

See Also:

im_get_control_key

Example See example for im_get_control_key.

2-126

Page 156

im_set_display_mode

2 im_set_display_mode Purpose:

This function sets the size mode, video mode, scroll mode, and character height of the display.

Syntax:

#include "im20lib.h" IM_STATUS im_set_display_mode (IM_STD_SIZE_MODE size_mode, IM_STD_VIDEO_MODE video_mode, IM_SCROLL_MODE scroll_mode, IM_CHARACTER_HEIGHT char_ht);

IN Parameters:

The size_mode parameter is required and is one of these constants: IM_SIZE_MODE_80X25 IM_SIZE_MODE_20X16 IM_SIZE_MODE_20X8 IM_SIZE_MODE_10X16 IM_SIZE_MODE_10X8

80 x 25 text mode 20 x 16 text mode (2010 and 2020) 20 x 8 text mode (2010 and 2020) 10 x 16 text mode (2010 and 2020) 10 x 8 text mode (2010 and 2020)

If the size_mode parameter is set to IM_SIZE_MODE_80X25, you also need to set the video mode, scroll mode, and character height. If any other size_mode is set, the video mode, scroll mode, and character height are automatically set. The video_mode parameter requires IM_SIZE_MODE_80X25. The standard PC BIOS supports up to video mode 13H. The reader only supports up to video mode 6. You can also set video modes 0 through 3 with IC.EXE. The video_mode parameter is one of these constants: IM_STD_VIDEO_MODE_0 IM_STD_VIDEO_MODE_1 IM_STD_VIDEO_MODE_2 IM_STD_VIDEO_MODE_3 IM_STD_VIDEO_MODE_4 IM_STD_VIDEO_MODE_5 IM_STD_VIDEO_MODE_6

40 x 25 (use for double-wide character) 40 x 25 (use for double-wide character) 80 x 25 80 x 25 300 x 200 2-color 300 x 200 monochrome 640 x 200 2-color (2050)

2-127

Page 157

im_set_display_mode

The scroll_mode requires IM_SIZE_MODE_80X25 and is one of these constants: IM_LCD_SCROLL_AT_25 IM_LCD_SCROLL_AT_16 IM_LCD_SCROLL_AT_13 IM_LCD_SCROLL_AT_8

Scroll at line 25 Scroll at line 16 (2010 and 2020) Scroll at line 13 (2050 and double height) Scroll at line 8 (2010 and 2020)

The char_ht requires IM_SIZE_MODE_80X25 and is one of these constants: IM_STANDARD_CHAR_HEIGHT

Standard height characters. You must have set the scroll_mode to scroll at line 25 or line 16.

IM_DOUBLE_CHAR_HEIGHT

Double height characters. You must have set the scroll_mode to scroll at line 8 or line 13.

OUT Parameters:

None.

Return Value:

This function returns one of the standard status codes defined in Appendix A, “Status Codes.”

Notes:

Changing display modes clears the screen. The IRL input commands do not display correctly when the display is in 80 x 25 mode and the cursor has scrolled off the display. To alleviate this problem, set the display mode to one of the other modes, such as 20 x 16. If your application uses an 8 x 10 or 16 x 10 (double width) display size and direct video addressing, the application will lock up because the display size does not provide enough characters to be detected by the hardware and displayed to the JANUS reader’s screen. To avoid this problem, you must write the video using the BIOS when using a double width display size. For example, you can use the Borland global variable directvideo, which determines whether video writing goes to BIOS or direct video. Note: Intermec recommends that all applications write video using the BIOS instead of using direct video addressing.

2-128

Page 158

im_set_display_mode

2

The mode does not change if there are conflicting parameters, such as trying to set the video_mode to 16 lines and the scroll_mode at line 8. If you want to use one of the graphics modes, use the appropriate function call provided by your programming language. For example, Borland uses initgraph and Microsoft uses _setvideomode. 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_get_display_mode, im_set_follow_cursor

Example See example for im_viewport_setxy.

2-129

Page 159

im_set_follow_cursor im_set_follow_cursor Purpose:

When the display is in 80 x 25 mode, the viewport follows the cursor as it moves. This function enables or disables the follow-the-cursor feature.

Syntax:

#include "im20lib.h" IM_STATUS im_set_follow_cursor (IM_CONTROL follow_cursor);

IN Parameters:

The follow_cursor parameter is one of these constants: IM_ENABLE IM_DISABLE

Enable follow-the-cursor mode Disable follow-the-cursor mode

OUT Parameters:

None.

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 for this function to work correctly. This function has no effect on the JANUS 2050.

See Also:

im_get_follow_cursor

Example See example for im_get_follow_cursor.

2-130

Page 160

im_set_input_mode

2 im_set_input_mode Purpose:

This function clears the input buffers and sets the input manager to one of three modes: Wedge, Programmer, or Desktop.

Syntax:

#include <im20lib.h> void im_set_input_mode (IM_MODE mode);

IN Parameters:

The mode parameter is one of these constants: IM_WEDGE IM_PROGRAMMER IM_DESKTOP

Wedge mode Programmer mode Desktop mode

OUT Parameters:

None.

Return Value:

None.

Notes:

You must install the Reader Wedge to use this function. For information on loading RWTSR.EXE, see “Runtime Requirements” earlier in this chapter. There are three different reader input modes: Wedge, Programmer, or Desktop. These modes affect how the reader interprets and stores input. Wedge Mode Keypad and label inputs go into the keyboard buffer with minimal filtering. Wedge mode is the default mode at the DOS prompt after reader services (RSERVICE.EXE) is loaded. Use Wedge mode when the reader is running an application that uses the Virtual Wedge. When in this mode, use standard input functions to retrieve keypad or label input. Wedge mode does not take full advantage of the reader’s power management capabilities. You will probably notice reduced battery life when the reader is in this mode compared to either Programmer or Desktop mode. For more information on power management, see Chapter 4, “Advanced Programming.” Programmer Mode Inputs are echoed to the screen. Reader commands are executed and saved. Use Programmer mode when the reader is executing IRL commands. In general, when you are running an application that uses the function libraries or software interrupts, the reader should be in Programmer mode.

2-131