Exemple #1
0
        // This function uses the FLOAT AMOUNT command to set the float amount. The validator will empty
        // notes into the cashbox leaving the requested floating amount in the payout. The minimum payout
        // is also setup so the validator will leave itself the ability to payout the minimum value requested.
        public void SetFloat(int minPayout, int floatAmount, char[] currency, TextBox log = null)
        {
            cmd.CommandData[0] = CCommands.SSP_CMD_FLOAT_AMOUNT;
            byte[] b = CHelpers.ConvertIntToBytes(minPayout);
            cmd.CommandData[1] = b[0];
            cmd.CommandData[2] = b[1];
            cmd.CommandData[3] = b[2];
            cmd.CommandData[4] = b[3];
            b = CHelpers.ConvertIntToBytes(floatAmount);
            cmd.CommandData[5] = b[0];
            cmd.CommandData[6] = b[1];
            cmd.CommandData[7] = b[2];
            cmd.CommandData[8] = b[3];

            // Add currency
            cmd.CommandData[9]  = (byte)currency[0];
            cmd.CommandData[10] = (byte)currency[1];
            cmd.CommandData[11] = (byte)currency[2];

            cmd.CommandData[12] = 0x58; // real float (could use 0x19 for test)

            cmd.CommandDataLength = 13;

            if (!SendCommand(log))
            {
                return;
            }
            if (CheckGenericResponses(log))
            {
                if (log != null)
                {
                    log.AppendText("Floated amount successfully\r\n");
                }
            }
        }
Exemple #2
0
        // This function uses the GET ROUTING command to see if a specified note is recycling. The
        // caller passes a bool across which is set by the function.
        public void IsNoteRecycling(int noteValue, char[] currency, ref bool response, TextBox log = null)
        {
            // Determine if the note is currently being recycled
            cmd.CommandData[0] = CCommands.SSP_CMD_GET_ROUTING;
            byte[] b = CHelpers.ConvertIntToBytes(noteValue);
            cmd.CommandData[1] = b[0];
            cmd.CommandData[2] = b[1];
            cmd.CommandData[3] = b[2];
            cmd.CommandData[4] = b[3];

            // Add currency
            cmd.CommandData[5]    = (byte)currency[0];
            cmd.CommandData[6]    = (byte)currency[1];
            cmd.CommandData[7]    = (byte)currency[2];
            cmd.CommandDataLength = 8;

            if (!SendCommand(log))
            {
                return;
            }
            if (CheckGenericResponses(log) && log != null)
            {
                // True if it is currently being recycled
                if (cmd.ResponseData[1] == 0x00)
                {
                    response = true;
                }
                // False if not
                else if (cmd.ResponseData[1] == 0x01)
                {
                    response = false;
                }
            }
        }
Exemple #3
0
        // This function calls the PAYOUT AMOUNT command to payout a specified value. This can be sent
        // with the option byte 0x19 to test whether the payout is possible or 0x58 to actually do the payout.
        public void PayoutAmount(int amount, char[] currency, TextBox log = null)
        {
            cmd.CommandData[0] = CCommands.SSP_CMD_PAYOUT_AMOUNT;
            byte[] b = CHelpers.ConvertIntToBytes(amount);
            cmd.CommandData[1] = b[0];
            cmd.CommandData[2] = b[1];
            cmd.CommandData[3] = b[2];
            cmd.CommandData[4] = b[3];

            cmd.CommandData[5] = (byte)currency[0];
            cmd.CommandData[6] = (byte)currency[1];
            cmd.CommandData[7] = (byte)currency[2];

            cmd.CommandData[8] = 0x58; // real payout

            cmd.CommandDataLength = 9;
            if (!SendCommand(log))
            {
                return;
            }

            if (CheckGenericResponses(log))
            {
                if (log != null)
                {
                    log.AppendText("Paying out " + CHelpers.FormatToCurrency(amount) + " " +
                                   new string(currency) + "\r\n");
                }
            }
        }
