Esempio n. 1
0
        public QueryAddition setAs(QueryAddition value)
        {
            m_Header            = value.m_Header;
            m_AdditionInputBody = value.m_AdditionInputBody;

            return(this);
        }
Esempio n. 2
0
 public void QueryAdditionTransition(QueryAddition msg, uint sender)
 {
     transition_ = "QueryAdditionTransition";
     State.QueryAdditionTransition(this, msg, sender);
     transition_ = "";
     return;
 }
Esempio n. 3
0
        public QueryAddition(QueryAddition value)
        {
            /// Initiliaze the protected variables
            m_Header            = new Header();
            m_AdditionInputBody = new AdditionInputBody();
            m_IsCommand         = false;

            /// Copy the values
            m_Header            = value.m_Header;
            m_AdditionInputBody = value.m_AdditionInputBody;
        }
Esempio n. 4
0
        public QueryAddition(QueryAddition value)
        {
            /// Initiliaze the protected variables
            m_Header = new Header();
            m_AdditionInputBody = new AdditionInputBody();
            m_IsCommand = false;

            /// Copy the values
            m_Header = value.m_Header;
            m_AdditionInputBody = value.m_AdditionInputBody;
        }
Esempio n. 5
0
        public bool  isEqual(QueryAddition value)
        {
            if (!this.getHeader().isEqual(value.getHeader()))
            {
                return(false);
            }
            if (!this.getAdditionInputBody().isEqual(value.getAdditionInputBody()))
            {
                return(false);
            }

            return(true);
        }
        //	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("AdditionServerServiceDef_additionServerFSM") != 0) && (!done))
                {
                    Receive casted_ie = (Receive)ie;
                    int     pos       = 0;
                    ushort  id        = BitConverter.ToUInt16(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                    if (id == new QueryAddition().getID())
                    {
                        QueryAddition msg = new QueryAddition();
                        msg.decode(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                        pAdditionServerServiceDef_additionServerFSM.context.QueryAdditionTransition();
                        done = true;
                    }
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("InitToReadyEventDef") == 0 && (ie.getSource().CompareTo("AdditionServerServiceDef_additionServerFSM") != 0) && (!done))
                {
                    InitToReadyEventDef casted_ie = (InitToReadyEventDef)ie;
                    pAdditionServerServiceDef_additionServerFSM.context.InitToReadyEventDefTransition();
                    done = true;
                }
            } catch (Exception e) {}



            mutex.ReleaseMutex();
            return(done);
        }
        public virtual void sendReportAdditionAction(QueryAddition msg, uint sender)
        {
            uint A1 = msg.getAdditionInputBody().getAdditionInput().getA1();
            uint A2 = msg.getAdditionInputBody().getAdditionInput().getA2();

            // Now, lets pull out the two numbers we received
            Console.WriteLine(" Need to add " + A1 + " + " + A2);

            // Now let's formulate a response
            uint answer;
            answer = A1 + A2;
            ReportAddition theAnswer = new ReportAddition();
            theAnswer.getAdditionOutputBody().
              getAdditionOutput().setAdditionResult(answer);

            // Encode the response and send it back to the requestor.
            sendJausMessage(theAnswer, new JausAddress(sender));

            Console.WriteLine("answer sent to client");
        }
        //    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("AdditionServerServiceDef_additionServerFSM") != 0) && (!done))
                {
                    Receive casted_ie = (Receive) ie;
                    int pos = 0;
                    ushort id = BitConverter.ToUInt16(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                    if ( id == new QueryAddition().getID())
                    {
                        QueryAddition msg = new QueryAddition();
                        msg.decode(casted_ie.getBody().getReceiveRec().getMessagePayload().getData(), pos);
                        pAdditionServerServiceDef_additionServerFSM.context.QueryAdditionTransition();
                        done = true;
                    }
                }
            } catch (Exception e) {}

            try
            {
                if (ie.getName().CompareTo("InitToReadyEventDef") == 0 && (ie.getSource().CompareTo("AdditionServerServiceDef_additionServerFSM") != 0) && (!done))
                {
                    InitToReadyEventDef casted_ie = (InitToReadyEventDef) ie;
                        pAdditionServerServiceDef_additionServerFSM.context.InitToReadyEventDefTransition();
                        done = true;
                }
            } catch (Exception e) {}

            mutex.ReleaseMutex();
            return done;
        }
