Example #1
0
        public ConfirmControl setAs(ConfirmControl value)
        {
            m_MsgHeader = value.m_MsgHeader;
            m_Body      = value.m_Body;

            return(this);
        }
Example #2
0
 public void ConfirmControlTransition(ConfirmControl msg)
 {
     transition_ = "ConfirmControlTransition";
     State.ConfirmControlTransition(this, msg);
     transition_ = "";
     return;
 }
Example #3
0
        public ConfirmControl(ConfirmControl value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body = new Body();
            m_IsCommand = false;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;
        }
Example #4
0
        public ConfirmControl(ConfirmControl value)
        {
            /// Initiliaze the protected variables
            m_MsgHeader = new MsgHeader();
            m_Body      = new Body();
            m_IsCommand = false;

            /// Copy the values
            m_MsgHeader = value.m_MsgHeader;
            m_Body      = value.m_Body;
        }
Example #5
0
        public bool  isEqual(ConfirmControl value)
        {
            if (!this.getMsgHeader().isEqual(value.getMsgHeader()))
            {
                return(false);
            }
            if (!this.getBody().isEqual(value.getBody()))
            {
                return(false);
            }

            return(true);
        }
Example #6
0
        public ConfirmControl setAs(ConfirmControl value)
        {
            m_MsgHeader = value.m_MsgHeader;
            m_Body = value.m_Body;

            return this;
        }
Example #7
0
 public bool notEquals(ConfirmControl value)
 {
     return !this.isEqual(value);
 }
Example #8
0
        public bool isEqual(ConfirmControl value)
        {
            if (!this.getMsgHeader().isEqual(value.getMsgHeader()))
            {
            return false;
            }
            if (!this.getBody().isEqual(value.getBody()))
            {
            return false;
            }

            return true;
        }
 public virtual bool isControlAccepted(ConfirmControl msg)
 {
     return (msg.getBody().getConfirmControlRec().getResponseCode() == 0);
 }
