예제 #1
0
        //private string getlogstring( int commport, task task )
        private string GetLogString(string remoteIP, Task task)
        {
            CommCmdBase     cmd             = task.CommCmd;
            CommResultState commResultState = task.LastCommResultState;
            string          sLastReceive    = string.Empty;

            if (task.LastReceived != null)
            {
                sLastReceive = CT.BytesToString(task.LastReceived);
            }

            string s = string.Format("Send\t\t: {0}, {1}\r\nReceived\t: {2}, {3}\r\nCommResult\t: {4}\r\nCmdType\t\t: {5}\r\nRemoteIP\t: {6}\r\n",
                                     task.LastSendDateTime, CT.BytesToString(task.LastSendDatas),
                                     //task.LastReceivedDateTime, CT.BytesToString( task.LastReceived),
                                     task.LastReceivedDateTime, sLastReceive,
                                     commResultState.ToString(), cmd.GetType().Name, remoteIP);

            return(s);
        }
예제 #2
0
        public void Process(object sender, EventArgs e)
        {
            TaskScheduler sch      = (TaskScheduler)sender;
            Task          act      = sch.ActiveTask;
            CommCmdBase   cmd      = act.CommCmd;
            Station       st       = cmd.Station;
            string        remoteIP = st.DestinationIP;
            string        s        = "DateTime   : " + DateTime.Now + Environment.NewLine;

            s += "Not find IP: " + remoteIP + Environment.NewLine;
            s += "cmd        : " + cmd.GetType().Name + Environment.NewLine;
            s += "stationName: " + st.StationName + Environment.NewLine;
            s += Environment.NewLine;

//            frmLogs.Default.AddLog( s );
            if (XGConfig.Default.ShowLogForm)
            {
                frmLogs.Default.AddLogRemoteIP(s);
            }

            // refreash run state
            //
            frmGprsCollState.Default.RunState = s;
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Process(object sender, EventArgs e)
        {
            ArgumentChecker.CheckNotNull(sender);
            TaskScheduler sch  = (TaskScheduler)sender;
            Task          task = sch.ActiveTask;

            ArgumentChecker.CheckNotNull(task);

            CommCmdBase     cmd             = task.CommCmd;
            CommResultState commResultState = task.LastCommResultState;

            if (commResultState != CommResultState.Correct)
            {
                if (XGConfig.Default.LogCommFail)
                {
                    string s = string.Format("Send\t\t: {0}, {1}\r\nReceived\t: {2}, {3}\r\nCommResult\t: {4}\r\nCmdType\t\t: {5}\r\n",
                                             task.LastSendDateTime, CT.BytesToString(task.LastSendDatas),
                                             task.LastReceivedDateTime, CT.BytesToString(task.LastReceived),
                                             commResultState.ToString(), cmd.GetType().Name);
                    FileLog.CommFail.Add(s);
                }
                return;
            }

            if (cmd is ReadRecordCommand)
            {
                ReadRecordCommand readRecordCmd = cmd as ReadRecordCommand;
                ProcessReadRecordCmd(readRecordCmd);
            }

            if (cmd is ReadTotalCountCommand)
            {
                ReadTotalCountCommand readCountCmd = cmd as ReadTotalCountCommand;
                ProcessReadTotalCountCmd(readCountCmd, task);
            }
        }