RFID.RFIDInterface.Source_FrequencyBand.store C# (CSharp) Method

store() public method

public store ( rfid transport, UInt32 readerHandle ) : rfid.Constants.Result
transport rfid
readerHandle System.UInt32
return rfid.Constants.Result
        public rfid.Constants.Result store(
            rfid.Linkage transport,
            UInt32                             readerHandle
        )
        {
            UInt32 config    = ( UInt32 ) state;
            UInt32 multdiv   = ( UInt32 ) ( this.divider      << 16 ) | ( UInt32 ) this.multiplier;
            UInt32 pllcc     = ( UInt32 ) ( this.guardBand    << 24 ) |
                               ( UInt32 ) ( this.maxDACBand   << 16 ) |
                               ( UInt32 ) ( this.affinityBand << 8  ) |
                               ( UInt32 ) ( this.minDACBand         ) ;

            rfid.Constants.Result result = transport.API_ConfigWriteRegister
            (
                SELECTOR_ADDRESS,
                this.band
            );

            if ( rfid.Constants.Result.OK != result )
            {
                return result;
            }

            result = transport.API_ConfigWriteRegister
            (
                CONFIG_ADDRESS,
                config
            );

            if ( rfid.Constants.Result.OK != result )
            {
                return result;
            }

            result = transport.API_ConfigReadRegister
            (
                CONFIG_ADDRESS,
                ref config
            );

            if ( rfid.Constants.Result.OK != result )
            {
                return result;
            }

            if ( BandState.ENABLED == ( BandState ) config )
            {
                result = transport.API_ConfigWriteRegister
                (
                    MULTDIV_ADDRESS,
                    multdiv
                );

                if ( rfid.Constants.Result.OK != result )
                {
                    return result;
                }

                result = transport.API_ConfigReadRegister
                (
                    MULTDIV_ADDRESS,
                    ref multdiv
                );

                if ( rfid.Constants.Result.OK != result )
                {
                    return result;
                }

                result = transport.API_ConfigWriteRegister
                (
                    PLLCC_ADDRESS,
                    pllcc
                );

                if ( rfid.Constants.Result.OK != result )
                {
                    return result;
                }

                result = transport.API_ConfigReadRegister
                (
                    PLLCC_ADDRESS,
                    ref pllcc
                );

                if ( rfid.Constants.Result.OK != result )
                {
                    return result;
                }

            }

            this.multiplier   = ( UInt16 ) ( ( multdiv >>  0 ) & 0xffff );
            this.divider      = ( UInt16 ) ( ( multdiv >> 16 ) & 0xff   );

            this.minDACBand   = ( UInt16 ) ( ( pllcc >>  0 ) & 0xff );
            this.affinityBand = ( UInt16 ) ( ( pllcc >>  8 ) & 0xff );
            this.maxDACBand   = ( UInt16 ) ( ( pllcc >> 16 ) & 0xff );
            this.guardBand    = ( UInt16 ) ( ( pllcc >> 24 ) & 0xff );

            return rfid.Constants.Result.OK;
        }