Public Member Functions | Private Member Functions | Private Attributes

wosh::bundles::ModemDslBundle Class Reference
[WOSH Bundles]

Represent a generic DSL Modem on POSIX systems. Designed for PPPoE driver (based on pppstats). More...

#include <H:/WOSH/win32_vc2010/src/bundles/ModemDsl/ModemDslBundle.h>

List of all members.

Public Member Functions

 ModemDslBundle (const std::string &name="")
 Empty constructor, init bundle and vars, Properties and Methods.
virtual ~ModemDslBundle ()
 Empty destructor, may (synch) stop bundle and internal threads when still running.
void busMessage (const Message &message, const Bus *source)
 Method raised by the Bus when it processes a new message. Implementations will probably analyze the message and perform actions.
Modem Interface
WRESULT connect (const std::string &params="")
 Connect modem. Raise Fact when connected.
WRESULT disconnect ()
 Disconnect modem. Raise Fact when disconnected.
WRESULT reconnect ()
 Reconnect modem. Raise Fact when connected.
WRESULT checkConnected ()
 Force connection check. Raise Fact when connection state changed.
WRESULT resetStats ()
 Force stats reset.
wosh::interfaces::network::CONNECTION_STATE getConnectionState () const
 Evaluate connection's state. Implemented by inherited classes.
Getters
long getRefreshFrequency () const
 Get period of refresh loop.
std::string getPingCheckAddress () const
 Get address used while checking connection through ping.
std::string getCtrlScript () const
 Get full path of support script, used to control the modem.
std::string getPppInterface () const
 Get POSIX interface associated with connection.
Modem Events
void modem_ConnectionState (ModemDslImpl *modem, wosh::interfaces::network::CONNECTION_STATE state)
 Callback event, called when connection status changes.
void modem_StatsUpdate (ModemDslImpl *modem, const pppStats &stats)
 Callback event, called periodically when stats have been updated.
Thread Events
void thread_event (Thread::THREAD_STATE thread_event, Thread *thread_source)

Protected Member Functions

Internal methods
void setConnectionState (wosh::interfaces::network::CONNECTION_STATE state, int raiseEvent=1)
 Update Connection State of Modem, internal var and Property. Also may raise Device event.

Private Member Functions

ResponsemmDoConnect (const Request *request)
 Connect method, accept connection parameters as (first) argument.
ResponsemmDoForceState (const Request *request)
 Force-State method, forces current Modem-Connection state to passed value (CONNECTION_STATE as string)
ResponsemmDoCheckConnected (const Request *request)
 Check-Connected method, force connection-check (using script)

Private Attributes

BusConnector BusDevices
 register myself & work as Device too
ModemDslImplmodemWorker
 real implementation
wosh::interfaces::network::CONNECTION_STATE connState
 current state of the modem

Detailed Description

Represent a generic DSL Modem on POSIX systems. Designed for PPPoE driver (based on pppstats).

Works as Bundle and register itself as Device. Offers live (auto-refreshed) properties (stats).

Real implementation is class ModemDslImpl, most are just a proxy to that internal object.

See also:
wosh::interfaces::network::ModemDsl
Version:
0.8.527
Id:
ModemDslBundle.h 3775 2011-01-01 16:38:17Z alex
Author:
Alessandro Polo
Date:
Released on 2009-06-04

Definition at line 69 of file ModemDslBundle.h.


Constructor & Destructor Documentation

wosh::bundles::ModemDslBundle::ModemDslBundle ( const std::string &  name = "" )

Empty constructor, init bundle and vars, Properties and Methods.

Parameters:
name[in] optional name of the bundle

Definition at line 46 of file ModemDslBundle.cpp.

References disconnect(), wosh::LOG_DEBUG, mmDoCheckConnected(), mmDoConnect(), wosh::Permission::Read, reconnect(), and wosh::Permission::RX.

wosh::bundles::ModemDslBundle::~ModemDslBundle (  ) [virtual]

