Nokia N97 SDK
Example Applications Guide

openchelloglibeventexhandler.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : OpenCHelloGlibEventExHandler.h
00004 *  Part of     : OpenC Hello World with Glib Events Example
00005 *  Interface   : 
00006 *  Description : 
00007 *  Version     : 
00008 *
00009 *  Copyright (c) 2007 Nokia Corporation.
00010 *  This material, including documentation and any related 
00011 *  computer programs, is protected by copyright controlled by 
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 
00017 #ifndef __OPENCHELLOGLIBEVENTEXHANDLER_H__
00018 #define __OPENCHELLOGLIBEVENTEXHANDLER_H__
00019 
00020 // INCLUDES
00021 #include <e32base.h>
00022 #include <glib.h>
00023 
00024 // CLASS DECLARATION
00025 /**
00026 * COpenCHelloGlibEventExHandler.
00027 * Timer-based active object for running the iterations of the Glib Main Context.
00028 * In each iteration, glib runs the callback functions of the event sources that are ready.
00029 */
00030 class COpenCHelloGlibEventExHandler: public CActive
00031         {
00032         
00033         public:
00034         
00035         /**
00036         * NewL
00037         * Two-phased constructor.
00038         * Construct a COpenCHelloGlibEventExHandler using two phase construction, and return a pointer
00039         * to the created object.
00040         * @param aMainContext The Glib Main Context to be used (NULL for default)
00041         * @return A pointer to the created instance of COpenCHelloGlibEventExHandler.
00042         */
00043                 static COpenCHelloGlibEventExHandler* NewL(GMainContext* aMainContext);
00044                 
00045         /**
00046         * ~COpenCHelloGlibEventExHandler
00047         * Destructor.
00048         */
00049                 ~COpenCHelloGlibEventExHandler();
00050         
00051                 /**
00052                 * RunL
00053                 * Called by the Active Scheduler when the asynchronous request is complete
00054                 */
00055                 void RunL();
00056                 
00057                 /**
00058                 * DoCancel
00059                 * Called by the Active Scheduler when a pending asynchronous request has been cancelled
00060                 */
00061                 void DoCancel();
00062                 
00063                 /**
00064                 * Start
00065                 * API to start the Timer-based handling of glib event sources
00066                 */
00067                 void Start();
00068                 
00069                 /**
00070                 * Stop
00071                 * API to stop the event handling 
00072                 */
00073                 void Stop();
00074 
00075         private:
00076                 /**
00077                 * COpenCHelloGlibEventExHandler
00078                 * Constructor
00079                 * @param aMainContext The Glib Main Context to be used (NULL for default)
00080                 */
00081                 COpenCHelloGlibEventExHandler(GMainContext* aMainContext);
00082                 
00083                 /**
00084                 * ConstructL
00085                 * Second-phase constructor
00086                 */
00087                 void ConstructL();      
00088         
00089                 /**
00090                 * Handle to the timer, used for scheduling
00091                 */
00092                 RTimer iTimer;
00093                 
00094                 /**
00095                 * The Glib main context to be used
00096                 */
00097                 GMainContext* iMainContext;
00098         };
00099 
00100 #endif // __OPENCHELLOGLIBEVENTEXHANDLER_H__
00101 
00102 // End of File

© Nokia 2009

Back to top