/// <summary>
        /// The device needs to pair with the POS to confirm proper security and configuration.
        /// If a previously established authToken was sent to the device, this step will be skipped.
        /// (Until the token expires and a new pairing exchange occurrs.)
        /// Not all connection types require paring. For example, a USB direct connection does not send pairing messages.
        /// </summary>
        void OnPairingCode(string code)
        {
            PairingCode?.Invoke(code);

            // Some fallback code if PairingCode event isn't being handled - not necessary but makes the sample more robust
            if (PairingCode == null)
            {
                System.Windows.Forms.MessageBox.Show($"Enter this pairing code on the Clover Device to confirm the computer and device have identified each other correctly.\n\n\t Pairing Code:  {code}", "Clover Device Network Pairing", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            }
        }
 private PairingCodeSet(string pinCode, string colorCode)
 {
     PinCode = new PairingCode(PairingCodeType.PIN_CODE, pinCode);
     ColorCode = new PairingCode(PairingCodeType.COLOR_CODE, colorCode);
 }
 protected override void ParseMessage(byte[] messageBody)
 {
     this._pairingCode = ParsePairingCode(messageBody);
 }
        public ClientTagVisualization GetMatchForPinCode(PairingCode pairingCode)
        {
            if (pairingCode.Type == PairingCodeType.COLOR_CODE)
                throw new NotSupportedException("Color code pairing not supported yet");

            ClientTagVisualization result = null; // Assume pairing code does not match a visualization
            lock (_pairingCodeToVisualisationDictionaryLock)
            {
                if (_pairingCodeToVisualisationLookUp.ContainsKey(pairingCode.Type))
                {
                    // Get the dictionary containing the pairing codes of the given type which are currently registered in use
                    IDictionary<string, ClientTagVisualization> codesOfTypeInUse = _pairingCodeToVisualisationLookUp[pairingCode.Type];
                    if (codesOfTypeInUse.ContainsKey(pairingCode.Code))
                    {
                        result = codesOfTypeInUse[pairingCode.Code];
                    }
                }
            }
            return result;
        }