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 13 of 28

6400 PSK Reference Manual, pages 121 to 130

Pages 121 to 130 of 272

The original document is the PDF (1.1 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.

For the Intermec 6400

Page 121

im_putchar

5 im_putchar Purpose:

This function places a character at the current cursor position with the specified attribute.

Syntax:

#include "im64psk.h" IM_STATUS im_putchar (IM_UCHAR char, IM_ATTRIBUTES attrib);

IN Parameters:

char

Specifies the character to be displayed attrib Specifies the display attribute for the character. Choose one of these constants: IM_NORMAL Plain text IM_INVERSE

Inverse color text

IM_UNDERLINE Underlined text OUT Parameters: Return Value:

None. This function returns one of these codes: IM_SUCCESS Success IM_INVALID_PARAM_2

See Also:

Invalid attribute value im_puts

5-65

Page 122

im_puts im_puts Purpose:

This function places a string on the screen with the specified attribute at the current cursor location with the specified attribute and appends a carriage return and line feed (CR LF) to the string.

Syntax:

#include "im64psk.h" IM_STATUS im_puts (IM_UCHAR far *string, IM_ATTRIBUTES attrib);

IN Parameters:

string

Far pointer to the text string to be displayed.

attrib Specifies the display attribute for the string. Choose one of these constants: IM_NORMAL Plain text IM_INVERSE

Inverse color text

IM_UNDERLINE Underline text OUT Parameters: Return Value:

None. This function returns one of these codes: IM_SUCCESS Success IM_BAD_ADDRESS

Invalid string address

IM_INVALID_PARAM_2 See Also:

5-66 im_cputs, im_putchar

Invalid attribute value

Page 123

im_put_text

5 im_put_text Purpose:

This function places a rectangular section of text on the virtual screen at the specified starting row and column and ending row and column.

Syntax:

#include “im64psk.h” IM_STATUS im_put_text (IM_USHORT start_col, IM_USHORT start_row, IM_USHORT end_col, IM_USHORT end_row, IM_UCHAR far *text_array);

IN Parameters:

start_col

Starting column.

start_row

Starting row.

end_col

Ending column.

end_row Ending row. text_array Character array large enough to hold a character and an attribute for each character position in the display range. text_array[n] Contains the attribute, where n is an odd number. text_array[m] OUT Parameters: Return Value:

Contains the character, where m is an even number.

None This function returns one of these codes: IM_SUCCESS

Successfully placed the text.

IM_INVALID_PAIR The end row/column combination is before the start row/column combination. No data placed. IM_INVALID_START The starting location is outside the virtual display. No data placed. IM_INVALID_END placed. Notes:

See Also:

The ending location is outside the virtual display. No data

The placed data includes a one-byte character and a one-byte attribute for each screen position. im_get_screen_char, im_get_text

Example See example for im_get_text.

5-67

Page 124

im_putchar_dbyte im_putchar_dbyte Purpose:

This function displays a double-byte international character on the screen with the specified attributes.

Syntax:

#include “im64psk.h” IM_STATUS im_putchar_dbyte (IM_USHORT char, IM_ATTRIBUTES attrib)

IN Parameters:

char

Unsigned short that represents the double-byte international character to display.

attrib Any combination of these constants: IM_NORMAL Plain text. IM_BLINK

Blinking text.

IM_INVERSE

Inverse color text.

IM_UNDERLINE Underlined text. OUT Parameters: Return Value:

None This function returns one of these codes: IM_SUCCESS Success. IM_INVALID_PARAM_1

Notes:

Invalid attribute value.

Double-byte characters are used in character sets (Chinese, Japanese, Korean) where the number of characters exceeds 256. You must have a double-byte character set installed on the host in order to use this function. Currently, the Application Simulator cannot simulate double-byte characters. The 2460 and 2461 terminals do not support this function.

Example /******************************************************************/ // Example of placing double byte (BIG5) character and string #include “im64psk.h” #include <conio.h> #include <stdio.h> void main(void) { IM_BOOL iBool;

5-68

Page 125

im_receive_buffer

5 im_receive_buffer Purpose:

This function receives the contents of a data buffer from the serial communications port.

Syntax:

#include "im64psk.h" IM_STATUS im_receive_buffer (IM_COM_PORT port_id, IM_USHORT length, IM_UCHAR far *data_buffer, IM_LTIME timeout, IM_USHORT far *comm_length);

IN Parameters:

port_id Identifies the communications port. Use this constant: IM_COM1 COM1 port IM_NET length

Radio stream or TCP/IP network

Specifies the maximum number of bytes to receive.

data_buffer Far pointer to the data array where you want to place the received data. This buffer must hold at least the number of bytes passed in as length. timeout Specifies the receive timeout period. Either enter a number from 0 to 4,294,967,294 to indicate the length of the timeout in milliseconds (55 ms granularity), or choose one of these constants: IM_INFINITE_NET_TIMEOUT IM_ZERO_TIMEOUT OUT Parameters:

Return Value:

Never timeout

No wait comm_length Far pointer to the variable that will hold the actual number of bytes received upon completion of the call. If IM_SUCCESS is not returned, this value will be 0. This function returns one of these codes: IM_SUCCESS

Successfully received data

IM_NET_BAD_DATA Data pointer is null or invalid data length IM_NET_DATA_LENGTH IM_TIMEDOUT

Data buffer size is too small for frame

No data was received in the timeout period

IM_INVALID_PORT

Invalid port_id

IM_BUFFER_OVERFLOW Receive buffer overflowed and needed to be flushed. This error will only be returned in character mode. Notes:

This function does not return until an end of message, a buffer is full, a timeout occurs, or an error occurs. If no EOM character is defined, the function returns after a character is received.

5-69

Page 126

im_receive_buffer im_receive_buffer (continued) To receive data from the radio network, im_receive_buffer requires that you provide radio parameters such as the terminal number, host identification, or LAN identification one time per application. The inquiry impacts all functions that provide radio communications (im_receive_field, im_receive_input, im_transmit_buffer). See Also:

im_receive_field, im_transmit_buffer

Example /********************* im_receive_buffer *****************************/ #include <string.h> #include <conio.h> #include "stdio.h" #include "im64psk.h" void main ( void ) { char szRxBuffer[1024]; IM_STATUS iStatus; IM_USHORT iCommLength; im_clear_screen(); iStatus = im_receive_buffer ( IM_NET, 1024, szRxBuffer, 10000L, &iCommLength ); if(iStatus == IM_SUCCESS) printf("\nData Receive: %s, Length: %u\n", szRxBuffer, iCommLength); else { printf("\nReceive Buffer Err:\nStatus Code#: %x\n", iStatus); im_message(iStatus); } getch(); }

5-70

Page 127

im_receive_buffer_no_wait

5 im_receive_buffer_no_wait Purpose:

This function receives data from the designated communications port and places the data into a user-defined record. It differs from im_receive_buffer in that the programmer must set up the data record and monitor the transfer status until transmission is complete. This function runs in the background after it is initiated; no checks are made. Use this function when receiving multiple buffer transmissions in conjunction with im_rx_check_status.

Syntax:

IN Parameters:

#include “im64psk.h” IM_STATUS im_receive_buffer_no_wait (IM_COM_PORT port_id, IM_COM_DATA_BUFFER far *data_struct); The port_id parameter identifies the communications port as follows: IM_COM1

COM1

IM_COM2

COM2, scanner port (2010 and 2050)

IM_COM4

COM4 (RF only)

The data_struct parameter is a far pointer to the data array for the received data. This buffer must hold at least 256 bytes. OUT Parameters:

None.

Return Value:

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

Notes:

You must build and maintain a data_struct of the type IM_COM_DATA_BUFFER as described in IM20LIB.H. You must periodically check the protocol_xfer_status element in the IM_COM_DATA_BUFFER record to see if all the data has been received. When protocol_xfer_status is no longer code 8602H (communications port in use), all data is received. You must install a protocol handler to use this function. This function differs from im_receive_buffer_noprot in that program execution continues after im_receive_buffer_no_wait is called. When im_receive_buffer_no prot returns from a function call, the data has been read, the timeout has expired, or no error was encountered.

See Also:

im_receive_buffer_noprot, im_cancel_rx_buffer, im_rx_check_status

5-71

Page 128

im_receive_buffer_no_wait im_receive_buffer_no_wait (continued) Example /******************** im_receive_buffer_no_wait ************************/ /* Also with: im_rx_check_status */ /* im_cancel_rx_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 <conio.h> #include <string.h> #include <ctype.h> #include "im64psk.h" #include "immsg.h" static IM_COM_PORT static IM_UCHAR void main (void) { IM_COM_DATA_BUFFER */ IM_STATUS IM_UCHAR IM_UCHAR int com_port = IM_COM1; eor_char = 'Q';

/* Uses COM1*/ /* Default end of receive char */ com_buff_struct; /*Data buffer structure for receive/transmit status; eor_byte; data_buff[300]; index = 0;

printf("Type End of receive\nchar?"); eor_byte = getche(); eor_byte = toupper( eor_byte);

/* Get End of Receive char */ if ( isascii(eor_byte)) eor_char = eor_byte; printf ("Enter characters\n"); printf ("to be received\n"); printf ("from host\n"); printf ("CRLF to End of Line\n");

/* Each line end with a CR & LF */

/* Get the receive environment ready */ status = im_cancel_rx_buffer(com_port); printf ("RX Init =%XH\n", status); /* Set up com_buff structure for init Receive Buffer No Wait */ com_buff_struct.command = IM_CU_RECEIVE; com_buff_struct.comm_length = 0; com_buff_struct.user_length = sizeof(data_buff); com_buff_struct.data_ptr = data_buff; com_buff_struct.protocol_mode = IM_NO_PROTOCOL; com_buff_struct.eom_char = 0x0d; /* CR for terminating char */ com_buff_struct.protocol_xfer_status = IM_COMM_INUSE; /* Call Intermec function */ status = im_receive_buffer_no_wait(com_port, (IM_COM_DATA_BUFFER far *)

5-72

Page 129

im_receive_buffer_no_wait

5 im_receive_buffer_no_wait (continued) &com_buff_struct); /* Uses im_rx_check_status to get the rest coming data */ do /* loop until first character in buffer is a 'Q' */ { /* Check for receive errors: Print the error status */ if ( IM_ISSUCCESS(status) ) { ++index; /* Indicator of the receiving buffer */ /* Let the receive data coming complete */ while (com_buff_struct.protocol_xfer_status == IM_COMM_INUSE) ; /* End of While loop, Wait the coming data settled */ printf ("Line %d Done\n", index); /* Put a null byte in received string for display */ data_buff[com_buff_struct.comm_length] = '\0'; /* If 1st byte in string is equal to eor_char, then quit the receive*/ eor_byte = toupper(data_buff[0]); /* Display received string to screen */ printf("%s\n", data_buff); /* ************************************************************* * Update buffer for next block before calling check status to * get protocol handler to reset status. ************************************************************** */ com_buff_struct.command = IM_CU_RECV_AGAIN; com_buff_struct.comm_length = 0; com_buff_struct.protocol_xfer_status = IM_COMM_INUSE; /* Call intermec function to see next block data */ status = im_rx_check_status(com_port); } else { eor_byte = '\0'; printf("Rx Error = %XH\n", status); } printf("ch: %xH, by: %xH\n", eor_char, eor_byte); } while ( eor_byte != eor_char);

/* Loop until reaching eor_char */ printf ("Receive Done\n"); }

