/// <summary>
        /// Timer Action的執行動作
        /// </summary>
        /// <param name="obj">The object.</param>
        public override void doProcess(object obj)
        {
            if (System.Threading.Interlocked.Exchange(ref syncPoint, 1) == 0)
            {
                try
                {
                    systemInfoMapAction = scApp.getEQObjCacheManager().getPortByPortID("MASTER_PLC")
                                          .getMapActionByIdentityKey(typeof(PLCSystemInfoMapAction).Name) as PLCSystemInfoMapAction;
                    if (systemInfoMapAction == null)
                    {
                        return;
                    }

                    if (IntervalMilliSec > 0)
                    {
                        if (lastSignal == false)
                        {
                            systemInfoMapAction.PLC_SetSystemTime();
                        }
                        else
                        {
                            systemInfoMapAction.PLC_FinishTimeCalibration();
                        }

                        lastSignal = !lastSignal;
                    }
                }
                finally
                {
                    System.Threading.Interlocked.Exchange(ref syncPoint, 0);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Timer Action的執行動作
        /// </summary>
        /// <param name="obj">The object.</param>
        public override void doProcess(object obj)
        {
            if (System.Threading.Interlocked.Exchange(ref syncPoint, 1) == 0)
            {
                try
                {
                    systemInfoMapAction = scApp.getEQObjCacheManager().getPortByPortID("MASTER_PLC")
                                          .getMapActionByIdentityKey(typeof(PLCSystemInfoMapAction).Name) as PLCSystemInfoMapAction;
                    if (systemInfoMapAction == null)
                    {
                        return;
                    }

                    if (IntervalMilliSec > 0)
                    {
                        aliveSignal = !aliveSignal;
                        systemInfoMapAction.PLC_SetHeartbeat(aliveSignal);

                        //2020.6.23 MCS online
                        bool MCSonline = (scApp.getEQObjCacheManager().getLine().Secs_Link_Stat == SCAppConstants.LinkStatus.LinkOK);
                        systemInfoMapAction.PLC_SetMCSOnline(MCSonline);
                    }
                }
                finally
                {
                    System.Threading.Interlocked.Exchange(ref syncPoint, 0);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Timer Action的執行動作
        /// </summary>
        /// <param name="obj">The object.</param>
        public override void doProcess(object obj)
        {
            if (System.Threading.Interlocked.Exchange(ref syncPoint, 1) == 0)
            {
                try
                {
                    systemInfoMapAction = scApp.getEQObjCacheManager().getPortByPortID("MASTER_PLC")
                                          .getMapActionByIdentityKey(typeof(PLCSystemInfoMapAction).Name) as PLCSystemInfoMapAction;
                    if (systemInfoMapAction == null)
                    {
                        return;
                    }

                    if (IntervalMilliSec > 0)
                    {
                        //lastAliveSignal = aliveSignal;
                        //aliveSignal = systemInfoMapAction.PLCHeartbeatSignal;
                        //if (lastAliveSignal == aliveSignal)
                        //{
                        //    retryCount++;
                        //    if (retryCount > retryCountThl)
                        //    {
                        //        //TODO: PLC disconnected
                        //    }
                        //}
                        //else
                        //{
                        //    retryCount = 0;
                        //}
                        //systemInfoMapAction.PLC_SetHeartbeat(!aliveSignal);
                        aliveSignal = !aliveSignal;
                        systemInfoMapAction.PLC_SetHeartbeat(aliveSignal);
                    }
                }
                finally
                {
                    System.Threading.Interlocked.Exchange(ref syncPoint, 0);
                }
            }
        }