Nokia N97 SDK
Example Applications Guide

sensorexampleappview.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : sensorexampleappview.h
00004 *  Part of     : sensorexample
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 #ifndef __SENSOREXAMPLEAPPVIEW_H__
00017 #define __SENSOREXAMPLEAPPVIEW_H__
00018 
00019 // INCLUDES
00020 #include <coecntrl.h>
00021 #include <sensrvaccelerometersensor.h>
00022 #include <sensrvorientationsensor.h>
00023 #include <sensrvchannelinfo.h>
00024 
00025 
00026 // CLASS DECLARATION
00027 class CSensorExampleAppView : public CCoeControl
00028     {
00029 public:
00030 
00031    /**
00032     * NewL.
00033     * Two-phased constructor.
00034     * Create a CSensorExampleAppView object, which will draw itself to aRect.
00035     * @param aRect The rectangle this view will be drawn to.
00036     * @return a pointer to the created instance of CSensorExampleAppView.
00037     */
00038     static CSensorExampleAppView* NewL( const TRect& aRect );
00039 
00040    /**
00041     * NewLC.
00042     * Two-phased constructor.
00043     * Create a CSensorExampleAppView object, which will draw itself
00044     * to aRect.
00045     * @param aRect Rectangle this view will be drawn to.
00046     * @return A pointer to the created instance of CSensorExampleAppView.
00047     */
00048     static CSensorExampleAppView* NewLC( const TRect& aRect );
00049 
00050    /**
00051     * ~CSensorExampleAppView
00052     * Virtual Destructor.
00053     */
00054     virtual ~CSensorExampleAppView();
00055 
00056 public:  // Functions from base classes
00057 
00058    /**
00059     * From CCoeControl, Draw
00060     * Draw this CSensorExampleAppView to the screen.
00061     * If the user has given a text, it is also printed to the center of
00062     * the screen.
00063     * @param aRect the rectangle of this view that needs updating
00064     */
00065     void Draw( const TRect& aRect ) const;
00066 
00067    /**
00068     * From CoeControl, SizeChanged.
00069     * Called by framework when the view size is changed.
00070     */
00071     virtual void SizeChanged();
00072 
00073 public:
00074 
00075    /**
00076     * Called by CSensorExampleDataListener when channel data is received.
00077     */
00078     void TappingEvent( TInt aDirection );
00079     void AccelerometerData( TInt aX, TInt aY );
00080     void OrientationEvent( TSensrvOrientationData::TSensrvDeviceOrientation aDeviceOrientation );
00081 
00082    /**
00083     * Show channel query dialog.
00084     *
00085     * @param aChannelList List of channels which are shown in query dialog.
00086     * @return index of selected channel from query dialog.
00087     */
00088     TInt ShowQueryDialogL( RSensrvChannelInfoList& aChannelList );
00089 
00090    /**
00091     * Show property query dialog
00092     *
00093     * @param aChannelPropertyList List of properties which are shown in query dialog.
00094     * @return index of selected property from query dialog.
00095     */
00096     TInt ShowQueryDialogL( RSensrvPropertyList& aChannelPropertyList );
00097 
00098    /**
00099     * Return name of a property
00100     *
00101     * @param aPropertyId  Property ID
00102     * @param aItemIndex   Item index of property
00103     * @param aPropertyBuf On return contains property's name
00104     */
00105     void CSensorExampleAppView::GetPropertyStringL( TSensrvPropertyId aPropertyId,
00106                                                     TInt aItemIndex,
00107                                                     TDes& aPropertyBuf );
00108 
00109 
00110 private: // Constructors
00111 
00112    /**
00113     * ConstructL
00114     * 2nd phase constructor.
00115     * Perform the second phase construction of a
00116     * CSensorExampleAppView object.
00117     * @param aRect The rectangle this view will be drawn to.
00118     */
00119     void ConstructL( const TRect& aRect );
00120 
00121    /**
00122     * CSensorExampleAppView.
00123     * C++ default constructor.
00124     */
00125     CSensorExampleAppView();
00126 
00127 private:
00128 
00129    /**
00130     * font used, when printing user-given text to the screen
00131     */
00132     const CFont* iFont;//Not own
00133 
00134    /**
00135     * Latest sensor data
00136     */
00137     TSensrvOrientationData::TSensrvDeviceOrientation iDeviceOrientation;
00138     TInt iX;
00139     TInt iY;
00140 
00141     TRgb iFaceColor;
00142     };
00143 
00144 #endif // __SENSOREXAMPLEAPPVIEW_H__
00145 
00146 // End of File

© Nokia 2009

Back to top