Esempio n. 1
0
                /*
                 *
                 * @param pv the numeric representation of a bitset.
                 *
                 */
                public void setPresenceVector(int pv)
                {
                    //m_PresenceVector = JausUtils.setPV(pv);
                    BitArray tmp = JausUtils.setPV((uint)m_PresenceVector);

                    tmp.Set(pv, true);
                    m_PresenceVector = (short)JausUtils.getPVint(tmp);
                }
Esempio n. 2
0
 /*
  * @param bytes the container of bytes to be sent.
  * @param pos the position in the buffer to begin encoding.
  *
  * Wraps the DestinationID into the byte 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(m_SubFields), pos, INT_BYTES, false);
     pos  += INT_BYTES;
 }
Esempio n. 3
0
                    /*
                     * @param bytes the container of bytes to be decoded.
                     * @param pos the position in the buffer to begin decoding.
                     *
                     * Pulls the DestinationID from the byte buffer.The number of bytes
                     *  each item occupies is based on the objects size in the JSIDL schema.
                     */
                    public void decode(byte[] bytes, int pos)
                    {
                        if (bytes == null)
                        {
                            return;
                        }


                        m_SubFields = BitConverter.ToUInt32(JausUtils.getFromBuffer(bytes, pos, INT_BYTES, false), 0);
                        pos        += INT_BYTES;
                    }
Esempio n. 4
0
 /*
  *
  */
 public SendRec(SendRec value)
 {
     m_PresenceVector  = JausUtils.setPV(value.getPresenceVector());
     m_DestSubsystemID = value.getDestSubsystemID();
     m_DestNodeID      = value.getDestNodeID();
     m_DestComponentID = value.getDestComponentID();
     m_SrcSubsystemID  = value.getSrcSubsystemID();
     m_SrcNodeID       = value.getSrcNodeID();
     m_SrcComponentID  = value.getSrcComponentID();
     m_Priority        = value.getPriority();
     m_MessagePayload.setAs(value.getMessagePayload());
 }
Esempio n. 5
0
                    /*
                     * Removes the MessagePayload data from the given buffer.
                     *
                     */
                    public void decode(byte[] bytes, int pos)
                    {
                        if (bytes == null)
                        {
                            return;
                        }
                        m_Length = BitConverter.ToUInt32(JausUtils.getFromBuffer(bytes, pos, JausUtils.UINT_BYTES, false), 0);
                        pos     += JausUtils.UINT_BYTES;

                        m_Data = JausUtils.getFromBuffer(bytes, pos, (int)m_Length, true);
                        pos   += JausUtils.UINT_BYTES;
                    }
Esempio n. 6
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;
                }
Esempio n. 7
0
                    /*
                     * Pulls the correct bits out of m_SubFields, then converts
                     *  them into a long.
                     * @return the value of the subsystem node ID.
                     */
                    public long getSubsystemID()
                    {
                        BitArray bfbs = JausUtils.setPV(m_SubFields);
                        BitArray sfbs = new BitArray(16);
                        int      i    = 0;

                        for (int index = 16; index <= 31; index++)
                        {
                            sfbs.Set(i++, bfbs.Get(index));
                        }

                        return(JausUtils.getPVint(sfbs));
                    }
Esempio n. 8
0
                    /*
                     * Pulls the correct bits out of m_SubFields, then converts
                     *  them into a long.
                     * @return the value of the destination node ID.
                     */
                    public long getNodeID()
                    {
                        BitArray bfbs = JausUtils.setPV(m_SubFields);
                        BitArray sfbs = new BitArray(8);
                        int      i    = 0;

                        for (int index = 8; index <= 15; index++)
                        {
                            sfbs.Set(i++, bfbs.Get(index));
                        }

                        return(JausUtils.getPVint(sfbs));
                    }
Esempio n. 9
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;
                    }
Esempio n. 10
0
                    /*
                     * Pulls the correct bits out of m_SubFields, then converts
                     *  them into a long.
                     * @return the value of the destination component ID.
                     */
                    public uint getComponentID()
                    {
                        BitArray bfbs = JausUtils.setPV(m_SubFields);
                        BitArray sfbs = new BitArray(8);
                        int      i    = 0;

                        for (int index = 0; index <= 7; index++)
                        {
                            sfbs.Set(i++, bfbs.Get(index));
                        }

                        return(JausUtils.getPVint(sfbs));
                    }
Esempio n. 11
0
                /*
                 *  Removes the necessary data from the buffer begining at the given position.
                 */
                public void decode(byte[] bytes, int pos)
                {
                    if (bytes == null)
                    {
                        return;
                    }
                    m_SrcSubsystemID = BitConverter.ToUInt16(JausUtils.getFromBuffer(bytes, pos, JausUtils.USHORT_BYTES, false), 0);
                    pos += JausUtils.USHORT_BYTES;

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

                    m_SrcComponentID = bytes[pos];
                    pos += JausUtils.BYTE_BYTES;
                }