Esempio n. 9
0
        public virtual void sendReportAdditionAction(QueryAddition msg, uint sender)
        {
            uint A1 = msg.getAdditionInputBody().getAdditionInput().getA1();
            uint A2 = msg.getAdditionInputBody().getAdditionInput().getA2();

            // Now, lets pull out the two numbers we received
            Console.WriteLine(" Need to add " + A1 + " + " + A2);

            // Now let's formulate a response
            uint answer;

            answer = A1 + A2;
            ReportAddition theAnswer = new ReportAddition();

            theAnswer.getAdditionOutputBody().
            getAdditionOutput().setAdditionResult(answer);

            // Encode the response and send it back to the requestor.
            sendJausMessage(theAnswer, new JausAddress(sender));

            Console.WriteLine("answer sent to client");
        }
Esempio n. 10
0
 public bool notEquals(QueryAddition value)
 {
     return !this.isEqual(value);
 }
 protected internal virtual void QueryAdditionTransition(AdditionServerServiceDef_additionServerFSMContext context, QueryAddition msg, uint sender)
 {
     Default(context);
 }
Esempio n. 12
0
 public bool  notEquals(QueryAddition value)
 {
     return(!this.isEqual(value));
 }
                protected internal override void QueryAdditionTransition(AdditionServerServiceDef_additionServerFSMContext context, QueryAddition msg, uint sender)
                {
                    AdditionServerServiceDef_additionServerFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : AdditionServerServiceDef_additionServerFSM_SM.Ready.QueryAdditionTransition(, QueryAddition msg, uint sender)");
                    #endif

                    context.State.Exit(context);
                    context.ClearState();

                    try
                    {
                        ctxt.sendReportAdditionAction(msg, sender);
                        ctxt.processNotifications("Ready", null);
                    }
                    finally
                    {
                        context.State = AdditionServerServiceDef_additionServerFSM_SM.Ready;
                        context.State.Entry(context);
                    }

                    return;
                }
Esempio n. 14
0
 protected internal virtual void QueryAdditionTransition(AdditionServerServiceDef_additionServerFSMContext context, QueryAddition msg, uint sender)
 {
     Default(context);
 }
Esempio n. 15
0
                protected internal override void QueryAdditionTransition(AdditionServerServiceDef_additionServerFSMContext context, QueryAddition msg, uint sender)
                {
                    AdditionServerServiceDef_additionServerFSM ctxt = context.Owner;


#if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : AdditionServerServiceDef_additionServerFSM_SM.Ready.QueryAdditionTransition(, QueryAddition msg, uint sender)");
#endif


                    context.State.Exit(context);
                    context.ClearState();

                    try
                    {
                        ctxt.sendReportAdditionAction(msg, sender);
                        ctxt.processNotifications("Ready", null);
                    }
                    finally
                    {
                        context.State = AdditionServerServiceDef_additionServerFSM_SM.Ready;
                        context.State.Entry(context);
                    }

                    return;
                }
Esempio n. 16
0
        public QueryAddition setAs(QueryAddition value)
        {
            m_Header = value.m_Header;
            m_AdditionInputBody = value.m_AdditionInputBody;

            return this;
        }
 public void QueryAdditionTransition(QueryAddition msg, uint sender)
 {
     transition_ = "QueryAdditionTransition";
     State.QueryAdditionTransition(this, msg, sender);
     transition_ = "";
     return;
 }
Esempio n. 18
0
        public bool isEqual(QueryAddition value)
        {
            if (!this.getHeader().isEqual(value.getHeader()))
            {
            return false;
            }
            if (!this.getAdditionInputBody().isEqual(value.getAdditionInputBody()))
            {
            return false;
            }

            return true;
        }