Example #10
0
        //	This is the function that will process an event either generated
        //  by the service, sent to it by another service on the same component,
        //  or as a message sent by a different component.
        public override bool processTransitions(InternalEvent ie)
        {
            bool done = false;

            // Since this function can be called from multiple threads,
            // we use a mutex to ensure only one state transition is
            // active at a time.
            mutex.WaitOne();

            // Invoke the FSM transition for this event.
            try
            {
                if (ie.getName().CompareTo("Receive") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    Receive casted_ie = (Receive)ie;
                    int     pos       = 0;
                    ushort  id        = BitConverter.ToUInt16(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                    if (id == new ConfirmControl().getID())
                    {
                        ConfirmControl msg = new ConfirmControl();
                        msg.decode(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                        pManagementOCU_ManagementOcuFSM.context.ConfirmControlTransition(msg);
                        done = true;
                    }
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("MenuItemEntered") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    MenuItemEntered casted_ie = (MenuItemEntered)ie;
                    MenuItemEntered msg       = casted_ie;
                    pManagementOCU_ManagementOcuFSM.context.MenuItemEnteredTransition(msg);
                    done = true;
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("MenuItemEntered") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    MenuItemEntered casted_ie = (MenuItemEntered)ie;
                    MenuItemEntered msg       = casted_ie;
                    pManagementOCU_ManagementOcuFSM.context.MenuItemEnteredTransition(msg);
                    done = true;
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("Receive") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    Receive casted_ie = (Receive)ie;
                    int     pos       = 0;
                    ushort  id        = BitConverter.ToUInt16(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                    if (id == new ConfirmControl().getID())
                    {
                        ConfirmControl msg = new ConfirmControl();
                        msg.decode(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                        pManagementOCU_ManagementOcuFSM.context.ConfirmControlTransition(msg);
                        done = true;
                    }
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("InternalStateChange_To_ManagementOCU_ManagementOcuFSM_HandleMenu") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    pManagementOCU_ManagementOcuFSM.context.InternalStateChange_To_ManagementOCU_ManagementOcuFSM_HandleMenuTransition(ie);
                    done = true;
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("MenuItemEntered") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    MenuItemEntered casted_ie = (MenuItemEntered)ie;
                    MenuItemEntered msg       = casted_ie;
                    pManagementOCU_ManagementOcuFSM.context.MenuItemEnteredTransition(msg);
                    done = true;
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("MenuItemEntered") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    MenuItemEntered casted_ie = (MenuItemEntered)ie;
                    MenuItemEntered msg       = casted_ie;
                    pManagementOCU_ManagementOcuFSM.context.MenuItemEnteredTransition(msg);
                    done = true;
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("Receive") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    Receive casted_ie = (Receive)ie;
                    int     pos       = 0;
                    ushort  id        = BitConverter.ToUInt16(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                    if (id == new RejectControl().getID())
                    {
                        RejectControl msg = new RejectControl();
                        msg.decode(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                        pManagementOCU_ManagementOcuFSM.context.RejectControlTransition(msg);
                        done = true;
                    }
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("Receive") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    Receive casted_ie = (Receive)ie;
                    int     pos       = 0;
                    ushort  id        = BitConverter.ToUInt16(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                    if (id == new ReportStatus().getID())
                    {
                        ReportStatus msg = new ReportStatus();
                        msg.decode(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                        pManagementOCU_ManagementOcuFSM.context.ReportStatusTransition(msg);
                        done = true;
                    }
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("InternalStateChange_To_ManagementOCU_ManagementOcuFSM_WaitForControl") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    pManagementOCU_ManagementOcuFSM.context.InternalStateChange_To_ManagementOCU_ManagementOcuFSM_WaitForControlTransition(ie);
                    done = true;
                }
            } catch (Exception e) {}



            mutex.ReleaseMutex();
            return(done);
        }
 public virtual bool isControlAccepted(ConfirmControl msg)
 {
     return(msg.getBody().getConfirmControlRec().getResponseCode() == 0);
 }
        //    This is the function that will check for default transitions if
        //  no other transitions were satisfied.
        //
        public override bool defaultTransitions(InternalEvent ie)
        {
            bool done = false;

               // Since this function can be called from multiple threads,
               // we use a mutex to ensure only one state transition is
               // active at a time.
               mutex.WaitOne();

            // Invoke the FSM transition for this event.
            try
            {
                if (ie.getName().CompareTo("Receive") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    Receive casted_ie = (Receive) ie;
                    int pos = 0;
                    ushort id = BitConverter.ToUInt16(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                    if ( id == new ReportStatus().getID())
                    {
                        ReportStatus msg = new ReportStatus();
                        msg.decode(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                        pManagementOCU_ManagementOcuFSM.context.ReportStatusTransition();
                        done = true;
                    }
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("Receive") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    Receive casted_ie = (Receive) ie;
                    int pos = 0;
                    ushort id = BitConverter.ToUInt16(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                    if ( id == new ConfirmControl().getID())
                    {
                        ConfirmControl msg = new ConfirmControl();
                        msg.decode(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                        pManagementOCU_ManagementOcuFSM.context.ConfirmControlTransition();
                        done = true;
                    }
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("Receive") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    Receive casted_ie = (Receive) ie;
                    int pos = 0;
                    ushort id = BitConverter.ToUInt16(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                    if ( id == new ReportControl().getID())
                    {
                        ReportControl msg = new ReportControl();
                        msg.decode(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                        pManagementOCU_ManagementOcuFSM.context.ReportControlTransition();
                        done = true;
                    }
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("Receive") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    Receive casted_ie = (Receive) ie;
                    int pos = 0;
                    ushort id = BitConverter.ToUInt16(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                    if ( id == new RejectControl().getID())
                    {
                        RejectControl msg = new RejectControl();
                        msg.decode(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                        pManagementOCU_ManagementOcuFSM.context.RejectControlTransition();
                        done = true;
                    }
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("MenuItemEntered") == 0 && (ie.getSource().CompareTo("ManagementOCU_ManagementOcuFSM") != 0) && (!done))
                {
                    MenuItemEntered casted_ie = (MenuItemEntered) ie;
                        pManagementOCU_ManagementOcuFSM.context.MenuItemEnteredTransition();
                        done = true;
                }
            } catch (Exception e) {}

            mutex.ReleaseMutex();
            return done;
        }
Example #13
0
                protected internal override void ConfirmControlTransition(ManagementOCU_ManagementOcuFSMContext context, ConfirmControl msg)
                {
                    ManagementOCU_ManagementOcuFSM ctxt = context.Owner;


#if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : ManagementOCU_ManagementOcuFSM_SM.WaitForControl.ConfirmControlTransition(, ConfirmControl msg)");
#endif

                    if (!ctxt.isControlAccepted(msg))
                    {
                        context.State.Exit(context);
                        context.ClearState();

                        try
                        {
                            ctxt.sendRequestControlAction();
                            ctxt.displayMenuAction();
                            ctxt.processNotifications("WaitForControl", null);
                        }
                        finally
                        {
                            context.State = ManagementOCU_ManagementOcuFSM_SM.WaitForControl;
                            context.State.Entry(context);
                        }
                    }
                    else if (ctxt.isControlAccepted(msg))
                    {
                        context.State.Exit(context);
                        context.ClearState();

                        try
                        {
                            ctxt.displayMenuAction();
                            ctxt.processNotifications("HandleMenu", null);
                        }
                        finally
                        {
                            context.State = ManagementOCU_ManagementOcuFSM_SM.HandleMenu;
                            context.State.Entry(context);
                        }
                    }
                    else
                    {
                        base.ConfirmControlTransition(context, msg);
                    }

                    return;
                }
Example #14
0
 protected internal virtual void ConfirmControlTransition(ManagementOCU_ManagementOcuFSMContext context, ConfirmControl msg)
 {
     Default(context);
 }
Example #15
0
 public bool  notEquals(ConfirmControl value)
 {
     return(!this.isEqual(value));
 }