Esempio n. 12
0
                    /*
                     * Converts the value of the component ID into a BitSet, then
                     *  adds it to m_SubFields.
                     * @param the value of the destination component ID.
                     */
                    public void setComponentID(uint value)
                    {
                        if ((value >= 1) && (value <= 225))
                        {
                            BitArray bfbs = JausUtils.setPV(m_SubFields);
                            BitArray sfbs = JausUtils.setPV(value);
                            int      i    = 0;

                            for (int index = 0; index <= 7; index++)
                            {
                                bfbs.Set(index, sfbs.Get(i++));
                            }

                            m_SubFields = JausUtils.getPVint(bfbs);
                        }
                    }
Esempio n. 13
0
                    /*
                     * Converts the value of the subsystem ID into a BitSet, then
                     *  adds it to m_SubFields.
                     * @param the value of the destination subsystem ID.
                     */
                    public void setSubsystemID(uint value)
                    {
                        if ((value >= 1) && (value <= 65535))
                        {
                            BitArray bfbs = JausUtils.setPV(m_SubFields);
                            BitArray sfbs = JausUtils.setPV(value);
                            int      i    = 0;

                            for (int index = 16; index <= 31; index++)
                            {
                                bfbs.Set(index, sfbs.Get(i++));
                            }

                            m_SubFields = JausUtils.getPVint(bfbs);
                        }
                    }
Esempio n. 14
0
                    /*
                     * @param bytes buffer
                     * @param pos the current position in the buffer
                     *
                     * Removes the MessagePayload data from the buffer starting at the given position.
                     */
                    public void decode(byte[] bytes, int pos)
                    {
                        if (bytes == null)
                        {
                            return;
                        }

                        try
                        {
                            m_Length = BitConverter.ToInt32(JausUtils.getFromBuffer(bytes, pos, INT_BYTES, false), 0);
                            pos     += JausUtils.getNumBytes("int");

                            m_Data = JausUtils.getFromBuffer(bytes, pos, m_Length, true);
                            pos   += m_Length;
                        }
                        catch (Exception e)
                        {
                        }
                    }
Esempio n. 15
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)
                        {
                        }
                    }
Esempio n. 16
0
                /*
                 * Retrieves all of the data in the class from the buffer. The number of bytes
                 *  each item occupies is based on the objects size in the JSIDL schema.
                 */
                public void decode(byte[] bytes, int pos)
                {
                    if (bytes == null)
                    {
                        return;
                    }

                    m_PresenceVector = JausUtils.setPV(BitConverter.ToUInt32(JausUtils.getFromBuffer(bytes, pos, JausUtils.ULONG_BYTES, false), 0));
                    pos += JausUtils.UINT_BYTES;

                    m_DestSubsystemID = BitConverter.ToUInt16(JausUtils.getFromBuffer(bytes, pos, JausUtils.USHORT_BYTES, false), 0);
                    pos += JausUtils.USHORT_BYTES;

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

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

                    if (isSrcSubsystemIDValid())
                    {
                        m_SrcSubsystemID = BitConverter.ToUInt16(JausUtils.getFromBuffer(bytes, pos, JausUtils.USHORT_BYTES, false), 0);
                        pos += JausUtils.USHORT_BYTES;
                    }
                    if (isSrcNodeIDValid())
                    {
                        m_SrcNodeID = bytes[pos];
                        pos        += JausUtils.BYTE_BYTES;
                    }
                    if (isPriorityValid())
                    {
                        m_Priority = bytes[pos];
                        pos       += JausUtils.BYTE_BYTES;
                    }

                    m_MessagePayload.decode(bytes, pos);
                    pos += m_MessagePayload.getSize();
                }
Esempio n. 17
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();
                }
Esempio n. 18
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();
                }
Esempio n. 19
0
                public void decode(byte[] bytes, int pos)
                {
                    if (bytes == null)
                    {
                        return;
                    }

                    // m_PresenceVector
                    m_PresenceVector = BitConverter.ToInt16(JausUtils.getFromBuffer(bytes, pos, SHORT_BYTES, false), 0);
                    pos += SHORT_BYTES;

                    //m_ReliableDelivery
                    m_ReliableDelivery = BitConverter.ToInt16(JausUtils.getFromBuffer(bytes, pos, SHORT_BYTES, false), 0);
                    pos += SHORT_BYTES;

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

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

                    //m_Priority
                    if (checkPresenceVector(1))
                    {
                        m_ReliableDelivery = BitConverter.ToInt16(JausUtils.getFromBuffer(bytes, pos, SHORT_BYTES, false), 0);
                        pos += SHORT_BYTES;
                    }

                    m_MessagePayload.decode(bytes, pos);
                    pos += m_MessagePayload.getSize();
                }
Esempio n. 20
0
 /*
  * get presence vector from the given integer representatio
  */
 public uint getPresenceVector()
 {
     return(JausUtils.getPVint(m_PresenceVector));
 }
Esempio n. 21
0
 /*
  * @param index the index of the presence vector to check.
  * @return the bool value of the presence vector at the index.
  *
  */
 public bool checkPresenceVector(int index)
 {
     return(JausUtils.setPV((uint)m_PresenceVector).Get(index));
 }