コード例 #1
1
 public virtual void SendAction(string arg0, CancelEvent msg, Receive.Body.ReceiveRec transportData)
 {
     /// Insert User Code HERE
 }
コード例 #2
0
        public virtual bool isControllingClient(Receive.Body.ReceiveRec transportData)
        {
            JausAddress requester = new JausAddress((ushort)transportData.getSourceID().getSubsystemID(),
                                            (byte)transportData.getSourceID().getNodeID(),
                                            (byte)transportData.getSourceID().getComponentID());

            if ((currentController != null) &&
            (requester.getSubsystemID() == currentController.getSubsystemID() &&
            requester.getNodeID() == currentController.getNodeID() &&
            requester.getComponentID() == currentController.getComponentID()))
            {
            return true;
            }
            return false;
        }
コード例 #3
0
    protected void sendMessage(JTS.Message msg, Inheritence1_csharp dest)
    {
        // First encode the message
        uint bufsize = (uint)msg.getSize();

        byte[] buffer = new byte[bufsize];
        int    pos    = 0;

        msg.encode(buffer, pos);

        // To inject a message directly into the component, we need
        // to wrap it in a receive event and spoof the source.
        JTS.Receive ie = new JTS.Receive();
        ie.getBody().getReceiveRec().getMessagePayload().set(bufsize, buffer);
        ie.getBody().getReceiveRec().setSrcSubsystemID(160);
        ie.getBody().getReceiveRec().setSrcNodeID(1);
        ie.getBody().getReceiveRec().setSrcComponentID(1);

        // Now wedge the event into the component...
        dest.processInternalEvent(ie);

        // Sleep for a bit to let the event percolate through...
        Thread.Sleep(500);
    }
コード例 #4
0
 public void ReceiveTransition(ClearEmergency msg, Receive.Body.ReceiveRec transportData)
 {
     transition_ = "ReceiveTransition";
     State.ReceiveTransition(this, msg, transportData);
     transition_ = "";
     return;
 }
コード例 #5
0
 protected internal virtual void ReceiveTransition(AccessControl_ReceiveFSMContext context, QueryTimeout msg, Receive.Body.ReceiveRec transportData)
 {
     Default(context);
 }
コード例 #6
0
 public void ReceiveTransition(RequestControl msg, Receive.Body.ReceiveRec transportData)
 {
     transition_ = "ReceiveTransition";
     State.ReceiveTransition(this, msg, transportData);
     transition_ = "";
     return;
 }
