Exemple #1
0
 public Scanner(String modelName)
 {
     model       = modelName;
     coreScanner = new CoreScanner.CCoreScanner();
     open();
     subscribeBarcode();
 }
 /// <summary>
 ///     Instantiates a new Defaults object.
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal Defaults(CCoreScanner scannerDriver, int scannerId)
 {
     _scannerDriver   = scannerDriver;
     _scannerId       = scannerId;
     _setAttributeXml =
         $@"<inArgs><scannerID>{_scannerId}</scannerID><cmdArgs><arg-xml><attrib_list><attribute><id>{{0}}</id><datatype>{{1}}</datatype><value>{{2}}</value></attribute></attrib_list></arg-xml></cmdArgs></inArgs>";
 }
 private void init_scanner()
 {
     try
     {
         //Instantiate CoreScanner Class
         cCoreScannerClass = new CCoreScanner();
         //Call Open API
         short[] scannerTypes = new short[1]; //Scanner Types you are interested in
         scannerTypes[0] = 1;                 // 1 for all scanner types
         short numberOfScannerTypes = 1;      // Size of the scannerTypes array
         int   status;                        // Extended API return code
         cCoreScannerClass.Open(0, scannerTypes, numberOfScannerTypes, out status);
         // Subscribe for barcode events in cCoreScannerClass
         cCoreScannerClass.BarcodeEvent += new
                                           _ICoreScannerEvents_BarcodeEventEventHandler(OnBarcodeEvent);
         // Let's subscribe for events
         int    opcode = 1001; // Method for Subscribe events
         string outXML;        // XML Output
         string inXML = "<inArgs>" +
                        "<cmdArgs>" +
                        "<arg-int>1</arg-int>" + // Number of events you want to subscribe
                        "<arg-int>1</arg-int>" + // Comma separated event IDs
                        "</cmdArgs>" +
                        "</inArgs>";
         cCoreScannerClass.ExecCommand(opcode, ref inXML, out outXML, out status);
         //Console.WriteLine(outXML);
     }
     catch (Exception exp)
     {
         Console.WriteLine("Something wrong please check... " + exp.Message);
     }
 }
