コード例 #1
0
        public override DeviceStatus Open()
        {
            if (Status == DeviceStatus.Opened)
            {
                return(Status);
            }

            if (!UseYN)
            {
                throw new Exception("고객표시기 사용 안함.");
            }

            Status = DeviceStatus.Closed;
            try
            {
                TraceHelper.Instance.TraceWrite("Open()", "LineDisplay: {0}", Config.LogicalName);
                var rc = m_device.Open(Config.LogicalName);
                if (rc == (int)OPOS_Constants.OPOS_SUCCESS)
                {
                    rc = m_device.ClaimDevice(5000);
                    if (rc == (int)OPOS_Constants.OPOS_SUCCESS)
                    {
                        Status = DeviceStatus.Opened;
                    }
                    else
                    {
                        Status = DeviceStatus.InitError;
                    }
                }
                else
                {
                    Status = DeviceStatus.OpenError;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("고객표시기 오픈 오류.", ex);
            }

            base.Open();
            return(Status);
        }
コード例 #2
0
            /// <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);
                });
            }
コード例 #3
0
        private void btnLineDisplay_Click(object sender, EventArgs e)
        {
            OPOSLineDisplay ld  = new OPOSLineDisplay();
            int             nRC = ld.Open("DefaultPOSLineDisplay");

            if (nRC == (int)OPOS_Constants.OPOS_SUCCESS)
            {
                nRC = ld.ClaimDevice(5000);
                if (nRC == (int)OPOS_Constants.OPOS_SUCCESS)
                {
                    ld.DeviceEnabled = true;

                    ld.DisplayTextAt(0, 0, "WELCOME To W-MALL",
                                     (int)POS.Devices.OPOSLineDisplayConstants.DISP_DT_NORMAL);

                    ld.DisplayTextAt(1, 0, "TOTAL" + "30,000".PadLeft(26 - "TOTAL".Length - 6, ' '),
                                     (int)POS.Devices.OPOSLineDisplayConstants.DISP_DT_NORMAL);

                    ld.DeviceEnabled = false;
                    ld.ReleaseDevice();
                    ld.Close();
                }
            }
        }