PikeAero::CTaskConsolePacket Class Reference

The packetized console object. More...

#include <ctaskconsolepacket.h>

Inheritance diagram for PikeAero::CTaskConsolePacket:

Inheritance graph
[legend]
Collaboration diagram for PikeAero::CTaskConsolePacket:

Collaboration graph
[legend]

Public Member Functions

 CTaskConsolePacket (CCommunication *comm)
virtual void event (CEvent *e)
 Receive a software event.
virtual CMachine::bit32 fault ()
 The CTaskScheduler will call the fault() method when a fault code was returned by any of the task's other methods.
virtual CMachine::bit32 init ()
 Called exactly once. perform task initialization such as initializing private variable. other tasks are not guaranteed so do not interract with other tasks at this stage.
virtual const char * name ()
virtual CMachine::bit32 run ()
 Called periodically by CTaskScheduler to do a piece of work.
virtual CMachine::bit32 start ()
 Called exactly once. all tasks are initialized at this point. called just prior to first call to run().
virtual CMachine::bit32 stop ()
 The CTaskScheduler will call the stop() method after the task was scheduled for cancelation.
virtual ~CTaskConsolePacket ()

Protected Member Functions

CCommandHandlercommandHandler ()
CMachine::bit32 execute (CString *command)
 Execute a command.
virtual void monitor ()

Private Attributes

CCommandHandlermCommandHandler

Detailed Description

The packetized console object.

Author:
Michael Sharkey <mike@pikeaero.com>

Definition at line 32 of file ctaskconsolepacket.h.


Constructor & Destructor Documentation

PikeAero::CTaskConsolePacket::CTaskConsolePacket ( CCommunication comm  ) 

Definition at line 29 of file ctaskconsolepacket.cpp.

00030  : inherited(comm)
00031  , mCommandHandler(NULL)
00032 {
00033 }

PikeAero::CTaskConsolePacket::~CTaskConsolePacket (  )  [virtual]

Definition at line 36 of file ctaskconsolepacket.cpp.

References mCommandHandler.

00037 {
00038     if ( mCommandHandler != NULL )
00039     {
00040         delete mCommandHandler;
00041         mCommandHandler = NULL;
00042     }
00043 }


Member Function Documentation

CCommandHandler* PikeAero::CTaskConsolePacket::commandHandler (  )  [inline, protected]

Definition at line 71 of file ctaskconsolepacket.h.

References mCommandHandler.

Referenced by execute().

00071 {return mCommandHandler;}

Here is the caller graph for this function:

void PikeAero::CTaskConsolePacket::event ( CEvent e  )  [virtual]

Receive a software event.

Reimplemented from PikeAero::CTaskConsoleBase.

Definition at line 145 of file ctaskconsolepacket.cpp.

00146 {
00147     inherited::event(e);
00148 }

CMachine::bit32 PikeAero::CTaskConsolePacket::execute ( CString command  )  [protected]

Execute a command.

Delete the argument string objects...

Reimplemented from PikeAero::CTaskConsoleBase.

Definition at line 153 of file ctaskconsolepacket.cpp.

References PikeAero::CArray< T >::at(), commandHandler(), PikeAero::CArray< T >::count(), PikeAero::CCommandHandler::execute(), and PikeAero::CString::explode().

Referenced by run().

00154 {
00155     CArray<CString*> argv = command->explode(':');
00156     CMachine::bit32 rc = commandHandler()->execute(argv);
00157 
00158     /**
00159     ** Delete the argument string objects...
00160     */
00161     for ( CMachine::ubit32 i = 0; i < argv.count(); i++ )
00162     {
00163         CString* str = argv.at(i);
00164         delete str;
00165     }
00166     return rc;
00167 }

Here is the call graph for this function:

Here is the caller graph for this function:

CMachine::bit32 PikeAero::CTaskConsolePacket::fault (  )  [virtual]

The CTaskScheduler will call the fault() method when a fault code was returned by any of the task's other methods.

Returns:
0 on success.

Reimplemented from PikeAero::CTaskConsoleBase.

Definition at line 110 of file ctaskconsolepacket.cpp.

References stop().

00111 {
00112     return inherited::stop();
00113 }

Here is the call graph for this function:

CMachine::bit32 PikeAero::CTaskConsolePacket::init (  )  [virtual]

Called exactly once. perform task initialization such as initializing private variable. other tasks are not guaranteed so do not interract with other tasks at this stage.

called exactly once. perform task initialization such as initializing private variable other tasks are not guaranteed so do not interract with other tasks at this stage.

Returns:
0 on success.

Reimplemented from PikeAero::CTaskConsoleBase.

Definition at line 49 of file ctaskconsolepacket.cpp.

00050 {
00051     return inherited::init();
00052 }

void PikeAero::CTaskConsolePacket::monitor (  )  [protected, virtual]

FIXME - move all this stuff to CStatistics class and reply on demand only

FIXME - move all this stuff to CStatistics class and reply on demand only

Reimplemented from PikeAero::CTaskConsoleBase.

Definition at line 115 of file ctaskconsolepacket.cpp.

References PikeAero::CTaskConsoleBase::aggregator(), PikeAero::CMemHeap::available(), PikeAero::CMemHeap::bottom(), PikeAero::CTaskTerminal::comm(), PikeAero::CTaskScheduler::count(), PikeAero::CTaskConsoleBase::mAggregator, PikeAero::CString::sprintf(), stackPointer, stackTop, PikeAero::CMemHeap::top(), PikeAero::CCommunication::tx(), and PikeAero::CMemHeap::used().

