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); }
/// <summary> /// Sends a command to the device. /// </summary> /// <param name="cmd">The command to send.</param> /// <param name="inf">When this method returns, contains the information about the command being sent.</param> /// public static bool SendCommand(ref SSP_COMMAND cmd, ref SSP_COMMAND_INFO inf, string periferico) { try { // Lock critical section to prevent multiple commands being sent simultaneously lock (thisLock) { return(libHandle.SSPSendCommand(cmd, inf)); } } catch (Exception ex) { m_LastEx = ex; return(false); } }
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); }
// 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); }
public static bool SendCommand(ref SSP_COMMAND cmd, ref SSP_COMMAND_INFO inf) { try { // Lock critical section to prevent multiple commands being sent simultaneously bool b; lock (m_Lock) { b = m_LibHandle.SSPSendCommand(cmd, inf); } Thread.Sleep(1); // Immediately yield to another process waiting to send a command return(b); } catch (Exception ex) { m_LastEx = ex; return(false); } }
public bool SendCommand(ref string log) { byte[] array = new byte[255]; cmd.CommandData.CopyTo(array, 0); byte commandDataLength = cmd.CommandDataLength; if (eSSP == null) { eSSP = new SSPComms(); Open(); } if (!eSSP.SSPSendCommand(cmd, info)) { eSSP.CloseComPort(); if (log != null) { log = log + "Sending command failed\r\nPort status: " + cmd.ResponseStatus.ToString() + "\r\n"; } return(false); } return(true); }
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); }