/// <summary> /// Opens a peripheral. /// </summary> /// <param name="peripheralName">Name of the peripheral.</param> /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param> public void Open(string peripheralName, PeripheralConfiguration peripheralConfig) { if (this.oposPinpad == null) { this.oposPinpad = new OPOSPINPadClass(); this.oposPinpad.DataEvent += this.OnPinPadDataEvent; // _IOPOSPINPadEvents_DataEventEventHandler this.oposPinpad.ErrorEvent += this.OnPinPadErrorEvent; // _IOPOSPINPadEvents_ErrorEventEventHandler try { // Open Task.Run(() => this.oposPinpad.Open(peripheralName)).Wait(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, this.oposPinpad.ResultCode); // Claim this.oposPinpad.ClaimDevice(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, this.oposPinpad.ResultCode); } catch { this.Close(); throw; } } }
/// <summary> /// Opens a peripheral. /// </summary> /// <param name="peripheralName">Name of the peripheral.</param> /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param> public void Open(string peripheralName, PeripheralConfiguration peripheralConfig) { this.oposBarcodeScanner = new OPOSScanner(); // Open this.oposBarcodeScanner.Open(peripheralName); OposHelper.CheckResultCode(this, this.oposBarcodeScanner.ResultCode); // Claim this.oposBarcodeScanner.ClaimDevice(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, this.oposBarcodeScanner.ResultCode); // Enable/Configure this.oposBarcodeScanner.DeviceEnabled = true; // Plug in handlers for data eevents this.oposBarcodeScanner.DataEvent += this.OnBarcodeScannerDataEvent; this.oposBarcodeScanner.ErrorEvent += this.OnBarcodeScannerErrorEvent; // Set autodisable to false this.oposBarcodeScanner.AutoDisable = false; // Enable data events this.oposBarcodeScanner.DataEventEnabled = true; }
/// <summary> /// Opens a peripheral. /// </summary> /// <param name="peripheralName">Name of the peripheral.</param> /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param> public void Open(string peripheralName, PeripheralConfiguration peripheralConfig) { if (this.oposSigCap == null) { this.oposSigCap = new OPOSSigCap(); this.oposSigCap.DataEvent += this.OnSigCapDataEvent; this.oposSigCap.ErrorEvent += this.OnSigCapErrorEvent; try { // Open Task.Run(() => this.oposSigCap.Open(peripheralName)).Wait(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, this.oposSigCap.ResultCode); // Claim this.oposSigCap.ClaimDevice(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, this.oposSigCap.ResultCode); // Configure this.CapUserTerminated = this.oposSigCap.CapUserTerminated; this.MaximumX = this.oposSigCap.MaximumY; this.MaximumY = this.oposSigCap.MaximumY; } catch { this.Close(); throw; } } // NOTE: Hardware station does not support "ReatlTimeDataEnabled" property. }
/// <summary> /// Ends the electronic funds transaction. /// </summary> /// <param name="completionCode">The completionCode code.</param> public void EndElectronicFundsTransaction(int completionCode) { if (this.oposPinpad != null) { int resultCode = this.oposPinpad.EndEFTTransaction(completionCode); OposHelper.CheckResultCode(this, resultCode); this.oposPinpad.DeviceEnabled = false; this.oposPinpad.DataEventEnabled = false; } }
/// <summary> /// Establishes a connection to the specified scale. /// </summary> /// <param name="peripheralName">Name of scale device to open.</param> /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param> public void Open(string peripheralName, PeripheralConfiguration peripheralConfig) { this.oposScale = new OPOSScale(); // Open this.oposScale.Open(peripheralName); OposHelper.CheckResultCode(this, this.oposScale.ResultCode); // Claim this.oposScale.ClaimDevice(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, this.oposScale.ResultCode); // Enable/Configure this.oposScale.DeviceEnabled = true; this.oposScale.PowerNotify = (int)OPOS_Constants.OPOS_PN_ENABLED; }
/// <summary> /// Establishes a connection to the specified cash drawer. /// </summary> /// <param name="peripheralName">Name of cash drawer device to open.</param> /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param> public void Open(string peripheralName, PeripheralConfiguration peripheralConfig) { this.oposCashDrawer = new OPOSCashDrawer(); // Open this.oposCashDrawer.Open(peripheralName); OposHelper.CheckResultCode(this, this.oposCashDrawer.ResultCode); // Claim this.oposCashDrawer.ClaimDevice(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, this.oposCashDrawer.ResultCode); // Enable this.oposCashDrawer.DeviceEnabled = true; OposHelper.CheckResultCode(this, this.oposCashDrawer.ResultCode); }
/// <summary> /// Ends the capture. /// </summary> public void EndCapture() { SignatureCaptureResults results = null; if (this.oposSigCap != null) { int resultCode = this.oposSigCap.EndCapture(); OposHelper.CheckResultCode(this, resultCode); results = ParsePointArray(this.oposSigCap.PointArray); this.oposSigCap.DeviceEnabled = false; this.oposSigCap.DataEventEnabled = false; } this.LastResult = results; }
/// <summary> /// Enable device for capture. /// </summary> /// <param name="formName">Form name (null or empty string will use default).</param> public void BeginCapture(string formName) { this.LastResult = null; if (this.oposSigCap != null) { if (string.IsNullOrEmpty(formName)) { // Default to empty string if value is not provided. formName = string.Empty; } this.oposSigCap.DeviceEnabled = true; this.oposSigCap.DataEventEnabled = true; this.oposSigCap.BeginCapture(formName); OposHelper.CheckResultCode(this, this.oposSigCap.ResultCode); } }
/// <summary> /// Begins the electronic funds transaction. /// </summary> /// <param name="amount">The amount.</param> /// <param name="accountNumber">The account number.</param> public void BeginElectronicFundsTransaction(decimal amount, string accountNumber) { if (this.oposPinpad != null) { this.oposPinpad.DeviceEnabled = true; this.oposPinpad.DataEventEnabled = true; // Clear any all device input that has been buffered (for data events) this.oposPinpad.ClearInput(); this.oposPinpad.Amount = amount; this.oposPinpad.AccountNumber = accountNumber; this.oposPinpad.TerminalID = "1"; // Note - we do not provide terminal ID for device on hardware station if (amount < 0) { // Money is being refunded to the debit card - this is credit this.oposPinpad.TransactionType = (int)Interop.OposConstants.OPOSPINPadConstants.PPAD_TRANS_CREDIT; } else { // Debit trans this.oposPinpad.TransactionType = (int)Interop.OposConstants.OPOSPINPadConstants.PPAD_TRANS_DEBIT; } this.oposPinpad.Track1Data = string.Empty; this.oposPinpad.Track2Data = string.Empty; this.oposPinpad.Track3Data = string.Empty; this.oposPinpad.Track4Data = string.Empty; // hardcoded value for Hardware Station int transactionHost = 1; this.oposPinpad.BeginEFTTransaction(EncryptionAlgorithm, transactionHost); OposHelper.CheckResultCode(this, this.oposPinpad.ResultCode); this.oposPinpad.EnablePINEntry(); OposHelper.CheckResultCode(this, this.oposPinpad.ResultCode); } else { this.AbortTransaction(); } }
/// <summary> /// Opens a peripheral. /// </summary> /// <param name="peripheralName">Name of the peripheral.</param> /// <param name="characterSet">The character set.</param> /// <param name="binaryConversion">If set to <c>true</c> [binary conversion].</param> /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param> public void Open(string peripheralName, int characterSet, bool binaryConversion, PeripheralConfiguration peripheralConfig) { this.oposPrinter = new OPOSPOSPrinter(); // Open this.oposPrinter.Open(peripheralName); OposHelper.CheckResultCode(this, this.oposPrinter.ResultCode); // Claim this.oposPrinter.ClaimDevice(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, this.oposPrinter.ResultCode); // Enable/Configure this.oposPrinter.DeviceEnabled = true; this.oposPrinter.AsyncMode = false; this.oposPrinter.CharacterSet = characterSet; this.oposPrinter.RecLineChars = 56; this.oposPrinter.SlpLineChars = 60; this.binaryConversionEnabled = binaryConversion; }
/// <summary> /// Opens a peripheral. /// </summary> /// <param name="peripheralName">Name of the peripheral.</param> /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param> public void Open(string peripheralName, PeripheralConfiguration peripheralConfig) { this.oposMsr = new OPOSMSR(); // Open this.oposMsr.Open(peripheralName); OposHelper.CheckResultCode(this, this.oposMsr.ResultCode); // Claim this.oposMsr.ClaimDevice(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, this.oposMsr.ResultCode); // Enable/Configure this.oposMsr.DeviceEnabled = true; // Set the decode data - so that the device decodes the scanned data this.oposMsr.DecodeData = true; // Note: there are two properties that look similar // ParseDecodedData and ParseDecodeData // Both do the same as per the OPOS spec. // Setting this property makes the device return data // in individual fields. this.oposMsr.ParseDecodedData = true; // Set Transmit Sentinels to true // so that when the data is sent, we can get the sentenels // and can parse the data of the tracks. this.oposMsr.TransmitSentinels = true; // Plug in handlers for data eevents this.oposMsr.DataEvent += this.OnMsrDataEvent; this.oposMsr.ErrorEvent += this.OnMsrErrorEvent; // Set autodisable to false this.oposMsr.AutoDisable = false; // Enable data events this.oposMsr.DataEventEnabled = true; }
/// <summary> /// Establishes a connection to the specified line display. /// </summary> /// <param name="peripheralName">Name of scale device to open.</param> /// <param name="characterSet">The character set.</param> /// <param name="binaryConversion">If set to <c>true</c> [binary conversion].</param> /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param> public void Open(string peripheralName, int characterSet, bool binaryConversion, PeripheralConfiguration peripheralConfig) { this.oposLineDisplayWorker = new WorkerThread <IOPOSLineDisplay>(() => { IOPOSLineDisplay oposLineDisplay = new OPOSLineDisplay(); // Open oposLineDisplay.Open(peripheralName); OposHelper.CheckResultCode(this, oposLineDisplay.ResultCode); // Claim oposLineDisplay.ClaimDevice(OposHelper.ClaimTimeOut); OposHelper.CheckResultCode(this, oposLineDisplay.ResultCode); // Enable/Configure oposLineDisplay.DeviceEnabled = true; binaryConversionEnabled = binaryConversion; if (characterSet != 0) { // If character set is not supported by device, then disable and error out. if (!oposLineDisplay.CharacterSetList.Split(CharacterSetListSeparator).Any(p => p.Equals(characterSet.ToString(CultureInfo.InvariantCulture), StringComparison.OrdinalIgnoreCase))) { oposLineDisplay.ReleaseDevice(); oposLineDisplay.Close(); throw new PeripheralException(PeripheralException.LineDisplayCharacterSetNotSupported); } oposLineDisplay.CharacterSet = characterSet; } this.numberOfColumns = oposLineDisplay.Columns; return(oposLineDisplay); }); }