// This helper allows one port to be open at once public static bool OpenPort(ref SSP_COMMAND cmd) { try { // Lock critical section lock (m_Lock) { // If this exact port is already open, return true if (cmd.ComPort == m_PortName && m_PortOpen) { return(true); } // Open port if (m_LibHandle.OpenSSPComPort(cmd)) { // Remember details m_PortName = cmd.ComPort; m_PortOpen = true; return(true); } return(false); } } catch (Exception ex) { m_LastEx = ex; return(false); } }
bool OpenComPort() { SSP_COMMAND cmd = new SSP_COMMAND(); cmd.ComPort = Global.ComPort; cmd.BaudRate = 9600; cmd.Timeout = 500; return(sspLib.OpenSSPComPort(cmd)); }
public SSP_Validator() { eSSP = new SSPComms(); cmd = new SSP_COMMAND(); storedCmd = new SSP_COMMAND(); keys = new SSP_KEYS(); sspKey = new SSP_FULL_KEY(); info = new SSP_COMMAND_INFO(); m_UnitDataList = new List <ChannelData>(); }
/// <summary> /// Initiates the key negotiation to establish a secure channel. /// </summary> /// <param name="keys">When this method returns, contains the information about the keys.</param> /// <param name="cmd">The command to send.</param> public static void InitiateKeys(ref SSP_KEYS keys, ref SSP_COMMAND cmd) { lock (thisLock) { var result = libHandle.InitiateSSPHostKeys(keys, cmd); if (!result) { throw new LibraryException("Could not initiate keys", cmd); } } }
// constructor public CPayout() { cmd = new SSP_COMMAND(); keys = new SSP_KEYS(); sspKey = new SSP_FULL_KEY(); info = new SSP_COMMAND_INFO(); m_Comms = new CCommsWindow("SMARTPayout"); m_Comms.Text = "SMART Payout Comms"; m_NumberOfChannels = 0; m_ValueMultiplier = 1; m_UnitDataList = new List<ChannelData>(); }
// constructor public CPayout() { cmd = new SSP_COMMAND(); keys = new SSP_KEYS(); sspKey = new SSP_FULL_KEY(); info = new SSP_COMMAND_INFO(); m_Comms = new CCommsWindow("SMARTPayout"); m_Comms.Text = "SMART Payout Comms"; m_NumberOfChannels = 0; m_ValueMultiplier = 1; m_UnitDataList = new List <ChannelData>(); }
static void Main(string[] args) { SSP_COMMAND cmd = new SSP_COMMAND(3); /* IntPtr.BaudRate = 9600; * IntPtr.PortName = "COM0"; * IntPtr.Parity = Parity.None; * IntPtr.StopBits = StopBits.One; */ Console.WriteLine("open {0}", OpenSSPComPort(ref cmd)); Console.WriteLine("close {0}", CloseSSPComPort()); Console.ReadKey(); }
// constructor public CValidator() { cmd = new SSP_COMMAND(); keys = new SSP_KEYS(); sspKey = new SSP_FULL_KEY(); info = new SSP_COMMAND_INFO(); m_Comms = new CCommsWindow("Note Validator"); m_NumberOfChannels = 0; m_ValueMultiplier = 1; m_UnitType = (char)0xFF; m_CurrentPollResponse = new byte[256]; m_CurrentPollResponseLength = 0; m_UnitDataList = new List <ChannelData>(); }
public static bool InitiateKeys(ref SSP_KEYS keys, ref SSP_COMMAND cmd) { try { lock (m_Lock) { return m_LibHandle.InitiateSSPHostKeys(keys, cmd); } } catch (Exception ex) { m_LastEx = ex; return false; } }
// constructor public CValidator() { eSSP = new SSPComms(); cmd = new SSP_COMMAND(); storedCmd = new SSP_COMMAND(); keys = new SSP_KEYS(); sspKey = new SSP_FULL_KEY(); info = new SSP_COMMAND_INFO(); m_Comms = new CCommsWindow("NoteValidator"); m_NumberOfChannels = 0; m_ValueMultiplier = 1; m_UnitType = (char)0xFF; m_UnitDataList = new List<ChannelData>(); }
public static bool InitiateKeys(ref SSP_KEYS keys, ref SSP_COMMAND cmd) { try { lock (m_Lock) { return(m_LibHandle.InitiateSSPHostKeys(keys, cmd)); } } catch (Exception ex) { m_LastEx = ex; return(false); } }
// constructor public CValidator() { eSSP = new SSPComms(); cmd = new SSP_COMMAND(); storedCmd = new SSP_COMMAND(); keys = new SSP_KEYS(); sspKey = new SSP_FULL_KEY(); info = new SSP_COMMAND_INFO(); m_Comms = new CCommsWindow("NoteValidator"); m_NumberOfChannels = 0; m_ValueMultiplier = 1; m_UnitType = (char)0xFF; m_UnitDataList = new List <ChannelData>(); }
/// <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); } }
// constructor public CNV11() { cmd = new SSP_COMMAND(); keys = new SSP_KEYS(); sspKey = new SSP_FULL_KEY(); info = new SSP_COMMAND_INFO(); m_Comms = new CCommsWindow("NV11"); m_TotalNotesAccepted = 0; m_TotalNotesDispensed = 0; m_NumberOfChannels = 0; m_ValueMultiplier = 1; m_CurrentPollResponse = new byte[256]; m_CurrentPollResponseLength = 0; m_UnitDataList = new List <ChannelData>(); m_NotePositionValues = new int[30]; }
// constructor public CNV11() { eSSP = new SSPComms(); cmd = new SSP_COMMAND(); keys = new SSP_KEYS(); sspKey = new SSP_FULL_KEY(); info = new SSP_COMMAND_INFO(); m_Comms = new CCommsWindow(); m_TotalNotesAccepted = 0; m_TotalNotesDispensed = 0; m_NumberOfChannels = 0; m_ValueMultiplier = 1; m_CurrentPollResponse = new byte[256]; m_CurrentPollResponseLength = 0; m_UnitDataList = new List<ChannelData>(); m_NotePositionValues = new int[30]; }
// Constructor public CHopper() { // init SSP handles m_cmd = new SSP_COMMAND(); m_keys = new SSP_KEYS(); m_sspKey = new SSP_FULL_KEY(); m_info = new SSP_COMMAND_INFO(); m_NumberOfChannels = 0; m_ProtocolVersion = 0; m_CoinMechEnabled = true; m_Comms = new CCommsWindow("SMARTHopper"); m_Comms.Text = "SMART Hopper Comms"; m_UnitDataList = new List<ChannelData>(); if (Properties.Settings.Default.Comms) Comms.Show(); }
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); } }
/// <summary> /// Opens a new port connection. /// </summary> /// <param name="command">The command that contains the port name to open.</param> public static void OpenPort(ref SSP_COMMAND command) { lock (thisLock) { if (command.ComPort == portName && isPortOpen) { return; } if (libHandle.OpenSSPComPort(command)) { portName = command.ComPort; isPortOpen = true; } else { throw new LibraryException($"Could not open the port {command.ComPort}."); } } }
// constructor public CHopper() { // init SSP handles m_cmd = new SSP_COMMAND(); m_keys = new SSP_KEYS(); m_sspKey = new SSP_FULL_KEY(); m_info = new SSP_COMMAND_INFO(); m_NumberOfChannels = 0; m_ProtocolVersion = 0; m_CoinMechEnabled = true; m_Comms = new CCommsWindow("SMART Hopper"); m_UnitDataList = new List <ChannelData>(); m_CurrentPollResponse = new byte[255]; if (Properties.Settings.Default.Comms) { Comms.Show(); } }
// constructor public CNV10() { m_eSSP = new SSPComms(); m_cmd = new SSP_COMMAND(); keys = new SSP_KEYS(); sspKey = new SSP_FULL_KEY(); info = new SSP_COMMAND_INFO(); m_TotalNotesAccepted = 0; m_TotalNotesDispensed = 0; m_NumberOfChannels = 0; m_ValueMultiplier = 1; m_CurrentPollResponse = new byte[256]; m_CurrentPollResponseLength = 0; m_UnitDataList = new List <ChannelData>(); m_NotePositionValues = new int[30]; m_StoredCurrency = ""; m_HoldCount = 0; m_HoldNumber = 0; }
public Control_NV_SSP() { eSSP = new SSPComms(); cmd = new SSP_COMMAND(); storedCmd = new SSP_COMMAND(); keys = new SSP_KEYS(); sspKey = new SSP_FULL_KEY(); info = new SSP_COMMAND_INFO(); m_NumberOfChannels = 0; m_ValueMultiplier = 1; m_UnitType = 'ΓΏ'; m_UnitDataList = new List <ChannelData>(); reconnectionInterval = 2; reconnectionTimer = new System.Windows.Forms.Timer(); respuesta = false; port = "COM3"; Creditos = 0m; Canal = new int[MaxCanales]; eCanal = new int[MaxCanales]; for (int i = 0; i < Canal.Length; i++) { Canal[i] = 0; eCanal[i] = 0; } eCanal[0] = 1; eCanal[1] = 1; eCanal[2] = 1; eCanal[3] = 1; eCanal[4] = 1; eCanal[5] = 1; Canal[0] = 500; Canal[1] = 1000; Canal[2] = 2000; Canal[3] = 5000; Canal[4] = 10000; Canal[5] = 20000; Canal[6] = 50000; OnLine = false; }
bool OpenComPort() { SSP_COMMAND cmd = new SSP_COMMAND(); cmd.ComPort = Global.ComPort; cmd.BaudRate = 9600; cmd.Timeout = 500; return sspLib.OpenSSPComPort(cmd); }
private static extern int OpenSSPComPort(ref SSP_COMMAND cmd);
public LibraryException(string message, SSP_COMMAND command) : base(message) { Command = command; }
public LibraryException(string message, SSP_COMMAND command, SSP_COMMAND_INFO commandInfo) : base(message) { Command = command; CommandInfo = commandInfo; }
public static bool SendCommand(ref SSP_COMMAND cmd, ref SSP_COMMAND_INFO inf) { try { // Lock critical section to prevent multiple commands being sent simultaneously lock (m_Lock) { return m_LibHandle.SSPSendCommand(cmd, inf); } } catch (Exception ex) { m_LastEx = ex; return false; } }
// This helper allows one port to be open at once public static bool OpenPort(ref SSP_COMMAND cmd) { try { // Lock critical section lock (m_Lock) { // If this exact port is already open, return true if (cmd.ComPort == m_PortName && m_PortOpen) return true; // Open port if (m_LibHandle.OpenSSPComPort(cmd)) { // Remember details m_PortName = cmd.ComPort; m_PortOpen = true; return true; } return false; } } catch (Exception ex) { m_LastEx = ex; return false; } }