Empty destructor, may (synch) stop bundle and internal threads when still running.

Definition at line 118 of file ModemDslBundle.cpp.


Member Function Documentation

void wosh::bundles::ModemDslBundle::busMessage ( const Message message,
const Bus source 
) [virtual]

Method raised by the Bus when it processes a new message. Implementations will probably analyze the message and perform actions.

Parameters:
[in]messagethe incoming message
[in]sourcethe source Bus of the incoming message
Warning:
The current thread is own and managed by the caller Bus. Heavy, dangerous or time expensive operations should be executed asynchronously and not inline!

Reimplemented from wosh::BundleGeneric.

Definition at line 190 of file ModemDslBundle.cpp.

References wosh::BundleGeneric::Log, wosh::SystemInfo::MODE_PERMANENT, and wosh::SystemInfo::SCOPE_SYSTEM.

WRESULT wosh::bundles::ModemDslBundle::checkConnected (  ) [virtual]

Force connection check. Raise Fact when connection state changed.

Returns:
WRET_ERR_INTERNAL if something went wrong; WRET_OK if check was successful.

Implements wosh::interfaces::network::Modem.

Definition at line 300 of file ModemDslBundle.cpp.

WRESULT wosh::bundles::ModemDslBundle::connect ( const std::string &  params = "" ) [virtual]

Connect modem. Raise Fact when connected.

Parameters:
params[in] Connection parameters (when required)
Returns:
WRET_ERR_INTERNAL if something went wrong; WRET_OK is modem has been disconnected.

Implements wosh::interfaces::network::Modem.

Definition at line 297 of file ModemDslBundle.cpp.

Referenced by mmDoCheckConnected().

WRESULT wosh::bundles::ModemDslBundle::disconnect (  ) [virtual]

Disconnect modem. Raise Fact when disconnected.

Returns:
WRET_ERR_INTERNAL if something went wrong; WRET_OK is modem has been disconnected.

Implements wosh::interfaces::network::Modem.

Definition at line 298 of file ModemDslBundle.cpp.

Referenced by ModemDslBundle().

wosh::interfaces::network::CONNECTION_STATE wosh::bundles::ModemDslBundle::getConnectionState (  ) const [inline, virtual]

Evaluate connection's state. Implemented by inherited classes.

Returns:
the current state of the connection

Implements wosh::interfaces::network::Modem.

Definition at line 133 of file ModemDslBundle.h.

References connState.

std::string wosh::bundles::ModemDslBundle::getCtrlScript (  ) const

Get full path of support script, used to control the modem.

Returns:
full path of script (example: bin/scripts/dslmodem.sh)

Definition at line 305 of file ModemDslBundle.cpp.

std::string wosh::bundles::ModemDslBundle::getPingCheckAddress (  ) const

Get address used while checking connection through ping.

Returns:
IPv4 or hostname address (example: www.google.com)

Definition at line 304 of file ModemDslBundle.cpp.

std::string wosh::bundles::ModemDslBundle::getPppInterface (  ) const

Get POSIX interface associated with connection.

Returns:
interface name (example: ppp0)

Definition at line 306 of file ModemDslBundle.cpp.

long wosh::bundles::ModemDslBundle::getRefreshFrequency (  ) const

Get period of refresh loop.

Returns:
refresh period in seconds

Definition at line 303 of file ModemDslBundle.cpp.

Response * wosh::bundles::ModemDslBundle::mmDoCheckConnected ( const Request request ) [private]

Check-Connected method, force connection-check (using script)

Parameters:
request[in] the Request representation
Returns:
standard WRESULT return value and connection state as response's data
Note:
method calls directly the bash support script, by default it pings an address
See also:
_ModemDsl_KEY_PingCheckAddress

Definition at line 378 of file ModemDslBundle.cpp.

References connect(), wosh::Request::getArgument(), wosh::interfaces::network::Modem::getConnectionStateAsString(), wosh::BundleGeneric::Log, wosh::LOG_VERBOSE, and wosh::Request::replyResponse().

