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 18 of 40

2D JANUS PSK for C/C++ Reference Manual, pages 171 to 180

Pages 171 to 180 of 400

The original document is the PDF (793 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 171

im_transmit_buffer_no_wait

2 im_transmit_buffer_no_wait Purpose:

This function transmits the contents of a buffer and passes control back to its client.

Syntax:

#include <im20lib.h> IM_STATUS im_transmit_buffer_no_wait (IM_COM_PORT port_id, IM_COM_DATA_BUFFER far *data_struct);

IN Parameters:

The port_id parameter identifies the communications port as follows: IM_COM1 IM_COM2 IM_COM4

COM1 COM2, scanner port (2010 and 2050) COM4 (RF only)

The data_struct parameter is a far pointer to the data array that you want to transmit. OUT Parameters:

None.

Return Value:

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

Notes:

You must install a protocol handler to use this function. This function differs from im_transmit_buffer in that the client must set the buffer structure and monitor the buffer status until transmission is complete. Use this function for multiple buffer transmissions in conjunction with checking the status in data_struct. You must build and maintain a data_struct of the type IM_COM_DATA_BUFFER as described in IM20LIB.H.

See Also:

im_transmit_buffer_noprot, im_cancel_tx_buffer

2-145

Page 172

im_transmit_buffer_no_wait

Example /******************** im_transmit_buffer_no_wait ************************/ /* Also with: im_cancel_tx_buffer */ /* Note: Must have reader services and comm protocol handler installed to */ /* enable send/receive buffer functions. */ /* Run these TSR's at DOS prompt before running these tests: */ /* rservice */ /* phimec 1 ( 1 is COM1) */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "im20lib.h" #include "immsg.h" static IM_COM_PORT com_port = IM_COM1;

/* Uses COM1*/ static IM_UCHAR *data_str[] = { "Hi There, It must have four lines down the road from this demo\r" "The line 2 demonstration proves the Transmit Buffer No Wait working\r", "The line 3 demonstration proves the Transmit Buffer No Wait working\r", "The demonstration of the Transmit Buffer No Wait is Done\r", NULL }; void main (void) { IM_USHORT IM_COM_DATA_BUFFER IM_STATUS IM_UCHAR index; com_buff_struct; /*data buffer structure for receive/transmit */ status; data_buff[300];

/* Get the transmit environment ready */ status = im_cancel_tx_buffer(com_port); printf("Cancel Tx status: %xH\n", status); /* Transmitting data string loop until it reaches NULL */ for (index =0; data_str[index] != NULL; index++) { /* Copy string to transmit into big buffer */ strcpy(data_buff, data_str[index]); /* Set up comm buffer parameters */ com_buff_struct.command = IM_CU_TRANSMIT; com_buff_struct.user_length = strlen(data_buff); com_buff_struct.comm_length = 0; com_buff_struct.protocol_mode = IM_NO_PROTOCOL; com_buff_struct.eom_char = 0; com_buff_struct.data_ptr = (char far *)data_buff; com_buff_struct.protocol_xfer_status = IM_COMM_INUSE; /* Call Intermec routine */ status = im_transmit_buffer_no_wait(com_port, (IM_COM_DATA_BUFFER far *) &com_buff_struct); if (IM_ISSUCCESS(status)) { /* Wait for data transfer to complete */ while (com_buff_struct.protocol_xfer_status == IM_COMM_INUSE) ; /* Waiting loop, end while */

2-146

Page 173

im_transmit_buffer_no_wait

2 printf("Line %d Sent\n", index + 1); } else { printf("Tx Error = %XH\n", status); printf("Buffer not sent\n"); } }

/* for */ printf ("Transmit Done\n"); }

2-147

Page 174

im_transmit_buffer_noprot im_transmit_buffer_noprot Purpose:

This function transmits a buffer without protocol and sends only the specified number of characters.

Syntax:

#include <im20lib.h> IM_STATUS im_transmit_buffer_noprot (IM_COM_PORT port_id, IM_USHORT user_length, IM_UCHAR far *data_buffer IM_USHORT timeout);

IN Parameters:

The port_id parameter identifies the communications port as follows: IM_COM1 IM_COM2 IM_COM4

COM1 COM2, scanner port (2010 and 2050) COM4 (RF only)

The user_length parameter is the maximum number of bytes to transmit. The data_buffer parameter is a far pointer to the data array that you want to transmit. The timeout parameter is the transmission timeout period. You can exit the function before data is sent 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. OUT Parameters:

None.

Return Value:

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

2-148

Page 175

im_transmit_buffer_noprot

Notes:

2

You must install a protocol handler other than PHPCSTD.EXE to use this function. If an existing transmit client is linked to the host, you must issue a cancel command first.

See Also:

im_transmit_buffer_no_wait, im_cancel_tx_buffer, im_transmit_buffer

Example /******************** im_transmit_buffer_noprot ************************/ /* Also with: im_cancel_tx_buffer */ /* Note: Must have reader services and comm protocol handler installed to /* enable send/receive buffer functions. /* Run these TSR's at DOS prompt before running these tests: /* rservice /* phimec 1 ( 1 is COM1)

*/ */ */ */ */

#include <stdio.h> #include <stdlib.h> #include <string.h> #include "im20lib.h" #include "immsg.h" static IM_COM_PORT com_port = IM_COM1;

/* Uses COM1*/ static IM_UCHAR *data_str[] = { "Hi There, It must have three lines down the road from this demo", "The line 2 demo proves the Transmit Buffer No Protocol is working", "The demonstration of the Transmit Buffer No Protocol is Done", NULL }; void main (void) { IM_STATUS status; IM_USHORT index; IM_UCHAR data_buffer[300]; /* PHIMEC protocol handler must be installed to run this routine */ /* It only works with PHIMEC protocol */ /* Get the transmit environment ready */ status = im_cancel_tx_buffer(com_port); printf("Cancel Tx status: %xH\n", status); /* Sending data string loop until it reaches NULL */ for (index =0; data_str[index] != NULL; index++) { /* Copy string to transmit into big buffer */ strcpy(data_buffer, data_str[index]); /* Call Intermec routine with infinite timeout */ status = im_transmit_buffer_noprot(com_port, strlen(data_buffer), data_buffer, IM_INFINITE_TIMEOUT);

2-149

Page 176

im_transmit_buffer_noprot if (IM_ISSUCCESS(status)) printf("Line %d Sent\n", index + 1); else printf("Tx Error\nStatus = %xH\n", status); } printf("Tx No Protocol Done\n"); }

2-150

Page 177

im_transmit_byte

2 im_transmit_byte Purpose:

This function transmits one byte of data out from the designated communications port. This function is identical to MS-DOS INT 14H Service 01H.

Syntax:

#include <im20lib.h> IM_STATUS im_transmit_byte (IM_COM_PORT port_id, IM_UCHAR transmit_byte);

IN Parameters:

The port_id parameter identifies the communications port as follows: IM_COM1 IM_COM2 IM_COM4

COM1 COM2, scanner port (2010 and 2050) COM4 (RF only)

The transmit_byte parameter is the byte of data to transmit. OUT Parameters:

None.

Return Value:

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

Notes:

This function requires the PC standard protocol handler PHPCSTD.EXE. Intermec recommends using im_transmit_buffer (with a user_length of one) instead of using im_transmit_byte. You can use this function for an acknowledgment.

See Also:

im_receive_byte, im_transmit_buffer

2-151

Page 178

im_transmit_byte

Example /******************** im_transmit_byte ************************************/ /* Uses Borland _bio_serialcom or Microsoft _bios_serialcom to init the */ /* com port for single byte. */ /* Operations. It sets up for 9600,E,7,1 on serial port */ /* Note: Phimec protocol handler must NOT be installed to run this routine */ #include <stdio.h> #include <dos.h> #include <conio.h> #include <stdlib.h> #include <bios.h> #include <string.h> #include "im20lib.h" #include "immsg.h" /* Byte oriented defines */ #define COM1 0 #define SETTINGS (_COM_9600 | _COM_CHR7 | _COM_STOP1 | _COM_EVENPARITY ) static IM_COM_PORT com_port = IM_COM1;

/* Uses COM1*/ void main (void) { IM_UCHAR outchar; IM_STATUS status; printf("\nChoose a protocol:\n"); printf("1) PC Standard\n"); printf("2) No protocol\n"); if (getche() == '2') /* Call bios to initialize com port */ { /* Communications port init */ _bios_serialcom(_COM_INIT, COM1, SETTINGS); } /* Display instruction */ printf ("Enter characters\n"); printf (" to be transmitted\n"); printf (" <ESC> to quit\n"); /* Phimec protocol handler must NOT be installed ...*/ while ((outchar = getche()) != '\x1B') /* Send char until <ESC> char*/ { /* Call Intermec function */ status = im_transmit_byte( com_port, outchar); if ( IM_ISERROR(status)) im_message(status); } }

2-152

Page 179

im_unlink_comm

2 im_unlink_comm Purpose:

This function removes the link between the Reader Wedge function and a designated communications port. After this function excutes, the Reader Wedge is not notified of receive buffer functions. You only need to use this procedure one time, at the end of your program.

Syntax:

#include <im20lib.h> IM_STATUS im_unlink_comm (IM_COM_PORT port_id);

IN Parameters:

The port_id parameter identifies the communications port as follows: IM_COM1 IM_COM2 IM_COM4

COM1 COM2, scanner port (2010 and 2050) COM4 (RF only)

OUT Parameters:

None.

Return Value:

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

Notes:

You must install a protocol handler to use this function. 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_link_comm

Example See example for im_receive_input.

2-153

Page 180

im_viewport_end im_viewport_end Purpose:

This function sets the viewport to the lower right corner (end) of the virtual display.

Syntax:

#include <im20lib.h> void im_viewport_end(void);

IN Parameters:

None.

OUT Parameters:

None.

Return Value:

None.

Notes:

This function has no effect on the JANUS 2050.

See Also:

im_cursor_to_viewport, im_viewport_home, im_viewport_move, im_viewport_page_down, im_viewport_page_up, im_viewport_to_cursor

Example See example for im_viewport_setxy.

2-154