public void coinSelectorThreadFunction() { coinSelector = new CoinSelector(); coinSelectorError = coinSelector.SearchDevices(); if (coinSelectorError == CoinSelectorError.OK) { coinSelectorError = coinSelector.ConnectDevice(); } double[] coinValues = new double[3]; coinValues[0] = CoinValues.TRY025; coinValues[1] = CoinValues.TRY050; coinValues[2] = CoinValues.TRY100; if (coinSelectorError == CoinSelectorError.OK) { coinSelectorError = coinSelector.SetEnabledCoins(coinValues); if (coinSelectorError == CoinSelectorError.OK) { pictureBox7.Invoke((MethodInvoker) delegate { pictureBox7.Visible = false; }); } else { LogManager.Log(new LogData(string.Format("Geçerli para birimleri kaydedilemedi."), LogType.Error)); } } else { LogManager.Log(new LogData(string.Format("Para tanıma cihazı bulunamadı."), LogType.Error)); } coinSelectorThread.Abort(); }
public CoinSelectorError ConnectDevice() { CoinSelectorError error = CoinSelectorError.OK; if (this._deviceCount == 0) { error = CoinSelectorError.NoDeviceFound; } else { if (this._currentDevice.OpenComm() != whCcTalkErrors.Ok) { error = CoinSelectorError.ConnectionFailed; } else { if (this._currentDevice.GetCoinStates(ref _selCoinStates) != whCcTalkErrors.Ok) { error = CoinSelectorError.GettinCoins; } if (this._currentDevice.GetCoinValues(ref _coinValues) != whCcTalkErrors.Ok) { error = CoinSelectorError.GettinCoins; } } } if (error == CoinSelectorError.OK) { Connected = true; } this.LastError = error; return(error); }
public CoinSelectorError SearchDevices() { CoinSelectorError error = CoinSelectorError.OK; this._deviceOps.SearchDevices(new byte[] { 1, 2, 3, 4, 5, 6 }); if (_deviceCount == 0) { error = CoinSelectorError.NoDeviceFound; } else { this._currentDevice = new whSelectorComm(); this._currentDevice.Port = this._deviceOps.CcTalkDevices[0].Port; this._currentDevice.Address = this._deviceOps.CcTalkDevices[0].Address; this._currentDevice.ChecksumType = this._deviceOps.CcTalkDevices[0].ChecksumType; this._currentDevice.EncryptionMode = this._deviceOps.CcTalkDevices[0].EncryptionMode; this._currentDevice.InitPINCode(this._deviceOps.CcTalkDevices[0].GetPINCode()); } this.LastError = error; return(error); }
public CoinSelectorError SetEnabledCoins(double[] values) { CoinSelectorError error = CoinSelectorError.OK; if (this.ConnectionStatus == false) { error = CoinSelectorError.NoConnection; } else { whSelCoinStatus[] coinStates = this._setCoinStates(values); if (this._currentDevice.SetCoinInhibit(coinStates) == whCcTalkErrors.Ok) { this._selCoinStates = coinStates; } else { error = CoinSelectorError.CoinEnableError; } } this.LastError = error; return(error); }