/// <summary> /// Human-readable representation /// </summary> /// <returns>Human-readable representation; e.g., /// SimpleReadPlan:[[GEN2],[1,2],1000]</returns> public override string ToString() { return(String.Format( "SimpleReadPlan:[{0},{1},{2},{3:D}]", ArrayToString(Antennas), Protocol.ToString(), (null == Filter) ? "null" : Filter.ToString(), Weight)); }
/// <summary> /// Create WHERE clauses representing a tag filter /// </summary> /// <param name="tagFilter">Tag filter</param> /// <returns>List of strings to be incorporated into "WHERE ... AND ..." phrase. /// List may be empty.</returns> private List<string> TagFilterToWhereClause(TagFilter tagFilter) { List<string> wheres = new List<string>(); if (null == tagFilter) { // Do nothing } else if (tagFilter is Iso180006b.TagData) { Iso180006b.TagData td = (Iso180006b.TagData)tagFilter; wheres.Add(String.Format("id={0}", ByteFormat.ToHex(td.EpcBytes))); } else if (tagFilter is TagData) { TagData td = (TagData) tagFilter; wheres.Add(String.Format("id={0}", ByteFormat.ToHex(td.EpcBytes))); } else if (tagFilter is Gen2.Select) { Gen2.Select sel = (Gen2.Select)tagFilter; wheres.Add("filter_subtype=0"); wheres.Add(String.Format("filter_mod_flags=0x{0:X}", (sel.Invert) ? "00000001" : "00000000")); wheres.Add(String.Format("filter_bank=0x{0:X}" , sel.Bank)); wheres.Add("filter_bit_address=" + sel.BitPointer); wheres.Add("filter_bit_length="+sel.BitLength); wheres.Add("filter_data=0x" + BitConverter.ToString(sel.Mask).Replace("-", string.Empty)); } else if (tagFilter is Iso180006b.Select) { Iso180006b.Select sel = (Iso180006b.Select)tagFilter; wheres.Add("filter_subtype=0"); string operation = string.Empty; switch (sel.Op) { case Iso180006b.SelectOp.EQUALS: operation = "00"; break; case Iso180006b.SelectOp.NOTEQUALS: operation = "01"; break; case Iso180006b.SelectOp.GREATERTHAN: operation = "02"; break; case Iso180006b.SelectOp.LESSTHAN: operation = "03"; break; default: break; }; wheres.Add(String.Format("filter_command=0x{0:X}",operation)); wheres.Add(String.Format("filter_mod_flags=0x{0:X}", (sel.Invert) ? "00000001" : "00000000")); wheres.Add("filter_bit_address=" + sel.Address); wheres.Add("filter_bit_length=64"); wheres.Add("filter_data=0x" + BitConverter.ToString(sel.Data).Replace("-", string.Empty)); } else throw new ArgumentException("RQL only supports singulation by EPC. " + tagFilter.ToString() + " is not supported."); return wheres; }