Exemple #4
0
 /// <summary>
 ///     Initializes this base class. Must be inherited
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver"></param>
 protected MotorolaAttributeSet(int scannerId, CCoreScanner scannerDriver)
 {
     _scannerId        = scannerId;
     _scannerDriver    = scannerDriver;
     _getAttributesXml = $@"<inArgs><scannerID>{scannerId}</scannerID><cmdArgs><arg-xml><attrib_list>{{0}}</attrib_list></arg-xml></cmdArgs></inArgs>";
     _setAttributeXml  =
         $@"<inArgs><scannerID>{scannerId}</scannerID><cmdArgs><arg-xml><attrib_list><attribute><id>{{0}}</id><datatype>{{1}}</datatype><value>{{2}}</value></attribute></attrib_list></arg-xml></cmdArgs></inArgs>";
 }
 /// <summary>
 ///
 /// </summary>
 public CoreScannerService(CCoreScanner coreScanner)
 {
     this.coreScanner          = coreScanner;
     this.deviceIdsBuffer      = new Int32[MaximumNumberOfScanners];
     this.isOpen               = false;
     this.whenBarcodeCaptured  = CreateWhenBarcodeScanned();
     this.whenCommandResponded = CreateWhenCommandResponded();
     this.whenPnp              = CreateWhenPnp();
 }
        /// <summary>
        /// Initialize/Open/Close CoreScanner
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            // Initialize CoreScanner COM object
            CoreScanner.CCoreScanner coreScannerObject = new CCoreScanner();

            int         appHandle            = 0;
            const short NumberOfScannerTypes = 1;

            short[] scannerTypes = new short[NumberOfScannerTypes];
            scannerTypes[0] = (short)ScannerType.All; //  All scanner types
            int status = -1;

            try
            {
                // Open CoreScanner COM Object
                coreScannerObject.Open(appHandle,            // Application handle
                                       scannerTypes,         // Array of scanner types
                                       NumberOfScannerTypes, // Length of scanner types array
                                       out status);          // Command execution success/failure return status

                if (status == (int)Status.Success)
                {
                    Console.WriteLine("CoreScanner Open() - Success");
                }
                else
                {
                    Console.WriteLine("CoreScanner Open() - Failed. Error Code : " + status);
                }

                // Send CoreScanner commands ..

                // Close CoreScanner COM Object
                coreScannerObject.Close(appHandle,   // Application handle
                                        out status); // Command execution success/failure return status

                if (status == (int)Status.Success)
                {
                    Console.WriteLine("CoreScanner Close() - Success");
                }
                else
                {
                    Console.WriteLine("CoreScanner Close() - Failed. Error Code : " + status);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("Exception : " + exception.ToString());
            }

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Exemple #7
0
        public void Init()
        {
            scanner = new CCoreScanner();
            short[] scannerTypes = new short[1];
            scannerTypes[0] = 1;
            short  numberOfScannerTypes = 1;
            int    status;
            int    opcode = 1001;
            string outXML;
            string inXML = this.XMLIn;

            scanner.Open(0, scannerTypes, numberOfScannerTypes, out status);
            scanner.ExecCommand(opcode, ref inXML, out outXML, out status);
            scanner.BarcodeEvent += Scanner_BarcodeEvent;
            this.Status           = ItemState.Initiated;
        }
        // Protected implementation of Dispose pattern.
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                Close();
            }

            // Free any unmanaged objects here.
            //
            _scannerDriver = null;
            _disposed      = true;
        }
        private BarcodeScannerManager()
        {
            try
            {
                if (_scannerDriver == null)
                {
                    _scannerDriver = new CCoreScannerClass();
                }

                Keyboard = new Keyboard(_scannerDriver);
            }
            catch (Exception ex)
            {
                Trace.WriteLine($"Initialization of the Motorola/Zebra BarcodeScannerManager failed:{Environment.NewLine}{ex.Message}");
                _scannerDriver = null;
                Keyboard       = null;
            }
        }
            public ScanListener(CCoreScanner coreScannerObject)
            {
                //ScannerAction = (int)ScanAction.Undefined;
                ScannerMode       = (int)Mode.Work;
                CoreScannerObject = coreScannerObject;
                Status status = GetConnectedScanners();

                if (status == Status.Success)
                {
                    SubscribeForBarcodeEvents();
                    Log.Write("Object ScanListener created", this);
                }
                else
                {
                    Log.Write("Object ScanListener don't create. Check connected scanners.", this);
                }
                Check(status);
            }
