CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2004
    Posts
    2

    Bar code scanning problem with PDT 8100

    I'm using PDT8100 Pocket PC. I've implemented bar code scanning using scanwedge.exe and code below. This is implemented on two pages. but some time it stop scanning. What check need to down to avoid scanning to stop


    private bool InitReader()
    {
    try
    {
    // If reader is already present then fail initialize
    if ( this.Field ServiceReader != null )
    {
    //MessageBox.Show(myDataTable.Rows.Count + " records found");
    return false;
    }

    try
    {
    // Get selected device from user
    Symbol.Generic.Device MyDevice =
    Symbol.StandardForms.SelectDevice.Select(
    Symbol.Barcode.Device.Title,
    Symbol.Barcode.Device.AvailableDevices);

    if ( MyDevice == null )
    {
    MessageBox.Show("No Device Selected","SelectDevice");
    return false;
    }

    // Create the reader, based on selected device
    this.Field ServiceReader = new Symbol.Barcode.Reader(MyDevice);

    // Create reader data
    this.Field ServiceReaderData = new Symbol.Barcode.ReaderData(
    Symbol.Barcode.ReaderDataTypes.Text,
    Symbol.Barcode.ReaderDataLengths.DefaultText);

    // Enable the Reader
    this.Field ServiceReader.Actions.Enable();

    // Initialize Reader parameters
    this.InitReadParams();

    // create event handlers
    this.MyReadNotifyHandler = new EventHandler(Field ServiceReader_ReadNotify);
    this.MyStatusNotifyHandler = new EventHandler(Field ServiceReader_StatusNotify);

    this.Activated +=new EventHandler(frmVwWorkOrders_Activated);
    this.Deactivate +=new EventHandler(frmVwWorkOrders_Deactivate);

    }
    catch ( Symbol.Exceptions.InvalidRequestException ex )
    {
    MessageBox.Show("InitReader\n"+"Invalid Operation\n"+ex.Message,"Field Service");
    return false;
    }
    catch ( Symbol.Exceptions.OperationFailureException ex )
    {
    MessageBox.Show("InitReader\n"+"Operation Failure"+ex.Message,"Field Service");
    return false;
    }
    catch ( Symbol.Exceptions.UnimplementedFunctionException ex )
    {
    MessageBox.Show("InitReader\n"+"Unimplemented Function"+ex.Message,"Field Service");
    return false;
    }
    }
    catch(Exception es)
    {
    MessageBox.Show(es.ToString(),"Field Service");
    return false;
    }

    return true;
    }

    private void InitReadParams()
    {
    this.MyReadParamsList = new object[2];
    }

    protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
    {
    // Terminate reader, call base class
    //this.TermReader();
    base.OnClosing(e);
    }

    private void TermReader()
    {
    try
    {
    // If we have a reader

    if ( this.Field ServiceReader != null )
    {


    // stop all notifications
    this.StopRead();
    this.StopStatus();

    try
    {
    if ( this.Field ServiceReader != null )
    {
    // Disable the reader
    this.Field ServiceReader.Actions.Disable();
    // Free it up
    this.Field ServiceReader.Dispose();
    // Indicate we no longer have one
    this.Field ServiceReader = null;
    }

    if ( this.Field ServiceReaderData != null )
    {
    // Free it up
    this.Field ServiceReaderData.Dispose();
    // Indicate we no longer have one
    this.Field ServiceReaderData = null;
    }

    }
    catch ( Symbol.Exceptions.InvalidRequestException ex )
    {
    MessageBox.Show("TermReader\n"+"Invalid Operation"+ex.Message,"Field Service");
    }
    catch ( Symbol.Exceptions.OperationFailureException ex )
    {
    MessageBox.Show("TermReader\n"+"Operation Failure\n"+"Result = 0x"+
    ((uint)ex.Result).ToString("X8")+"\n"+ex.Message,"Field Service");
    }
    catch ( Symbol.Exceptions.UnimplementedFunctionException ex )
    {
    MessageBox.Show("TermReader\n"+"Unimplemented Function"+ex.Message,"Field Service");
    }
    }


    }
    catch(Exception es)
    {
    MessageBox.Show(es.ToString(),"Field Service");
    }
    }

    private void StartRead()
    {
    // If we have both a reader and a reader data
    if ( ( this.Field ServiceReader != null ) &&
    ( this.Field ServiceReaderData != null ) )

    try
    {
    //this.Field ServiceReader.Changes.Restore(this.MyReadParamsList[this.CurrentReadParamIndex]);

    if ( ++this.CurrentReadParamIndex >= this.MyReadParamsList.Length )
    {
    this.CurrentReadParamIndex = 0;
    }

    this.Field ServiceReader.ReadNotify += MyReadNotifyHandler;

    // Submit a read
    this.Field ServiceReader.Actions.Read(this.Field ServiceReaderData);
    }
    catch ( Symbol.Exceptions.UnimplementedFunctionException ex )
    {
    MessageBox.Show("StartRead\n" +
    "Unimplemented Function\n" +
    ex.Message,"Field Service");
    }
    catch ( Symbol.Exceptions.InvalidIndexerException ex )
    {
    MessageBox.Show("StartRead\n"+
    "Invalid Indexer\n"+
    ex.Message,"Field Service");
    }
    catch ( Symbol.Exceptions.OperationFailureException ex )
    {
    MessageBox.Show("StopRead\n" +
    "Operation Failure\n" +
    "Result = 0x" +
    ((uint)ex.Result).ToString("X8") +
    "\n"+
    ex.Message,"Field Service");
    }
    catch ( Symbol.Exceptions.InvalidRequestException ex )
    {
    /*MessageBox.Show("StartRead\n"+
    "Invalid Request\n"+
    ex.Message,"Field Service");*/
    string s = ex.Message;
    };
    }

    private void StopRead()
    {
    // If we do not have a reader, then do nothing
    if ( this.Field ServiceReader == null )
    {
    return;
    }

    try
    {
    // Remove read notification handler
    this.Field ServiceReader.ReadNotify -= MyReadNotifyHandler;

    // Flush (Cancel all pending reads)
    this.Field ServiceReader.Actions.Flush();
    }
    catch ( Symbol.Exceptions.InvalidRequestException ex )
    {
    MessageBox.Show("StopRead\n"+"Invalid Operation"+ex.Message,"Field Service");
    }
    catch ( Symbol.Exceptions.OperationFailureException ex )
    {
    MessageBox.Show("StopRead\n"+"Operation Failure\n"+"Result = 0x"+
    ((uint)ex.Result).ToString("X8")+"\n"+ex.Message,"Field Service");
    }
    catch ( Symbol.Exceptions.UnimplementedFunctionException ex )
    {
    MessageBox.Show("StopRead\n"+"Unimplemented Function\n"+ex.Message,"Field Service");
    }
    }

    private void StartStatus()
    {
    if( this.Field ServiceReader != null)
    {
    // Attach status notification handler
    this.Field ServiceReader.StatusNotify += this.MyStatusNotifyHandler;
    }
    }

  2. #2
    Join Date
    Oct 2004
    Posts
    2

    Bar code scanning problem with PDT 8100

    I have a unique problem with my PDT8100. Often it seizes scanning during continuous operation. What can be the cause for this? Even if I try “trim reader”, I’m unable to start scan again. Can anyone help me on this?

  3. #3
    Join Date
    Sep 2002
    Location
    Maryland - Fear The Turtle!
    Posts
    7,537

    Re: Bar code scanning problem with PDT 8100

    <merged threads>

    Please post new response in the original thread <this> rather than creating new threads.

    Thank you.

  4. #4
    Join Date
    Feb 2005
    Posts
    1

    Re: Bar code scanning problem with PDT 8100

    Hi, I've got similar problem as you, so I cannot help you, I just hope that you have already solve this problem, and maybe you can help me.

    I'm also using scanwedge.exe and my scanner sometimes just change its behavior, does not stop scanning, but ignores the settings (prefix to send before barcode, sufix to send after barcode)

    You can contact me at [email protected] .Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured