コード例 #1
0
        /// <summary>
        ///  Opens connection and request main data from device (e.g. Serial number)
        ///  If there is some data in event buffer - events will be raised
        /// </summary>
        public void Init(bool ignoreLastEvents = true)
        {
            _rawDev.Connection.Open();

            DeviceCategory = _rawDev.CmdRequestEquipmentCategory();
            if (DeviceCategory != CctalkDeviceTypes.CoinAcceptor)
            {
                throw new InvalidOperationException("Connected device is not a coin acceptor. " + DeviceCategory);
            }

            //_rawDev.CmdReset();
            _rawDev.CmdSetMasterInhibitStatus(IsInhibiting);

            //throw new InvalidOperationException("Msg: " + _rawDev.CmdGetMasterInhibitStatus().ToString()); - vraca false znaci da neInhibira.

            SerialNumber = _rawDev.CmdGetSerial();
            PollInterval = _rawDev.CmdRequestPollingPriority();
            Manufacturer = _rawDev.CmdRequestManufacturerId();
            ProductCode  = _rawDev.CmdRequestProductCode();

            var evBuf = _rawDev.CmdReadEventBuffer();

            if (!ignoreLastEvents)
            {
                RaiseLastEvents(evBuf);
            }
            _lastEvent = evBuf.Counter;

            IsInitialized = true;
        }
コード例 #2
0
ファイル: CoinAcceptor.cs プロジェクト: ysjr-2002/moneymore
        /// <summary>
        ///  Opens connection and request main data from device (e.g. Serial number)
        ///  If there is some data in event buffer - events will be raised
        /// </summary>
        public void Init(Boolean ignoreLastEvents = true)
        {
            _rawDev.Connection.Open();

            DeviceCategory = _rawDev.CmdRequestEquipmentCategory();
            if (DeviceCategory != CctalkDeviceTypes.CoinAcceptor)
            {
                throw new InvalidOperationException("Connected device is not a coin acceptor. " + DeviceCategory);
            }

            //_rawDev.CmdReset();
            _rawDev.CmdSetMasterInhibitStatus(IsInhibiting);
            _rawDev.CmdModifyInhibitStatus(Enumerable.Repeat(true, 16).ToArray());

            SerialNumber = _rawDev.CmdGetSerial();
            PollInterval = _rawDev.CmdRequestPollingPriority();
            Manufacturer = _rawDev.CmdRequestManufacturerId();
            ProductCode  = _rawDev.CmdRequestProductCode();

            var evBuf = _rawDev.CmdReadEventBuffer();

            if (!ignoreLastEvents)
            {
                RaiseLastEvents(evBuf);
            }
            _lastEvent    = evBuf.Counter;
            IsInitialized = true;
        }