Exemplo n.º 1
0
 public bool Next_Find_Device()
 {
     if (eSSP != null)
     {
         eSSP.CloseComPort();
         eSSP = null;
     }
     if (_f_ports == null)
     {
         respuesta    = false;
         _f_resp_scom = "-";
         return(true);
     }
     if (_f_cnt < _f_ports.Length)
     {
         respuesta    = false;
         _f_resp_scom = "-";
         _f_com       = _f_ports[_f_cnt];
         port         = _f_com;
         _f_cnt++;
         return(Open());
     }
     respuesta    = false;
     _f_resp_scom = "-";
     return(true);
 }
Exemplo n.º 2
0
        public bool SendCommand()
        {
            // Backup data and length in case we need to retry
            byte[] backup = new byte[255];
            m_cmd.CommandData.CopyTo(backup, 0);
            byte length = m_cmd.CommandDataLength;

            // attempt to send the command
            if (m_eSSP.SSPSendCommand(m_cmd, info) == false)
            {
                m_eSSP.CloseComPort();
                Log.WriteLog("Sending command failed Port status: " + m_cmd.ResponseStatus.ToString() + " ", "CashAcceptor");
                return(false);
            }
            return(true);
        }
Exemplo n.º 3
0
        public bool SendCommand()
        {
            // Backup data and length in case we need to retry
            byte[] backup = new byte[255];
            cmd.CommandData.CopyTo(backup, 0);
            byte length = cmd.CommandDataLength;

            // attempt to send the command
            if (eSSP.SSPSendCommand(cmd, info) == false)
            {
                eSSP.CloseComPort();
                return(false);
            }

            return(true);
        }
Exemplo n.º 4
0
        // Non-Command functions

        // This is used to send a command via SSP to the validator
        public bool SendCommand(TextBox log)
        {
            // attempt to send the command
            if (m_eSSP.SSPSendCommand(m_cmd, m_info) == false)
            {
                m_eSSP.CloseComPort();
                m_Comms.UpdateLog(m_info, true);
                if (log != null)
                {
                    log.AppendText("Sending command failed\r\nPort status: " + m_cmd.ResponseStatus.ToString() + "\r\n");
                }
                return(false);
            }
            // update the log after every command
            m_Comms.UpdateLog(m_info);
            return(true);
        }
Exemplo n.º 5
0
 public static void ClosePort()
 {
     try
     {
         lock (m_Lock)
         {
             // Close the COM port and reset vars
             m_LibHandle.CloseComPort();
             m_PortName = "";
             m_PortOpen = false;
         }
     }
     catch (Exception ex)
     {
         m_LastEx = ex;
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Closes the port connection.
 /// </summary>
 public static void ClosePort()
 {
     lock (thisLock)
     {
         try
         {
             var result = libHandle.CloseComPort();
             if (!result)
             {
                 throw new LibraryException("Could not close the port");
             }
         }
         finally
         {
             portName   = null;
             isPortOpen = false;
         }
     }
 }
Exemplo n.º 7
0
        public bool SendCommand(TextBox log = null)
        {
            // Backup data and length in case we need to retry
            byte[] backup = new byte[255];
            cmd.CommandData.CopyTo(backup, 0);
            byte length = cmd.CommandDataLength;

            // attempt to send the command
            if (eSSP.SSPSendCommand(cmd, info) == false)
            {
                eSSP.CloseComPort();
                m_Comms.UpdateLog(info, true);
                if (log != null)
                {
                    log.AppendText("Sending command failed\r\nPort status: " + cmd.ResponseStatus.ToString() + "\r\n");
                }
                return(false);
            }

            // update the log after every command
            m_Comms.UpdateLog(info);
            return(true);
        }