Exemple #1
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);
    }
Exemple #2
0
 /// <summary>
 /// Encodes the given message into a buffer and prepares to send it.
 /// </summary>
 /// <param name="msg">The message to be sent</param>
 /// <param name="dest">The address to which the message is going.</param>
 protected void sendJausMessage(Message msg, JausAddress dest)
 {
     // Encode the message
     uint bufsize = (uint) msg.getSize();
     byte[] buffer = new byte[bufsize];
     int pos = 0;
     msg.encode(buffer, pos);
     // and send...
     sendJausMessage (bufsize, buffer, dest);
 }