public static void ReadProtectionMemory2WbpExample(string readerName)
        {
            try
            {
                var twoWireBusProtocol           = new Readers.AViatoR.Components.Synchronus2WBP();
                ISmartCardReader smartCardReader = Connect(readerName);

                if (!smartCardReader.IsConnected)
                {
                    return;
                }

                byte notUsed = 0x00;

                string command  = twoWireBusProtocol.GetApdu(Synchronus2WBP.ControlByte.ReadProtectionMemory, notUsed, notUsed);
                string response = smartCardReader.Transmit(command);
                if (response.StartsWith("9D04") && response.EndsWith("9000"))
                {
                    string data = response.Substring(4, 8);
                    PrintData("Read Protection Memory", command, response, $"Value 0x{data}");
                }
                else
                {
                    PrintData("Read Protection Memory", command, response, "Error Response");
                }
                smartCardReader.Disconnect(CardDisposition.Unpower);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        public static void UpdateMainMemory2WbpExample(string readerName)
        {
            try
            {
                var twoWireBusProtocol           = new Readers.AViatoR.Components.Synchronus2WBP();
                ISmartCardReader smartCardReader = Connect(readerName);

                if (!smartCardReader.IsConnected)
                {
                    return;
                }
                // Following code is commented to prevent usage of incorrect Pin code, which can lead to blocking the synchronus card if done three times in row
                // Verification with correct pin code is necessary to write any data into card memory
                // Be advice not to use VerifyUser2Wbp command if correct pin code is not known

                /*
                 * string pin = "FFFFFF";
                 *
                 * byte firstPinByte = byte.Parse(pin.Substring(0, 2), NumberStyles.HexNumber);
                 * byte secondPinByte = byte.Parse(pin.Substring(2, 2), NumberStyles.HexNumber);
                 * byte thirdPinByte = byte.Parse(pin.Substring(4, 2), NumberStyles.HexNumber);
                 *
                 * VerifyUser2Wbp(reader, firstPinByte, secondPinByte, thirdPinByte);
                 * //*/

                byte address = 0x20;
                byte data    = 0x01;

                string command  = twoWireBusProtocol.GetApdu(Synchronus2WBP.ControlByte.UpdateMainMemory, address, data);
                string response = smartCardReader.Transmit(command);
                PrintData($"Write Main Memory, address: 0x{address:X2}, data: 0x{data:X2}", command, response, response.Equals("9D009000") ? "Success" : "Error Response");

                address  = 0x20;
                data     = 0xF0;
                command  = twoWireBusProtocol.GetApdu(Synchronus2WBP.ControlByte.UpdateMainMemory, address, data);
                response = smartCardReader.Transmit(command);
                PrintData($"Write Main Memory, address: 0x{address:X2}, data: 0x{data:X2}", command, response, response.Equals("9D009000") ? "Success" : "Error Response");

                smartCardReader.Disconnect(CardDisposition.Unpower);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        private static void VerifyUser2Wbp(ISmartCardReader smartCardReader, byte firstPinByte, byte secondPinByte, byte thirdPinByte)
        {
            var twoWireBusProtocol = new Readers.AViatoR.Components.Synchronus2WBP();

            byte notUsed = 0x00;
            byte newErrorCounter;

            Console.WriteLine("User Verification");

            // Read Error Counter
            string command             = twoWireBusProtocol.GetApdu(Synchronus2WBP.ControlByte.ReadSecurityMemory, notUsed, notUsed);
            string response            = smartCardReader.Transmit(command);
            string currentErrorCounter = response.Substring(4, 2);

            PrintData("Read Error Counter", command, response, $"0x{currentErrorCounter}");

            // decrement counter
            switch (currentErrorCounter)
            {
            case "07":
                newErrorCounter = 0x06;
                break;

            case "06":
                newErrorCounter = 0x04;
                break;

            case "04":
                newErrorCounter = 0x00;
                break;

            default:
                Console.WriteLine("Returned error counter is not correct or card is blocked");
                return;
            }
            command  = twoWireBusProtocol.GetApdu(Synchronus2WBP.ControlByte.UpdateSecurityMemory, 0x00, newErrorCounter);
            response = smartCardReader.Transmit(command);
            PrintData("Write new Error Counter", command, response, $"0x{newErrorCounter:X2}");

            // Compare verification data - first part
            command  = twoWireBusProtocol.GetApdu(Synchronus2WBP.ControlByte.CompareVerificationData, 0x01, firstPinByte);
            response = smartCardReader.Transmit(command);
            PrintData("Compare verification data - first part", command, response, $"{firstPinByte:X2}");

            // Compare verification data - second part
            command  = twoWireBusProtocol.GetApdu(Synchronus2WBP.ControlByte.CompareVerificationData, 0x02, secondPinByte);
            response = smartCardReader.Transmit(command);
            PrintData("Compare verification data - second part", command, response, $"{secondPinByte:X2}");

            // Compare verification data - third part
            command  = twoWireBusProtocol.GetApdu(Synchronus2WBP.ControlByte.CompareVerificationData, 0x03, thirdPinByte);
            response = smartCardReader.Transmit(command);
            PrintData("Compare verification data - third part", command, response, $"{thirdPinByte:X2}");

            // Reset Error Counter
            command  = twoWireBusProtocol.GetApdu(Synchronus2WBP.ControlByte.UpdateSecurityMemory, 0x00, 0xFF);
            response = smartCardReader.Transmit(command);
            PrintData("Reset Error Counter", command, response, "");
        }
        public static void ReadMainMemory2WbpExample(string readerName)
        {
            try
            {
                var twoWireBusProtocol           = new Readers.AViatoR.Components.Synchronus2WBP();
                ISmartCardReader smartCardReader = Connect(readerName);

                if (!smartCardReader.IsConnected)
                {
                    return;
                }

                // address of first byte to be read
                byte   address    = 0x20;
                byte   notUsed    = 0x00;
                string cardMemory = string.Empty;
                for (int i = 32; i < 256; i++)
                {
                    string command  = twoWireBusProtocol.GetApdu(Synchronus2WBP.ControlByte.ReadMainMemory, address, notUsed);
                    string response = smartCardReader.Transmit(command);
                    if (response.StartsWith("9D01") && response.EndsWith("9000"))
                    {
                        string data = response.Substring(4, 2);
                        PrintData($"Read Main Memory, Address 0x{address:X2}", command, response, $"Value 0x{data}");
                        cardMemory += data;
                    }
                    else
                    {
                        PrintData($"Read Main Memory, Address 0x{address:X2}", command, response, "Error Response");
                    }
                    address++;
                }
                Console.WriteLine($"\nMain Memory starting from address 0x20 to address 0xFF:\n{cardMemory}\n");

                smartCardReader.Disconnect(CardDisposition.Unpower);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }