author | wimpie <wimpie> | 2004-04-02 18:29:49 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-02 18:29:49 (UTC) |
commit | 5334b639c9f97793bcae4f50f7b47c7a2ada4e2f (patch) (side-by-side diff) | |
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) (show 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 @@ +#include <resources.h> + +#include "profilerun.h" + +void ProfileRun::detectState( NodeCollection * NC ) { + if( Data->Disabled ) { + NC->setCurrentState( Disabled ); + } else { + // find next item in connection + // convert to runtime and ask to detect the state + netNode()->nextNode()->runtime()->detectState( NC ); + } +} + +bool ProfileRun::setState( NodeCollection * NC, Action_t A ) { + ANetNodeInstance * NNNI; + + NNNI = netNode()->nextNode(); + switch ( A ) { + case Enable : + if( NC->currentState() == Disabled ) { + NC->setCurrentState( Off ); // at least + // ... but request deeper + NNNI->runtime()->detectState(NC); + return 1; + } + return 1; + case Disable : + if( NC->currentState() == IsUp ) { + // bring down -> make available + NNNI->runtime()->setState(NC, Down); + } + if( NC->currentState() == Available ) { + // make unavailable + NNNI->runtime()->setState(NC, Deactivate); + } + if( NC->currentState() > Available ) { + // could not disable + return 0; + } + NC->setCurrentState( Disabled ); + return 1; + default : + break; + } + return NNNI->runtime()->setState(NC, A); +} + +bool ProfileRun::canSetState( State_t Curr, Action_t A ) { + RuntimeInfo * RI; + switch ( A ) { + case Enable : + case Disable : + // always possible + return 1; + default : + break; + } + RI = netNode()->nextNode()->runtime(); + return ( Curr != Disabled ) ? + RI->canSetState(Curr, A) : 0; +} + +bool ProfileRun::handlesInterface( const QString & S ) { + // donno -> pass deeper + return netNode()->nextNode()->runtime()->handlesInterface(S); +} |