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 25 of 42

JANUS PSK for C/C++ Reference Manual, Version 2.1, pages 241 to 250

Pages 241 to 250 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 241

INT 7EH, Function 10H

3

INT 7EH, Function 10H Enable Viewport Purpose:

This function enables the viewport so that it automatically follows the cursor. This function does not apply to the JANUS 2050.

Call With:

AH =

10H

Enable viewport

Return Value:

AX = nnnn

One of the standard status codes defined in Appendix A, “Status Codes.”

See Also:

VP_CUR.CPP in Appendix B, “Sample Interrupt Programs.”

3-43

Page 242

INT 7EH, Function 11H

INT 7EH, Function 11H Disable Viewport Purpose:

This function disables the viewport from automatically following the cursor. This function does not apply to the JANUS 2050.

Call With:

AH =

Return Value:

AX = nnnn

See Also:

VP_CUR.CPP in Appendix B, “Sample Interrupt Programs.”

3-44

11H

Disable viewport One of the standard status codes defined in Appendix A, “Status Codes.”

Page 243

4 Advanced Programming

Page 244

This page is a scan with no text; see it in the PDF.

Page 245

Advanced Programming

4

This chapter explains the various reader input modes and how to use the power management software.

Reader Input Modes Reader input modes affect how scanned input is interpreted and stored by the reader. You can control input modes by: • Using the reader commands described in your JANUS user’s manual. • Using the im_get_input_mode and im_set_input_mode commands described in Chapter 2, “C Language Support.” • Using the imGetInputMode and imSetInputMode commands described in the JANUS PSK for Basic Reference Manual. • Using the im_get_input_mode and im_set_input_mode commands described the JANUS PSK for Ada Reference Manual. There are three different input modes: • Wedge mode • Programmer mode • Desktop mode

Wedge Mode In 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 are loaded (RSERVICE.EXE). Use this mode when the reader is running an application that uses the Virtual Wedge. For more information about the Virtual Wedge, see Chapter 1, “Getting Started.” When the reader is in Wedge mode, use standard input functions such as getch to retrieve keypad or label input. Do not use the methods described for other modes. Wedge mode does not take full advantage of the reader power management capabilities. You will probably notice reduced battery life when the reader is in Wedge mode.

4-3

Page 246

JANUS PSK for C/C++ Reference Manual

Programmer Mode In Programmer mode, keypad input is echoed to the screen as the keys are pressed. Any reader commands that you enter are executed and saved. Use this mode when the reader is executing Interactive Reader Language (IRL) commands such as im_irl_a, or im_irl_k.

Desktop Mode In Desktop mode, the application is responsible for retrieving and displaying keypad input. Use this mode when you need detailed information about the pressed key. Use the input function im_receive_input to capture the keys pressed. Each character returned uses the structure IM_KEYCODE, described in IM20LIB.H. This structure consists of four bytes: the ASCII code, the scan code, and two bytes of keyboard flags (Shift, Control, Alt).

Differences in Input Modes Programmer mode and Desktop mode differ only in how they handle keypad inputs. In programmer mode, keypad entry terminates when you press the Enter key. In desktop mode, keypad entry terminates each time you press a key. Do not use functions such as getch to retrieve input when the reader is in Desktop or Programmer modes. The internal software intercepts any input before functions such as getch can receive it, and the application waits forever on that instruction. In Wedge mode, label input is placed directly into the keyboard buffer. In Programmer and Desktop modes, label input is not placed into the keyboard buffer. It is, however, retrieved in a manner similar to the way keyboard data is retrieved. An example of handling reader input is given below. Note: For the reader to function as a bar code reader, LOADSYMB.EXE must be loaded. RDG.BAT loads both reader services (RSERVICE.EXE) and the decode algorithms (LOADSYMB.EXE).

4-4

Page 247

Advanced Programming

4

Example: Input Modes // This example demonstrates reader input from either the keyboard or a label. Additional // sources (or a single source) can be given. All possible sources, including COM ports, // can be selected using IM_ALL_SELECT. // // In programmer mode, the im_receive_input() function returns after the Enter key is // pressed. In desktop mode, the im_receive_input() function returns after each // key is pressed. // // This method is used primarily to receive input from multiple sources when you do not // know the input source. char input[80]; IM_ORIGIN source; IM_DECTYPE symbol; IM_STATUS istatus im_set_input_mode(IM_PROGRAMMER);