5-73

Page 130

im_receive_byte im_receive_byte Purpose:

This function receives one byte of data through the designated communications port. This function is identical to MS-DOS INT 14H service 02H.

Syntax:

#include “im64psk.h” IM_STATUS im_receive_byte (IM_COM_PORT port_id, IM_UCHAR *receive_byte);

IN Parameters:

The port_id parameter identifies the communications port as follows: IM_COM1

COM1

IM_COM2

COM2, scanner port (2020 and 2050)

IM_COM4

COM4 (RF only)

OUT Parameters:

The receive_byte parameter is a pointer to the byte received from the communications port.

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. If you are using PHIMEC.EXE and want to receive a single byte, use im_receive_buffer with a buffer length of one instead of the im_receive_byte procedure. This procedure will not work if linked.

See Also:

im_transmit_byte

Example /******************** im_receive_byte *******************************/ /* Uses Borland _bio_serialcom or Microsoft _bios_serialcom to init the */ /* com port for single byte receive. */ /* Operations. It sets up for 9600,E,7,1 on serial port */ /* To Terminate reception of bytes: */ /* To end the reception of bytes from the host, type <ESC> on JANUS */ /* and then type a Ctrl Z on the host */ /* Note: Phimec protocol handler must NOT be installed to run this routine */ /* Phpcstd protocol handler must be installed to run this routine */ #include <stdio.h> #include <dos.h> #include <conio.h> #include <bios.h> #include <string.h> #include "im64psk.h" #include "immsg.h"

5-74