Nokia N97 SDK
Example Applications Guide

applicationusingsnap.h

00001 /*
00002 * ==============================================================================
00003 *  Name        : applicationusingsnap.h
00004 *  Part of     : datamobility
00005 *  Description : Example of class declaration using connection.
00006 *
00007 *  Copyright (c) 2007 Nokia Corporation.
00008 *  This material, including documentation and any related
00009 *  computer programs, is protected by copyright controlled by
00010 *  Nokia Corporation.
00011 * ==============================================================================
00012 */
00013 
00014 #ifndef APPLICATIONUSINGSNAP_H
00015 #define APPLICATIONUSINGSNAP_H
00016 
00017 // INCLUDES
00018 #include <e32base.h>
00019 #include <in_sock.h>
00020 
00021 // FORWARD DECLARATIONS
00022 class MDataMobilityPrinter;
00023 
00024 // CLASS DECLARATION
00025 
00026 /**
00027 *  CApplicationUsingSNAP  example of class using connection.
00028 *
00029 */
00030 class CApplicationUsingSNAP : public CActive
00031     {
00032     public:  // Constructors and destructor
00033 
00034         /**
00035         * NewL is first phase of two-phased constructor.
00036         */
00037         static CApplicationUsingSNAP* NewL( MDataMobilityPrinter& aObserver );
00038 
00039         /**
00040         * Destructor.
00041         */
00042         ~CApplicationUsingSNAP();
00043 
00044     public: // From CActive
00045 
00046         void RunL();
00047 
00048         void DoCancel();
00049 
00050     public: // New functions 
00051 
00052         /**
00053         * Start the connection.
00054         */
00055         void StartL();
00056 
00057     private:
00058 
00059         /** 
00060         * C++ default constructor.
00061         */
00062         CApplicationUsingSNAP( MDataMobilityPrinter& aObserver );
00063 
00064         /**
00065         * By default Symbian OS constructor is private.
00066         */
00067         void ConstructL();
00068 
00069         /**
00070          * Helper method to send message to print to the observer.
00071          * @param aResourceId Resource identifier of the string to print.
00072          */
00073          void PrintL( TInt aResourceId );
00074 
00075          /**
00076          * Helper method to send message to print to the observer.
00077          * @param aResourceId Resource identifier of the string to print.
00078          * @param aInt Integer value replacing %N in the string.
00079          */
00080          void PrintL( TInt aResourceId, TInt aInt );
00081 
00082     private:    // Data
00083  
00084         MDataMobilityPrinter& iObserver;       // Pointer to Observer
00085         RConnection           iConnection;
00086         RSocketServ           iSocketServer;
00087     };
00088 
00089 #endif // APPLICATIONUSINGSNAP_H
00090 

© Nokia 2009

Back to top