コード例 #7
0
                protected internal override void ReceiveTransition(AccessControl_ReceiveFSMContext context, RequestControl msg, Receive.Body.ReceiveRec transportData)
                {
                    AccessControl_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : AccessControl_ReceiveFSM_SM.Receiving_Ready_NotControlled_NotAvailable.ReceiveTransition(, RequestControl msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    AccessControl_ReceiveFSMState endState = context.State;

                    context.ClearState();

                    try
                    {
                        ctxt.SendAction("ConfirmControl", "NOT_AVAILABLE", transportData);
                    }
                    finally
                    {
                        context.State = endState;
                    }

                    return;
                }
コード例 #8
0
                protected internal override void ReceiveTransition(AccessControl_ReceiveFSMContext context, QueryAuthority msg, Receive.Body.ReceiveRec transportData)
                {
                    AccessControl_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : AccessControl_ReceiveFSM_SM.Receiving_Ready_NotControlled_Available.ReceiveTransition(, QueryAuthority msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    AccessControl_ReceiveFSMState endState = context.State;

                    context.ClearState();

                    try
                    {
                        ctxt.SendAction("ReportAuthority", transportData);
                    }
                    finally
                    {
                        context.State = endState;
                    }

                    return;
                }
コード例 #9
0
                protected internal override void ReceiveTransition(AccessControl_ReceiveFSMContext context, ReleaseControl msg, Receive.Body.ReceiveRec transportData)
                {
                    AccessControl_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : AccessControl_ReceiveFSM_SM.Receiving_Ready_Controlled_Available.ReceiveTransition(, ReleaseControl msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    if (ctxt.isControllingClient( transportData ))
                    {

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

                        try
                        {
                            ctxt.SendAction("RejectControl", "CONTROL_RELEASED", transportData);
                            ctxt.initAction();
                            ctxt.processNotifications("Receiving_Ready_NotControlled_Available", null);
                        }
                        finally
                        {
                            context.State = AccessControl_ReceiveFSM_SM.Receiving_Ready_NotControlled_Available;
                            context.State.Entry(context);
                        }

                    }
                    else                    {
                        base.ReceiveTransition(context, msg, transportData);
                    }

                    return;
                }
コード例 #10
0
			if (layer == 1) return ((urn_org_jts_test_Intermediary_1_0.IntermediaryService) serviceList[layer]).pIntermediary_Parent1FSM.context.State.Name;
			if (layer == 2) return ((urn_org_jts_test_Child_1_0.ChildService) serviceList[layer]).pChild_Parent1FSM.context.State.Name;
			return "";
		}
コード例 #11
0
                protected internal override void ReceiveTransition(Management_ReceiveFSMContext context, ClearEmergency msg, Receive.Body.ReceiveRec transportData)
                {
                    Management_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : Management_ReceiveFSM_SM.Receiving_Ready_NotControlled_NotAvailable_Emergency.ReceiveTransition(, ClearEmergency msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    if (ctxt.isIDStored( transportData ))
                    {

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

                    try
                    {
                            ctxt.popWrapper_367bc5868aa53b23a6c5a07701058fbf(msg, transportData);
                            ctxt.processNotifications(context.peakTopStateStack(), null);
                    }
                    finally
                    {
                            context.PopState();
                    }

                    }
                    else                    {
                        base.ReceiveTransition(context, msg, transportData);
                    }

                    return;
                }
コード例 #12
0
                protected internal override void ReceiveTransition(Events_ReceiveFSMContext context, QueryEvents msg, Receive.Body.ReceiveRec transportData)
                {
                    Events_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : Events_ReceiveFSM_SM.Receiving_Ready.ReceiveTransition(, QueryEvents msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    Events_ReceiveFSMState endState = context.State;

                    context.ClearState();

                    try
                    {
                        ctxt.SendAction("ReportEvents", msg, transportData);
                    }
                    finally
                    {
                        context.State = endState;
                    }

                    return;
                }
コード例 #13
0
                protected internal override void ReceiveTransition(Management_ReceiveFSMContext context, ReleaseControl msg, Receive.Body.ReceiveRec transportData)
                {
                    Management_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : Management_ReceiveFSM_SM.Receiving_Ready_Controlled_NotAvailable_Emergency.ReceiveTransition(, ReleaseControl msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    Management_ReceiveFSMState endState = context.State;

                    context.ClearState();

                    try
                    {
                        ctxt.SendAction("RejectControl", "NOT_AVAILABLE", transportData);
                    }
                    finally
                    {
                        context.State = endState;
                    }

                    return;
                }
コード例 #14
0
                protected internal override void ReceiveTransition(Management_ReceiveFSMContext context, Resume msg, Receive.Body.ReceiveRec transportData)
                {
                    Management_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : Management_ReceiveFSM_SM.Receiving_Ready_Controlled_Available_Standby.ReceiveTransition(, Resume msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    if (ctxt.isControllingClient( transportData ))
                    {

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

                        try
                        {
                            ctxt.processNotifications("Receiving_Ready_Controlled_Available_Ready", null);
                        }
                        finally
                        {
                            context.State = Management_ReceiveFSM_SM.Receiving_Ready_Controlled_Available_Ready;
                            context.State.Entry(context);
                        }

                    }
                    else                    {
                        base.ReceiveTransition(context, msg, transportData);
                    }

                    return;
                }
コード例 #15
0
        public void popWrapper_1014a7ff54cb3a51af2f80235d77d9d1(ClearEmergency msg, Receive.Body.ReceiveRec transportData)
        {
            string tempstr = "Receiving_Ready_Controlled_NotAvailable_Emergency";
            string tempstr2 = context.peakTopStateStack();
            string[] leafStateTOK = tempstr.Split(new char[] {'_'});
            string[] stackStateTOK = tempstr2.Split(new char[] {'_'});
            int currentToken = 0;

            if(tempstr2.CompareTo("Receiving_Ready_Controlled_NotAvailable_Emergency") == 0)
            {
            DeleteIDAction(transportData);
            return;
            }

            if(leafStateTOK[currentToken].CompareTo(stackStateTOK[currentToken]) != 0)
            {
            DeleteIDAction(transportData);
            return;
            }
            currentToken++;
            if(currentToken >= stackStateTOK.Length || currentToken >= leafStateTOK.Length)
            {
            Console.WriteLine("Problem with StringTokenizer.");
            }

            if(leafStateTOK[currentToken].CompareTo(stackStateTOK[currentToken]) != 0)
            {
            DeleteIDAction(transportData);
            return;
            }
            currentToken++;
            if(currentToken >= stackStateTOK.Length || currentToken >= leafStateTOK.Length)
            {
            Console.WriteLine("Problem with StringTokenizer.");
            }

            if(leafStateTOK[currentToken].CompareTo(stackStateTOK[currentToken]) != 0)
            {
            DeleteIDAction(transportData);
            return;
            }
            currentToken++;
            if(currentToken >= stackStateTOK.Length || currentToken >= leafStateTOK.Length)
            {
            Console.WriteLine("Problem with StringTokenizer.");
            }

            if(leafStateTOK[currentToken].CompareTo(stackStateTOK[currentToken]) != 0)
            {
            DeleteIDAction(transportData);
            return;
            }
            currentToken++;
            if(currentToken >= stackStateTOK.Length || currentToken >= leafStateTOK.Length)
            {
            Console.WriteLine("Problem with StringTokenizer.");
            }

            if(leafStateTOK[currentToken].CompareTo(stackStateTOK[currentToken]) != 0)
            {
            DeleteIDAction(transportData);
            return;
            }
            currentToken++;
            if(currentToken >= stackStateTOK.Length || currentToken >= leafStateTOK.Length)
            {
            Console.WriteLine("Problem with StringTokenizer.");
            }
        }
コード例 #16
0
 public virtual bool isIDStored(Receive.Body.ReceiveRec transportData)
 {
     /// Insert User Code HERE
     return true;
 }
コード例 #17
0
ファイル: Receive.cs プロジェクト: winterjr/jaustoolset
 public Receive(Receive r) : base(r)
 {
 }
コード例 #18
0
                protected internal override void ReceiveTransition(Events_ReceiveFSMContext context, UpdateEvent msg, Receive.Body.ReceiveRec transportData)
                {
                    Events_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : Events_ReceiveFSM_SM.Receiving_Ready.ReceiveTransition(, UpdateEvent msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    if (ctxt.isSupported(msg) && ctxt.eventExists(msg))
                    {
                        Events_ReceiveFSMState endState = context.State;

                        context.ClearState();

                        try
                        {
                            ctxt.updateEventAction(msg);
                            ctxt.SendAction("ConfirmEventRequest", msg, transportData);
                            ctxt.resetEventTimerAction();
                        }
                        finally
                        {
                            context.State = endState;
                        }

                    }
                    else if (! ctxt.isSupported(msg) || ! ctxt.eventExists(msg))
                    {
                        Events_ReceiveFSMState endState = context.State;

                        context.ClearState();

                        try
                        {
                            ctxt.SendAction("RejectEventRequest", msg, transportData);
                        }
                        finally
                        {
                            context.State = endState;
                        }

                    }                    else                    {
                        base.ReceiveTransition(context, msg, transportData);
                    }

                    return;
                }
コード例 #19
0
                protected internal override void ReceiveTransition(Management_ReceiveFSMContext context, QueryStatus msg, Receive.Body.ReceiveRec transportData)
                {
                    Management_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : Management_ReceiveFSM_SM.Receiving_Ready_NotControlled_NotAvailable_Shutdown.ReceiveTransition(, QueryStatus msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                        Management_ReceiveFSMState endState = context.State;

                        context.ClearState();

                        try
                        {
                        ctxt.SendAction("ReportStatus", transportData);
                        }
                        finally
                        {
                            context.State = endState;
                        }

                    return;
                }
コード例 #20
0
ファイル: Receive.cs プロジェクト: nikola-v/jaustoolset
 public Receive(Receive r)
     : base(r)
 {
 }
コード例 #21
0
                protected internal override void ReceiveTransition(Management_ReceiveFSMContext context, SetEmergency msg, Receive.Body.ReceiveRec transportData)
                {
                    Management_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : Management_ReceiveFSM_SM.Receiving_Ready_NotControlled_NotAvailable_Shutdown.ReceiveTransition(, SetEmergency msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    Management_ReceiveFSMState endState = context.State;

                    context.ClearState();

                    try
                    {
                        ctxt.StoreIDAction(transportData);
                        ctxt.processNotifications("Receiving_Ready_NotControlled_NotAvailable_Emergency", null);
                    }
                    finally
                    {
                        context.State = endState;
                        context.PushState(Management_ReceiveFSM_SM.Receiving_Ready_NotControlled_NotAvailable_Emergency);
                        context.State.Entry(context);
                    }

                    return;
                }
コード例 #22
0
 protected internal virtual void ReceiveTransition(Management_ReceiveFSMContext context, Standby msg, Receive.Body.ReceiveRec transportData)
 {
     Default(context);
 }
コード例 #23
0
ファイル: JausRouter.cs プロジェクト: nikola-v/jaustoolset
 /// <summary>
 /// Takes the incoming message and if its ID is in the Handlers list,
 /// invoke the event.
 /// </summary>
 /// <param name="msg">The incoming message</param>
 public void routeMessage(Receive msg)
 {
     ieHandler.invoke((InternalEvent) msg);
 }
コード例 #24
0
                protected internal override void ReceiveTransition(AccessControl_ReceiveFSMContext context, SetAuthority msg, Receive.Body.ReceiveRec transportData)
                {
                    AccessControl_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : AccessControl_ReceiveFSM_SM.Receiving_Ready_Controlled_NotAvailable.ReceiveTransition(, SetAuthority msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    if (ctxt.isAuthorityValid(msg) && ctxt.isControllingClient( transportData ))
                    {
                        AccessControl_ReceiveFSMState endState = context.State;

                        context.ClearState();

                        try
                        {
                            ctxt.SetAuthorityAction(msg);
                        }
                        finally
                        {
                            context.State = endState;
                        }

                    }
                    else                    {
                        base.ReceiveTransition(context, msg, transportData);
                    }

                    return;
                }
コード例 #25
0
ファイル: JausRouter.cs プロジェクト: nikola-v/jaustoolset
        /// <summary>
        /// Checks the C++ framework for incoming messages, routing them as needed.
        /// </summary>
        public override void run()
        {
            int priority = 0;
            uint source = 0;
            int flags =0;
            uint bufsize = 0;
            byte[] buffer;
            ushort msg_id = 0;
            //runLock._lock();
            isRunning = true;
            //runLock.unlock();

            while(isRunning)
            {
                buffer = JuniorAPI.JrReceive((int) jrHandle, ref source, ref priority, ref flags, ref msg_id);
                if( buffer != null & buffer.Length > 0)
                {
                    if(!isRunning)
                    {
                        break;
                    }
                    bufsize = (uint) buffer.Length;
                    Receive message = new Receive();
                    JausAddress sender = new JausAddress(source);

                    message.getBody().getReceiveRec().getSourceID().setSubsystemID(sender.getSubsystemID());
                    message.getBody().getReceiveRec().getSourceID().setNodeID(sender.getNodeID());
                    message.getBody().getReceiveRec().getSourceID().setComponentID(sender.getComponentID());
                    message.getBody().getReceiveRec().getMessagePayload().set((int) bufsize, buffer);
                    routeMessage(message);
                }
                else
                {
                    //OS.JrSleep(1); //throttle
                }
            }
        }
コード例 #26
0
                protected internal override void ReceiveTransition(AccessControl_ReceiveFSMContext context, RequestControl msg, Receive.Body.ReceiveRec transportData)
                {
                    AccessControl_ReceiveFSM ctxt = context.Owner;

                    #if TRACE
                    Trace.WriteLine(
                        "TRANSITION   : AccessControl_ReceiveFSM_SM.Receiving_Ready_NotControlled_Available.ReceiveTransition(, RequestControl msg, Receive.Body.ReceiveRec transportData)");
                    #endif

                    if (ctxt.isDefaultAuthorityGreater(msg))
                    {
                        AccessControl_ReceiveFSMState endState = context.State;

                        context.ClearState();

                        try
                        {
                            ctxt.SendAction("ConfirmControl", "INSUFFICIENT_AUTHORITY", transportData);
                        }
                        finally
                        {
                            context.State = endState;
                        }

                    }
                    else if (! ctxt.isDefaultAuthorityGreater(msg))
                    {

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

                        try
                        {
                            ctxt.StoreAddressAction(transportData);
                            ctxt.SetAuthorityAction(msg);
                            ctxt.ResetTimerAction();
                            ctxt.SendAction("ConfirmControl", "CONTROL_ACCEPTED", transportData);
                            ctxt.processNotifications("Receiving_Ready_Controlled_Available", null);
                        }
                        finally
                        {
                            context.State = AccessControl_ReceiveFSM_SM.Receiving_Ready_Controlled_Available;
                            context.State.Entry(context);
                        }

                    }                    else                    {
                        base.ReceiveTransition(context, msg, transportData);
                    }

                    return;
                }
コード例 #27
0
ファイル: JausRouter.cs プロジェクト: nikola-v/jaustoolset
        /// <summary>
        /// Determines if the outgoing message is local, or needs to be routed through
        /// the node manager.
        /// </summary>
        /// <param name="msg">the outgoing message wrapped in a Send wrapper.</param>
        public void sendMessage(ref Send msg)
        {
            // Pull the destination ID
            JausAddress destination = new JausAddress((ushort) msg.getBody().getSendRec().getDestinationID().getSubsystemID(),
                                                      (byte) msg.getBody().getSendRec().getDestinationID().getNodeID(),
                                                      (byte) msg.getBody().getSendRec().getDestinationID().getComponentID());
            // If the destination is local, loopback to the route message function
            if(destination.get() == jausAddress.get())
            {
                Receive message = new Receive();
                message.getBody().getReceiveRec().getSourceID().setSubsystemID(jausAddress.getSubsystemID());
                message.getBody().getReceiveRec().getSourceID().setNodeID(jausAddress.getNodeID());
                message.getBody().getReceiveRec().getSourceID().setComponentID(jausAddress.getComponentID());
                message.getBody().getReceiveRec().getMessagePayload().set(msg.getBody().getSendRec().getMessagePayload().getLength(),
                                                                      msg.getBody().getSendRec().getMessagePayload().getData());

                routeMessage(message);
            }
            // Otherwise, forward the message to NodeManager
            else
            {
                JrErrorCode ret = JuniorAPI.JrSend((int) jrHandle, destination.get(),
                                                   (uint) msg.getBody().getSendRec().getMessagePayload().getLength(),
                                                   msg.getBody().getSendRec().getMessagePayload().getData());
            }
        }
コード例 #28
0
 public void ReceiveTransition(QueryTimeout msg, Receive.Body.ReceiveRec transportData)
 {
     transition_ = "ReceiveTransition";
     State.ReceiveTransition(this, msg, transportData);
     transition_ = "";
     return;
 }
コード例 #29
0
 public void ReceiveTransition(UpdateEvent msg, Receive.Body.ReceiveRec transportData)
 {
     transition_ = "ReceiveTransition";
     State.ReceiveTransition(this, msg, transportData);
     transition_ = "";
     return;
 }
コード例 #30
0
 public void ReceiveTransition(SetAuthority msg, Receive.Body.ReceiveRec transportData)
 {
     transition_ = "ReceiveTransition";
     State.ReceiveTransition(this, msg, transportData);
     transition_ = "";
     return;
 }
コード例 #31
0
 protected internal virtual void ReceiveTransition(Events_ReceiveFSMContext context, UpdateEvent msg, Receive.Body.ReceiveRec transportData)
 {
     Default(context);
 }
コード例 #32
0
 protected internal virtual void ReceiveTransition(AccessControl_ReceiveFSMContext context, SetAuthority msg, Receive.Body.ReceiveRec transportData)
 {
     Default(context);
 }
コード例 #33
0
ファイル: JausRouter.cs プロジェクト: winterjr/jaustoolset
 /// <summary>
 /// Takes the incoming message and if its ID is in the Handlers list,
 /// invoke the event.
 /// </summary>
 /// <param name="msg">The incoming message</param>
 public void routeMessage(Receive msg)
 {
     ieHandler.invoke((InternalEvent)msg);
 }