Symbol LS7708扫描仪设备问题 [英] Symbol LS7708 Scanner device problem

查看:64
本文介绍了Symbol LS7708扫描仪设备问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我们有基于.Net Framework 4.0(客户端配置文件)的POS应用程序,它使用POS for .NET v1.12来处理OPOS设备。当我们尝试初始化Symbol LS7708表扫描程序时会出现问题。注册表值正常处理,当尝试
执行打开设备时,我们得到此异常:

We have POS application based on .Net Framework 4.0 (Client Profile) and it uses POS for.NET v1.12 to handle OPOS devices. The problem occurs when we are trying to initialize Symbol LS7708 table scanner. Registry values are handled normally and when trying to perform open device we are getting this exception:

ScannerDevice错误02/17/2011 09:40:00:533 #Microsoft。 PointOfService.PosControlException:方法Open抛出异常。 设备无法执行请求的过程。 ---> System.Reflection.TargetInvocationException:调用目标已抛出
异常。 ---> System.Runtime.InteropServices.COMException:灾难性故障(HRESULT异常:0x8000FFFF(E_UNEXPECTED))

   ---内部异常堆栈跟踪结束---

   at System.RuntimeType.InvokeDispMethod(String name,BindingFlags invokeAttr,Object target,Object [] args,Boolean [] byrefModifiers,Int32 culture,String [] namedParameters)

   at System.RuntimeType.InvokeMember(String name,BindingFlags bindingFlags,Binder binder,Object target,Object [] providedArgs,ParameterModifier [] modifiers,CultureInfo culture,String [] namedParams)

  在Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethod(String methodName,Object []& parameters,Boolean [] byRef)

   ---内部异常堆栈跟踪结束---

   at Microsoft.PointOfService.Legacy.LegacyProxy.ThrowLegacyMethodException(String methodName,Int32 ResultCode,Exception e)

  在Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethod(String methodName,Object []& parameters,Boolean [] byRef)

  在Microsoft.PointOfService.Legacy.LegacyProxy.Open()

  在Microsoft.PointOfService.Legacy.LegacyScanner.Open()

  在SQPos.SQUpos.ScannerDevice.Open()

ScannerDevice Error 02/17/2011 09:40:00:533 # Microsoft.PointOfService.PosControlException: Method Open threw an exception.  The device cannot perform the requested procedure. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
   --- End of inner exception stack trace ---
   at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethod(String methodName, Object[]& parameters, Boolean[] byRef)
   --- End of inner exception stack trace ---
   at Microsoft.PointOfService.Legacy.LegacyProxy.ThrowLegacyMethodException(String methodName, Int32 ResultCode, Exception e)
   at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethod(String methodName, Object[]& parameters, Boolean[] byRef)
   at Microsoft.PointOfService.Legacy.LegacyProxy.Open()
   at Microsoft.PointOfService.Legacy.LegacyScanner.Open()
   at SQPos.SQUpos.ScannerDevice.Open()

因此我们非常确定注册表和驱动程序的一切正常,因为Symbol测试应用程序工作正常并且我自己的开发环境中没有发生错误(32位W7 Enterprise)具有完全相同的应用程序版本。仅在我们的测试工作站出现问题
。测试工作站都是HP ap5000机器,我们在其他机器上安装了Windows XP SP3,在其他机器上安装了Windows 7专业版。我们正在使用相同的扫描仪单元,它适用于开发环境。

So we are quite sure that everything is fine with registry and drivers because Symbol test application works fine and error is not occurring in my own development environment (32 bit W7 Enterprise) which has exactly same application version. Problem occurs only at our test workstations. Test workstations are both HP ap5000 machines and we have Windows XP SP3 on other and Windows 7 Professional on other. We are using same scanner unit which works on dev environment.

我们没有更多的线索可以关注,所以如果有人弄明白,请回复...

We have no more clues to follow, so please respond if someone gets this figured out...

以下是我们的扫描仪设备类的源代码:

Here's source code of our scanner device class:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.PointOfService;


namespace SQPos.SQUpos
{
  
  public class ScannerDevice :DeviceBase
  {
    private Scanner _scanner;
    private PosExplorer myPosExplorer;

    public ScannerDevice()
      :base()
    {
      
    }

    public bool Initialize()
    {
      try
      {
        int i;
        int u;

        this.LogDebug("Initialize", "start initializing...");

        DeviceInfo myDeveiceInfo = null;
        DeviceCollection myDCollection;
        myPosExplorer = new PosExplorer();
        myDCollection = myPosExplorer.GetDevices("Scanner");

        for (i = 0; i < myDCollection.Count; i++)
        {
          for (u = 0; u < myDCollection[i].LogicalNames.Length; u++)
          {
            if (myDCollection[i].LogicalNames[u].ToLower() == "posscanner")
            {
              myDeveiceInfo = myDCollection[i];
              break;
            }
          }
          if (myDeveiceInfo != null)
          {
            break;
          }
        }

        if (myDeveiceInfo == null)
        {
          this.LogWarning("Initialize", "ScannerDevice not set at registry...");
          return false;
        }
        else
        {
          _scanner = (Scanner)myPosExplorer.CreateInstance(myDeveiceInfo);

          this.LogDebug("Initialize", "PosScanner: " + myDeveiceInfo.ServiceObjectName);

          this.Open();
          this.Claim();
          _scanner.DeviceEnabled = true;
          _scanner.DataEvent += new DataEventHandler(scanner_DataEvent);
          _scanner.DataEventEnabled = true;

          return _scanner.DeviceEnabled;

        }

      }
      catch (Exception e)
      {
        this.LogException("Initialize", e);
        return false;
      }
    }

    // Finalizer
    ~ScannerDevice()
    {
      Close();
    }
    
    private void scanner_DataEvent(object sender, DataEventArgs e)
    {
      try
      {
        byte[] b = _scanner.ScanData;

        string str = "";
        b = _scanner.ScanDataLabel;
        for (int i = 0; i < b.Length; i++)
          str += (char)b[i];

        this.SendScannerData(str);

        _scanner.DataEventEnabled = true;

      }
      catch (Exception ex)
      {
        this.LogException("scanner_DataEvent", ex);
      }
      
    }

    private void Open()
    {
      try
      {

        // Device State checking done in base class

        _scanner.Open();
        _scanner.DecodeData = true;
      }
      catch (Exception ex)
      {
        this.LogException("Open", ex);
      }
      
    }

    private void Claim()
    {
      try
      {
        _scanner.Claim(1000);
      }
      catch (Exception ex)
      {
        this.LogException("Claim", ex);
      }
    }

    private void Close()
    {
      try
      {
        _scanner.Close();
      }
      catch (Exception ex)
      {
        this.LogException("Close", ex);
      }
    }

  } // Class
}

推荐答案

您还需要安装.NET Framework  2.0,因为POS for .NET不支持.NET 4.0独立版。不久前还有另一篇关于这个主题的帖子。

You will also need .NET Framework 2.0 installed since POS for .NET doesn't support .NET 4.0 standalone. There was another post on the subject not to long ago.

-Sean


这篇关于Symbol LS7708扫描仪设备问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