author | wimpie <wimpie> | 2004-04-02 18:29:49 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-02 18:29:49 (UTC) |
commit | 5334b639c9f97793bcae4f50f7b47c7a2ada4e2f (patch) (unidiff) | |
tree | f55aebd4314ab878bc39b6b08b8323a8ef78d803 /noncore/settings/networksettings2/profile/profilerun.cpp | |
parent | 7c8922b37b5bb7696c0ff2cbc999e2936b9b509f (diff) | |
download | opie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.zip opie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.tar.gz opie-5334b639c9f97793bcae4f50f7b47c7a2ada4e2f.tar.bz2 |
First import of NS2 app
Diffstat (limited to 'noncore/settings/networksettings2/profile/profilerun.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/profile/profilerun.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/profile/profilerun.cpp b/noncore/settings/networksettings2/profile/profilerun.cpp new file mode 100644 index 0000000..90c37ed --- a/dev/null +++ b/noncore/settings/networksettings2/profile/profilerun.cpp | |||
@@ -0,0 +1,67 @@ | |||
1 | #include <resources.h> | ||
2 | |||
3 | #include "profilerun.h" | ||
4 | |||
5 | void ProfileRun::detectState( NodeCollection * NC ) { | ||
6 | if( Data->Disabled ) { | ||
7 | NC->setCurrentState( Disabled ); | ||
8 | } else { | ||
9 | // find next item in connection | ||
10 | // convert to runtime and ask to detect the state | ||
11 | netNode()->nextNode()->runtime()->detectState( NC ); | ||
12 | } | ||
13 | } | ||
14 | |||
15 | bool ProfileRun::setState( NodeCollection * NC, Action_t A ) { | ||
16 | ANetNodeInstance * NNNI; | ||
17 | |||
18 | NNNI = netNode()->nextNode(); | ||
19 | switch ( A ) { | ||
20 | case Enable : | ||
21 | if( NC->currentState() == Disabled ) { | ||
22 | NC->setCurrentState( Off ); // at least | ||
23 | // ... but request deeper | ||
24 | NNNI->runtime()->detectState(NC); | ||
25 | return 1; | ||
26 | } | ||
27 | return 1; | ||
28 | case Disable : | ||
29 | if( NC->currentState() == IsUp ) { | ||
30 | // bring down -> make available | ||
31 | NNNI->runtime()->setState(NC, Down); | ||
32 | } | ||
33 | if( NC->currentState() == Available ) { | ||
34 | // make unavailable | ||
35 | NNNI->runtime()->setState(NC, Deactivate); | ||
36 | } | ||
37 | if( NC->currentState() > Available ) { | ||
38 | // could not disable | ||
39 | return 0; | ||
40 | } | ||
41 | NC->setCurrentState( Disabled ); | ||
42 | return 1; | ||
43 | default : | ||
44 | break; | ||
45 | } | ||
46 | return NNNI->runtime()->setState(NC, A); | ||
47 | } | ||
48 | |||
49 | bool ProfileRun::canSetState( State_t Curr, Action_t A ) { | ||
50 | RuntimeInfo * RI; | ||
51 | switch ( A ) { | ||
52 | case Enable : | ||
53 | case Disable : | ||
54 | // always possible | ||
55 | return 1; | ||
56 | default : | ||
57 | break; | ||
58 | } | ||
59 | RI = netNode()->nextNode()->runtime(); | ||
60 | return ( Curr != Disabled ) ? | ||
61 | RI->canSetState(Curr, A) : 0; | ||
62 | } | ||
63 | |||
64 | bool ProfileRun::handlesInterface( const QString & S ) { | ||
65 | // donno -> pass deeper | ||
66 | return netNode()->nextNode()->runtime()->handlesInterface(S); | ||
67 | } | ||