コード例 #1
0
ファイル: StateMachine.cs プロジェクト: winterjr/jaustoolset
        /// <summary>
        /// Wraps the message buffer into a Send wrapper and sends it through
        /// the JausRouter.
        /// </summary>
        /// <param name="bufsize">the size of the given buffer in bytes</param>
        /// <param name="buffer">the bytes from the message to be sent</param>
        /// <param name="dest">the destination of the message</param>
        protected void sendJausMessage(uint bufsize, byte[] buffer, JausAddress dest)
        {
            Send response = new Send();

            response.getBody().getSendRec().getMessagePayload().set((int)bufsize, buffer);
            response.getBody().getSendRec().getDestinationID().setSubsystemID(dest.getSubsystemID());
            response.getBody().getSendRec().getDestinationID().setNodeID(dest.getNodeID());
            response.getBody().getSendRec().getDestinationID().setComponentID(dest.getComponentID());
            //Console.WriteLine("Sending response msg " + BitConverter.ToInt16(b, 0));
            jausRouter.sendMessage(ref response);
        }
コード例 #2
0
        /// <summary>
        /// Wraps the message buffer into a Send wrapper and sends it through
        /// the JausRouter.
        /// </summary>
        /// <param name="bufsize">the size of the given buffer in bytes</param>
        /// <param name="buffer">the bytes from the message to be sent</param>
        /// <param name="dest">the destination of the message</param>
        protected void sendJausMessage(uint bufsize, byte[] buffer, JausAddress dest, bool force = false)
        {
            // We need to have a complete JAUS ID (no wildcards)
            // to send any messages, unless that message is specifically forced
            // to send by the calling application
            if (jausRouter.getJausAddress().containsWildcards() && !force)
            {
                Console.WriteLine("Can't send message when ID contains wildcards");
                return;
            }

            Send response = new Send();

            response.getBody().getSendRec().getMessagePayload().set((int)bufsize, buffer);
            response.getBody().getSendRec().getDestinationID().setSubsystemID(dest.getSubsystemID());
            response.getBody().getSendRec().getDestinationID().setNodeID(dest.getNodeID());
            response.getBody().getSendRec().getDestinationID().setComponentID(dest.getComponentID());
            //Console.WriteLine("Sending response msg " + BitConverter.ToInt16(b, 0));
            jausRouter.sendMessage(ref response);
        }