/// <summary> /// Load the device. /// </summary> /// <exception cref="IOException"></exception> public void Load() { if (LSRetailPosis.Settings.HardwareProfiles.MSR.DeviceType != DeviceTypes.OPOS) { return; } NetTracer.Information("Peripheral [MSR] - OPOS device loading: {0}", DeviceName ?? "<Undefined>"); oposMSR = new OPOSMSRClass(); //Open oposMSR.Open(DeviceName); Peripherals.CheckResultCode(this, oposMSR.ResultCode); //Claim oposMSR.ClaimDevice(Peripherals.ClaimTimeOut); Peripherals.CheckResultCode(this, oposMSR.ResultCode); //Enable/Configure oposMSR.DataEvent += new _IOPOSMSREvents_DataEventEventHandler(oposMSR_DataEvent); oposMSR.DeviceEnabled = true; // Override default configuraiton values as required by POS. oposMSR.AutoDisable = true; oposMSR.DecodeData = true; oposMSR.TransmitSentinels = true; // Wait for POS to enable the device... oposMSR.DeviceEnabled = false; oposMSR.DataEventEnabled = false; IsActive = true; }
/// <summary> /// Open and claim the device. /// </summary> public void Load() { if (LSRetailPosis.Settings.HardwareProfiles.SignatureCapture.DeviceType == DeviceTypes.OPOS && !this.IsActive) { NetTracer.Information("Peripheral [SigCap] - OPOS device loading: {0}", DeviceName ?? "<Undefined>"); int resultCode = 0; this.oposSigCapClass = new OPOSSigCapClass(); this.oposSigCapClass.DataEvent += new _IOPOSSigCapEvents_DataEventEventHandler(oposSigCapClass_DataEvent); this.oposSigCapClass.ErrorEvent += new _IOPOSSigCapEvents_ErrorEventEventHandler(oposSigCapClass_ErrorEvent); resultCode = this.oposSigCapClass.Open(DeviceName); Peripherals.CheckResultCode(this, resultCode); resultCode = this.oposSigCapClass.ClaimDevice(Peripherals.ClaimTimeOut); Peripherals.CheckResultCode(this, resultCode); this.CapDisplay = this.oposSigCapClass.CapDisplay; this.CapRealTimeData = this.oposSigCapClass.CapRealTimeData; this.CapUserTerminated = this.oposSigCapClass.CapUserTerminated; this.MaximumX = this.oposSigCapClass.MaximumX; this.MaximumY = this.oposSigCapClass.MaximumY; this.IsActive = true; } }
/// <summary> /// Load the device. /// </summary> /// <exception cref="IOException"></exception> public void Load() { if (this.deviceType != DeviceTypes.OPOS) { return; } NetTracer.Information("Peripheral [Scanner] - OPOS device loading: {0}", this.DeviceName ?? "<Undefined>"); oposScanner = new OPOSScannerClass(); // Open oposScanner.Open(this.DeviceName); Peripherals.CheckResultCode(this, oposScanner.ResultCode); // Claim oposScanner.ClaimDevice(Peripherals.ClaimTimeOut); Peripherals.CheckResultCode(this, oposScanner.ResultCode); // Enable/Configure oposScanner.DataEvent += new _IOPOSScannerEvents_DataEventEventHandler(posScanner_DataEvent); oposScanner.DeviceEnabled = true; oposScanner.AutoDisable = true; oposScanner.DecodeData = true; oposScanner.DataEventEnabled = true; IsActive = true; }
/// <summary> /// Load the device. /// </summary> /// <exception cref="IOException">Cannot load device</exception> public void Load() { if (this.DeviceType == DeviceTypes.None) { return; } if (this.DeviceType == DeviceTypes.OPOS) { NetTracer.Information("Peripheral [CashDrawer] - OPOS device loading: {0}", this.DeviceName ?? "<Undefined>"); oposCashDrawer = new OPOSCashDrawerClass(); // Open oposCashDrawer.Open(this.DeviceName); Peripherals.CheckResultCode(this, oposCashDrawer.ResultCode); // Claim oposCashDrawer.ClaimDevice(Peripherals.ClaimTimeOut); Peripherals.CheckResultCode(this, oposCashDrawer.ResultCode); // Enable oposCashDrawer.DeviceEnabled = true; oposCashDrawer.StatusUpdateEvent += new _IOPOSCashDrawerEvents_StatusUpdateEventEventHandler(posCashDrawer_StatusUpdateEvent); } IsActive = true; }
/// <summary> /// Load the device. /// </summary> /// <exception cref="IOException"></exception> public void Load() { if (LSRetailPosis.Settings.HardwareProfiles.Scale.DeviceType != DeviceTypes.OPOS) { return; } NetTracer.Information("Peripheral [Scale] - OPOS device loading: {0}", DeviceName ?? "<Undefined>"); oposScale = new OPOSScaleClass(); // Open oposScale.Open(DeviceName); Peripherals.CheckResultCode(this, oposScale.ResultCode); // Claim oposScale.ClaimDevice(Peripherals.ClaimTimeOut); Peripherals.CheckResultCode(this, oposScale.ResultCode); // Enable/Configure oposScale.DataEvent += new _IOPOSScaleEvents_DataEventEventHandler(posScale_DataEvent); oposScale.ErrorEvent += new _IOPOSScaleEvents_ErrorEventEventHandler(posScale_ErrorEvent); oposScale.DeviceEnabled = true; oposScale.AsyncMode = true; oposScale.AutoDisable = true; oposScale.DataEventEnabled = true; oposScale.PowerNotify = (int)OPOS_Constants.OPOS_PN_ENABLED; IsActive = true; }
/// <summary> /// Load the device. /// </summary> /// <exception cref="IOException"></exception> public void Load() { if (LSRetailPosis.Settings.HardwareProfiles.PinPad.DeviceType != DeviceTypes.OPOS) { return; } NetTracer.Information("Peripheral [PinPad] - OPOS device loading: {0}", DeviceName ?? "<Undefined>"); oposPinpad = new OPOSPINPadClass(); // Open oposPinpad.Open(DeviceName); Peripherals.CheckResultCode(this, oposPinpad.ResultCode); // Claim oposPinpad.ClaimDevice(Peripherals.ClaimTimeOut); Peripherals.CheckResultCode(this, oposPinpad.ResultCode); // Configure/Enable oposPinpad.DataEvent += new _IOPOSPINPadEvents_DataEventEventHandler(posPinpad_DataEvent); oposPinpad.ErrorEvent += new _IOPOSPINPadEvents_ErrorEventEventHandler(posPinpad_ErrorEvent); oposPinpad.DeviceEnabled = true; IsActive = true; }
/// <summary> /// Enable device for capture. /// </summary> public void BeginCapture() { if (this.oposSigCapClass != null && this.IsActive) { NetTracer.Information("Peripheral [SigCap] - Begin Capture"); this.oposSigCapClass.DeviceEnabled = true; this.oposSigCapClass.DataEventEnabled = true; int result = this.oposSigCapClass.BeginCapture(LSRetailPosis.Settings.HardwareProfiles.SignatureCapture.FormName); Peripherals.CheckResultCode(this, result); } }
/// <summary> /// Load the device. /// </summary> /// <exception cref="IOException"></exception> public void Load() { if (this.deviceType == DeviceTypes.None) { return; } if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled()) { FiscalPrinter.FiscalPrinter.Instance.Load(); return; } if (this.deviceType == DeviceTypes.OPOS) { NetTracer.Information("Peripheral [CashDrawer] - OPOS device loading: {0}", this.DeviceName ?? "<Undefined>"); oposPrinter = new OPOSPOSPrinterClass(); // Open oposPrinter.Open(this.DeviceName); Peripherals.CheckResultCode(this, oposPrinter.ResultCode); // Claim oposPrinter.ClaimDevice(Peripherals.ClaimTimeOut); Peripherals.CheckResultCode(this, oposPrinter.ResultCode); // Enable/Configure oposPrinter.DeviceEnabled = true; oposPrinter.AsyncMode = false; oposPrinter.CharacterSet = characterSet; oposPrinter.RecLineChars = 56; oposPrinter.SlpLineChars = 60; // Loading a bitmap for the printer string logoFile = Path.Combine(ApplicationSettings.GetAppPath(), "RetailPOSLogo.bmp"); if (File.Exists(logoFile)) { NetTracer.Information("Peripheral [Printer] - OPOS printer bitmap load"); oposPrinter.SetBitmap(1, (int)OPOSPOSPrinterConstants.PTR_S_RECEIPT, logoFile, 500, (int)OPOSPOSPrinterConstants.PTR_BM_CENTER); } } IsActive = true; }
/// <summary> /// Load the device. /// </summary> /// <exception cref="IOException"></exception> /// <exception cref="NotSupportedException"></exception> public void Load() { NotificationCenter = NotificationProxy.GetNotificationCenter(); if (LSRetailPosis.Settings.HardwareProfiles.LineDisplay.DeviceType != DeviceTypes.OPOS) { return; } NetTracer.Information("Peripheral [LineDisplay] - OPOS device loading: {0}", DeviceName ?? "<Undefined>"); // If character set is not supported by OS, then error out. if (!Encoding.GetEncodings().Any(p => p.CodePage == characterSet)) { throw new NotSupportedException(string.Format("Peripheral [LineDisplay] - Character set '{0}' is not supported by Windows OS", characterSet)); } oposLineDisplay = new OPOSLineDisplayClass(); //Open oposLineDisplay.Open(DeviceName); Peripherals.CheckResultCode(this, oposLineDisplay.ResultCode); // Claim oposLineDisplay.ClaimDevice(Peripherals.ClaimTimeOut); Peripherals.CheckResultCode(this, oposLineDisplay.ResultCode); // Enable/Configure oposLineDisplay.DeviceEnabled = true; // If character set is not supported by device, then disable and error out. if (!oposLineDisplay.CharacterSetList.Split(CharacterSetListSeparator).Any(p => p.Equals(characterSet.ToString(), StringComparison.OrdinalIgnoreCase))) { oposLineDisplay.ReleaseDevice(); oposLineDisplay.Close(); throw new NotSupportedException(string.Format("Peripheral [LineDisplay] - Character set '{0}' is not supported by device.", characterSet)); } oposLineDisplay.CharacterSet = characterSet; IsActive = true; }
/// <summary> /// Load the device. /// </summary> /// <exception cref="IOException">Cannot load device</exception> public void Load() { if (Keylock.DeviceType != DeviceTypes.OPOS) { return; } NetTracer.Information("Peripheral [Keylock] - OPOS device loading: {0}", DeviceName ?? "<Undefined>"); oposKeylock = new OPOSKeylockClass(); //Open oposKeylock.Open(DeviceName); Peripherals.CheckResultCode(this, oposKeylock.ResultCode); //Enable oposKeylock.StatusUpdateEvent += new _IOPOSKeylockEvents_StatusUpdateEventEventHandler(posKeylock_StatusUpdateEvent); oposKeylock.DeviceEnabled = true; IsActive = true; }
/// <summary> /// Begin transaction workflow on the claimed OPOS Pinpad device. /// Pinpad device will enable pin entry and request the user to follow debit workflows. /// </summary> /// <param name="amount"></param> /// <param name="accountNumber"></param> public void BeginTransaction(decimal amount, string accountNumber) { if (IsActive) { NetTracer.Information("Peripheral [PinPad] - Begin Transcation"); // Clear any all device input that has been buffered (for data events) this.oposPinpad.ClearInput(); this.oposPinpad.Amount = amount; //CheckResultCode(); // We know verifone has problems with amount. this.oposPinpad.AccountNumber = accountNumber; this.oposPinpad.TerminalID = LSRetailPosis.Settings.ApplicationSettings.Terminal.TerminalId; if (amount < 0) { // Money is being refunded to the debit card - this is credit this.oposPinpad.TransactionType = (int)EFTTransactionType.Credit; } else { // Debit trans this.oposPinpad.TransactionType = (int)EFTTransactionType.Debit; } this.oposPinpad.Track1Data = String.Empty; this.oposPinpad.Track2Data = String.Empty; this.oposPinpad.Track3Data = String.Empty; this.oposPinpad.Track4Data = String.Empty; this.oposPinpad.DataEventEnabled = true; // NOTE FILED PS#2802: Terminal Host not same as TerminalID int th = Convert.ToInt32(this.oposPinpad.TerminalID); // Try to do BeginEFTTransaction (if busy, do retry until available or TMO). // If we are going to support retry logic, we may need to check for device // OPOS_E_BUSY with System.Threading.Thread.Sleep(2000); // Peripherals.CheckResultCode(this, oposPinpad.BeginEFTTransaction(encryptionAlgorithm, th)); Peripherals.CheckResultCode(this, oposPinpad.EnablePINEntry()); } }
/// <summary> /// End PinPad transaction. /// </summary> /// <param name="normal"></param> public void EndTransaction(bool normal) { if (IsActive) { NetTracer.Information("Peripheral [PinPad] - End Transcation"); int resultCode = 0; if (normal) { // Tell the device to end the EFT transcation (Normal) resultCode = oposPinpad.EndEFTTransaction((int)EFTTransactionCompletion.Normal); } else { // Tell the device to end the EFT transcation (Abonormal) resultCode = oposPinpad.EndEFTTransaction((int)EFTTransactionCompletion.Abnormal); } Peripherals.CheckResultCode(this, resultCode); } }