Dear list,
I am trying to implement my own Decider. I created a network following
[2] and created MyDecider following the (outdated?) steps from [1].
- Declare the network MyNetwork subclassing BaseNetwork including the
the hosts
- MyHost which extend org.mixim.modules.node.WirelessNode and overwrite
the default parameter nicType using "MyNic"
- MyNic which extends Nic80211 and sets the parameter phyType to
default("mynetwork.MyPhyLayer")
- MyPhyLayer which extends org.mixim.modules.phy.PhyLayer and the
parameter @class(MyPhyLayer) which is able to initialize MyDecider and
ThresholdDecider.
MyDecider.cc extends Decider (and is based on ThresholdDecider) and
currently looks as follows:
> simtime_t MyDecider::processSignal(airframe_ptr_t frame)
> {
> Signal* signal = &frame->getSignal();
> std::map<Signal*, int>::iterator it = currentSignals.find(signal);
> if(it == currentSignals.end()) {
> return processSignalStart(frame);
> }
> else {
> return processSignalEnd(frame);
> }
> }
>
> simtime_t MyDecider::processSignalStart(airframe_ptr_t frame)
> {
> Signal *signal = &frame->getSignal();
> currentSignals[signal] = 1;
> simtime_t start = signal->getReceptionStart();
> return start + signal->getDuration();
> }
>
> simtime_t MyDecider::processSignalEnd(airframe_ptr_t frame)
> {
> phy->sendUp(frame, new DeciderResult(true));
> Signal *signal = &frame->getSignal();
> currentSignals.erase(signal);
> return notAgain;
> }
>
> ChannelState MyDecider::getChannelState() const {
> /* Here is the problem: Returning ChannelState(true) results in
> the error mentioned below */
> return ChannelState(true);
> }
>
> simtime_t MyDecider::handleChannelSenseRequest(ChannelSenseRequest*) {
> return notAgain;
> }
So the channel is always idle and any frame can be received.
The error I get is:
> <!> Error in module (Mac80211) MyNetwork.node[4].nic.mac (id=42) at
> event #10, t=3.373961616307: send()/sendDelayed(): cannot send message
> (ChannelSenseRequest)contention, it is currently contained/owned by
> (MyPhyLayer)MyNetwork.node[4].nic.phy.
The callstack is:
BaseLayer::sendControlDown()
Mac80211::senseChannelWhileIdle()
Mac80211::beginNewCycle()
I am failing to understand the error message, can anyone point me in the
right direction?
Regards
Daniel
[1]
http://sourceforge.net/apps/trac/mixim/wiki/HowToWriteOwnDecider
[2]
http://sourceforge.net/apps/trac/mixim/wiki/StepByStep