Пример #1
0
        private static Configure.ErrorCodes CreateXML()
        {
            Configure.ErrorCodes ret = Configure.ErrorCodes.Success;
            try
            {
                _xmlDoc.Load(_xmlFileName);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(Configure.ErrorCodes.XMLFileMissing);
            }

            return(ret);
        }
Пример #2
0
        /// <summary>
        /// Reads line from serial.
        /// </summary>
        /// <param name="data"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public Configure.ErrorCodes ReadData(out String data, string token)
        {
            string tmp = null;

            Configure.ErrorCodes res = Configure.ErrorCodes.Success;
            try
            {
                tmp = _spClock.ReadExisting();
                tmp = tmp.Replace(token + "\n\r\n", "");
                tmp = tmp.Replace("\r", "");
                tmp = tmp.Replace("\n", "");
                tmp = tmp.Replace("> ", "");
                Log.Write(tmp + " - read");
            }
            catch (TimeoutException exp)
            {
                Log.Write("Read from serial is failed!");
                data = null;
                return(Configure.ErrorCodes.ReadSerialFailed);
            }
            data = tmp;
            return(Configure.ErrorCodes.Success);
        }