public static CloverDeviceConfiguration GetNetworkConfiguration() { PairingDeviceConfiguration.OnPairingCodeHandler pairingCodeHandler = new PairingDeviceConfiguration.OnPairingCodeHandler(OnPairingCode); PairingDeviceConfiguration.OnPairingSuccessHandler pairingsuccessHandler = new PairingDeviceConfiguration.OnPairingSuccessHandler(OnPairingSuccess); // ws vs wss must match Network Pay Display setting. wss requires Clover root CA var endpoint = "ws://192.168.0.6:12345/remote_pay"; // Network Pay Display must be installed and configured to allow // insecure connections for the above configuration // Create a WebSocketDeviceConfiguration with appropriate // remoteApplicationID (see above), POS name and POS serial number var websocketConfiguration = new WebSocketCloverDeviceConfiguration(endpoint, //endpoint "com.cloverconnector.windows.simple.sample:1.3.1", //remoteApplicationID false, //enableLogging 1, //pingSleepSeconds "Aisle 2", //posName "ABC123", //serialNumber null, //pairingAuthToken OnPairingCode, //pairingCodeHandler OnPairingSuccess, //pairingSuccessHandler OnPairingState); //pairingStateHandler return(websocketConfiguration); }
public StartupForm(Form tocover, PairingDeviceConfiguration.OnPairingCodeHandler pairingHandler, PairingDeviceConfiguration.OnPairingSuccessHandler successHandler) : base(tocover) { this.pairingCodeHandler = pairingHandler; this.pairingSuccessHandler = successHandler; WebSocketConfig.OnPairingCode = pairingHandler; WebSocketConfig.OnPairingSuccess = successHandler; Properties.Settings.Default.Reload(); WebSocketConfig.endpoint = Properties.Settings.Default.lastWSEndpoint; if (WebSocketConfig.endpoint == null || "".Equals(WebSocketConfig.endpoint)) { WebSocketConfig.endpoint = "wss://192.168.1.15:12345/remote_pay"; // just a default... } WebSocketConfig.pairingAuthToken = Properties.Settings.Default.pairingAuthToken; InitializeComponent(); }
/// <summary> /// Create a WebSockect configured connection CloverConnector to a Clover Device running Secure Network Pay Display (SNPD) /// Convenience wrapper around creating a WebSocketCloverDeviceConfiguration object and calling CloverConnectorFactory.createICloverConnector /// </summary> /// <param name="endpoint">Clover Device Secure Network Pay Display (SNPD) network address, usually similar to "https://192.168.0.1:1234/remote_pay"</param> /// <param name="remoteApplicationId">Application ID for server reporting</param> /// <param name="posName">Point of Sale name for server reporting</param> /// <param name="serialNumber">Station ID / serial number for server reporting</param> /// <param name="pairingAuthToken">Previous paired auth token to allow quick reconnection without initiating antoerh pairing. Blank value, invalid or expired token will initiate a new pairing</param> /// <param name="pairingCodeHandler">Delegate method called with temporary pairing code to enter on device, like `6341` - display to user to enter on Clover Device to complete pairing</param> /// <param name="pairingSuccessHandler">Delegate method called with reconnection auth token when pairing has succeeded</param> /// <param name="pairingStateHandler">Delegate method called during pairing flow transitions</param> /// <param name="enableLogging">Turn logging on or off</param> /// <returns></returns> public static ICloverConnector CreateWebSocketConnector(string endpoint, string remoteApplicationId, string posName, string serialNumber, string pairingAuthToken, PairingDeviceConfiguration.OnPairingCodeHandler pairingCodeHandler, PairingDeviceConfiguration.OnPairingSuccessHandler pairingSuccessHandler, PairingDeviceConfiguration.OnPairingStateHandler pairingStateHandler, bool enableLogging = false) { WebSocketCloverDeviceConfiguration config = new WebSocketCloverDeviceConfiguration(endpoint, remoteApplicationId, enableLogging, 1, posName, serialNumber, pairingAuthToken, pairingCodeHandler, pairingSuccessHandler, pairingStateHandler); return(createICloverConnector(config)); }