public new object Clone()
 {
     PEQMessageNotify msg =
         new PEQMessageNotify(_DestinationID, _SenderID,
         _SequenceNumber, _SinkID, (PEQData)_Data.Clone());
     msg._nextHopCheat = _nextHopCheat;
     return msg;
 }
        private void processNotify(PEQMessageNotify msg)
        {
            if ((msg._SinkID == _id) && _isSink)
            {
                sendAck(msg);
                _dataReceived++;
                msg._Data._TotalDistance += msg._nextHopCheat.Distance(_location);
                if (_SINK_REPORTS)
                    Notify(GeneratePEQSinkInfoReport(_eventManager.CurrentClock - msg._Data._StartTime, msg));

                PEQDataInfoReport dataReport = new PEQDataInfoReport(this.ID, _eventManager.CurrentClock);
                dataReport._Received = 1;
                dataReport._DataID = msg._Data._DataID;
                Notify(dataReport);
            }
            else
            {
                // Find route to Sink
                foreach (PEQTableEntryRouting entry in _tableRouting)
                {
                    if ((entry._SinkID == msg._SinkID) && entry._Valid)
                    {
                        sendAck(msg);

                        sendNotify(entry, msg);
                    }
                }
            }
        }
        IInfoReport GeneratePEQSinkInfoReport(double elapsedTime, PEQMessageNotify notifyMessage)
        {
            PEQSinkInfoReport report = new PEQSinkInfoReport(_id.GetID(), _eventManager.CurrentClock,
                "PEQ_Sink", "PEQ Sink:");
            report._elapsedTime = elapsedTime;
            report._numHops = notifyMessage._Data._NumHops;
            report._totalDistance = notifyMessage._Data._TotalDistance;
            report.Loc = this.Location;

            return report;
        }
 private void processApplicationMessage(PEQMessageApplication msg)
 {
     msg._Data._StartTime = _eventManager.CurrentClock;
     foreach (PEQTableEntryRouting routeEntry in _tableRouting)
     //foreach (PEQTableEntrySubscription subEntry in _tableSubscription)
     {
         //if ((subEntry._CriteriaType == msg._Criteria.CriteriaType)
           //  && subEntry._Valid)
         if (routeEntry._Valid)
         {
             PEQMessageNotify notifyMsg = new PEQMessageNotify(_id, _id,
                 0x00, routeEntry._SinkID, msg._Data);
             notifyMsg._nextHopCheat = _location;
             processNotify(notifyMsg);
         }
     }
 }
        private void sendNotify(PEQTableEntryRouting Route, PEQMessageNotify msg)
        {
            PEQMessageNotify newMsg = (PEQMessageNotify)msg.Clone();
            newMsg._SenderID = _id;
            newMsg._SequenceNumber = _sequenceNumber++;
            newMsg._DestinationID = Route._DestinationID;
            newMsg._nextHopCheat = _location;
            newMsg._Data._NumHops++;
            newMsg._Data._TotalDistance += _location.Distance(msg._nextHopCheat);

            PEQTimerMessage timerEvent = new PEQTimerMessage(newMsg,
                _eventManager.CurrentClock + _TIMER_WAIT_SEND, this);
            _eventManager.AddEvent(timerEvent);
        }