00116 {
00117     if ( mAggregator != NULL )
00118     {
00119         CString str;
00120         comm()->tx("RPY");
00121 
00122         CMachine::ubit32 taskCount = CTaskScheduler::count();
00123         CMachine::ubit32 top = stackTop();
00124         CMachine::ubit32 ptr = stackPointer();
00125 
00126         /** FIXME - move all this stuff to CStatistics class and reply on demand only  */
00127         comm()->tx( str.sprintf( ":SWP:%d:%d:%d", aggregator()->taskSlicesPerSecond(), 1000000/aggregator()->taskSlicesPerSecond(), aggregator()->vectorIRQCountPerSecond() ) );
00128         comm()->tx( str.sprintf( ":EVT:%d:%d:%d", aggregator()->enqueueEventsPerSecond(), aggregator()->deliverEventsPerSecond(), aggregator()->maxEventsInQueuePerSecond() ) );
00129         comm()->tx( str.sprintf( ":STK:%d:%d:%d", top-(CMachine::ubit32)CMemHeap::top(), (top-(CMachine::ubit32)CMemHeap::top())-(top-ptr), top-ptr  ) );
00130         comm()->tx( str.sprintf( ":HEP:%d:%d:%d", CMemHeap::top()-CMemHeap::bottom(), CMemHeap::used(), CMemHeap::available() ) );
00131 
00132         /** FIXME - move all this stuff to CStatistics class and reply on demand only  */
00133         for( CMachine::ubit32 i=0; i < 16; i++ )
00134         {
00135             comm()->tx( str.sprintf( ":A:%d:%d", i, aggregator()->analog(i) ) );
00136         }
00137 
00138         comm()->tx( str.sprintf( ":R:%d\n\r", aggregator()->rpm() ) );
00139     }
00140 }

Here is the call graph for this function:

virtual const char* PikeAero::CTaskConsolePacket::name (  )  [inline, virtual]

Returns:
A CString containing an human readable name for the task.

Reimplemented from PikeAero::CTaskConsoleBase.

Definition at line 39 of file ctaskconsolepacket.h.

00039 {return "CTaskConsolePacket";}

CMachine::bit32 PikeAero::CTaskConsolePacket::run (  )  [virtual]

Called periodically by CTaskScheduler to do a piece of work.

called periodically by CTaskScheduler to do a piece of work.

Returns:
0 on success.

interpret input here

Reimplemented from PikeAero::CTaskConsoleBase.

Definition at line 80 of file ctaskconsolepacket.cpp.

References PikeAero::CString::append(), PikeAero::CByteArray::clear(), PikeAero::CTaskTerminal::comm(), execute(), PikeAero::CTaskConsoleBase::mCommandLine, PikeAero::CTaskConsoleBase::mMonitorMode, PikeAero::CTaskConsoleBase::monitorNone, and PikeAero::CCommunication::rx().

00081 {
00082     /** interpret input here  */
00083     while ( comm()->rxReady() )
00084     {
00085         CMachine::ubit8 ch = comm()->rx();
00086         mMonitorMode = monitorNone;
00087         switch ( ch )
00088         {
00089             case '\n':
00090             case '\r':
00091                 execute( &mCommandLine );
00092                 mCommandLine.clear();
00093             break;
00094             default:
00095                 if ( ch >= ' ' && ch <= '~' )
00096                 {
00097                     mCommandLine.append(ch);
00098                 }
00099                 break;
00100         }
00101     }
00102 
00103     return 0;
00104 }

Here is the call graph for this function:

CMachine::bit32 PikeAero::CTaskConsolePacket::start (  )  [virtual]

Called exactly once. all tasks are initialized at this point. called just prior to first call to run().

called exactly once. all tasks are initialized at this point. called just prior to first call to run()

Returns:
0 on success.

Reimplemented from PikeAero::CTaskConsoleBase.

Definition at line 58 of file ctaskconsolepacket.cpp.

References PikeAero::CTaskConsoleBase::aggregator(), PikeAero::CTaskTerminal::comm(), and mCommandHandler.

00059 {
00060     CMachine::bit32 rc = inherited::start();
00061     mCommandHandler = new CCommandHandler(comm(),aggregator());
00062     return rc;
00063 }

Here is the call graph for this function:

CMachine::bit32 PikeAero::CTaskConsolePacket::stop (  )  [virtual]

The CTaskScheduler will call the stop() method after the task was scheduled for cancelation.

The CTaskScheduler will call the stop () method after the task was scheduled for cancelation.

Returns:
0 on success.

Reimplemented from PikeAero::CTaskConsoleBase.

Definition at line 69 of file ctaskconsolepacket.cpp.

References mCommandHandler.

Referenced by fault().

00070 {
00071     delete mCommandHandler;
00072     mCommandHandler = NULL;
00073     return inherited::stop();
00074 }

Here is the caller graph for this function:


Field Documentation

Definition at line 75 of file ctaskconsolepacket.h.

Referenced by commandHandler(), start(), stop(), and ~CTaskConsolePacket().


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

Generated on Sun Oct 25 14:00:25 2009 for stingray3 by  doxygen 1.5.8