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

2D JANUS PSK for C/C++ Reference Manual, pages 161 to 170

Pages 161 to 170 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 161

im_setup_trx

2

The db_protocol parameter is one or more of these constants: IM_DBPACE_ENABLE

Enable pacing for database read. The database sends one record to the reader and then waits for a request for the next record. Default is on.

IM_BATCH_ENABLE

Store all records in standby file, if one is enabled with hsafety. Default is off, no standby file.

IM_DOBEST_ENABLE

Ignore NAK and continue sending records when uploading standby records. Default is off: stop sending records on NAK.

The sys_delimiter parameter is the default transaction ID delimiter set in DCM. Default is a comma (,). The parse_char parameter is the user-defined, data field-specific delimiter set in DCM. Default is a comma (,). The packet_max_len parameter defines the maximum length for a transaction packet and is one of these values: 0 -1 1-256

Use the default value and do not send a value. Use the previous setting. Set the maximum length to this number. Default is 256.

The hsafety parameter is the file handler for the standby file. Valid values are: 0 num

No standby file. Default. Use a standby file. A nonzero value that is the file handler created from open( ). See Notes below.

OUT Parameters:

None.

Return Value:

This function returns one of the status codes from the following table. For more information on these return codes, see Chapter 5, “Using the PSK With DCM.” IM_DCM_OK IM_DCM_FILE_ERR

1A00 9A09

Protocol parameters set successfully Standby file I/O error

2-135

Page 162

im_setup_trx

Notes:

To use a standby file, you must set hSafety by opening the file. The action of the standby file is determined by IM_BATCH_ENABLE. If IM_BATCH_ENABLE is off, only transactions that cannot be sent are logged into the file. Usually this happens when the transmission times out. If IM_BATCH_ENABLE is on, then all transactions are logged into the standby file. To transmit the standby file, you must set IM_BATCH_ENABLE to off, or use im_standard_trx with IM_ZIP_STANDBY to flush the standby records. See Chapter 5, “Using the PSK With DCM.”

See Also:

im_standard_trx, im_parse_host_response

Example See the sample program in Chapter 5, “Using the PSK With DCM.”

2-136

Page 163

im_sound

2 im_sound Purpose:

This function generates a beep of specified pitch and duration. For example, use a soft beep for library use, a loud beep for manufacturing use, or a unique beep to distinguish between other readers.

Syntax:

#include <im20lib.h> IM_STATUS im_sound (IM_USHORT pitch, IM_USHORT duration, IM_USHORT volume);

IN Parameters:

The pitch parameter is the frequency of the beep you want the reader to make. The numeric range for pitch is from 20 to 20,000 Hz. You can also use one of these constants: IM_HIGH_PITCH IM_LOW_PITCH IM_VERY_LOW_PITCH

2400 Hz 1200 Hz 600 Hz

The duration parameter is the length of the beep. The numeric range for duration is from 1 to 65,000 ms. You can also use one of these constants: IM_BEEP_DURATION IM_CLICK_DURATION

50 ms 4 ms

The volume parameter is one of these constants: IM_OFF_VOLUME IM_QUIET_VOLUME IM_NORMAL_VOLUME IM_LOUD_VOLUME IM_EXTRA_LOUD_VOLUME IM_CURRENT_VOLUME

Volume is off Volume is quiet Volume is normal Volume is loud Volume is extra loud Volume is the current volume

OUT Parameters:

None.

Return Value:

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

2-137

Page 164

im_sound

Example /******************** im_sound *************************************/ #include <time.h> #include <conio.h> #include <im20lib.h> enum NOTES /* Enumeration of notes and frequencies */ { C0 = 262, D0 = 296, E0 = 330, F0 = 349, G0 = 392, A0 = 440, B0 = 494, C1 = 523, D1 = 587, E1 = 659, F1 = 698, G1 = 784, A1 = 880, B1 = 988, EIGHTH = 125, QUARTER = 250, HALF = 500, WHOLE = 1000, END = 0 } song[] = /* Array initialized to notes of song */ { C1, HALF, G0, HALF, A0, HALF, E0, HALF, F0, HALF, E0, QUARTER, D0, QUARTER, C0, WHOLE, END }; /* Predefined the play volume */ IM_USHORT volume[] = { IM_NORMAL_VOLUME, IM_EXTRA_LOUD_VOLUME, IM_QUIET_VOLUME, IM_NORMAL_VOLUME };

/* Play normal volume */ /* Play extra loud volume */ /* Play quiet volume */ /* Play normal volume */ void main (void) { int note; int index; /* Play 4 times with 5 seconds dealy between each play */ for ( index = 0; index < 4; index++) { for ( note = 0; song[note] != 0; note += 2 ) im_sound( song[note], song[note + 1], volume[index]); /* Delay 5 seconds for next throughput*/ im_standby_wait(5000); } }

2-138

Page 165

im_standard_trx

2 im_standard_trx Purpose:

This function packs reader data into a DCM transaction. The function packs the data, transmits the packed transaction through a communications port, and then reads the host response message from the communications port. For a detailed discussion of programming database transactions, see Chapter 5, “Using the PSK With DCM.”

Syntax:

#include "im20lib.h" IM_USHORT im_standard_trx (IM_UCHAR *trans_id, IM_UCHAR request_type, IM_UCHAR *send_var_array[], IM_USHORT max_str_len, IM_UCHAR *ret_string, IM_DCMSTRN ret_array[], IM_UCHAR *oper_type);

IN Parameters:

