Ejemplo n.º 1
0
        void EventCallback(MMM.Readers.FullPage.EventCode aEventType)
        {
            try
            {
                switch (aEventType)
                {
                case MMM.Readers.FullPage.EventCode.SETTINGS_INITIALISED:
                {
                    // You may wish to change the settings immediately after they have
                    // been loaded - for example, to turn off options that you do not
                    // want.
                    MMM.Readers.FullPage.ReaderSettings settings;
                    MMM.Readers.ErrorCode errorCode = MMM.Readers.FullPage.Reader.GetSettings(
                        out settings
                        );

                    if (errorCode == MMM.Readers.ErrorCode.NO_ERROR_OCCURRED)
                    {
                        /* if (settings.puCameraSettings.puSplitImage == false)
                         *   this.tabControl.Controls.Remove(this.ImagesRearTab);*/

                        settings.puDataToSend.send |=
                            MMM.Readers.FullPage.DataSendSet.Flags.DOCMARKERS;
                        settings.puDataToSend.special =
                            MMM.Readers.FullPage.DataSendSet.Flags.VISIBLEIMAGE;
                    }
                    else
                    {
                        MessageBox.Show(
                            "GetSettings failure, check for Settings " +
                            "structure mis-match. Error: " +
                            errorCode.ToString(),
                            "Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Error
                            );
                    }
                    break;
                }

                case MMM.Readers.FullPage.EventCode.START_OF_DOCUMENT_DATA:
                {
                    msgsplash.Text = "Leyendo información...";
                    break;
                }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Ejemplo n.º 2
0
        private void LoadSwipeSettings(ref MMM.Readers.Modules.Swipe.SwipeSettings swipeSettings)
        {
            MMM.Readers.ErrorCode lErrorCode = MMM.Readers.Modules.Reader.LoadSwipeSettings(
                ref swipeSettings
                );

            if (lErrorCode != MMM.Readers.ErrorCode.NO_ERROR_OCCURRED)
            {
                String message = String.Format("Failed to Load Swipe Settings {0} {1}", (int)lErrorCode, lErrorCode.ToString());
                log.Warn(message);
                throw new PosHardwareException(message);
            }
        }
Ejemplo n.º 3
0
        private void InitializeSwipeReader(
            MMM.Readers.Modules.Swipe.SwipeSettings swipeSettings,
            MMM.Readers.Modules.Swipe.DataDelegate dataDelegate,
            MMM.Readers.FullPage.EventDelegate eventDelegate
            )
        {
            log.Info("Intializing Swipe Reader");
            log.Debug("Swipe Reader Settings : [" + swipeSettings + "]");

            MMM.Readers.ErrorCode lErrorCode = MMM.Readers.Modules.Swipe.Initialise(
                swipeSettings,
                dataDelegate,
                eventDelegate);
            if (lErrorCode != MMM.Readers.ErrorCode.NO_ERROR_OCCURRED)
            {
                String message = String.Format("Failed SwipeReader Initialization {0} {1}", (int)lErrorCode, lErrorCode.ToString());
                throw new PosHardwareException(message);
            }
        }
Ejemplo n.º 4
0
        private void InitalizeLogging()
        {
            MMM.Readers.ErrorCode lErrorCode = MMM.Readers.Modules.Reader.InitialiseLogging(
                true,
                3,
                -1,
                "SwipeReader.Net.log"
                );

            if (lErrorCode != MMM.Readers.ErrorCode.NO_ERROR_OCCURRED)
            {
                String message = String.Format("Failed Logger Initialization {0} {1}", (int)lErrorCode, lErrorCode.ToString());
                throw new PosHardwareException(message);
            }
        }
Ejemplo n.º 5
0
        private void InitialiseSwipeAPI()
        {
            MMM.Readers.ErrorCode lErrorCode = MMM.Readers.ErrorCode.NO_ERROR_OCCURRED;

            // Initialise logging and error handling first. The error handler callback
            // will receive all error messages generated by the 3M Page Reader SDK
            MMM.Readers.Modules.Reader.SetErrorHandler(
                new MMM.Readers.ErrorDelegate(ProcessErrorThreadHelper),
                IntPtr.Zero
                );
            lErrorCode = MMM.Readers.Modules.Reader.InitialiseLogging(
                true,
                3,
                -1,
                "SwipeReader.Net.log"
                );

            if (lErrorCode == MMM.Readers.ErrorCode.NO_ERROR_OCCURRED)
            {
                // Next load the settings for the Swipe Reader from the ini files. You can
                // also modify and save settings back to the ini files using
                // MMM.Readers.Modules.Reader.SaveSwipeSettings()
                lErrorCode = MMM.Readers.Modules.Reader.LoadSwipeSettings(
                    ref swipeSettings
                    );
            }

            if (lErrorCode == MMM.Readers.ErrorCode.NO_ERROR_OCCURRED)
            {
                // Initialise the Swipe Reader. Data and events will be sent back in a
                // non-blocking fashion through the callbacks provided
                //
                // Thread helper delegates are used to avoid thread-safety issues,
                // particularly with .NET framework 2.0
                lErrorCode = MMM.Readers.Modules.Swipe.Initialise(
                    swipeSettings,
                    new MMM.Readers.Modules.Swipe.DataDelegate(ProcessDataThreadHelper),
                    new MMM.Readers.FullPage.EventDelegate(ProcessEventThreadHelper)
                    );
            }

            if (lErrorCode != MMM.Readers.ErrorCode.NO_ERROR_OCCURRED)
            {
                InsertRow(
                    (int)lErrorCode,
                    lErrorCode.ToString(),
                    0,
                    "Failed to initialise Swipe Reader API",
                    RowType.Error
                    );
            }
            else
            {
                // Display the hardware device and protocol in use
                string lProtocolName = new string(swipeSettings.Protocol.ProtocolName);

                if (lProtocolName.StartsWith("RTE"))
                {
                    // For RTE_INTERRUPT and RTE_POLLED modes, the Swipe Reader API can
                    // automatically send Enable Device commands once finished reading so
                    // that you do not have to
                    if (
                        !lProtocolName.Equals("RTE_NATIVE") &&
                        swipeSettings.Protocol.RTE.AutoSendEnableDevice > 0
                        )
                    {
                        lProtocolName = string.Concat(
                            lProtocolName,
                            ", Auto Send Enable Command"
                            );
                    }

                    if (swipeSettings.Protocol.RTE.UseBCC > 0)
                    {
                        lProtocolName = string.Concat(
                            lProtocolName,
                            ", with BCC"
                            );
                    }
                    else
                    {
                        lProtocolName = string.Concat(
                            lProtocolName,
                            ", no BCC"
                            );
                    }
                }

                labelHardwareProto.Text = string.Format(
                    "{0}, Hardware: {1}",
                    lProtocolName,
                    swipeSettings.Hardware.DeviceType.ToString()
                    );
            }
        }
Ejemplo n.º 6
0
 private void ProcessError(MMM.Readers.ErrorCode aErrorCode, string aErrorMessage)
 {
     InsertRow((int)aErrorCode, aErrorCode.ToString(), 0, aErrorMessage, RowType.Error);
 }
Ejemplo n.º 7
0
        private void InitialiseTimer(object sender, System.EventArgs e)
        {
            timer1.Stop();

            try
            {
                MMM.Readers.FullPage.Reader.EnableLogging(
                    true,
                    1,
                    -1,
                    "HLNonBlockingExample.Net.log"
                    );

                //UpdateState(MMM.Readers.FullPage.ReaderState.READER_NOT_INITIALISED);
                // prDocStartTime = System.DateTime.UtcNow;

                // Thread helper delegates are used to avoid thread-safety issues, particularly
                // with .NET framework 2.0
                MMM.Readers.ErrorCode lResult = MMM.Readers.ErrorCode.NO_ERROR_OCCURRED;

                Microsoft.Win32.SystemEvents.PowerModeChanged += new Microsoft.Win32.PowerModeChangedEventHandler(OnPowerModeChanged);

                lResult = MMM.Readers.FullPage.Reader.Initialise(
                    new MMM.Readers.FullPage.DataDelegate(DataCallbackThreadHelper),
                    new MMM.Readers.FullPage.EventDelegate(EventCallbackThreadHelper),
                    new MMM.Readers.ErrorDelegate(ErrorCallbackThreadHelper),
                    null,
                    true,
                    false
                    );

                if (lResult != MMM.Readers.ErrorCode.NO_ERROR_OCCURRED)
                {
                    MessageBox.Show(
                        "Initialise failed - " + lResult.ToString(),
                        "Error",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error,
                        MessageBoxDefaultButton.Button1
                        );
                }
                Panel1.GradientBottomLeft  = Color.ForestGreen;
                Panel1.GradientBottomRight = Color.ForestGreen;
                Panel1.GradientTopLeft     = Color.LimeGreen;
                Panel1.GradientTopRight    = Color.LimeGreen;
                msgsplash.Text             = "Ya puede colocar el pasaporte a escanear.";
                //MessageBox.Show(Properties.Settings.Default.ipBD + "--" + Properties.Settings.Default.serverBD + "--" + Properties.Settings.Default.usuarioBD+"--"+ Properties.Settings.Default.passBD);

                /* WinAPI.NoSiempreEncima(this.Handle.ToInt32());
                 * msgsplash = "Ya puede colocar el pasaporte a escanear.";
                 * Thread splashThread = new Thread(new ThreadStart(StartSplash));
                 * splashThread.Start();*/
                //MMM.Readers.FullPage.Reader.SetWarningCallback(new MMM.Readers.WarningDelegate(WarningCallbackThreadHelper));


                //			//Example of how to set the signrequest callback
                //			MMM.Readers.FullPage.Reader.SetSignRequestCallback(
                //				SignRequestCallbackThreadHelper
                //			);
            }
            catch (System.DllNotFoundException except)
            {
                MessageBox.Show(
                    except.Message +
                    "\nEnsure the \"working directory\" of the application is set to the " +
                    "3M Page Reader\\bin folder. When run within the IDE, set this through " +
                    "Properties -> Configuration Properties -> Debugging"
                    );
            }
        }