Exemple #1
0
        /// <summary>
        /// updates tags of an issue
        /// </summary>
        /// <param name="issueId">issue id</param>
        /// <param name="addedTags">list of new tags which were added to issue (if tag id == 0 then its a not existing tag which will be created)</param>
        /// <param name="deletedTags">list of tags which have to be removed from issue</param>
        /// <param name="userId">user who is performing this operation</param>
        public void UpdateIsseuTags(int issueId, List <TagModel> addedTags, List <TagModel> deletedTags, int userId)
        {
            TagModel tm = new TagModel();

            TagOp.AddTagsToIssue(tm.ToEntityList(addedTags), issueId, userId);
            TagOp.RemoveTagsFromIssue(tm.ToEntityList(deletedTags.Where(x => x.Id > 0).ToList()), issueId, userId);
        }
Exemple #2
0
        public static void embeddedRead(TagProtocol protocol, TagFilter filter, TagOp tagop)
        {
            TagReadData[]  tagReads = null;
            SimpleReadPlan plan     = new SimpleReadPlan(antennaList, protocol, filter, tagop, 1000);

            r.ParamSet("/reader/read/plan", plan);
            tagReads = r.Read(1000);
            // Print tag reads
            foreach (TagReadData tr in tagReads)
            {
                Console.WriteLine(tr.ToString());
                if (tr.isErrorData)
                {
                    // In case of error, show the error to user. Extract error code.
                    int errorCode = ByteConv.ToU16(tr.Data, 0);
                    Console.WriteLine("Embedded Tag operation failed. Error: " + ReaderCodeException.faultCodeToMessage(errorCode));
                }
                else
                {
                    if (tagop is Gen2.EMMicro.EM4325.GetSensorData)
                    {
                        if (tr.Data.Length > 0)
                        {
                            GetSensorDataResponse rData = new GetSensorDataResponse(tr.Data);
                            Console.WriteLine("Data:" + rData.ToString());
                        }
                    }
                    else
                    {
                        Console.WriteLine("  Data:" + ByteFormat.ToHex(tr.Data, "", " "));
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// retuns issueModel by issue id
        /// </summary>
        /// <param name="issueId"></param>
        /// <returns>IssueModel</returns>
        public IssueModel GetIssue(int issueId)
        {
            IssueModel im = new IssueModel();

            im = im.ToModel(IssueOp.GetIssueById(issueId));
            if (im.Parent != null)
            {
                int parrentIssueId = Convert.ToInt32(im.Parent);
                im.ParentTitle = IssueOp.GetIssueById(parrentIssueId).Title;
            }
            else
            {
                im.Parent = -1;
            }
            if (im.DependsOn != null)
            {
                int dependsOnIssueId = Convert.ToInt32(im.DependsOn);
                im.DependsOnTitle = IssueOp.GetIssueById(dependsOnIssueId).Title;
            }
            else
            {
                im.DependsOn = -1;
            }

            TagModel tm = new TagModel();

            im.Tags = tm.ToModelList(TagOp.GetIssueTags(issueId), tm);

            return(im);
        }
Exemple #4
0
 private void Task_OffOutChanged(object sender, EventArgs e)
 {
     if (OffOutTag != "")
     {
         TagOp.WriteTag(OffOutTag, OffOut);
     }
 }
Exemple #5
0
        private void PerformReadAllMemOperation(TagFilter filter, TagOp op)
        {
            TagReadData[]  tagReads = null;
            SimpleReadPlan plan     = new SimpleReadPlan(null, TagProtocol.GEN2, filter, op, 1000);

            reader.ParamSet("/reader/read/plan", plan);
            Console.WriteLine("Embedded tag operation - ");
            // Read tags
            tagReads = reader.Read(500);
            foreach (TagReadData tr in tagReads)
            {
                Console.WriteLine(tr.ToString());
                if (0 < tr.Data.Length)
                {
                    Console.WriteLine(" Embedded read data: " + ByteFormat.ToHex(tr.Data, "", " "));
                    Console.WriteLine(" User memory: " + ByteFormat.ToHex(tr.USERMemData, "", " "));
                    Console.WriteLine(" Reserved memory: " + ByteFormat.ToHex(tr.RESERVEDMemData, "", " "));
                    Console.WriteLine(" Tid memory: " + ByteFormat.ToHex(tr.TIDMemData, "", " "));
                    Console.WriteLine(" EPC memory: " + ByteFormat.ToHex(tr.EPCMemData, "", " "));
                }
                Console.WriteLine(" Embedded read data length:" + tr.Data.Length);
            }
            Console.WriteLine();
            Console.WriteLine("Standalone tag operation - ");
            ushort[] data = (ushort[])reader.ExecuteTagOp(op, filter);
            //// Print tag reads
            if (0 < data.Length)
            {
                Console.WriteLine(" Standalone read data:" + ByteFormat.ToHex(ByteConv.ConvertFromUshortArray(data), "", " "));
                Console.WriteLine(" Standalone read data length:" + ByteConv.ConvertFromUshortArray(data).Length);
            }
            data = null;
            Console.WriteLine();
        }
Exemple #6
0
 /// <summary>
 /// Create simple read plan with custom Antenna Configurations
 /// </summary>
 /// <param name="antennaList">List of antenna numbers.  May be null.</param>
 /// <param name="protocol">Protocol identifier</param>
 /// <param name="op">Operation mode</param>
 /// <param name="customAntConfig">Custom Antenna Configuration class</param>
 public SimpleReadPlan(ICollection <int> antennaList, TagProtocol protocol, TagOp op, CustomAntConfig customAntConfig)
     : base(DEFAULT_WEIGHT)
 {
     Antennas      = (antennaList != null) ? CollUtil.ToArray(antennaList) : null;
     Protocol      = protocol;
     Op            = op;
     CustAntConfig = customAntConfig;
 }
Exemple #7
0
 /// <summary>
 ///  Create a SimpleReadPlan
 /// </summary>
 /// <param name="antennaList">List of antenna numbers.  May be null.</param>
 /// <param name="protocol">Protocol identifier</param>
 /// <param name="filter">Tag filter.  May be null.</param>
 /// <param name="op">Operation mode</param>
 /// <param name="weight">Relative scheduling weight</param>
 public SimpleReadPlan(ICollection <int> antennaList, TagProtocol protocol, TagFilter filter, TagOp op, int weight)
     : base(weight)
 {
     Antennas = (antennaList != null) ? CollUtil.ToArray(antennaList) : null;
     Protocol = protocol;
     Filter   = filter;
     Op       = op;
 }
Exemple #8
0
 /// <summary>
 ///  Create a SimpleReadPlan
 /// </summary>
 /// <param name="antennaList">List of antenna numbers.  May be null.</param>
 /// <param name="protocol">Protocol identifier</param>
 /// <param name="filter">Tag filter.  May be null.</param>
 /// <param name="op">Operation mode</param>
 /// <param name="useFastSearch">Enable fast search</param>
 public SimpleReadPlan(ICollection <int> antennaList, TagProtocol protocol, TagFilter filter, TagOp op, bool useFastSearch)
     : base(DEFAULT_WEIGHT)
 {
     Antennas      = (antennaList != null) ? CollUtil.ToArray(antennaList) : null;
     Protocol      = protocol;
     Filter        = filter;
     Op            = op;
     UseFastSearch = useFastSearch;
 }
Exemple #9
0
        public static byte[] performEmbeddedOperation(TagFilter filter, TagOp op)
        {
            TagReadData[]  tagReads = null;
            byte[]         response = null;
            SimpleReadPlan plan     = new SimpleReadPlan(antennaList, TagProtocol.GEN2, filter, op, 1000);

            r.ParamSet("/reader/read/plan", plan);
            tagReads = r.Read(1000);
            foreach (TagReadData tr in tagReads)
            {
                response = tr.Data;
            }
            return(response);
        }
Exemple #10
0
        public static void embeddedReadAfterWrite(TagFilter filter, TagOp tagop)
        {
            TagReadData[]  tagReads = null;
            SimpleReadPlan plan     = new SimpleReadPlan(antennaList, TagProtocol.GEN2, filter, tagop, 1000);

            r.ParamSet("/reader/read/plan", plan);
            tagReads = r.Read(1000);
            //// Print tag reads
            foreach (TagReadData tr in tagReads)
            {
                Console.WriteLine(tr.ToString());
                if (0 < tr.Data.Length)
                {
                    Console.WriteLine("  Data:" + ByteFormat.ToHex(tr.Data, "", " "));
                }
            }
        }
Exemple #11
0
        private List <IssueModel> ChildIssues(List <IssueModel> list, int issueId)
        {
            List <IssueModel> children = new List <IssueModel>();

            foreach (IssueModel model in list.Where(m => m.Parent == issueId))
            {
                model.Children = ChildIssues(list, model.Id);
                TagModel tm = new TagModel();
                model.Tags = tm.ToModelList(TagOp.GetIssueTags(model.Id), tm);
                children.Add(model);
            }
            if (children.Count == 0)
            {
                return(null);
            }
            else
            {
                return(children);
            }
        }
Exemple #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userId">user id</param>
        /// <returns>list of all issues which the user can access</returns>
        public List <IssueModel> GetUserIssues(int userId)
        {
            IssueModel        im         = new IssueModel();
            List <IssueModel> allIssues  = im.ToModelList(IssueOp.UserIssues(userId), im);
            List <IssueModel> rootIssues = new List <IssueModel>();

            foreach (IssueModel model in allIssues.Where(m => m.Parent == null))
            {
                TagModel tm = new TagModel();
                model.Tags     = tm.ToModelList(TagOp.GetIssueTags(model.Id), tm);
                model.Children = ChildIssues(allIssues, model.Id);
                rootIssues.Add(model);
            }

            List <IssueModel> hlist = new List <IssueModel>();

            foreach (IssueModel m in rootIssues)
            {
                Traverse(m, m.Children, ref hlist);
            }

            return(hlist);
        }
        /// <summary>
        /// execute a TagOp
        /// </summary>
        /// <param name="tagOP">Tag Operation</param>
        /// <param name="target">Tag filter</param>
        ///<returns>the return value of the tagOp method if available</returns>
        public override Object ExecuteTagOp(TagOp tagOP, TagFilter target)
        {
            //Delegate to receive the Ro Access report
            llrp.OnRoAccessReportReceived += new delegateRoAccessReport(TagOpOnRoAccessReportReceived);
            reportReceived = false;
            isRoAccessReportReceived = false;
            roSpecId = 0;
            
            /*  Reset Reader
            * Delete all ROSpec and AccessSpecs on the reader, so that
            * we don't have to worry about the prior configuration
            * No need to verify the error status. */

            DeleteRoSpec();
            DeleteAccessSpecs();           
            //Though its a standalone tag operation, From server point of view
            //we need to submit requests in the following order.

            // Add ROSpec 
            // Enable ROSpec
            // Add AccessSpec
            // Enable AccessSpec
            // Start ROSpec
            // Wait for response and verify the result

            SimpleReadPlan srp = new SimpleReadPlan();
            srp.Filter = target;
            roSpecProtcolTable = new Hashtable();
            if (tagOP.GetType().Equals(typeof(Iso180006b.ReadData))
                || tagOP.GetType().Equals(typeof(Iso180006b.WriteData)) 
                || tagOP.GetType().Equals(typeof(Iso180006b.LockTag)))
            {
                srp.Protocol = TagProtocol.ISO180006B;
            }
            else
            {
                srp.Protocol = (TagProtocol)ParamGet("/reader/tagop/protocol");
            }
            srp.Antennas = new int[] { (int)ParamGet("/reader/tagop/antenna")};
            srp.Op = tagOP;
            List<PARAM_ROSpec> roSpecList = new List<PARAM_ROSpec>();
            TagQueueEmptyEvent.Reset();
            try
            {
                BuildRoSpec(srp, 0, roSpecList,true);
                if (AddRoSpec(roSpecList[0]))
                {
                    if (EnableRoSpec(roSpecList[0].ROSpecID))
                    {
                        if (!StartRoSpec(roSpecList[0].ROSpecID))
                            return null;
                    }
                    else
                    {
                        return null;
                    }
                }
                else
                {
                    return null;
                }
            }
            catch (Exception ex)
            {
                throw new ReaderException(ex.ToString());
            }
            WaitForSearchEnd(0);
            //wait for ro access report
            while (!reportReceived)
            {
                Thread.Sleep(20);
            }
            ReaderException tempReaderexception = rx;
            try
            {
                if (null == rx)
                {
                    //Update tagOpResponse in UpdateRoReport;
                    if ((tagOP is Gen2.ReadData) 
                        || (tagOP is Gen2.BlockPermaLock) 
                        || (tagOP is Gen2.Impinj.Monza4.QTReadWrite) 
                        || (tagOP is Gen2.NxpGen2TagOp.Calibrate) 
                        || (tagOP is Gen2.NxpGen2TagOp.EasAlarm) 
                        || (tagOP is Gen2.NXP.G2I.ChangeConfig)
                        || (tagOP is Iso180006b.ReadData)
                        || (tagOP is Gen2.IDS.SL900A.GetBatteryLevel) 
                        || (tagOP is Gen2.IDS.SL900A.GetSensorValue)
                        || (tagOP is Gen2.IDS.SL900A.GetLogState)
                        || (tagOP is Gen2.IDS.SL900A.GetCalibrationData) 
                        || (tagOP is Gen2.IDS.SL900A.GetMeasurementSetup)
                        || (tagOP is Gen2.IDS.SL900A.AccessFifoRead)
                        || (tagOP is Gen2.IDS.SL900A.AccessFifoStatus)
                        || (tagOP is Gen2.Denatran.IAV.ActivateSecureMode)
                        || (tagOP is Gen2.Denatran.IAV.ActivateSiniavMode)
                        || (tagOP is Gen2.Denatran.IAV.AuthenticateOBU)
                        || (tagOP is Gen2.Denatran.IAV.OBUAuthFullPass1)
                        || (tagOP is Gen2.Denatran.IAV.OBUAuthFullPass2)
                        || (tagOP is Gen2.Denatran.IAV.OBUAuthID)
                        || (tagOP is Gen2.Denatran.IAV.OBUReadFromMemMap)
                        || (tagOP is Gen2.Denatran.IAV.OBUWriteToMemMap))
                    {
                        return tagOpResponse;
                    }
                    else
                    {
                        return null;
                    }
                }
                else
                {
                    tempReaderexception = rx;
                    rx = null;
                    throw tempReaderexception;
                }
            }
            finally
            {
                tempReaderexception = null;
            }
        }
        /// <summary>
        /// Create a OpSpec that write into Gen2 memory
        /// </summary>
        /// <param name="tagOperation"> Tag operation</param>
        /// <returns>PARAM_C1G2Write</returns>
        private PARAM_C1G2Write BuildWriteDataOpSpec(TagOp tagOperation)
        {
            PARAM_C1G2Write c1g2Write = new PARAM_C1G2Write();
            int dataLength = 0;

            c1g2Write.AccessPassword = ((Gen2.Password)(ParamGet("/reader/gen2/accessPassword"))).Value;

            // Memory Bank
            c1g2Write.MB = new LTKD.TwoBits(((ushort)((Gen2.WriteData)tagOperation).Bank));
            c1g2Write.WordPointer = (ushort)((Gen2.WriteData)tagOperation).WordAddress;
            dataLength = ((Gen2.WriteData)tagOperation).Data.Length;
            
            //Data to be written
            LTKD.UInt16Array data = new LTKD.UInt16Array();
            List<ushort> dataWrite = new List<ushort>();
            for (int i = 0; i < dataLength; i++)
            {
                dataWrite.Add(((Gen2.WriteData)tagOperation).Data[i]);
            }
            data.data = dataWrite;
            c1g2Write.WriteData = LTKD.UInt16Array.FromString(data.ToString());

            // Set the OpSpecID to a unique number.
            c1g2Write.OpSpecID = ++OpSpecID;
            return c1g2Write;
        }
        /// <summary>
        /// Create a OpSpec that write epc into Gen2 memory
        /// </summary>
        /// <param name="tagOperation"> Tag operation</param>
        /// <returns>PARAM_ThingMagicWriteTag</returns>
        private PARAM_ThingMagicWriteTag BuildWriteTagOpSpec(TagOp tagOperation)
        {
            PARAM_ThingMagicWriteTag c1g2WriteTag = new PARAM_ThingMagicWriteTag();
            
            c1g2WriteTag.AccessPassword = ((Gen2.Password)(ParamGet("/reader/gen2/accessPassword"))).Value;

            c1g2WriteTag.WriteData = LTKD.UInt16Array.FromHexString(((Gen2.WriteTag)tagOperation).Epc.EpcString);

            // Set the OpSpecID to a unique number.
            c1g2WriteTag.OpSpecID = ++OpSpecID;
            return c1g2WriteTag;
        }
Exemple #16
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>all available tags</returns>
        public List <TagModel> GetAllTags()
        {
            TagModel tm = new TagModel();

            return(tm.ToModelList(TagOp.GetAllTags(), tm));
        }
Exemple #17
0
        /// <summary>
        /// returns list of issue tags
        /// </summary>
        /// <param name="issueId">issue id</param>
        /// <returns>List of issue tags</returns>
        public List <TagModel> GetIssueTags(int issueId)
        {
            TagModel tm = new TagModel();

            return(tm.ToModelList(TagOp.GetIssueTags(issueId), tm));
        }
 /// <summary>
 /// Create StopTriggerReadPlan
 /// </summary>
 /// <param name="sotc">StopOnTagCount object</param>
 /// <param name="antennaList">List of antenna numbers</param>
 /// <param name="protocol">Protocol identifier</param>
 /// <param name="filter">Tag filter.  May be null.</param>
 /// <param name="op">Operation mode</param>
 /// <param name="weight">Relative scheduling weight</param>
 public StopTriggerReadPlan(StopOnTagCount sotc, ICollection<int> antennaList, TagProtocol protocol, TagFilter filter, TagOp op, int weight)
     : base(antennaList, protocol, filter, op, weight)
 {
     stopOnCount = sotc;
 }
 /// <summary>
 /// Create StopTriggerReadPlan
 /// </summary>
 /// <param name="sotc">StopOnTagCount object</param>
 /// <param name="antennaList">List of antenna numbers</param>
 /// <param name="protocol">Protocol identifier</param>
 /// <param name="filter">Tag filter.  May be null.</param>
 /// <param name="op">Operation mode</param>
 /// <param name="useFastSearch">Enable fast search</param>
 public StopTriggerReadPlan(StopOnTagCount sotc, ICollection<int> antennaList, TagProtocol protocol, TagFilter filter, TagOp op, bool useFastSearch)
     : base(antennaList, protocol, filter, op, useFastSearch)
 {
     stopOnCount = sotc;
 }
Exemple #20
0
 /// <summary>
 /// Create StopTriggerReadPlan
 /// </summary>
 /// <param name="sotc">StopOnTagCount object</param>
 /// <param name="antennaList">List of antenna numbers</param>
 /// <param name="protocol">Protocol identifier</param>
 /// <param name="filter">Tag filter.  May be null.</param>
 /// <param name="op">Operation mode</param>
 /// <param name="useFastSearch">Enable fast search</param>
 public StopTriggerReadPlan(StopOnTagCount sotc, ICollection <int> antennaList, TagProtocol protocol, TagFilter filter, TagOp op, bool useFastSearch)
     : base(antennaList, protocol, filter, op, useFastSearch)
 {
     stopOnCount = sotc;
 }
Exemple #21
0
 /// <summary>
 /// Create StopTriggerReadPlan
 /// </summary>
 /// <param name="sotc">StopOnTagCount object</param>
 /// <param name="antennaList">List of antenna numbers</param>
 /// <param name="protocol">Protocol identifier</param>
 /// <param name="filter">Tag filter.  May be null.</param>
 /// <param name="op">Operation mode</param>
 /// <param name="weight">Relative scheduling weight</param>
 public StopTriggerReadPlan(StopOnTagCount sotc, ICollection <int> antennaList, TagProtocol protocol, TagFilter filter, TagOp op, int weight)
     : base(antennaList, protocol, filter, op, weight)
 {
     stopOnCount = sotc;
 }
Exemple #22
0
        public ReadPlan LoadSimpleReadPlan(string valstr)
        {
            Object value = ParseValue(valstr);
            string str   = string.Empty;

            //Reamoves leading string for ex: SimpleReadPlan:
            str = valstr.Remove(0, 15);
            SimpleReadPlan srp = new SimpleReadPlan();
            //Regular expression to remove leading and trailing square brackets
            string remove = Regex.Replace(str, @"]$|^\[", "");

            //Regular expression to split the string
            string[]  lines = Regex.Split(remove, @",(?![^\[\]]*\])");
            TagFilter tf    = null;
            TagOp     op    = null;

            foreach (string line in lines)
            {
                if (-1 != line.IndexOf("Antennas"))
                {
                    ArrayList list    = new ArrayList();
                    int[]     antList = null;
                    object    value1  = ParseValue(line.Split('=')[1]);
                    if (value1 != null)
                    {
                        antList = (int[])((ArrayList)value1).ToArray(typeof(int));
                    }
                    srp.Antennas = antList;
                }
                else if (-1 != line.IndexOf("Protocol"))
                {
                    srp.Protocol = (TagProtocol)Enum.Parse(typeof(TagProtocol), line.Split('=')[1], true);
                }
                else if (-1 != line.IndexOf("Filter"))
                {
                    string filterData = line.Split('=')[1];
                    if (-1 != filterData.IndexOf("Gen2.Select"))
                    {
                        str = line.Remove(0, 19);
                        //Regular expression to remove leading and trailing square brackets
                        str = Regex.Replace(str, @"]$|^\[", "");
                        //Regular expression to split the string
                        string[]  select     = Regex.Split(str, @"[ ,;]+");
                        bool      Invert     = false;
                        Gen2.Bank bank       = Gen2.Bank.EPC;
                        uint      BitPointer = 0;
                        ushort    BitLength  = 0;
                        byte[]    mask       = null;
                        if (select.Length != 5)
                        {
                            throw new Exception("Invalid number of arguments for ReadPlan filter");
                        }
                        foreach (string arg in select)
                        {
                            if (-1 != arg.IndexOf("Invert"))
                            {
                                Invert = Convert.ToBoolean(arg.Split('=')[1]);
                            }
                            else if (-1 != arg.IndexOf("Bank"))
                            {
                                bank = (Gen2.Bank)Enum.Parse(typeof(Gen2.Bank), arg.Split('=')[1], true);
                            }
                            else if (-1 != arg.IndexOf("BitPointer"))
                            {
                                BitPointer = Convert.ToUInt32(arg.Split('=')[1]);
                            }
                            else if (-1 != arg.IndexOf("BitLength"))
                            {
                                BitLength = Convert.ToUInt16(arg.Split('=')[1]);
                            }
                            else if (-1 != arg.IndexOf("Mask"))
                            {
                                mask = StringToByteArray(arg.Split('=')[1]);
                            }
                            else
                            {
                                throw new Exception("Invalid Argument in ReadPlan");
                            }
                        }
                        tf = new Gen2.Select(Invert, bank, BitPointer, BitLength, mask);
                    }
                    else if (-1 != filterData.IndexOf("EPC"))
                    {
                        str = line.Remove(0, 15);
                        str = Regex.Replace(str, @"]$|^\[", "");
                        tf  = new TagData(StringToByteArray((str.Split('=')[1])));
                    }
                    else
                    {
                        if (!filterData.Equals("null"))
                        {
                            throw new Exception("Invalid Argument in ReadPlan");
                        }
                    }
                }
                else if (-1 != line.IndexOf("Op"))
                {
                    string tagOpData = line.Split('=')[1];
                    if (tagOpData != null)
                    {
                        if (-1 != tagOpData.IndexOf("ReadData"))
                        {
                            str = line.Remove(0, 12);
                            //Regular expression to remove leading and trailing square brackets
                            str = Regex.Replace(str, @"]$|^\[", "");
                            //Regular expression to split the string
                            string[]  select      = Regex.Split(str, @"[ ,;]+");
                            Gen2.Bank bank        = Gen2.Bank.EPC;
                            uint      wordAddress = 0;
                            byte      length      = 0;
                            foreach (string arg in select)
                            {
                                if (-1 != arg.IndexOf("Bank"))
                                {
                                    bank = (Gen2.Bank)Enum.Parse(typeof(Gen2.Bank), arg.Split('=')[1], true);
                                }
                                else if (-1 != arg.IndexOf("WordAddress"))
                                {
                                    wordAddress = Convert.ToUInt32(arg.Split('=')[1]);
                                }
                                else if (-1 != arg.IndexOf("Len"))
                                {
                                    length = Convert.ToByte(arg.Split('=')[1]);
                                }
                                else
                                {
                                    throw new Exception("Invalid Argument in ReadPlan TagOp");
                                }
                            }
                            op = new Gen2.ReadData(bank, wordAddress, length);
                        }
                        else
                        {
                            if (!tagOpData.Equals("null"))
                            {
                                throw new Exception("Invalid Argument in ReadPlan");
                            }
                        }
                    }
                }
                else if (-1 != line.IndexOf("UseFastSearch"))
                {
                    srp.UseFastSearch = Convert.ToBoolean(line.Split('=')[1]);
                }
                else if (-1 != line.IndexOf("Weight"))
                {
                    srp.Weight = Convert.ToInt32(lines[5].Split('=')[1]);
                }
                else
                {
                    throw new Exception("Invalid Argument in ReadPlan");
                }
            }
            srp.Filter = tf;
            srp.Op     = op;
            return(srp);
        }
 /// <summary>
 ///  Create a SimpleReadPlan
 /// </summary>
 /// <param name="antennaList">List of antenna numbers.  May be null.</param>
 /// <param name="protocol">Protocol identifier</param>
 /// <param name="filter">Tag filter.  May be null.</param>
 /// <param name="op">Operation mode</param>
 /// <param name="weight">Relative scheduling weight</param>
 /// <param name="useFastSearch">Enable fast search</param>
 public SimpleReadPlan(ICollection<int> antennaList, TagProtocol protocol, TagFilter filter, TagOp op, bool useFastSearch, int weight)
     : base(weight)
 {
     Antennas = (antennaList != null) ? CollUtil.ToArray(antennaList) : null;
     Protocol = protocol;
     Filter = filter;
     Op = op;
     UseFastSearch = useFastSearch;
 }
Exemple #24
0
        /// <summary>
        /// converts inssue model to user issue model
        /// </summary>
        /// <param name="im">issue model</param>
        /// <param name="userId">user who is performing operation</param>
        /// <returns>user issue model</returns>
        private UserIssueModel GetUserIssueModelFromIssueModel(IssueModel im, int userId)
        {
            UserIssueModel uim = new UserIssueModel();
            int            unreadCnt;
            List <KeyValuePair <string, int> > unreadInfos;

            uim.Issue = im;
            uim.SelfAssessmentActionRequired = AccessRightOp.SelfAssessmentActionRequired(im.Id, userId);
            uim.CriteriaActionRatingRequired = CriterionOp.CriteriaWeightingActionRequired(im.Id, userId);
            uim.EvaluationActionRequired     = RatingOp.GetRatingActionRequired(im.Id, userId);

            uim.UnreadCoreItems = new List <string>();
            unreadInfos         = InformationReadOp.GetUnreadInfos(im.Id, userId);
            unreadCnt           = 0;
            foreach (KeyValuePair <string, int> kvp in unreadInfos)
            {
                if (kvp.Key.StartsWith("Alternative I") || kvp.Key.StartsWith("Issue I") || kvp.Key.StartsWith("Criteria I"))
                {
                    unreadCnt = unreadCnt + kvp.Value;
                    if (kvp.Value > 0)
                    {
                        if (kvp.Key.StartsWith("Alternative Information"))
                        {
                            uim.UnreadCoreItems.Add(kvp.Value + " new Alternatives");
                        }
                        if (kvp.Key.StartsWith("Issue Information"))
                        {
                            uim.UnreadCoreItems.Add(kvp.Value + " new Issue Attributes");
                        }
                        if (kvp.Key.StartsWith("Criteria Information"))
                        {
                            uim.UnreadCoreItems.Add(kvp.Value + " new Criteria");
                        }
                    }
                }
            }
            uim.UnreadCoreItemsCount = unreadCnt;
            TagModel tm = new TagModel();

            if (uim.Issue.Tags == null || uim.Issue.Tags.Count == 0)
            {
                uim.Issue.Tags = tm.ToModelList(TagOp.GetIssueTags(uim.Issue.Id), tm);
            }

            ReviewModel           rm       = new ReviewModel();
            IssueCreating         ic       = new IssueCreating();
            List <UserShortModel> userList = ic.GetAllUsers();
            UserShortModel        usm;

            if (uim.Issue.Status == "FINISHED" || uim.Issue.Status == "CLOSED")
            {
                uim.Rating  = ReviewOp.GetReviewRating(uim.Issue.Id);
                uim.Reviews = rm.ToModelList(ReviewOp.GetIssueReviews(uim.Issue.Id), rm);
                foreach (ReviewModel reviewModel in uim.Reviews)
                {
                    usm = userList.Find(x => x.Id == reviewModel.UserId);
                    reviewModel.UserName = usm.FirstName + " " + usm.LastName;
                }
            }
            else
            {
                uim.Rating = 0.0;
            }

            return(uim);
        }
 private void PerformReadAllMemOperation(TagFilter filter, TagOp op)
 {
     TagReadData[] tagReads = null;
     SimpleReadPlan plan = new SimpleReadPlan(null, TagProtocol.GEN2, filter, op, 1000);
     reader.ParamSet("/reader/read/plan", plan);
     Console.WriteLine("Embedded tag operation - ");
     // Read tags
     tagReads = reader.Read(500);
     foreach (TagReadData tr in tagReads)
     {
         Console.WriteLine(tr.ToString());
         if (0 < tr.Data.Length)
         {
             Console.WriteLine(" Embedded read data: " + ByteFormat.ToHex(tr.Data, "", " "));
             Console.WriteLine(" User memory: " + ByteFormat.ToHex(tr.USERMemData, "", " "));
             Console.WriteLine(" Reserved memory: " + ByteFormat.ToHex(tr.RESERVEDMemData, "", " "));
             Console.WriteLine(" Tid memory: " + ByteFormat.ToHex(tr.TIDMemData, "", " "));
             Console.WriteLine(" EPC memory: " + ByteFormat.ToHex(tr.EPCMemData, "", " "));
         }
         Console.WriteLine(" Embedded read data length:" + tr.Data.Length);
     }
     Console.WriteLine();
     Console.WriteLine("Standalone tag operation - ");
     ushort[] data = (ushort[])reader.ExecuteTagOp(op, filter);
     //// Print tag reads
     if (0 < data.Length)
     {
         Console.WriteLine(" Standalone read data:" + ByteFormat.ToHex(ByteConv.ConvertFromUshortArray(data), "", " "));
         Console.WriteLine(" Standalone read data length:" + ByteConv.ConvertFromUshortArray(data).Length);
     }
     data = null;
     Console.WriteLine();
 }
        /// <summary>
        /// execute a TagOp
        /// </summary>
        /// <param name="tagOP">Tag Operation</param>
        /// <param name="target">Tag filter</param>
        ///<returns>the return value of the tagOp method if available</returns>

        public override Object ExecuteTagOp(TagOp tagOP, TagFilter target)
        {
            TagProtocol oldProtocol = (TagProtocol)ParamGet("/reader/tagop/protocol");
            try
            {
                if (tagOP is Gen2.ReadData)
                {
                    ParamSet("/reader/tagop/protocol", TagProtocol.GEN2);
                    return ReadTagMemWords(target, (int)(((Gen2.ReadData)tagOP).Bank), (int)((Gen2.ReadData)tagOP).WordAddress, ((Gen2.ReadData)tagOP).Len);
                }
                if (tagOP is Gen2.WriteData)
                {
                    ParamSet("/reader/tagop/protocol", TagProtocol.GEN2);
                    WriteTagMemWords(target, (int)(((Gen2.WriteData)tagOP).Bank), (int)((Gen2.WriteData)tagOP).WordAddress, (ushort[])((Gen2.WriteData)tagOP).Data);
                    return null;
                }
                if (tagOP is Gen2.Lock)
                {
                    ParamSet("/reader/tagop/protocol", TagProtocol.GEN2);
                    Gen2.Password oldPassword = (Gen2.Password)(ParamGet("/reader/gen2/accessPassword"));
                    if (((Gen2.Lock)tagOP).AccessPassword != 0)
                    {
                        ParamSet("/reader/gen2/accessPassword", new Gen2.Password(((Gen2.Lock)tagOP).AccessPassword));
                    }
                    try
                    {
                        LockTag(target, ((Gen2.Lock)tagOP).LockAction);
                    }
                    finally
                    {
                        ParamSet("/reader/gen2/accessPassword", oldPassword);
                    }
                    return null;
                }
                if (tagOP is Gen2.Kill)
                {
                    ParamSet("/reader/tagop/protocol", TagProtocol.GEN2);
                    Gen2.Password auth = new Gen2.Password(((Gen2.Kill)tagOP).KillPassword);
                    KillTag(target, auth);
                    return null;
                }
                else if (tagOP is Gen2.WriteTag)
                {
                    ParamSet("/reader/tagop/protocol", TagProtocol.GEN2);
                    WriteTag(target, ((Gen2.WriteTag)tagOP).Epc);
                    return null;
                }
                else if (tagOP is Gen2.BlockWrite)
                {
                    throw new FeatureNotSupportedException("Gen2.BlockWrite not supported");
                }
                else if (tagOP is Gen2.BlockPermaLock)
                {
                    throw new FeatureNotSupportedException("Gen2.BlockPermaLock not supported");
                }
                else if (tagOP is Iso180006b.ReadData)
                {
                    ParamSet("/reader/tagop/protocol", TagProtocol.ISO180006B);
                    return ReadTagMemBytes(target, 0, (int)(((Iso180006b.ReadData)tagOP).byteAddress), ((Iso180006b.ReadData)tagOP).length);
                }
                else if (tagOP is Iso180006b.WriteData)
                {
                    ParamSet("/reader/tagop/protocol", TagProtocol.ISO180006B);
                    WriteTagMemBytes(target, 0, (int)(((Iso180006b.WriteData)tagOP).Address), ((Iso180006b.WriteData)tagOP).Data);
                    return null;
                }
                else if (tagOP is Iso180006b.LockTag)
                {
                    ParamSet("/reader/tagop/protocol", TagProtocol.ISO180006B);
                    Iso180006bLockTag(target, ((Iso180006b.LockTag)tagOP).Address);
                    return null;
                }
                else
                {
                    throw new Exception("Unsupported tagop.");
                }
            }
            finally
            {
                ParamSet("/reader/tagop/protocol", oldProtocol);
            }
        }