Ejemplo n.º 1
0
        void QueryTagEventNotifty(AW_API_NET.rfTagEvent_t tagEvent)
        {
            lock (myLock)
            {
                if (tagEvent.tag.id == srchTagID)
                {
                    tagSrchStruct tagSrchObj = new tagSrchStruct();
                    tagSrchObj.host   = tagEvent.host;
                    tagSrchObj.reader = tagEvent.reader;
                    tagSrchObj.fGen   = tagEvent.fGenerator;
                    tagSrchObj.rssi   = tagEvent.RSSI;
                    tagSrchList.Add(tagSrchObj);

                    //if rdr exits in the rdrStatusList remove it and replace it otherwise add it.
                    readerStatStruct readerObj = new readerStatStruct(tagEvent.reader);
                    if (utility.GetRdrFromList(tagEvent.reader, ref readerObj, rdrStatusList))
                    {
                        //make the timer to start processing
                        startSearch = false;
                        srchIndex   = 0;
                        counter     = 0;

                        readerStatStruct rdrStat = new readerStatStruct(tagEvent.reader);
                        readerObj.Copy(ref rdrStat);
                        rdrStatusList.Remove(readerObj);
                        rdrStat.SetSrchStatus(true);
                        rdrStatusList.Add(rdrStat);

                        Console.WriteLine("QueryTagNotify(TagSearchClass) ProcessSrchList time:" + DateTime.Now.ToString());
                        ProcessSrchList();
                    }
                }        //if (tagEvent.tag.id == srchTagID)
            }            //lock
        }
Ejemplo n.º 2
0
        //application will set the reader to be a search rdr by looking at zone table, rdr type
        public void SetSearchReader(ushort rdr)
        {
            readerStatStruct readerObj = new readerStatStruct(rdr);

            if (utility.GetRdrFromList(rdr, ref readerObj, rdrStatusList))
            {
                readerStatStruct readerObj2 = new readerStatStruct(rdr);
                readerObj.Copy(ref readerObj);
                rdrStatusList.Remove(readerObj);
                readerObj2.SetSearchReader(true);
                rdrStatusList.Add(readerObj2);
            }
        }
Ejemplo n.º 3
0
        //returns true if the rdr object counter has maxed out
        bool ProcessRdrError(AW_API_NET.rfReaderEvent_t readerEvent, int errorID)          //(ushort rdrID, int errorID)
        {
            //lock(myLock)
            {
                //bool ret = false;
                readerStatStruct rdrObj;                 // = new readerStatStruct(0); //create an readerStatStruct object with temp rdr id
                //rdrStat = (readerStatStruct)rdrStatusList[rdrIndexPoll];
                //foreach (readerStatStruct rdrObj in rdrStatusList)
                for (int i = 0; i < rdrStatusList.Count; i++)
                {
                    rdrObj = new readerStatStruct(0);
                    rdrObj = (readerStatStruct)rdrStatusList[i];

                    if (rdrObj.rdrID == readerEvent.reader)
                    {
                        readerStatStruct rdrObj2 = new readerStatStruct(readerEvent.reader); //new
                        rdrObj.Copy(ref rdrObj2);                                            //new

                        if ((errorID == AW_API_NET.APIConsts.RF_E_NO_RESPONSE) &&
                            (readerEvent.eventType == AW_API_NET.APIConsts.RF_READER_ENABLE))
                        {
                            //if reached max
                            if (rdrObj.GetCounter() >= MAX_READER_NO_RESPONSE)
                            {
                                //if reader prev stat was online set an event in the application
                                //will set event once until the status goes back to online
                                //if (rdrObj.GetStatus() == 1)
                                //ret = true;

                                Console.WriteLine("NetRdrConn - ProcessRdrError - reader #" + Convert.ToString(readerEvent.reader) + " rdrObj counter Maxed");
                                //rdrStatusList.RemoveAt(i);  //new removed
                                rdrStatusList.Remove(rdrObj);                           //new

                                rdrObj2.SetStatus(0);                                   //reader offline
                                rdrObj2.SetCounter(0);                                  //reset the counter

                                //rdrObj.SetProcessing(true);
                                //rdrObj.SetCmdSent(false);
                                rdrStatusList.Add(rdrObj2);

                                //@@ start the process to close and open socket
                                //@@ this process will handle in NetRdrReconn module
                                //if (StartReconnProcessHandler != null)
                                //StartReconnProcessHandler(readerEvent);

                                return(true);
                            }
                            else                             //increment
                            {
                                Console.WriteLine("NetRdrConn - ProcessRdrError - reader #" + Convert.ToString(readerEvent.reader) + " Incrementing rdrObj counter");
                                //increment counter to be used in polling timer to call EnableReader()
                                rdrObj2.SetCounter(Convert.ToUInt16(rdrObj.GetCounter() + 1));                                  //reset the counter
                                rdrObj2.SetProcessing(true);
                                rdrObj2.online = false;
                                //rdrStatusList.RemoveAt(i);  //new removed
                                rdrStatusList.Remove(rdrObj);
                                if (rdrObj.GetCounter() == 0)
                                {
                                    rdrObj2.SetStartTimeSec(DateTime.Now);
                                }
                                rdrStatusList.Add(rdrObj2);
                            }                    //incremet
                        }                        //NO_RESPONSE
                        else if (errorID == AW_API_NET.APIConsts.BUSY)
                        {
                            //Reader is busy servicing other command and is busy and
                            //did not process the EnableReader() command.
                            //may need to put some more code in here
                            Console.WriteLine("NetRdrConn - ProcessRdrError - reader #" + Convert.ToString(readerEvent.reader) + " is BUSY");
                        }
                    }            //if reader in list
                }                //for loop

                return(false);   //no counter not maxed
            }
        }