Exemple #1
0
        public static void AEVITest()
        {
            // Инициализация каналов, тестовая среда
            string[] channelsArray = new string[] { "TestChannel;192.168.34.31:53105;userWEBTestServer;keyASDF8765" };
            MPChannels.Init(channelsArray);

            if (MPChannels.IsAvailable("TestChannel"))
            {
            }

            // Запрос
            string retCode, text;

            AEVI.Request("TestChannel", "DeleteCard", "77777", out retCode, out text);
            if (retCode != "0")
            {
            }
        }
Exemple #2
0
        // всегда возвращает непустой resultCode
        public static bool Request(
            string channels,
            string action,
            string data,
            out string resultCode,
            out string text
            )
        {
            //   try
            //   {
            resultCode = text = null;
            if (string.IsNullOrEmpty(channels))
            {
                resultCode = "5001"; text = "Empty request destination"; return(false);
            }
            string[] clist = channels.Split(',');

            string answer;
            string packet = "R1|" + action + "|" + data;

            foreach (string ch in clist)
            {
                if (!MPChannels.IsAvailable(ch))
                {
                    continue;
                }
                answer = MPChannels.SendAndWaitString(ch, "AEVI.WEB", packet, 10 * 1000);
                //if (answer == null) continue;
                TAG t = new TAG(answer);
                resultCode = t["RC"];
                if (string.IsNullOrEmpty(resultCode))
                {
                    continue;
                }
                text = t["Text"];
                return(true);
            }
            resultCode = "5002"; text = "No channel available";
            //   }
            //  catch(Exception ex) {log.Write(LogType.Error, "Request" + ex.Message);}
            return(false);
        }