public virtual void SendAction(string arg0, CancelEvent msg, Receive.Body.ReceiveRec transportData) { /// Insert User Code HERE }
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; }
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); }
public void ReceiveTransition(ClearEmergency msg, Receive.Body.ReceiveRec transportData) { transition_ = "ReceiveTransition"; State.ReceiveTransition(this, msg, transportData); transition_ = ""; return; }
protected internal virtual void ReceiveTransition(AccessControl_ReceiveFSMContext context, QueryTimeout msg, Receive.Body.ReceiveRec transportData) { Default(context); }
public void ReceiveTransition(RequestControl msg, Receive.Body.ReceiveRec transportData) { transition_ = "ReceiveTransition"; State.ReceiveTransition(this, msg, transportData); transition_ = ""; return; }
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; }
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; }
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; }
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 ""; }
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; }
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; }
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; }
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; }
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."); } }
public virtual bool isIDStored(Receive.Body.ReceiveRec transportData) { /// Insert User Code HERE return true; }
public Receive(Receive r) : base(r) { }
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; }
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; }
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; }
protected internal virtual void ReceiveTransition(Management_ReceiveFSMContext context, Standby msg, Receive.Body.ReceiveRec transportData) { Default(context); }
/// <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); }
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; }
/// <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 } } }
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; }
/// <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()); } }
public void ReceiveTransition(QueryTimeout msg, Receive.Body.ReceiveRec transportData) { transition_ = "ReceiveTransition"; State.ReceiveTransition(this, msg, transportData); transition_ = ""; return; }
public void ReceiveTransition(UpdateEvent msg, Receive.Body.ReceiveRec transportData) { transition_ = "ReceiveTransition"; State.ReceiveTransition(this, msg, transportData); transition_ = ""; return; }
public void ReceiveTransition(SetAuthority msg, Receive.Body.ReceiveRec transportData) { transition_ = "ReceiveTransition"; State.ReceiveTransition(this, msg, transportData); transition_ = ""; return; }
protected internal virtual void ReceiveTransition(Events_ReceiveFSMContext context, UpdateEvent msg, Receive.Body.ReceiveRec transportData) { Default(context); }
protected internal virtual void ReceiveTransition(AccessControl_ReceiveFSMContext context, SetAuthority msg, Receive.Body.ReceiveRec transportData) { Default(context); }
/// <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); }