Ejemplo n.º 1
0
                /*
                 * Wraps the class data into the buffer.
                 */
                public void encode(byte[] bytes, int pos)
                {
                    //bytes[pos] = BitConverter.GetBytes(m_SrcSubsystemID);
                    bytes = JausUtils.addToBuffer(bytes, BitConverter.GetBytes(m_SrcSubsystemID), pos, JausUtils.USHORT_BYTES, false);
                    pos  += JausUtils.USHORT_BYTES;

                    bytes[pos] = m_SrcNodeID;
                    pos       += JausUtils.BYTE_BYTES;

                    bytes[pos] = m_SrcComponentID;
                    pos       += JausUtils.BYTE_BYTES;
                }
Ejemplo n.º 2
0
                    /// <summary>
                    /// Encodes the message payload in the given buffer.
                    /// </summary>
                    /// <param name="bytes">The buffer to contain the payload data</param>
                    /// <param name="pos">The position in the buffer to begin encoding at.</param>
                    public void encode(byte[] bytes, int pos)
                    {
                        if (bytes == null)
                        {
                            return;
                        }

                        bytes = JausUtils.addToBuffer(bytes, BitConverter.GetBytes(m_Length), pos, JausUtils.UINT_BYTES, false);
                        pos  += JausUtils.UINT_BYTES;

                        bytes = JausUtils.addToBuffer(bytes, m_Data, pos, (int)m_Length, true);
                        pos  += (int)m_Length;
                    }
Ejemplo n.º 3
0
                    /*
                     * @param bytes buffer
                     * @param pos the position in the buffer
                     *
                     * Adds MessagePayload data to the buffer starting at the given position.
                     */
                    public void encode(byte[] bytes, int pos)
                    {
                        if (bytes == null)
                        {
                            return;
                        }

                        try
                        {
                            bytes = JausUtils.addToBuffer(bytes, BitConverter.GetBytes(m_Length), pos, INT_BYTES, false);
                            pos  += INT_BYTES;

                            bytes = JausUtils.addToBuffer(bytes, m_Data, pos, m_Length, true);
                            pos  += m_Length;
                        }
                        catch (Exception e)
                        {
                        }
                    }
Ejemplo n.º 4
0
                /*
                 * Wraps all of the data in the class into the buffer. The number of bytes
                 *  each item occupies is based on the objects size in the JSIDL schema.
                 */
                public void encode(byte[] bytes, int pos)
                {
                    if (bytes == null)
                    {
                        return;
                    }

                    bytes = JausUtils.addToBuffer(bytes, BitConverter.GetBytes(JausUtils.getPVint(m_PresenceVector)), pos, JausUtils.UINT_BYTES, false);
                    pos  += JausUtils.UINT_BYTES;

                    bytes = JausUtils.addToBuffer(bytes, BitConverter.GetBytes(m_DestSubsystemID), pos, JausUtils.USHORT_BYTES, false);
                    pos  += JausUtils.USHORT_BYTES;

                    bytes[pos] = m_DestComponentID;
                    pos       += JausUtils.BYTE_BYTES;

                    bytes[pos] = m_DestComponentID;
                    pos       += JausUtils.BYTE_BYTES;

                    if (isSrcSubsystemIDValid())
                    {
                        bytes = JausUtils.addToBuffer(bytes, BitConverter.GetBytes(m_SrcSubsystemID), pos, JausUtils.USHORT_BYTES, false);
                        pos  += JausUtils.USHORT_BYTES;
                    }

                    bytes[pos] = m_SrcComponentID;
                    pos       += JausUtils.BYTE_BYTES;

                    if (isSrcNodeIDValid())
                    {
                        bytes[pos] = m_SrcNodeID;
                        pos       += JausUtils.BYTE_BYTES;
                    }

                    m_MessagePayload.encode(bytes, pos);
                    pos += m_MessagePayload.getSize();
                }
Ejemplo n.º 5
0
                public void encode(byte[] bytes, int pos)
                {
                    if (bytes == null)
                    {
                        return;
                    }

                    // m_PresenceVector
                    bytes = JausUtils.addToBuffer(bytes, BitConverter.GetBytes(m_PresenceVector), pos, SHORT_BYTES, false);
                    pos  += SHORT_BYTES;

                    //m_ReliableDelivery
                    bytes = JausUtils.addToBuffer(bytes, BitConverter.GetBytes(m_ReliableDelivery), pos, SHORT_BYTES, false);
                    pos  += SHORT_BYTES;

                    //m_DestinationID
                    m_DestinationID.encode(bytes, pos);
                    pos += m_DestinationID.getSize();

                    //m_SourceID
                    if (checkPresenceVector(0))
                    {
                        m_SourceID.encode(bytes, pos);
                        pos += m_SourceID.getSize();
                    }

                    //m_Priority
                    if (checkPresenceVector(1))
                    {
                        bytes = JausUtils.addToBuffer(bytes, BitConverter.GetBytes(m_Priority), pos, SHORT_BYTES, false);
                        pos  += SHORT_BYTES;
                    }

                    m_MessagePayload.encode(bytes, pos);
                    pos += m_MessagePayload.getSize();
                }