コード例 #1
0
ファイル: ModbusServer.cs プロジェクト: mosaicsys/MosaicLibCS
        private string InnerRunRelayAction(IBasicAction portAction, string description)
        {
            IBasicNotificationList notifyOnComplete = portAction.NotifyOnComplete;

            try
            {
                notifyOnComplete.AddItem(threadWakeupNotifier);

                string resultCode = Fcns.MapNullOrEmptyTo(portAction.Start(), null);

                while (resultCode == null)
                {
                    WaitForSomethingToDo();

                    InnerServiceFCServerAndStateRelay();

                    if (portAction.ActionState.IsComplete)
                    {
                        break;
                    }
                }

                resultCode = (portAction.ActionState.ResultCode ?? Fcns.CheckedFormat("Internal: port.{0} complete with null ResultCode", description));

                return(resultCode);
            }
            finally
            {
                notifyOnComplete.RemoveItem(threadWakeupNotifier);
            }
        }
コード例 #2
0
        //----------------------------------------
        #region SimpleActivePart overridden methods

        /// <summary>
        /// Implemenation for for required GoOnline Action: runs the corresponding command on the related IPort instance and returns its result
        /// </summary>
        protected override string PerformGoOnlineAction(bool andInitialize)
        {
            IBasicAction iba = (IBasicAction)port.CreateGoOnlineAction(andInitialize);
            string       rc  = iba.Run();

            PerformMainLoopService();
            return(rc);
        }
コード例 #3
0
        /// <summary>
        /// Implemenation for for required GoOffline Action: runs the corresponding command on the related IPort instance and returns its result
        /// </summary>
        protected override string PerformGoOfflineAction()
        {
            IBasicAction iba = (IBasicAction)port.CreateGoOfflineAction();
            string       rc  = iba.Run();

            PerformMainLoopService();
            return(rc);
        }
コード例 #4
0
ファイル: ModbusServer.cs プロジェクト: mosaicsys/MosaicLibCS
        private string InnerRunRelayAction(IBasicAction portAction, string description)
        {
            IBasicNotificationList notifyOnComplete = portAction.NotifyOnComplete;

            try
            {
                notifyOnComplete.AddItem(threadWakeupNotifier);

                string resultCode = Fcns.MapNullOrEmptyTo(portAction.Start(), null);

                while (resultCode == null)
                {
                    WaitForSomethingToDo();

                    InnerServiceFCServerAndStateRelay();

                    if (portAction.ActionState.IsComplete)
                        break;
                }

                resultCode = (portAction.ActionState.ResultCode ?? Fcns.CheckedFormat("Internal: port.{0} complete with null ResultCode", description));

                return resultCode;
            }
            finally
            {
                notifyOnComplete.RemoveItem(threadWakeupNotifier);
            }
        }