Referenced by ModemDslBundle().

Response * wosh::bundles::ModemDslBundle::mmDoConnect ( const Request request ) [private]

Connect method, accept connection parameters as (first) argument.

Parameters:
request[in] the Request representation
Returns:
standard WRESULT return value and connection state as response's data

Definition at line 367 of file ModemDslBundle.cpp.

Referenced by ModemDslBundle().

Response * wosh::bundles::ModemDslBundle::mmDoForceState ( const Request request ) [private]

Force-State method, forces current Modem-Connection state to passed value (CONNECTION_STATE as string)

Parameters:
request[in] the Request representation
Returns:
standard WRESULT return value and connection state as response's data

Definition at line 388 of file ModemDslBundle.cpp.

void wosh::bundles::ModemDslBundle::modem_ConnectionState ( ModemDslImpl modem,
wosh::interfaces::network::CONNECTION_STATE  state 
) [virtual]

Callback event, called when connection status changes.

Parameters:
modem[out] the ModemDsl instance which raise the event
state[in] the new connection state
See also:
ModemDsl::connect()
ModemDsl::disconnect()
ModemDsl::reconnect()
ModemDsl::checkConnected()

Implements IModemDslListener.

Definition at line 290 of file ModemDslBundle.cpp.

References wosh::BundleGeneric::Properties.

void wosh::bundles::ModemDslBundle::modem_StatsUpdate ( ModemDslImpl modem,
const pppStats &  stats 
) [virtual]

Callback event, called periodically when stats have been updated.

Parameters:
modem[out] the ModemDsl instance which raise the event
stats[out] last available stats (points to internal reference)
See also:
autoRefreshFrequency

Implements IModemDslListener.

Definition at line 310 of file ModemDslBundle.cpp.

References ModemDslImpl::connect(), and modemWorker.

WRESULT wosh::bundles::ModemDslBundle::reconnect (  ) [virtual]

Reconnect modem. Raise Fact when connected.

Returns:
WRET_ERR_INTERNAL if something went wrong; WRET_OK is modem has been disconnected.

Implements wosh::interfaces::network::Modem.

Definition at line 299 of file ModemDslBundle.cpp.

Referenced by ModemDslBundle().

WRESULT wosh::bundles::ModemDslBundle::resetStats (  ) [virtual]

Force stats reset.

Returns:
WRET_NOT_IMPLEMENTED or WRET_ERR_ILLEGAL_USE if feature is not available; WRET_ERR_INTERNAL if something went wrong; WRET_OK if check was successful.

Implements wosh::interfaces::network::Modem.

Definition at line 302 of file ModemDslBundle.cpp.

void wosh::bundles::ModemDslBundle::setConnectionState ( wosh::interfaces::network::CONNECTION_STATE  state,
int  raiseEvent = 1 
) [protected]

Update Connection State of Modem, internal var and Property. Also may raise Device event.

Parameters:
state[in] the new connection's state
raiseEvent[in] pick if/how raise Device Event. '0' won't raise event; '2' will always raise event; '1' will raise event only if connection's state changed. Event message (Fact) contains CONNECTION_STATE as string.

Definition at line 223 of file ModemDslBundle.cpp.


Member Data Documentation

register myself & work as Device too

Definition at line 211 of file ModemDslBundle.h.

wosh::interfaces::network::CONNECTION_STATE wosh::bundles::ModemDslBundle::connState [private]

current state of the modem

Definition at line 213 of file ModemDslBundle.h.

Referenced by getConnectionState().

real implementation

Definition at line 212 of file ModemDslBundle.h.

Referenced by modem_StatsUpdate().


The documentation for this class was generated from the following files:

Generated on Tue Feb 8 2011 09:33:36 for WOSH system 0.8.888 [wolf] by Alessandro Polo, using DoxyGen 1.7.2 hosted by WOSH Framework