Exemple #4
0
        // This function uses the command GET NOTE AMOUNT to find out the number of
        // a specified type of note stored in the payout. Returns the number of notes stored
        // of that denomination.
        public int CheckNoteLevel(int note, char[] currency, TextBox log = null)
        {
            cmd.CommandData[0] = CCommands.SSP_CMD_GET_NOTE_AMOUNT;
            byte[] b = CHelpers.ConvertIntToBytes(note);
            cmd.CommandData[1] = b[0];
            cmd.CommandData[2] = b[1];
            cmd.CommandData[3] = b[2];
            cmd.CommandData[4] = b[3];

            cmd.CommandData[5]    = (byte)currency[0];
            cmd.CommandData[6]    = (byte)currency[1];
            cmd.CommandData[7]    = (byte)currency[2];
            cmd.CommandDataLength = 8;

            if (!SendCommand(log))
            {
                return(0);
            }
            if (CheckGenericResponses(log))
            {
                int i = (int)cmd.ResponseData[1];
                return(i);
            }
            return(0);
        }
Exemple #5
0
        // This function uses the GET ROUTING command to determine whether a particular note
        // is recycling.
        void IsNoteRecycling(int note, char[] currency, ref bool b, TextBox log = null)
        {
            cmd.CommandData[0] = CCommands.SSP_CMD_GET_ROUTING;
            byte[] byteArr = CHelpers.ConvertIntToBytes(note);
            cmd.CommandData[1]    = byteArr[0];
            cmd.CommandData[2]    = byteArr[1];
            cmd.CommandData[3]    = byteArr[2];
            cmd.CommandData[4]    = byteArr[3];
            cmd.CommandData[5]    = (byte)currency[0];
            cmd.CommandData[6]    = (byte)currency[1];
            cmd.CommandData[7]    = (byte)currency[2];
            cmd.CommandDataLength = 8;

            if (!SendCommand(log))
            {
                return;
            }
            if (CheckGenericResponses(log))
            {
                if (cmd.ResponseData[1] == 0x00)
                {
                    b = true;
                }
                else
                {
                    b = false;
                }
            }
        }
        private void PayoutBtn_Click(object sender, EventArgs e)
        {
            bool payoutRequired = false;

            byte[] data           = new byte[9 * Payout.NumberOfChannels]; // create to size of maximum possible
            byte   length         = 0;
            int    dataIndex      = 0;
            byte   denomsToPayout = 0;

            // For each denomination
            for (int i = 0; i < Payout.NumberOfChannels; i++)
            {
                try
                {
                    // Check if there is input in the box
                    if (AmountToPayout[i].Text != "" && AmountToPayout[i].Text != "0")
                    {
                        // If textbox isn't blank then this denom is being paid out
                        denomsToPayout++;
                        length        += 9;    // 9 bytes per denom to payout (2 amount, 4 value, 3 currency)
                        payoutRequired = true; // need to do a payout as there is now > 0 denoms

                        // Number of this denomination to payout
                        UInt16 numToPayout = UInt16.Parse(AmountToPayout[i].Text);
                        byte[] b           = CHelpers.ConvertIntToBytes(numToPayout);
                        data[dataIndex++] = b[0];
                        data[dataIndex++] = b[1];

                        // Value of this denomination
                        ChannelData d = Payout.UnitDataList[i];
                        b = CHelpers.ConvertIntToBytes(d.Value);
                        data[dataIndex++] = b[0];
                        data[dataIndex++] = b[1];
                        data[dataIndex++] = b[2];
                        data[dataIndex++] = b[3];

                        // Currency of this denomination
                        data[dataIndex++] = (Byte)d.Currency[0];
                        data[dataIndex++] = (Byte)d.Currency[1];
                        data[dataIndex++] = (Byte)d.Currency[2];
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    payoutRequired = false; // don't payout on exception
                }
            }

            if (payoutRequired)
            {
                // Send payout command and shut this form
                Payout.PayoutByDenomination(denomsToPayout, data, length, Output);
                base.Dispose();
            }
        }