The *trans_id parameter is a pointer to the transaction ID string. The transaction ID must match the ID already defined in DCM. See the example in Chapter 5, “Using the PSK With DCM.” The request_type parameter is associated with the transaction ID and either accesses the remote database or manipulates the standby file. The request_type is one of these constants: For Accessing the Remote Database IM_DBRQT_DATA IM_DBRQT_NEXTROW IM_DBRQT_DISCARD

D N S

Request data Request next row Delete the following records

For Manipulating the Standby File IM_ERROR_RECORD

E

Report error record without advancing the record pointer in the standby file

IM_ADVANCE_RECORD A

Report error record and advance the record pointer in the standby file

IM_ZIP_STANDBY

Flush the standby records

Z

2-139

Page 166

im_standard_trx

The *send_var_array[] parameter is valid only when request_type is “D.” It is a pointer to the array containing the data to send to the database. Each element in the array corresponds to a DCM transaction field. The max_str_len parameter is the maximum length of the return string buffer. OUT Parameters:

The *ret_string parameter is a pointer to the return string buffer. The buffer contains the database server’s transaction message unless a timeout occurred. If the reader receives IM_DCM_TIMEOUT, then the communication error status is placed in the first two bytes of the return buffer. You can check this communication status code against the list in Appendix A, “Status Codes.” The return string buffer must be large enough to hold a complete packet from the controller. The ret_array[] parameter is the array containing pointers to the variables that hold the data returned from the database. The received data field is parsed and then placed into the variables. The *oper_type parameter is a pointer to the operation type returned by the remote database and is one of these constants: IM_DB_READ IM_DB_INSERT IM_DB_UPDATE IM_DB_DELETE IM_DB_UNKNOWN

Return Value:

2-140

R W U D X

Read records from the database Write records to the database Update records in the database Delete records from the database Unknown

This function returns one of the status codes from the following table. For more information on these return codes, see Chapter 5, “Using the PSK With DCM.”

Page 167

im_standard_trx

Notes:

2

Return Code

Hex

Description

IM_DCM_OK

1A00

Transaction successful Retrieved record from standby file All standby records sent successfully

IM_DCM_ACK_RCD

1A01

Transaction successful, ACK

IM_DCM_MSG_RCD

1A10

Received message on Read operation

IM_DCM_NAK_RCD

5A02

Transaction failed, NAK received

IM_DCM_NO_RECORD

5A07

Standby file is empty

IM_DCM_TRUNCATED

5A11

Data was truncated

IM_DCM_EXCESSFIELD

5A12

Too many fields

IM_DCM_STANDBY

5A20

Record stored in standby file successfully

IM_DCM_STANDBY_TXERR

5A21

Record stored in standby file, but upload standby error

IM_DCM_NOTRANSMIT

9A03

Transmit failed Transmit channel error

IM_DCM_TIMEOUT

9A04

Receive port timeout

IM_DCM_HEAD_ERR

9A05

Packet header error

IM_DCM_TRANSID_ERR

9A06

Missing transaction ID

IM_DCM_FILE_ERR

9A08

Standby file I/O error

IM_DCM_NO_HANDLE

9A09

Missing standby file

IM_DCM_FILLED

9A40

Buffer overflow

IM_DCM_FILLED_TXERR

9A41

Buffer overflow with upload standby error

You can use the *oper_type and request_type to verify that the database, the DCM interface, and the JANUS transaction are configured properly. For example, if the request_type is IM_DBRQT_DATA (read or write), but the *oper_type is IM_DB_DELETE (delete), then you need to correct the configuration. See Chapter 5, “Using the PSK With DCM.”

See Also:

im_setup_trx, im_parse_host_response

Example See the sample program in Chapter 5, “Using the PSK With DCM.”

2-141

Page 168

im_standby_wait im_standby_wait Purpose:

This function requests that reader services wait in standby mode for a specific period of time. You use this function to suspend the reader for a length of time to save the battery power.

Syntax:

#include <im20lib.h> IM_STATUS im_standby_wait (IM_UINT timeout);

IN Parameters:

The timeout parameter is the amount of time to wait in standby mode. You can exit the function before data is received 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

OUT Parameters:

None.

Return Value:

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

Notes:

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:

None.

Example See example for im_irl_a.

2-142

Page 169

im_transmit_buffer

2 im_transmit_buffer Purpose:

This function transmits the contents of a data buffer through a designated communications port. This function continues operating until the buffer transmission is complete or until an error status is detected.

Syntax:

#include <im20lib.h> IM_STATUS im_transmit_buffer (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 length of the data string that you want 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

OUT Parameters:

None.

Return Value:

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

2-143

Page 170

im_transmit_buffer

Notes:

You must install a protocol handler to use this function.

See Also:

im_receive_buffer, im_transmit_buffer_no_wait, im_transmit_buffer_noprot

Example /******************** im_transmit_buffer *******************************/ /* 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 <conio.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 demonstration proves the transmit buffer is working", "The demonstration of the transmit buffer is Done", NULL }; void main (void) { int index; size_t actual_count; IM_STATUS status; IM_UCHAR data_buffer[160]; /* Call im_cancel_tx_buffer to initialize the communications port and its buffer */ 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 big buffer */ strcpy(data_buffer, data_str[index]); actual_count = strlen(data_buffer); /* Get its length */ /* Call Intermec function, timeout within 50000 milliseconds */ status = im_transmit_buffer(com_port, actual_count, data_buffer, 50000); if (IM_ISSUCCESS(status)) printf("Line %d Sent\n", index + 1); else printf("Transmit error\nStatus = %xH\n", status); } printf("Transmit Done\n"); }

2-144