Exemple #11
0
 /// <summary>
 ///     Instantiates a Maxicode object
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 public Maxicode(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
 /// <summary>
 ///     Instantiates a Code39 object
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal Code39(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
 /// <summary>
 ///     Instantiates a DLParsing object.
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal LicenseParsing(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
 /// <summary>
 ///     Initializes a Beeper object.
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal Beeper(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
Exemple #15
0
 static COM()
 {
     CoreScannerObject = new CCoreScanner();
 }
 /// <summary>
 ///     Instantiates a Discrete2Of5 object
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal Discrete2Of5(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
Exemple #17
0
        /// <summary>
        /// Trigger scanner beep/LED using CoreScanner
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            // Initialize CoreScanner COM object
            CoreScanner.CCoreScanner coreScannerObject = new CCoreScanner();

            int         appHandle            = 0;
            const short NumberOfScannerTypes = 1;

            short[] scannerTypes = new short[NumberOfScannerTypes];
            scannerTypes[0] = (short)ScannerType.All;  //  All scanner types
            int status           = -1;
            int currentScannerId = 1;

            try
            {
                // Open CoreScanner COM Object
                coreScannerObject.Open(appHandle,            // Application handle
                                       scannerTypes,         // Array of scanner types
                                       NumberOfScannerTypes, // Length of scanner types array
                                       out status);          // Command execution success/failure return status

                if (status == (int)Status.Success)
                {
                    Console.WriteLine("CoreScanner Open() - Success");

                    short  numOfScanners = 0;
                    string outXml        = "";
                    int[]  scannerIdList = new int[Constant.MaxNumDevices];
                    // Get connected scanners
                    coreScannerObject.GetScanners(out numOfScanners, // Returns number of scanners discovered
                                                  scannerIdList,     // Returns array of connected scanner ids
                                                  out outXml,        // Output xml containing discovered scanners information
                                                  out status);       // Command execution success/failure return status

                    if (status == (int)Status.Success)
                    {
                        Console.WriteLine("CoreScanner GetScanners()- Success");
                        Console.WriteLine(" Total Scanners : " + numOfScanners);
                        string scannerIds = "";
                        Array.Resize(ref scannerIdList, numOfScanners);
                        scannerIds = String.Join(", ", scannerIdList);
                        Console.WriteLine(" Scanner IDs :" + scannerIds);
                        Console.WriteLine(" Out xml : " + Environment.NewLine + outXml);

                        if (numOfScanners > 0)
                        {
                            // Use first scanner
                            currentScannerId = scannerIdList[0];

                            // Trigger Scanner Beep
                            Console.WriteLine("Beep scanner (one short high) using setAction");
                            status = -1;
                            int opCode = (int)Opcode.SetAction;
                            // Beep: one short high - input xml
                            string inXml = "<inArgs>" +
                                           "<scannerID>" + currentScannerId.ToString() + "</scannerID>" +
                                           "<cmdArgs>" +
                                           "<arg-int>" + (int)BeepCode.OneShortHigh +   // Specify beeper code
                                           "</arg-int>" +
                                           "</cmdArgs>" +
                                           "</inArgs>";

                            coreScannerObject.ExecCommand(opCode,      // Opcode: for Scanner Beep (SET_ACTION)
                                                          ref inXml,   // Input XML
                                                          out outXml,  // Output XML
                                                          out status); // Command execution success/failure return status

                            if (status == (int)Status.Success)
                            {
                                Console.WriteLine("Scanner Beep() scanner ID:[" +
                                                  currentScannerId.ToString() + "] - Success");
                            }
                            else
                            {
                                Console.WriteLine("Scanner Beep() scanner ID:[" +
                                                  currentScannerId.ToString() + "] - Failed. Error Code : " + status);
                            }

                            Console.WriteLine();

                            Console.WriteLine("Trigger scanner LED3 (Red) on using setAction");
                            opCode = (int)Opcode.SetAction;
                            // Trigger scanner LED3(Red) on - input xml
                            inXml = "<inArgs>" +
                                    "<scannerID>" + currentScannerId.ToString() + "</scannerID>" +
                                    "<cmdArgs>" +
                                    "<arg-int>" + (int)LEDCode.Led3On +    // Specify LED code to switch on/off
                                    "</arg-int>" +
                                    "</cmdArgs>" +
                                    "</inArgs>";

                            // Trigger scanner LED on
                            coreScannerObject.ExecCommand(opCode,      // Opcode: for Scanner LED on (SET_ACTION)
                                                          ref inXml,   // Input XML
                                                          out outXml,  // Output XML
                                                          out status); // Command execution success/failure return status

                            if (status == (int)Status.Success)
                            {
                                Console.WriteLine("Scanner LED on, scanner ID:[" +
                                                  currentScannerId.ToString() + "] - Success");
                            }
                            else
                            {
                                Console.WriteLine("Scanner LED on, scanner ID:[" +
                                                  currentScannerId.ToString() + "] - Failed. Error Code : " + status);
                            }

                            Console.WriteLine("LED3 (red) switched on, press any key to continue.");
                            while (!Console.KeyAvailable)
                            {
                                Thread.Sleep(10);
                            }

                            Console.ReadKey();
                            Console.WriteLine();

                            Console.WriteLine("Trigger scanner LED3 (Red) off using setAction");
                            opCode = (int)Opcode.SetAction;
                            // Trigger scanner LED3 (Red) off - input xml
                            inXml = "<inArgs>" +
                                    "<scannerID>" + currentScannerId.ToString() + "</scannerID>" +
                                    "<cmdArgs>" +
                                    "<arg-int>" + (int)LEDCode.Led3Off +   // Specify LED code to switch on/off
                                    "</arg-int>" +
                                    "</cmdArgs>" +
                                    "</inArgs>";

                            // Trigger scanner LED off
                            coreScannerObject.ExecCommand(opCode,      // Opcode: for Scanner LED on (SET_ACTION)
                                                          ref inXml,   // Input XML
                                                          out outXml,  // Output XML
                                                          out status); // Command execution success/failure return status

                            if (status == (int)Status.Success)
                            {
                                Console.WriteLine("Scanner LED off, scanner ID:[" +
                                                  currentScannerId.ToString() + "] - Success");
                            }
                            else
                            {
                                Console.WriteLine("Scanner LED off, scanner ID:[" +
                                                  currentScannerId.ToString() + "] - Failed. Error Code : " + status);
                            }

                            Console.WriteLine("LED3 (red) switched off, press any key to continue.");
                        }
                        else
                        {
                            Console.WriteLine("CoreScanner GetScanner() - No scanners found");
                        }
                    }
                    else
                    {
                        Console.WriteLine("CoreScanner GetScanner() - Failed. Error Code : " + status);
                    }
                }
                else
                {
                    Console.WriteLine("CoreScanner Open() - Failed. Error Code : " + status);
                }

                // Close CoreScanner COM Object
                coreScannerObject.Close(appHandle,   // Application handle
                                        out status); // Command execution success/failure return status

                if (status == (int)Status.Success)
                {
                    Console.WriteLine("CoreScanner Close() - Success");
                }
                else
                {
                    Console.WriteLine("CoreScanner Close() - Failed. Error Code : " + status);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("Exception : " + exception.ToString());
            }

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Exemple #18
0
 /// <summary>
 ///     Instantiates a Discovery object.
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal Discovery(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
        /// <summary>
        /// Get connected scanners using CoreScanner
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            // Initialize CoreScanner COM object
            CoreScanner.CCoreScanner coreScannerObject = new CCoreScanner();

            int         appHandle            = 0;
            const short NumberOfScannerTypes = 1;

            short[] scannerTypes = new short[NumberOfScannerTypes];
            scannerTypes[0] = (short)ScannerType.All; //  All scanner types
            int status = -1;

            try
            {
                // Open CoreScanner COM Object
                coreScannerObject.Open(appHandle,            // Application handle
                                       scannerTypes,         // Array of scanner types
                                       NumberOfScannerTypes, // Length of scanner types array
                                       out status);          // Command execution success/failure return status

                if (status == (int)Status.Success)
                {
                    Console.WriteLine("CoreScanner Open() - Success");
                    short  numOfScanners = 0;
                    string outXml        = "";
                    int[]  scannerIdList = new int[Constant.MaxNumDevices];

                    // Get connected scanners
                    coreScannerObject.GetScanners(out numOfScanners, // Returns number of scanners discovered
                                                  scannerIdList,     // Returns array of connected scanner ids
                                                  out outXml,        // Output xml containing discovered scanners information
                                                  out status);       // Command execution success/failure return status

                    if (status == (int)Status.Success)
                    {
                        Console.WriteLine("CoreScanner GetScanners()- Success");
                        Console.WriteLine(" Total Scanners : " + numOfScanners);
                        string scannerIds = "";
                        Array.Resize(ref scannerIdList, numOfScanners);
                        scannerIds = String.Join(", ", scannerIdList);
                        Console.WriteLine(" Scanner IDs :" + scannerIds);
                        Console.WriteLine(" Out xml : " + Environment.NewLine + outXml);
                    }
                    else
                    {
                        Console.WriteLine("CoreScanner GetScanner() - Failed. Error Code : " + status);
                    }
                }
                else
                {
                    Console.WriteLine("CoreScanner Open() - Failed. Error Code : " + status);
                }

                // Close CoreScanner COM Object
                coreScannerObject.Close(appHandle,   // Application handle
                                        out status); // Command execution success/failure return status

                if (status == (int)Status.Success)
                {
                    Console.WriteLine("CoreScanner Close() - Success");
                }
                else
                {
                    Console.WriteLine("CoreScanner Close() - Failed. Error Code : " + status);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("Exception : " + exception.ToString());
            }

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
 /// <summary>
 ///     Initializes a Keyboard object.
 /// </summary>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal Keyboard(CCoreScanner scannerDriver)
 {
     _scannerDriver = scannerDriver;
 }
 /// <summary>
 ///     Instantiates a SymbologySecurity object
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal SymbologySecurity(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
 /// <summary>
 ///     Instantiates a new Firmware object.
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal Firmware(CCoreScanner scannerDriver, int scannerId)
 {
     _scannerDriver = scannerDriver;
     _scannerId     = scannerId;
 }
 /// <summary>
 ///     Initializes a new Imaging object
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal Imaging(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
Exemple #24
0
 /// <summary>
 ///     Instantiates a UpcEan object
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal UpcEan(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
 /// <summary>
 ///     Instantiates a new MacroPdf object
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal MacroPdf(CCoreScanner scannerDriver, int scannerId)
 {
     _scannerDriver = scannerDriver;
     _scannerId     = scannerId;
 }
 /// <summary>
 ///     Instantiates a new AccessControl object.
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal AccessControl(CCoreScanner scannerDriver, int scannerId)
 {
     _scannerDriver = scannerDriver;
     _scannerId     = scannerId;
 }
 internal BarcodeScanner(CCoreScanner scannerDriver, XElement scannerXml)
 {
     _scannerDriver = scannerDriver;
     Info           = new ScannerInfo(scannerXml);
 }
Exemple #28
0
        /// <summary>
        /// Register/Unregister for events using CoreScanner
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            // Initialize CoreScanner COM object
            CoreScanner.CCoreScanner coreScannerObject = new CCoreScanner();

            int         appHandle            = 0;
            const short NumberOfScannerTypes = 1;

            short[] scannerTypes = new short[NumberOfScannerTypes];
            scannerTypes[0] = (short)ScannerType.All; //  All scanner types
            int status = -1;

            try
            {
                // Open CoreScanner COM Object
                coreScannerObject.Open(appHandle,            // Application handle
                                       scannerTypes,         // Array of scanner types
                                       NumberOfScannerTypes, // Length of scanner types array
                                       out status);          // Command execution success/failure return status

                if (status == (int)Status.Success)
                {
                    Console.WriteLine("CoreScanner Open() - Success");

                    int   eventIdCount = 1; // Number of events to register (only barcode events)
                    int[] eventIdList  = new int[eventIdCount];
                    // Register for barcode events only
                    eventIdList[0] = (int)EventType.Barcode;

                    string eventIds = String.Join(",", eventIdList);
                    string inXml    = "<inArgs>" +
                                      "<cmdArgs>" +
                                      "<arg-int>" + eventIdCount + "</arg-int>" + // Number of events to register
                                      "<arg-int>" + eventIds + "</arg-int>" +     // Event id list of events to register for
                                      "</cmdArgs>" +
                                      "</inArgs>";

                    int    opCode = (int)Opcode.RegisterForEvents;
                    string outXml = "";
                    status = -1;

                    // Call register for events
                    coreScannerObject.ExecCommand(opCode,      // Opcode: Register for events
                                                  ref inXml,   // Input XML
                                                  out outXml,  // Output XML
                                                  out status); // Command execution success/failure return status

                    if (status == (int)Status.Success)
                    {
                        Console.WriteLine("CoreScanner RegisterForEvents() - Success");
                    }
                    else
                    {
                        Console.WriteLine("CoreScanner RegisterForEvents() - Failed. Error Code : " + status);
                    }

                    // Add barcode data event handler
                    coreScannerObject.BarcodeEvent += CoreScannerObject_BarcodeEvent;

                    Console.WriteLine("Scan a barcode now, press " +
                                      "any key to exit.");
                    while (!Console.KeyAvailable)
                    {
                        Thread.Sleep(10);
                    }

                    status = -1;
                    opCode = (int)Opcode.UnregisterForEvents;

                    // Call unregister for events
                    coreScannerObject.ExecCommand(opCode,      // Opcode: Unregister for events
                                                  ref inXml,   // Input XML
                                                  out outXml,  // Output XML
                                                  out status); // Command execution success/failure return status

                    if (status == (int)Status.Success)
                    {
                        Console.WriteLine("CoreScanner UnregisterForEvents() - Success");
                    }
                    else
                    {
                        Console.WriteLine("CoreScanner UnregisterForEvents() - Failed. Error Code : " + status);
                    }
                }
                else
                {
                    Console.WriteLine("CoreScanner Open() - Failed. Error Code : " + status);
                }

                // Close CoreScanner COM Object
                coreScannerObject.Close(appHandle,   // Application handle
                                        out status); // Command execution success/failure return status

                if (status == (int)Status.Success)
                {
                    Console.WriteLine("CoreScanner Close() - Success");
                }
                else
                {
                    Console.WriteLine("CoreScanner Close() - Failed. Error Code : " + status);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("Exception : " + exception.ToString());
            }

            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Exemple #29
0
 /// <summary>
 ///     Instantiates a Pdf object
 /// </summary>
 /// <param name="scannerId">ID number of the scanner to get/set data from.</param>
 /// <param name="scannerDriver">CCoreScanner instance</param>
 internal Pdf(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
 internal Chinese2Of5(int scannerId, CCoreScanner scannerDriver) : base(scannerId, scannerDriver)
 {
 }
Exemple #31
0
 // Inicializa el Scanner
 private void initializeScanner()
 {
     try
     {
         //Instantiate CoreScanner Class
         cCoreScannerClass = new CCoreScanner();
         //Call Open API
         short[] scannerTypes = new short[1];//Scanner Types you are interested in
         scannerTypes[0] = 1; // 1 for all scanner types
         short numberOfScannerTypes = 1; // Size of the scannerTypes array
         int status; // Extended API return code
         cCoreScannerClass.Open(0, scannerTypes, numberOfScannerTypes, out status);
         // Subscribe for barcode events in cCoreScannerClass
         cCoreScannerClass.BarcodeEvent += new
         _ICoreScannerEvents_BarcodeEventEventHandler(OnBarcodeEvent);
         // Let's subscribe for events
         int opcode = 1001; // Method for Subscribe events
         string outXML; // XML Output
         string inXML = "<inArgs>" +
         "<cmdArgs>" +
         "<arg-int>1</arg-int>" + // Number of events you want to subscribe
         "<arg-int>1</arg-int>" + // Comma separated event IDs
         "</cmdArgs>" +
         "</inArgs>";
         cCoreScannerClass.ExecCommand(opcode, ref inXML, out outXML, out status);
     }
     catch (Exception exp)
     {
         MessageBox.Show("Error de conexión con el Scanner... " + exp.Message);
     }
 }