예제 #1
0
        public override void Close()
        {
            VerifyResult(_cco.Close());

            _cco.DataEvent         -= (_IOPOSPOSKeyboardEvents_DataEventEventHandler)_cco_DataEvent;
            _cco.DirectIOEvent     -= (_IOPOSPOSKeyboardEvents_DirectIOEventEventHandler)_cco_DirectIOEvent;
            _cco.ErrorEvent        -= (_IOPOSPOSKeyboardEvents_ErrorEventEventHandler)_cco_ErrorEvent;
            _cco.StatusUpdateEvent -= (_IOPOSPOSKeyboardEvents_StatusUpdateEventEventHandler)_cco_StatusUpdateEvent;
            _cco = null;
        }
예제 #2
0
        public override void Open()
        {
            if (string.IsNullOrWhiteSpace(_oposDeviceName))
            {
                try
                {
                    _oposDeviceName = GetConfigurationProperty("OposDeviceName");
                    _oposDeviceName.Trim();
                }
                catch
                {
                    _oposDeviceName = "";
                }
            }

            if (string.IsNullOrWhiteSpace(_oposDeviceName))
            {
                string strMessage = "OposDeviceName is not configured on " + DevicePath + ".";
                throw new Microsoft.PointOfService.PosControlException(strMessage, ErrorCode.NoExist);
            }

            if (_cco == null)
            {
                try
                {
                    // CCO object CreateInstance
                    _cco = new POS.Devices.OPOSPOSKeyboard();

                    // Register event handler
                    _cco.DataEvent         += new _IOPOSPOSKeyboardEvents_DataEventEventHandler(_cco_DataEvent);
                    _cco.DirectIOEvent     += new _IOPOSPOSKeyboardEvents_DirectIOEventEventHandler(_cco_DirectIOEvent);
                    _cco.ErrorEvent        += new _IOPOSPOSKeyboardEvents_ErrorEventEventHandler(_cco_ErrorEvent);
                    _cco.StatusUpdateEvent += new _IOPOSPOSKeyboardEvents_StatusUpdateEventEventHandler(_cco_StatusUpdateEvent);
                }
                catch
                {
                    string strMessage = "Can not create Common ControlObject on " + DevicePath + ".";
                    throw new Microsoft.PointOfService.PosControlException(strMessage, ErrorCode.Failure);
                }
            }

            VerifyResult(_cco.Open(_oposDeviceName));
        }
예제 #3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    // TODO: Discard the managed state (managed object).
                }

                if (_cco != null)
                {
                    _cco.DataEvent         -= (_IOPOSPOSKeyboardEvents_DataEventEventHandler)_cco_DataEvent;
                    _cco.DirectIOEvent     -= (_IOPOSPOSKeyboardEvents_DirectIOEventEventHandler)_cco_DirectIOEvent;
                    _cco.ErrorEvent        -= (_IOPOSPOSKeyboardEvents_ErrorEventEventHandler)_cco_ErrorEvent;
                    _cco.StatusUpdateEvent -= (_IOPOSPOSKeyboardEvents_StatusUpdateEventEventHandler)_cco_StatusUpdateEvent;
                    _cco = null;
                }

                _disposedValue = true;
            }
        }
예제 #4
0
 public OpenPOSPOSKeyboard()
 {
     _cco              = null;
     _oposDeviceName   = "";
     _binaryConversion = 0;
 }