private IntermecIsdc.DllErrorCode ScannerInit() { string key = "HKCU\\SOFTWARE\\Intermec\\IsdcNetApp"; byte status; m_Error = m_Isdc.Initialise(key, out status); return(m_Error); }
private void btnConnect_Click(object sender, EventArgs e) { ScannerInit(); if (mScannerConnected == false) { m_Error = m_Isdc.ConfigurationDialog(); if (m_Error != 0) { //MessageError(m_Error); } else { m_Error = m_Isdc.Connect(); if (m_Error != 0) { //MessageError(m_Error); } else { mScannerConnected = true; this.btnConnect.Text = "Disconnect"; nBytesInInputBuffer = 0; InputBuffer[nBytesInInputBuffer++] = 0x50; InputBuffer[nBytesInInputBuffer++] = 0x40; InputBuffer[nBytesInInputBuffer++] = 0x00; m_Isdc.ControlCommand(InputBuffer, nBytesInInputBuffer, OutputBuffer, out nBytesReturned); ScannerCfg(); nBytesInInputBuffer = 0; InputBuffer[nBytesInInputBuffer++] = 0x30; InputBuffer[nBytesInInputBuffer++] = 0xC0; m_Isdc.StatusRead(InputBuffer, nBytesInInputBuffer, OutputBuffer, out nBytesReturned); } } } else { m_Isdc.Disconnect(); mScannerConnected = false; this.btnConnect.Text = "Connect"; } }
private void ScannerCfg() { nBytesInInputBuffer = 0; InputBuffer[nBytesInInputBuffer++] = 0x73; //Packeted Data format = enable InputBuffer[nBytesInInputBuffer++] = 0x40; InputBuffer[nBytesInInputBuffer++] = 0x01; /******************************************/ /* Snapshot - Image conditioning */ /******************************************/ InputBuffer[nBytesInInputBuffer++] = 0x6A; InputBuffer[nBytesInInputBuffer++] = 0xC1; InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x20; InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x01; //Auto Contrast InputBuffer[nBytesInInputBuffer++] = 0x01; //00=None / 01=Photo / 02=Black on white / 03=white on black InputBuffer[nBytesInInputBuffer++] = 0x02; //Edge Enhancement InputBuffer[nBytesInInputBuffer++] = 0x00; //00=None / 01=Low / 02=Medium / 03=High InputBuffer[nBytesInInputBuffer++] = 0x03; //Image Rotation InputBuffer[nBytesInInputBuffer++] = 0x00; //00=None / 01=90° / 02=180° / 03=270° InputBuffer[nBytesInInputBuffer++] = 0x04; //Subsampling InputBuffer[nBytesInInputBuffer++] = 0x00; //00=None / 01=1 pixel out of 2 InputBuffer[nBytesInInputBuffer++] = 0x05; //Noise Reduction InputBuffer[nBytesInInputBuffer++] = 0x00; //00 to 09 Level of noise reduction (00=none) InputBuffer[nBytesInInputBuffer++] = 0x07; //Image Lighting Correction InputBuffer[nBytesInInputBuffer++] = 0x00; //00=None / 01=Low / 02=Medium / 03=High InputBuffer[nBytesInInputBuffer++] = 0x09; //Reverse Video InputBuffer[nBytesInInputBuffer++] = 0x00; //00=Disable / 01=Enable InputBuffer[nBytesInInputBuffer++] = 0x41; //Color Conversion + Threshold InputBuffer[nBytesInInputBuffer++] = 0x00; //00=None / 01=Monochrome / 02=Enhanced InputBuffer[nBytesInInputBuffer++] = 0x00; //00=Very Dark / 01=Dark / 02=Normal / 03=Bright / 04=Very Bright InputBuffer[nBytesInInputBuffer++] = 0x42; //Output Compression + Output Compression Quality InputBuffer[nBytesInInputBuffer++] = 0x01; //00=Raw / 01=JPEG / 02=TIFFG4 InputBuffer[nBytesInInputBuffer++] = 60; //00 to 64 (0 to 100 decimal) InputBuffer[nBytesInInputBuffer++] = 0x80; //Cropping InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x08; //8 bytes InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x00; //Bytes 1 and 2 (UINT16): Left column (x) InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x00; //Bytes 3 and 4 (UINT16): Top row (y) InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x00; //Bytes 5 and 6 (UINT16): Width InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x00; //Bytes 7 and 8 (UINT16): Height /******************************************/ /* Video - Image conditioning */ /******************************************/ InputBuffer[nBytesInInputBuffer++] = 0x6A; InputBuffer[nBytesInInputBuffer++] = 0xC0; InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x20; InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x01; //Auto Contrast InputBuffer[nBytesInInputBuffer++] = 0x01; //00=None / 01=Photo / 02=Black on white / 03=white on black InputBuffer[nBytesInInputBuffer++] = 0x02; //Edge Enhancement InputBuffer[nBytesInInputBuffer++] = 0x00; //00=None / 01=Low / 02=Medium / 03=High InputBuffer[nBytesInInputBuffer++] = 0x03; //Image Rotation InputBuffer[nBytesInInputBuffer++] = 0x00; //00=None / 01=90° / 02=180° / 03=270° InputBuffer[nBytesInInputBuffer++] = 0x04; //Subsampling InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x05; //Noise Reduction InputBuffer[nBytesInInputBuffer++] = 0x00; //00 to 09 Level of noise reduction (00=none) InputBuffer[nBytesInInputBuffer++] = 0x07; //Image Lighting Correction InputBuffer[nBytesInInputBuffer++] = 0x00; //00=None / 01=Low / 02=Medium / 03=High InputBuffer[nBytesInInputBuffer++] = 0x09; //Reverse Video InputBuffer[nBytesInInputBuffer++] = 0x00; //00=Disable / 01=Enable InputBuffer[nBytesInInputBuffer++] = 0x41; //Color Conversion / Threshold InputBuffer[nBytesInInputBuffer++] = 0x00; //00=None / 01=Monochrome / 02=Enhanced Monochrome InputBuffer[nBytesInInputBuffer++] = 0x00; //00=Very Dark / 01=Dark / 02=Normal / 03=Bright / 04=Very Bright InputBuffer[nBytesInInputBuffer++] = 0x42; //Compression/Compression Quality InputBuffer[nBytesInInputBuffer++] = 0x01; //00=Raw / 01=JPEG / 02=TIFFG4 InputBuffer[nBytesInInputBuffer++] = 60; //00 to 64 (0 to 100 decimal) InputBuffer[nBytesInInputBuffer++] = 0x80; //Cropping InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x08; //8 bytes InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x00; //Bytes 1 and 2 (UINT16): Left column (x) InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x00; //Bytes 3 and 4 (UINT16): Top row (y) InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x00; //Bytes 5 and 6 (UINT16): Width InputBuffer[nBytesInInputBuffer++] = 0x00; InputBuffer[nBytesInInputBuffer++] = 0x00; //Bytes 7 and 8 (UINT16): Height m_Error = m_Isdc.SetupWrite(InputBuffer, nBytesInInputBuffer, OutputBuffer, out nBytesReturned); }