Exemple #1
0
        public override com.mirle.iibg3k0.ttc.Common.TrxTcpIp.ReturnCode snedRecv <TSource2>(WrapperMessage wrapper, out TSource2 stRecv, out string rtnMsg)
        {
            //lock (sendRecv_LockObj)
            //{
            //    return ITcpIpControl.sendRecv_Google(bcfApp, tcpipAgentName, wrapper, out stRecv, out rtnMsg);
            //}
            bool lockTaken = false;

            try
            {
                Monitor.TryEnter(sendRecv_LockObj, SCAppConstants.LOCK_TIMEOUT_MS, ref lockTaken);
                if (!lockTaken)
                {
                    throw new TimeoutException("snedRecv time out lock happen");
                }
                return(ITcpIpControl.sendRecv_Google(bcfApp, tcpipAgentName, wrapper, out stRecv, out rtnMsg));
            }
            finally
            {
                if (lockTaken)
                {
                    Monitor.Exit(sendRecv_LockObj);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Does the initialize.
        /// </summary>
        public override void doInit()
        {
            try
            {
                if (eqpt == null)
                {
                    return;
                }
                event_id       = "EQTcpIpMapAction_" + eqpt.VEHICLE_ID;
                tcpipAgentName = eqpt.TcpIpAgentName;
                //======================================連線狀態=====================================================
                RegisteredTcpIpProcEvent();
                ITcpIpControl.addTcpIpConnectedHandler(bcfApp, tcpipAgentName, Connection);
                ITcpIpControl.addTcpIpDisconnectedHandler(bcfApp, tcpipAgentName, Disconnection);

                ITcpIpControl.addTcpIpReplyTimeOutHandler(bcfApp, tcpipAgentName, ReplyTimeOutHandler);
                ITcpIpControl.addTcpIpSendErrorHandler(bcfApp, tcpipAgentName, SendErrorHandler);
                eqpt.addEventHandler(event_id
                                     , BCFUtility.getPropertyName(() => eqpt.ObstacleStatus)
                                     , (s1, e1) => { whenObstacleStatusChange(); });
                eqpt.addEventHandler(event_id
                                     , BCFUtility.getPropertyName(() => eqpt.BlockingStatus)
                                     , (s1, e1) => { whenBlockFinish(); });
                eqpt.addEventHandler(event_id
                                     , BCFUtility.getPropertyName(() => eqpt.PauseStatus)
                                     , (s1, e1) => { whenPauseFinish(); });
            }
            catch (Exception ex)
            {
                scApp.getBCFApplication().onSMAppError(0, "EQTcpIpMapAction doInit");
                logger.Error(ex, "Exection:");
            }
        }
Exemple #3
0
        public override bool send_Str11(ID_11_COUPLER_INFO_REP send_gpp, out ID_111_COUPLER_INFO_RESPONSE receive_gpp)
        {
            bool isScuess = true;

            try
            {
                string         rtnMsg  = string.Empty;
                WrapperMessage wrapper = new WrapperMessage
                {
                    ID             = WrapperMessage.CouplerInfoRepFieldNumber,
                    CouplerInfoRep = send_gpp
                };
                //com.mirle.iibg3k0.ttc.Common.TrxTcpIp.ReturnCode result = snedRecv(wrapper, out receive_gpp, out rtnMsg);
                receive_gpp = new ID_111_COUPLER_INFO_RESPONSE();

                ITcpIpControl.sendGoogleMsg(bcfApp, tcpipAgentName, wrapper, false);
                //isScuess = result == TrxTcpIp.ReturnCode.Normal;
            }
            catch (Exception ex)
            {
                receive_gpp = null;
                logger.Error(ex, "Exception");
            }
            return(isScuess);
        }
Exemple #4
0
 internal System.Net.IPEndPoint getIPEndPoint(BCFApplication bcfApp)
 {
     if (SCUtility.isEmpty(TcpIpAgentName))
     {
         return(null);
     }
     return(ITcpIpControl.RemoteEndPoint(bcfApp, TcpIpAgentName));
 }
Exemple #5
0
 internal string getIPAddress(BCFApplication bcfApp)
 {
     if (SCUtility.isEmpty(TcpIpAgentName))
     {
         return(string.Empty);
     }
     return(ITcpIpControl.getRemoteIPAddress(bcfApp, TcpIpAgentName));
 }
Exemple #6
0
        public bool IsCommunication(BCFApplication bcfApp)
        {
            bool      is_communication = false;
            Stopwatch fromLastCommTime = ITcpIpControl.StopWatch_FromTheLastCommTime(bcfApp, TcpIpAgentName);

            is_communication = fromLastCommTime.IsRunning ?
                               fromLastCommTime.ElapsedMilliseconds < CommunicationInterval_ms : false;
            return(is_communication);
        }
Exemple #7
0
        public override void UnRgisteredProcEvent()
        {
            ITcpIpControl.removeTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.BasicInfoVersionRepFieldNumber.ToString(), str102_Receive);
            ITcpIpControl.removeTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.IndividualDownloadReqFieldNumber.ToString(), str162_Receive);
            ITcpIpControl.removeTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.AlarmRepFieldNumber.ToString(), str194_Receive);

            ITcpIpControl.removeTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.TranCmpRepFieldNumber.ToString(), str132_Receive);
            ITcpIpControl.removeTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.TransEventRepFieldNumber.ToString(), str134_Receive);
            ITcpIpControl.removeTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.ImpTransEventRepFieldNumber.ToString(), str136_Receive);
            ITcpIpControl.removeTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.GuideInfoReqFieldNumber.ToString(), str138_Receive);
            ITcpIpControl.removeTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.StatueChangeRepFieldNumber.ToString(), str144_Receive);
        }