// Input buffer (user sets the length) // Source(s) where input is to come from // Symbology (for label input) // Can also be IM_DESKTOP (but not IM_WEDGE)

istatus = im_receive_input (im_keyboard_select | im_label_select, im_infinite_timeout, &source, input); if (source = = IM_KEYBOARD_SELECT) { printf("Input from keyboard\n"); } if (source = = IM_LABEL_SELECT) { printf("Input from scanner\n"); } printf("%s\n", input);

4-5

Page 248

JANUS PSK for C/C++ Reference Manual

Receiving Serial Data There are two methods for receiving serial data: • Reader service routines that allow multiple inputs • Communications routines that use the INT 14H BIOS extensions The method you use depends on how you want to receive keypad and label data. Both of these methods are valid in Desktop mode and Programmer mode. With minor modifications, these methods will work in Wedge mode.

CAUTION

Caution Do not mix reader service routines with communications routines: a usable response is not returned. Conseil Ne mélangez pas les routines de révision lecteur à des routines de communication: aucune réponse utilisable ne sera renvoyée.

Reader Services Routines You can use reader service routines that include communications port inputs by following these application requirements: • At the beginning of your application, link the reader service input functions using a call to im_link_comm. At the end of your application, unlink them with a call to im_unlink_comm. • Enable or disable the protocol using im_serial_protocol_control. The default is to have the protocol enabled. • Clear the receive buffer by disabling and then enabling the protocol. Do not use im_cancel_rx_buffer when using this method because it stops the reader from communicating.

4-6

Page 249

Advanced Programming

4

Example: Reader Services // This example shows how to accept input from either the keyboard or from a serial // port. The function im_receive_input( ) is given two sources: keyboard or COM1. // Additional sources (or a single source) can be given. Use IM_ALL_SELECT to select // all possible sources (including label input). // // This program waits for input, and then makes it available by calling // im_receive_input( ). // // Use this method when you want to receive input from multiple sources and you don’t know // the input source. // // This is not a complete program, but it demonstrates the required function calls. char input[300]; // Input buffer (user sets the length) char com_buff[300]; // Used by Communications link only IM_ORIGIN source; // Source(s) where input is to come from IM_STATUS status; // Results of call im_set_input_mode(IM_PROGRAMMER);

//

// In this example, the mode might be IM_DESKTOP // (but not IM_WEDGE). If the reader is in // IM_WEDGE mode, use a function like gets( ) // to retrieve keyboard and label input. // The only sources that can be ORed together in // IM_WEDGE mode are COM ports.

im_link_comm(IM_COM1, com_buff, 300); // Link to reader services input routines // Wait for input from either the keyboard or from COM 1 status = im_receive_input (IM_KEYBOARD_SELECT | IM_COM1_SELECT, IM_INFINITE_TIMEOUT, &source, input); // Data is now available in the buffer input if (status == IM_RW_SUCCESS) im_transmit_buffer(IM_COM1, strlen(input), input, 1000); im_unlink_comm(IM_COM1);

// Transmit data with // a 1-second timeout // Unlink from reader services input routines

4-7

Page 250

JANUS PSK for C/C++ Reference Manual

Communications Routines You can use communications routines with the INT 14H BIOS extensions by following these application requirements: • Do not link your application with the reader service input functions (do not call im_link_comm). • Use either im_receive_buffer or im_receive_buffer_noprot to select communications with or without protocol. • Use im_cancel_rx_buffer to clear the receive buffer.

Example: Communications Routines // This example shows how input is requested from a single source. This function waits // for input and then puts it into the specified buffer. // In programmer mode, keyboard entry terminates when you press the Enter key. In desktop // mode, keyboard entry terminates when you press each key. IM_UCHAR IM_USHORT far IM_DECTYPE input[300]; num_chars; symbol;

// Input buffer (user sets the length)

im_set_input_mode(IM_PROGRAMMER);

// Could be any mode im_receive_buffer(IM_COM1, 300, input, 1000, &num_chars); im_transmit_buffer(IM_COM1, strlen(input), input, 1000);

4-8

// Get serial input (timeout) // is 1-second) // Transmit data with a // 1-second timeout