Пример #1
0
 private void timerRestartTcpServer_Tick(object sender, EventArgs e)
 {
     if (TcpServerForGPRSDev.Get().Start())
     {
         timerRestartTcpServer.Enabled = false;
     }
 }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            TCPLisentedPort port   = TcpServerForGPRSDev.Get().GetDevConnectedTcpClient(1);
            string          strVal = "";

            port.ReadOilValString(1, ref strVal);

            GLLedPublic.CardCfgByJson cfg = new GLLedPublic.CardCfgByJson();
            port.GetLedCfg(1, ref cfg);
        }
Пример #3
0
 private void buttonStart_Click(object sender, EventArgs e)
 {
     TcpServerForGPRSDev.Get().Stop();
     if (!TcpServerForGPRSDev.Get().Start())
     {
         timerRestartTcpServer.Enabled = true;
         buttonStart.Enabled           = false;
         buttonStop.Enabled            = true;
     }
     CmdOp.Get().Start();
 }
Пример #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            TCPLisentedPort port    = TcpServerForGPRSDev.Get().GetDevConnectedTcpClient(1);
            string          strVal  = "";
            List <string>   lstVals = new List <string>();

            lstVals.Add("222222");
            lstVals.Add("222222");
            lstVals.Add("222222");
            lstVals.Add("222222");
            lstVals.Add("222222");
            lstVals.Add("222222");
            port.SendOilContext(1, lstVals);
        }
Пример #5
0
        public bool SetOilDigi(int commID, string strValues)
        {
            TCPLisentedPort port = TcpServerForGPRSDev.Get().GetDevConnectedTcpClient(commID);

            if (port == null)
            {
                return(false);
            }

            string[]      values  = strValues.Split(new char[] { '-', ',' });
            List <string> lstVals = new List <string>(values);

            return(port.SendOilDot(1, strValues));
        }
Пример #6
0
        public bool SetOilValue(int commID, string strValues)
        {
            TCPLisentedPort port = TcpServerForGPRSDev.Get().GetDevConnectedTcpClient(commID);

            if (port == null)
            {
                LogMgr.WriteDebugDefSys("commdev dnot connect...");
                return(false);
            }

            string[]      values  = strValues.Split(new char[] { '-', ',' });
            List <string> lstVals = new List <string>(values);

            return(port.SendOilContext(1, lstVals));
        }
Пример #7
0
        public bool GetOilDigiCfgBySpilits(int commID, out string strValues)
        {
            strValues = "";
            TCPLisentedPort port = TcpServerForGPRSDev.Get().GetDevConnectedTcpClient(commID);

            if (port == null)
            {
                return(false);
            }
            List <GlareLedSysDefPub.CardGasValEachNumAByte> lstVals = new List <GlareLedSysDefPub.CardGasValEachNumAByte>();
            string strOut = "";
            bool   bRt    = port.ReadLedDotValString(1, ref strOut);

            strValues = strOut;
            return(bRt);
        }
Пример #8
0
        private void backgroundWorkerLoading_DoWork(object sender, DoWorkEventArgs e)
        {
            TcpServerForGPRSDev.Get().Port = _iListenPort;
            MemCfgInfo.MemDbMgr.Get().Load();

            CfgVersion cfg = CfgVersionBll.GetFirstCfg();

            if (cfg == null)
            {
                CfgVersion ver = new CfgVersion()
                {
                    Id       = 0,
                    UpdateDt = DateTime.Now,
                    Version  = 1
                };
                string strErr;
                CfgVersionBll.AddVersion(ref ver, out strErr);
            }
        }
Пример #9
0
        private void timerGetStatus_Tick(object sender, EventArgs e)
        {
            try
            {
                foreach (ListViewItem item in listViewCardList.Items)
                {
                    MemCfgInfo.MemCardWithCommDev dev = item.Tag as MemCfgInfo.MemCardWithCommDev;

                    item.SubItems[1].Text  = DbConstDefine.GetStringByStatus((DbConstDefine.ValueFlag)dev.CurStatus);
                    item.SubItems[11].Text = dev.strGettedValues;
                    item.SubItems[12].Text = dev.dtGetted.ToString();
                }

                buttonStart.Enabled = !TcpServerForGPRSDev.Get().GetStatus();
                buttonStop.Enabled  = TcpServerForGPRSDev.Get().GetStatus();
            }
            catch (Exception ex)
            {
                LogMgr.WriteErrorDefSys("timer get status error:");
                LogMgr.WriteErrorDefSys(ex.Message);
            }
        }
Пример #10
0
        public bool SetOilCfg(int commId, string strStringBySpilt)
        {
            LogMgr.WriteDebugDefSys("handleing cmd SetOilCfg");
            string[] strArr = strStringBySpilt.Split(new char[] { ',', '-' });
            if (strArr.Length != 5)
            {
                return(false);
            }
            int[] iArr = new int[5];
            for (int i = 0; i < 5; i++)
            {
                iArr[i] = int.Parse(strArr[i]);
            }


            CardCfgByJson cfg = new CardCfgByJson()
            {
                iCardType     = 0,
                iFirmVer      = 0,
                iHardVer      = 0,
                iID           = 0,
                bDobule       = iArr[0] == 1,
                iScreenCount  = iArr[1],
                iCardDigCount = iArr[2],
                bShowAppend   = iArr[3] == 1,
                iLight        = 8,
            };

            TCPLisentedPort port = TcpServerForGPRSDev.Get().GetDevConnectedTcpClient(commId);

            if (port == null)
            {
                LogMgr.WriteDebugDefSys("handing cmd SetOilCfg dev is not connected...");
                return(false);
            }

            return(port.SetLedCfg(1, cfg));
        }
Пример #11
0
        public bool GetOilCfgBySpilits(int commID, out string strValues)
        {
            strValues = "";
            TCPLisentedPort port = TcpServerForGPRSDev.Get().GetDevConnectedTcpClient(commID);

            if (port == null)
            {
                return(false);
            }
            List <GlareLedSysDefPub.CardGasValEachNumAByte> lstVals = new List <GlareLedSysDefPub.CardGasValEachNumAByte>();
            CardCfgByJson cfg    = new CardCfgByJson();
            bool          bRt    = port.GetLedCfg(1, ref cfg);
            string        strOut = (cfg.bDobule ? "1" : "0");

            strOut += "-" + cfg.iScreenCount.ToString();
            strOut += "-" + cfg.iCardDigCount;
            strOut += "-";
            strOut += cfg.bShowAppend ? "1" : "0";
            strOut += "-" + cfg.iLight;

            strValues = strOut;
            return(bRt);
        }
Пример #12
0
 private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     CmdOp.Get().Stop();
     TcpServerForGPRSDev.Get().Stop();
 }
Пример #13
0
        private void buttonStop_Click(object sender, EventArgs e)
        {
            CmdOp.Get().Stop();

            TcpServerForGPRSDev.Get().Stop();
        }