The text of a manual · part 17 of 28
6400 PSK Reference Manual, pages 161 to 170
Pages 161 to 170 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 161
im_transmit_buffer_no_wait
5 im_transmit_buffer_no_wait (continued) 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 "im64psk.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); im_cputs("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))
5-105
Page 162
im_transmit_buffer_no_wait im_transmit_buffer_no_wait (continued) { /* Wait for data transfer to complete */ while (com_buff_struct.protocol_xfer_status == IM_COMM_INUSE) ; /* Waiting loop, end while */ printf("Line %d Sent\n", index + 1); } else { printf("Tx Error = %XH\n", status); printf("Buffer not sent\n"); } }
/* for */ printf ("Transmit Done\n"); }
5-106
Page 163
im_transmit_buffer_no_wait_t
5 im_transmit_buffer_no_wait_t Purpose:
This function transmits the contents of a data buffer through a designated communications port without a timeout or wait. When this function is called, the user can input data to the 6400 while the transmission is in progress.
Syntax:
#include "im64psk.h" extern #ifdef _cplusplus "C" #endif IM_STATUS im_transmit_buffer_no_wait_t (IM_COM_PORT port_id, IM_USHORT length, IM_UCHAR far *data_buffer);
IN Parameters:
port_id Communications port: IM_COM1 COM1 input IM_NET length
Network input
Length of the buffer.
data_buffer Far pointer to the data array that you want to transmit. OUT Parameters: Return Value:
None. This function returns one of these codes: IM_SUCCESS Transmit completed IM_NET_NOT_READY Network not active or not properly configured IM_NET_BAD_DATA Data pointer is null or invalid data length IM_NET_DATA_LENGTH Data length exceeds 1K IM_NET_CONFIG_ERROR
Incorrect RF configuration
The status block returns one of these values: IM_COMM_INUSE 1 IM_NS_COMPLETE 2 IM_NS_CANCELLED 3 IM_NS_ERROR 4 Notes:
Use im_get_tx_status or im_event_wait to determine if the transmission has completed. Use im_cancel_tx_buffer to cancel a previous transmission. To receive data from the radio network, im_transmit_buffer_no_wait_t requires that you provide radio parameters such as the terminal number, host identification, or
5-107
Page 164
im_transmit_buffer_no_wait_t im_transmit_buffer_no_wait_t (continued) LAN identification one time per application. The inquiry impacts all functions that provide radio communications (im_receive_field, im_receive_input, im_receive_buffer, im_transmit_buffer). See Also:
im_cancel_tx_buffer, im_event_wait, im_get_tx_status, im_transmit_buffer
Example /**************** im_transmit_buffer_no_wait_t *************************/ /* accepts user input, transmits it, then displays any received data. */ /* Task switch occurs at least once per sec (to update time display). */ /* The battery runs down faster than if time was not being displayed. */ /***********************************************************************/ #include <string.h> #include <imstdio.h> #include <time.h> //#include <conio.h> #include "im64psk.h" IM_UCHAR gszString[1024]; /* Routine to display the time and other header info */ void doHeader ( void ) { IM_USHORT iX, iY; char szTime[9], szData[9]; im_get_cursor_xy( &iY, &iX ); /* Save cursor so can restore after paint heading */ im_set_cursor_xy(0,0); /* Display the time */ szTime[0] = ‘\0’; strdate(szDate); strTime(szTime); printf(“ %s %s \n" , szDate, szTime); /* if cursor on top move down, then restore cursor */ if ( iY < 2 ) { iY = 2; iX = 0 } im_set_cursor_xy (iY, iX ); } void TryTransmit ( IM_UCHAR * szString ) { IM_STATUS iStatus; IM_ORIGIN iSource; /* make sure last transmit completed */ iSource = IM_TX_NET_SELECT; iStatus = im_event_wait (60000L, &iSource ); if (iStatus == IM_SUCCESS) iStatus = im_transmit_buffer_no_wait_t ( IM_NETUDP, strlen( szString ), szString ); if ( iStatus == IM_TIMEOUT ) im_puts ( "Timed out on Transmit",IM_NORMAL); else if ( iStatus != IM+SUCCESS ) printf (“Error on Transmit\nError Code=%x\n", iStatus); }
5-108
Page 165
im_transmit_buffer_no_wait_t
5 im_transmit_buffer_no_wait_t (continued) void main (void) { IM_USHORT ii; IM_ORIGIN iSource; IM_STATUS iStatus; im_clear_screen(); im_command("$+DA1", 5); /* Turn on the time in seconds display */ dpHeader(); im_puts (" Default App ", IM_BOLD); puts ("\n\rKeypad input with\n\ra comma in the \n\rfirst 6 chars and\n\rscanned input will \n\rbe transmitted\n\r"); /* Set the timer event so can update clock once per second */ iStatus = im_set_time_event(1000); /* forever and ever just watch for input and send it up, */ /* and display any return messages */ for (;;) { /* event wait is only needed b/c IM_TIMER_SELECT is not an input event */ /* so not handled by im_receive_input. Normally next 2 lines not needed */ iSource = IM_ALL_SELECT | IM_TIMER_SELECT; im_event_wait ( IM_INFINITE_TIMEOUT, &iSource ); if ( !( iSource & IM_TIMER_SELECT )) /* not a timeout so get data */ { iStatus = im_receive_input(IM_ALL_SELECT , IM_INFINITE_TIMEOUT , &iSource, gszString); if ( iSource & IM_KEYBOARD_SELECT ) /**/ { ii =strcspn ( gszString, ","); if ( ( ii<= 6) && (ii < strlen(gszString) ) ) { TryTransmit (gszString); } } else if ( iSourse & IM_LABEL_SELECT ) /**/ { TryTransmit (gszString); } else if ( iSource & IM_NET_SELECT ) /* strip the data identifier and display */ { ii = strcspn ( gszString, ","); im_puts("Received:", IM_INVERSE); if ( ( ii<= 6) && ( ii > 0 ) && (ii+i < strlen(gszString) ) ) { im_puts ( &gszString[ii+i], IM_BOLD ); } else imputs ( gszString, IM_BOLD ); } } /* end of not timer */ do Header(); iStatus = im_set_time_event( 1000); } }
5-109
Page 166
im_transmit_byte im_transmit_byte Purpose:
This function transmits one byte of data out from the designated communications port. This funtion is identical to MS-DOS INT 14H Service 01H.
Syntax:
#include <im64psk.h> IM_STATUS im_transmit_byte (IM_COM_PORT port_id, IM_UCHAR transmit_byte);
IN Parameters:
The port_id paramter identifies the communications port as follows: IM_COM1
COM1
IM_COM2
COM2, scanner port (2010 and 2050)
IM_COM4
COM4 (RF only)
The transmit_byte parameter is the byte of data to transmit. OUT Parameters: Return Value:
Notes:
None. This function returns one of the standard status codes defined in Appendix A, "Status Codes." 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 acknowledgement.
See Also:
im_receive_byte, im_transmit_buffer
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 <bios.h> #include <string.h> #include "im64psk.h" #include "immsg.h" /* Byte oriented defines */ #define COM1 0
5-110
Page 167
im_transmit_byte
5 im_transmit_byte (continued) : #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; im_cputs("\nChoose a protocol:\n", IM_NORMAL); 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); } }
5-111
Page 168
im_viewport_end im_viewport_end Purpose:
This function sets the viewport to the lower right corner (end) of the virtual display.
Syntax:
#include ”im64psk.h” void im_viewport_end(void);
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
None.
Notes: See Also:
This function is valid only when viewporting is enabled. 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.
5-112
Page 169
im_viewport_getxy
5 im_viewport_getxy Purpose:
This function sets the viewport to the lower right corner (end) of the virtual display.
Syntax:
#include "im64psk.h" IM_STATUS im_viewport_getxy (IM_USHORT *row, IM_USHORT *col);
IN Parameters: OUT Parameters:
None. row Returns the row value (Y-coordinate) of the viewport. col
Return Value:
Returns the colum value (X-coordinate) of the viewport.
This function returns one of these codes: IM_SUCCESS Success. IM_VP_DISABLED
Notes: See Also:
Viewporting is currentlly disabled.
This function is valid only when viewporting is enabled. 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.
5-113
Page 170
im_viewport_home im_viewport_home Purpose:
This function sets the viewport to the upper left corner (home) of the virtual display.
Syntax:
#include "im64psk.h" void im_viewport_home(void);
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
None.
5-114