Exemple #8
0
        public bool IsTcpIpListening(BCFApplication bcfApp)
        {
            bool IsListening = false;
            int  local_port  = ITcpIpControl.getLocalPortNum(bcfApp, TcpIpAgentName);

            if (local_port != 0)
            {
                iibg3k0.ttc.Common.TCPIP.TcpIpServer tcpip_server = bcfApp.getTcpIpServerByPortNum(local_port);
                if (tcpip_server != null)
                {
                    IsListening = tcpip_server.IsListening;
                }
            }
            return(IsListening);
        }
Exemple #9
0
        public override void RegisteredTcpIpProcEvent()
        {
            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.BasicInfoVersionRepFieldNumber.ToString(), str102_Receive);
            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.AvoidCompleteRepFieldNumber.ToString(), str152_Receive);
            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.IndividualDownloadReqFieldNumber.ToString(), str162_Receive);
            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.AddressTeachRepFieldNumber.ToString(), str174_Receive);
            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.RangeTeachingCmpRepFieldNumber.ToString(), str172_Receive);
            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.AlarmRepFieldNumber.ToString(), str194_Receive);

            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.TranCmpRepFieldNumber.ToString(), str132_Receive);
            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.TransEventRepFieldNumber.ToString(), str134_Receive);
            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.ImpTransEventRepFieldNumber.ToString(), str136_Receive);
            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.GuideInfoReqFieldNumber.ToString(), str138_Receive);
            ITcpIpControl.addTcpIpReceivedHandler(bcfApp, tcpipAgentName, WrapperMessage.StatueChangeRepFieldNumber.ToString(), str144_Receive);
        }
Exemple #10
0
        public void getAgentInfo(BCFApplication bcfApp,
                                 out bool IsListening, out bool IsCommunication, out bool IsConnections,
                                 out DateTime connTime, out TimeSpan accConnTime,
                                 out DateTime disConnTime, out TimeSpan accDisConnTime,
                                 out int disconnTimes, out int lostPackets)
        {
            Stopwatch fromLastCommTime = ITcpIpControl.StopWatch_FromTheLastCommTime(bcfApp, TcpIpAgentName);

            IsCommunication = fromLastCommTime.IsRunning ?
                              fromLastCommTime.ElapsedMilliseconds < CommunicationInterval_ms : false;
            IsConnections  = ITcpIpControl.IsConnection(bcfApp, TcpIpAgentName);
            connTime       = ITcpIpControl.ConnectionTime(bcfApp, TcpIpAgentName);
            accConnTime    = ITcpIpControl.StopWatch_ConnectionTime(bcfApp, TcpIpAgentName).Elapsed;
            disConnTime    = ITcpIpControl.DisconnectionTime(bcfApp, TcpIpAgentName);
            accDisConnTime = ITcpIpControl.StopWatch_DisconnectionTime(bcfApp, TcpIpAgentName).Elapsed;
            disconnTimes   = ITcpIpControl.DisconnectionTimes(bcfApp, TcpIpAgentName);
            lostPackets    = ITcpIpControl.NumberOfPacketsLost(bcfApp, TcpIpAgentName);
            //取得目前VH 使用的TCPIPAgent所對應的TCPIPServer是否有在進行聆聽中
            IsListening = IsTcpIpListening(bcfApp);
        }
Exemple #11
0
        public override bool snedMessage(WrapperMessage wrapper, bool isReply = false)
        {
            Boolean resp_cmp = ITcpIpControl.sendGoogleMsg(bcfApp, tcpipAgentName, wrapper, true);

            return(resp_cmp);
        }
Exemple #12
0
 internal double getFromTheLastCommTime(BCFApplication bcfApp)
 {
     return(ITcpIpControl.StopWatch_FromTheLastCommTime(bcfApp, TcpIpAgentName).Elapsed.TotalSeconds);
 }
Exemple #13
0
 internal double getDisconnectionIntervalTime(BCFApplication bcfApp)
 {
     return(ITcpIpControl.StopWatch_DisconnectionTime(bcfApp, TcpIpAgentName).Elapsed.TotalSeconds);
 }
Exemple #14
0
 public int getPortNum(BCFApplication bcfApp)
 {
     return(ITcpIpControl.getLocalPortNum(bcfApp, TcpIpAgentName));
 }