Exemplo n.º 1
0
        public LakeChabotReader BindReader( rfidReaderID Reader )
        {
            if ( IsDisposed )
            {
                throw new ObjectDisposedException( "LakeChabotReader" );
            }

            if ( rfid.Constants.Result.OK != LakeChabotReader.LIBRARY_Result )
            {
                throw new rfidException( rfidErrorCode.LibraryFailedToInitialize );
            }

            if ( Mode == rfidReader.OperationMode.Static )
            {
                throw new rfidException( rfidErrorCode.CannotBindToStaticReader );
            }

            if ( Mode == rfidReader.OperationMode.BoundToReader )
            {
                throw new rfidException( rfidErrorCode.AlreadyBoundToAReader );
            }

            if ( Reader == null )
            {
                throw new ArgumentNullException( "Reader" );
            }

            //clark 2011.3.23 既留旅
            //if ( Reader.Handle == 0 )
            //{
            //    throw new rfidException( rfidErrorCode.InvalidRfidReaderID );
            //}

            _theReaderID = Reader;

            if ( Result.OK != this.initAntennaList( ) )
            {
                Console.WriteLine( "Error initializing antenna information from radio" );
            }

            CreateDataSet( );

            FunctionController.Name = Reader.Name;

            Mode = rfidReader.OperationMode.BoundToReader;

            _sessionTagList = new rfidTagList( );
            _requestTagList = new rfidTagList( );
            _periodTagList = new rfidTagList( );
            _commandTagList = new rfidTagList( );
            _antennaCycleTagList = new rfidTagList( );
            _antennaTagList = new rfidTagList( );
            _inventoryCycleTagList = new rfidTagList( );
            _inventoryRoundTagList = new rfidTagList( );

            DateTime temp = DateTime.UtcNow;
            _sessionStartMS = HighResolutionTimer.Milliseconds;
            _sessionStart = new DateTime( temp.Year, temp.Month,  temp.Day,
                                          temp.Hour, temp.Minute, temp.Second,
                                          Math.Min( 999, ( int ) ElapsedMilliseconds ),
                                          DateTimeKind.Utc );
            return this;
        }
Exemplo n.º 2
0
        // TODO : Move to locator & communicator class
        // TODO : Modify to active query for radios each call

        private static List<rfidReaderID> EnumerateReaders( rfidReaderID whereToLook )
        {
            if ( rfid.Constants.Result.OK != LakeChabotReader.LIBRARY_Result )
            {
                throw new rfidException( rfidErrorCode.LibraryFailedToInitialize );
            }

            //if ( Mode == rfidReader.OperationMode.Static )
            //{
            //    throw new rfidException( rfidErrorCode.CannotBindToStaticReader );
            //}

            if ( whereToLook == null )
            {
                throw new ArgumentNullException( "whereToLook" );
            }

            if ( whereToLook.LocationType != rfidReaderID.LocationTypeID.LocalDevice )
            {
                throw new rfidException( rfidErrorCode.LocationTypeNotSupported, String.Format( "reader does not support {0} location type", Enum.GetName( typeof( rfidReaderID.LocationTypeID ), whereToLook.LocationType ) ) );
            }

            List<rfidReaderID> readers = new List<rfidReaderID>( );

            foreach ( KeyValuePair<UInt32, rfid.Structures.RadioInformation> pair in LakeChabotReader.LOCATED_READERS )
            {
                readers.Add
                (
                    new rfidReaderID
                        (
                            rfidReaderID.ReaderType.MTI,
                            0,  // bad handle ~ unknown handle
                            System.Text.Encoding.ASCII.GetString( pair.Value.uniqueId, 0, pair.Value.uniqueId.Length ),
                            "RFID reader ",
                            "local attached reader",
                            rfidReaderID.LocationTypeID.LocalDevice
                         )
                 );
            }
            return readers;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create a bound reader
        /// </summary>
        /// <param name="ReaderToBind"></param>
        public LakeChabotReader( rfidReaderID ReaderToBind )
        {                       
            InitReader();
            
            PacketQueue = new Queue<PacketData.PacketWrapper>(INITIAL_QUEUE_SIZE);

            this._queueCount = 0;

            // Ugly but will switch rfidReaderID to provide cookie n lookup that way
            // when code is completed...

            rfid.Structures.RadioInformation radioInfo = null;

            foreach (KeyValuePair<UInt32, rfid.Structures.RadioInformation> pair in LakeChabotReader.LOCATED_READERS)
            {
                if
                (
                    System.Text.Encoding.ASCII.GetString(pair.Value.uniqueId, 0, pair.Value.uniqueId.Length).Equals
                    (
                        ReaderToBind.Name
                    )
                )
                {
                    radioInfo = pair.Value;
                    break;
                }
            }

           
            Mode = rfidReader.OperationMode.Unbound; // ???? ~ bound set auto ~ but needs unset for BindReader ????

            BindReader(ReaderToBind);

            LakeChabotReader.MANAGED_ACCESS.API_MacGetFirmwareVersion(ref firmwareVersion);
            LakeChabotReader.MANAGED_ACCESS.API_MacGetOEMCfgVersion(ref OemCfgVersion);
            LakeChabotReader.MANAGED_ACCESS.API_MacGetOEMCfgUpdateNumber(ref OemCfgUpdateNumber);
            LakeChabotReader.MANAGED_ACCESS.API_MacGetBootLoaderVersion(ref bootLoaderVersion);

            UInt32 version = 0;

            LakeChabotReader.MANAGED_ACCESS.API_ConfigReadRegister(0x0002, ref version);

            this.hardwareVersion.major = (version >> 16) & 0xFFFF;  // control block
            this.hardwareVersion.minor = (version >> 0) & 0xFFFF;   // chip rev
            this.hardwareVersion.release = 0;         

        }
Exemplo n.º 4
0
        // TODO : Move to locator & communicator class

        public static List<rfidReaderID> FindReaders( rfidReaderID whereToLook )
        {
            return EnumerateReaders( whereToLook );
        }