Esempio n. 1
0
        /// <summary>
        /// Send to parent, if any
        /// </summary>
        /// <remarks>
        /// User should first check if IsParent is true and only then invoke this method.
        /// </remarks>
        /// <param name="mac"></param>
        /// <param name="msgBytes"></param>
        /// <param name="length"></param>
        /// <returns></returns>
        public static ushort SendToParent(MACPipe mac, byte[] msgBytes, int length)
        {
            // If in a reset, do not forward
            if (RoutingGlobal._color == Color.Red)
            {
#if DBG_VERBOSE
                Debug.Print("\tIn a Reset wave... not forwarded");
#endif
                return(999);
            }
            ushort index = mac.EnqueueToSend(_parent, msgBytes, 0, (ushort)length);
            return(mac.IsMsgIDValid(index) ? index : (ushort)999);
        }
Esempio n. 2
0
        public static ushort SendToChild(MACPipe mac, ushort destination, byte[] msgBytes, int length)
        {
            ushort next_neighbor = RoutingGlobal.GetChild(destination);

            // If in a reset, do not forward
            if (RoutingGlobal._color == Color.Red)
            {
#if DBG_VERBOSE
                Debug.Print("\tIn a Reset wave... not forwarded");
#endif
                return(999);
            }

            ushort index = mac.EnqueueToSend(next_neighbor, msgBytes, 0, (ushort)length);
            return(mac.IsMsgIDValid(index) ? index : (ushort)999);
        }