~openwns-possum/openwns-wimac/changedProbeName

« back to all changes in this revision

Viewing changes to src/frame/TimingControl.hpp

  • Committer: Maciej Muehleisen
  • Date: 2009-05-15 09:53:12 UTC
  • Revision ID: mue@comnets.rwth-aachen.de-20090515095312-68hvhapb4nsuglon
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*******************************************************************************
 
2
 * This file is part of openWNS (open Wireless Network Simulator)
 
3
 * _____________________________________________________________________________
 
4
 *
 
5
 * Copyright (C) 2004-2009
 
6
 * Chair of Communication Networks (ComNets)
 
7
 * Kopernikusstr. 5, D-52074 Aachen, Germany
 
8
 * phone: ++49-241-80-27910,
 
9
 * fax: ++49-241-80-22242
 
10
 * email: info@openwns.org
 
11
 * www: http://www.openwns.org
 
12
 * _____________________________________________________________________________
 
13
 *
 
14
 * openWNS is free software; you can redistribute it and/or modify it under the
 
15
 * terms of the GNU Lesser General Public License version 2 as published by the
 
16
 * Free Software Foundation;
 
17
 *
 
18
 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
 
19
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 
20
 * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
 
21
 * details.
 
22
 *
 
23
 * You should have received a copy of the GNU Lesser General Public License
 
24
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
25
 *
 
26
 ******************************************************************************/
 
27
 
 
28
#ifndef WIMAC_FRAME_TIMINGCONTROL_H
 
29
#define WIMAC_FRAME_TIMINGCONTROL_H
 
30
 
 
31
#include <WNS/ldk/ldk.hpp>
 
32
#include <WNS/ldk/fcf/TimingControl.hpp>
 
33
#include <WNS/events/CanTimeout.hpp>
 
34
 
 
35
 
 
36
NAMESPACE_BEGIN(wns)
 
37
 
 
38
NAMESPACE_BEGIN(pyconfig)
 
39
 
 
40
class View;
 
41
 
 
42
NAMESPACE_END
 
43
 
 
44
NAMESPACE_BEGIN(ldk)
 
45
NAMESPACE_BEGIN(fcf)
 
46
 
 
47
class FrameBuilder;
 
48
class CompoundCollectorInterface;
 
49
 
 
50
NAMESPACE_END
 
51
NAMESPACE_END
 
52
NAMESPACE_END
 
53
 
 
54
NAMESPACE_BEGIN(wimac)
 
55
NAMESPACE_BEGIN(frame)
 
56
 
 
57
/**
 
58
 * @brief WiMAC specific Timing Control.
 
59
 *
 
60
 * The Timing Control of the WiMAC module introduces abstract Activations
 
61
 * to the Frame Configuration Framework. Each CompoundCollector is activated
 
62
 * by three different types of Activations (Start, StartCollection,     FinishCollection).
 
63
 * The Activations specify the concrete action the CompoundCollector has to perform.
 
64
 * The chronologically ordered list of Activations is created from (/defined by) the PyConig file.
 
65
 */
 
66
class TimingControl :
 
67
        public virtual wns::ldk::fcf::TimingControlInterface,
 
68
        public wns::events::PeriodicTimeout,
 
69
        public wns::events::CanTimeout
 
70
{
 
71
public:
 
72
 
 
73
        enum Activation {
 
74
                Start,
 
75
                StartCollection,
 
76
                FinishCollection,
 
77
                Pause
 
78
        };
 
79
 
 
80
        TimingControl( wns::ldk::fcf::FrameBuilder* fb, const wns::pyconfig::View& config );
 
81
 
 
82
        /// Inherited from TiminControlInterface
 
83
        void configure();
 
84
        void start();
 
85
        void pause();
 
86
        void stop();
 
87
        void getRole();
 
88
        void finishedPhase( wns::ldk::fcf::CompoundCollectorInterface* collector );
 
89
        wns::ldk::fcf::FrameBuilder* getFrameBuilder() const
 
90
        {
 
91
                return frameBuilder_;
 
92
        }
 
93
 
 
94
 
 
95
        /// Inherited from PeriodicTimeout
 
96
        void periodically();
 
97
 
 
98
        /// Inherited from CanTimeout
 
99
        void onTimeout();
 
100
 
 
101
        void onFUNCreated();
 
102
 
 
103
private:
 
104
        struct ActivationEntry
 
105
        {
 
106
                wns::ldk::fcf::CompoundCollectorInterface* compoundCollector;
 
107
                int mode;
 
108
                int action;
 
109
                double duration;
 
110
        };
 
111
        typedef std::list<ActivationEntry> Activations;
 
112
 
 
113
        void startProcessingActivations();
 
114
        void processOneActivation();
 
115
 
 
116
        /// cronologically ordered list of activations.
 
117
        /// For the modes sending and receiving a CompoundCollector has three
 
118
        /// Activations: startCollection, finishCollection, start
 
119
        /// For the mode pause only one activation is valid: pause
 
120
        Activations activations_;
 
121
        /// iterator through activations
 
122
        Activations::const_iterator activeCC_;
 
123
 
 
124
        /// iterator is used for validation only ( assure(timeoutIsForMe == activeCC_, ...) )
 
125
        //Activations::const_iterator timeoutIsForMe;
 
126
 
 
127
        wns::ldk::fcf::FrameBuilder* frameBuilder_;
 
128
 
 
129
        bool running_;
 
130
        wns::pyconfig::View config_;
 
131
 
 
132
        simTimeType frameStartupDelay_;
 
133
 
 
134
        friend class TriggerActivationStart;
 
135
};
 
136
 
 
137
NAMESPACE_END
 
138
NAMESPACE_END
 
139
 
 
140
#endif
 
141