/// <summary>
        /// Reset the RFID Radio Module to restore the default configuration.
        /// </summary>
        /// <remarks>
        /// Rfiddler may not restore all configuration changes, therefore it's best to reset the device to the default state.
        /// </remarks>
        private void MacReset()
        {
            RadioEnumeration radios = RetrieveAttachedRadiosList();

            int radioHandle = RadioOpen(radios);

            Result result = link.MacReset(radioHandle, MacResetType.SOFT);

            logger.Information("link.MacReset => {Result}", result);
        }
        private int RadioOpen(RadioEnumeration radios)
        {
            var radioHandle = 0;

            Result result = link.RadioOpen(radios.radioInfo[0].cookie, ref radioHandle, MacMode.DEFAULT);

            logger.Information("link.RadioOpen => {Result}", result);
            logger.Information("Cookie: {Cookie}, radio handle: {Handle}", radios.radioInfo[0].cookie, radioHandle);

            return(radioHandle);
        }
        private RadioEnumeration RetrieveAttachedRadiosList()
        {
            RadioEnumeration radios = new RadioEnumeration();

            Result result = link.RetrieveAttachedRadiosList(radios, 0);

            logger.Information("link.RetrieveAttachedRadiosList => {Result}", result);
            logger.Information("RadioEnum.length: {Length}, RadioEnum.totalLength: {TotalLength}, RadioEnum.countRadios: {CountRadios}", radios.length, radios.totalLength, radios.countRadios);

            for (int index = 0; index < radios.radioInfo.Length; ++index)
            {
                var version  = radios.radioInfo[index].driverVersion;
                var uniqueId = radios.radioInfo[index].uniqueId;

                logger.Information("\tRadio " + index + " RadioEnum.radioInfo.length : " + radios.radioInfo[index].length);
                logger.Information("\tRadio " + index + " RadioEnum.radioInfo.driverVersion : {@Version}", new { version.major, version.minor, version.maintenance, version.release });
                logger.Information("\tRadio " + index + " RadioEnum.radioInfo.cookie   : " + radios.radioInfo[index].cookie);
                logger.Information("\tRadio " + index + " RadioEnum.radioInfo.idLength : " + radios.radioInfo[index].idLength);
                logger.Information("\tRadio " + index + " RadioEnum.radioInfo.uniqueId : {UniqueId}", Encoding.ASCII.GetString(uniqueId, 0, uniqueId.Length));
            }

            return(radios);
        }
        public void Start()
        {
            Startup(LibraryMode.DEFAULT);

            RadioEnumeration radios = RetrieveAttachedRadiosList();

            int radioHandle = RadioOpen(radios);

            RadioClose(radioHandle);

            radioHandle = RadioOpen(radios);

            RadioGetOperationMode(radioHandle);

            GetMacVersion(radioHandle);

            MacGetBootLoaderVersion(radioHandle);

            RadioSetOperationMode(radioHandle, RadioOperationMode.NONCONTINUOUS);

            RadioGetOperationMode(radioHandle);

            RadioGetPowerState(radioHandle);

            RadioSetPowerState(radioHandle, RadioPowerState.FULL);

            RadioGetPowerState(radioHandle);

            RadioSetPowerState(radioHandle, RadioPowerState.STANDBY);

            RadioGetPowerState(radioHandle);

            EnumerateLinkProfiles(radioHandle);

            GetAntennaPortStatus(radioHandle);

            SetAntennaPortStatus(radioHandle, AntennaPortState.DISABLED);

            GetAntennaPortStatus(radioHandle);

            SetAntennaPortStatus(radioHandle, AntennaPortState.ENABLED);

            GetAntennaPortStatus(radioHandle);

            AntennaPortGetConfiguration(radioHandle);

            AntennaPortSetConfiguration(radioHandle, (uint)options.DwellTime, (uint)options.PowerLevel);

            var selectCriteria = Set18K6CSelectCriteria(radioHandle);

            Get18K6CSelectCriteria(radioHandle, selectCriteria);

            Set18K6CQueryTagGroup(radioHandle);

            ConfigureImpinjExtensions(radioHandle);

            Set18K6CPostMatchCriteria(radioHandle);

            Set18K6CSingulationAlgorithmParameters(radioHandle);

            //result = link.RadioSetResponseDataMode( radioHandle, ResponseType.DATA, ResponseMode.EXTENDED );
            //logger.Information( "link.RadioSetResponseDataMode => " + result );

            Tag18K6CInventory(radioHandle);

            Tag18K6CRead(radioHandle);

            Tag18K6CQT(radioHandle);

            Tag18K6CBlockErase(radioHandle);

            Tag18K6CKill(radioHandle);

            Tag18K6CLock(radioHandle);

            RadioTurnCarrierWaveOnRandom(radioHandle);

            RegisterAccess(radioHandle);

            RadioClose(radioHandle);

            MacReset();
        }