/* #pragma module UG_BARCODE.H "X-1" */ /* ******************************************************************************** ** ** ** © Copyright 1976, 2006 Hewlett-Packard Development Company, L.P. ** ** ** ** Confidential computer software. Valid license from HP and/or ** ** its subsidiaries required for possession, use, or copying. ** ** ** ** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, ** ** Computer Software Documentation, and Technical Data for Commercial ** ** Items are licensed to the U.S. Government under vendor's standard ** ** commercial license. ** ** ** ** Neither HP nor any of its subsidiaries shall be liable for technical ** ** or editorial errors or omissions contained herein. The information ** ** in this document is provided "as is" without warranty of any kind and ** ** is subject to change without notice. The warranties for HP products ** ** are set forth in the express limited warranty statements accompanying ** ** such products. Nothing herein should be construed as constituting an ** ** additional warranty. ** ** ** ******************************************************************************** ** ** ** FACILITY: ** ** Example ** ** ABSTRACT: ** ** Include file has definitions for the barcode support code. ** ** AUTHOR: Forrest A. Kenney 08-September-2006 ** ** REVISION HISTORY: ** ** X-1 FAK001 Forrest A. Kenney 29-December-2008 ** Initial version. */ #ifndef __BARCODE #define __BARCODE /* ** Define all the keyboard codes that can come back. This came from ** HID$KEYBOARD but we don't ship that so we replicate it here. */ /* */ /* first, the top row */ /* */ #define KEY_ESC 41 #define KEY_F1 58 #define KEY_F2 59 #define KEY_F3 60 #define KEY_F4 61 #define KEY_F5 62 #define KEY_F6 47 #define KEY_F7 64 #define KEY_F8 65 #define KEY_F9 66 #define KEY_F10 67 #define KEY_F11 68 #define KEY_F12 69 #define KEY_F13 104 #define KEY_F14 105 #define KEY_HELP 106 /* F15 or HELP key */ #define KEY_DO 107 /* F16 or DO key */ #define KEY_F17 110 #define KEY_PRINT_SCREEN 70 #define KEY_SCROLL_LOCK 71 #define KEY_PAUSE 72 /* editing keypad */ #define KEY_INSERT 103 #define KEY_HOME 110 #define KEY_PAGE_UP 111 #define KEY_DELETE 100 #define KEY_END 101 #define KEY_PAGE_DOWN 109 /* numeric keypad */ #define KEY_KP_NUMLOCK 83 #define KEY_KP_SLASH 84 #define KEY_KP_STAR 85 #define KEY_KP_HYPHEN 86 #define KEY_KP_PLUS 87 #define KEY_KP_ENTER 88 #define KEY_KP_1 89 #define KEY_KP_2 90 #define KEY_KP_3 91 #define KEY_KP_4 92 #define KEY_KP_5 93 #define KEY_KP_6 94 #define KEY_KP_7 95 #define KEY_KP_8 96 #define KEY_KP_9 97 #define KEY_KP_0 98 #define KEY_KP_PERIOD 99 /* arrow (cursor) keys */ #define KEY_RIGHT 79 #define KEY_LEFT 80 #define KEY_DOWN 81 #define KEY_UP 82 /* misc keys */ #define KEY_ENTER 40 #define KEY_BACKSPACE 42 #define KEY_TAB 43 #define KEY_CAPS_LOCK 57 /* typewriter keys - top row */ #define KEY_TILDE 53 #define KEY_TR_1 30 #define KEY_TR_2 31 #define KEY_TR_3 32 #define KEY_TR_4 33 #define KEY_TR_5 34 #define KEY_TR_6 35 #define KEY_TR_7 36 #define KEY_TR_8 37 #define KEY_TR_9 38 #define KEY_TR_0 39 #define KEY_UBAR 45 #define KEY_PLUS 46 /* typewriter keys - 2nd row */ #define KEY_Q 20 #define KEY_W 26 #define KEY_E 8 #define KEY_R 21 #define KEY_T 23 #define KEY_Y 28 #define KEY_U 24 #define KEY_I 12 #define KEY_O 18 #define KEY_P 19 #define KEY_LBRACE 47 #define KEY_RBRACE 48 #define KEY_VBAR 49 /* typewriter keys - 3rd row */ #define KEY_A 4 #define KEY_S 22 #define KEY_D 7 #define KEY_F 9 #define KEY_G 10 #define KEY_H 11 #define KEY_J 13 #define KEY_K 14 #define KEY_L 15 #define KEY_SEMICOLON 51 #define KEY_QUOTE 52 /* typewriter keys - 4th row */ #define KEY_Z 29 #define KEY_X 27 #define KEY_C 6 #define KEY_V 25 #define KEY_B 5 #define KEY_N 17 #define KEY_M 16 #define KEY_COMMA 54 #define KEY_PERIOD 55 #define KEY_QMARK 56 /* typewriter keys - bottom row */ #define KEY_SPACE 44 /* Report format for array items */ #define MODIFIER_KEY_LEFT_CTRL 1 #define MODIFIER_KEY_LEFT_SHIFT 2 #define MODIFIER_KEY_LEFT_ALT 4 #define MODIFIER_KEY_LEFT_GUI 8 #define MODIFIER_KEY_RIGHT_CTRL 16 #define MODIFIER_KEY_RIGHT_SHIFT 32 #define MODIFIER_KEY_RIGHT_ALT 64 #define MODIFIER_KEY_RIGHT_GUI 128 #define MAX_PIPES 10 #define MAX_INTERRUPT_DATA 128 typedef struct _iosb { short int status; short int msg_len; int usb_status; } UG_IOSB; typedef struct _device_data { short int channels[MAX_PIPES]; int pipe_count; uint64 pipe_handles[MAX_PIPES]; int pipe_state[MAX_PIPES]; int pipe_type[MAX_PIPES]; int pipe_direction[MAX_PIPES]; int interrupt_pipe_index; struct dsc$descriptor_s device_name; UG_IOSB iosb; unsigned char interrupt_data[MAX_INTERRUPT_DATA]; } DEVICE_DATA; // // Internal routine // int associate_channels (struct dsc$descriptor_s *devname, short int *channels, int pipe_count, uint64 *pipe_handles, int *pipe_direction, int *pipe_type); // // Internal routine // int configure_device (short int channel, uint64 pipe_handle); // // Internal routine // int get_channels (short int *channels, int *pipe_count, uint64 *pipe_handles, unsigned short int vendor_id, unsigned short int product_id); // // User routine called to read data from the scanner. This routine // loops until it gets a report with valid data or until there is an error // that cannot be dealt with // // Inputs: // device - Pointer to device data block // scan_data_length - Size of scan report from scanner // data - ASCII decocded data from scan // data_length - Size of buffer // return_length - Number of ASCII characters decoded // // Outputs: // // data - Decoded data // return_length - Number of byte of valid data // // Return Values: // // SS$_NORMAL - Worked // SS$_BADPARAM - Buffer size or scan_data_length to large // SS$_TOOMUCHDATA - Ascii data would not fit into supplied buffer // if this happens the scan is invalid // int get_data (DEVICE_DATA *device, int scan_data_length, unsigned char *data, int data_length, int *return_length); // // Internal routine // int map_pipes (DEVICE_DATA *device); // // This is used to open the reader for use // // Inputs: // // device Pointer to device data block // vendor_id Unsigned integer with Vendor Id // product_int Unsigned integer with Product Id // // Return Values: // // SS$_NORMAL Worked // SS$_XXXX Failed // int open_barcode (DEVICE_DATA *device, unsigned short int vendor_id, unsigned short int product_id); #endif