Ejemplo n.º 1
0
        public void Start()
        {
            if (engineClient == null)
            {
                EngineLogin login = new EngineLogin();
                login.LocalIp     = TbLocalIp.Text;
                login.LocalPort   = TbLocalPort.Text.ToInt();
                login.LocalPort2  = TbLocalAreaAlarmPort.Text.ToInt();
                login.EngineIp    = TbEngineIp.Text;
                login.EnginePort  = TbEnginePort.Text.ToInt();
                login.EnginePort2 = TbEngineAreaAlarmPort.Text.ToInt();
                //if (login.Valid() == false)
                //{
                //    MessageBox.Show("本地Ip和对端Ip必须是同一个Ip段的");
                //    return;
                //}

                engineClient             = PositionEngineClient.Instance();
                engineClient.Logs        = Logs;
                engineClient.IsWriteToDb = (bool)CbWriteToDb.IsChecked;
                engineClient.StartConnectEngine(login);
                engineClient.NewAlarmsFired += EngineClient_NewAlarmsFired;

                int nFaintFlag = LocationServer.AppContext.FaintFlag;
                if (nFaintFlag == 1)
                {
                    StartFaintAlarm();
                }

                Log.Info(LogTags.Server, string.Format("开始定位引擎对接 local={0}:{1}:{2},engine={3}:{4}:{5}", login.LocalIp, login.LocalPort, login.EnginePort2, login.EngineIp, login.EnginePort, login.EnginePort2));
            }
        }
        public void StartConnectEngine()
        {
            Location.BLL.Tool.Log.Info("开始连接定位引擎");
            int mockCount = int.Parse(TbMockTagPowerCount0.Text);

            if (engineClient == null)
            {
                EngineLogin login = new EngineLogin("127.0.0.1", 2323, 2324, "192.168.10.155", 3456, 1994);
                engineClient           = PositionEngineClient.Instance();
                engineClient.Logs      = Logs;
                engineClient.MockCount = mockCount;
                engineClient.StartConnectEngine(login);//todo:ip写到配置文件中
            }
            StartInsertPositionTimer();
        }
        private void StartEngine()
        {
            if (engineClient == null)
            {
                EngineLogin login = new EngineLogin();
                login.LocalIp     = "127.0.0.1";
                login.LocalPort   = 2323;
                login.LocalPort2  = 2324;
                login.EngineIp    = "127.0.0.1";
                login.EnginePort  = 3456;
                login.EnginePort2 = 1994;
                if (login.Valid() == false)
                {
                    MessageBox.Show("本地Ip和对端Ip必须是同一个Ip段的");
                    return;
                }

                engineClient = PositionEngineClient.Instance();
                //engineClient.Logs = Logs;
                engineClient.IsWriteToDb = true;
                engineClient.StartConnectEngine(login);
                engineClient.NewAlarmsFired += EngineClient_NewAlarmsFired;
            }
        }