예제 #1
0
        public bool WriteTagASCII(string asciiString)
        {
            var tagsInventory = _reader.TagInventory(true, 0x10, Settings.Instance.AntennaByte);

            int status   = -1;
            int tagCount = tagsInventory.Count;

            if (tagCount > 1)
            {
                Display.WriteError("Too Many Tags in Reader Field");
                return(false);
            }

            if (tagCount < 1)
            {
                Display.WriteError("No Tags in Reader Field");
                return(false);
            }

            FedmIscTagHandler_EPC_Class1_Gen2 tag = tagsInventory.Values.First() as FedmIscTagHandler_EPC_Class1_Gen2;

            if (tag != null)
            {
                Display.WriteInformation($"Detected Tag - Writing: {asciiString}");
                status = tag.WriteEPC(HexConverter.ConvertASCIItoHexString(asciiString), "");
            }

            if (status == 0)
            {
                return(true);
            }

            Display.WriteError("Error status code " + status + ": " + _reader.GetStatusText((byte)status));

            return(false);
        }