examples/SFExamples/RecipeEx/inc/MobilityEngine.h

00001 // Symbian Foundation Example Code
00002 // 
00003 // This software is in the public domain. No copyright is claimed, and you 
00004 // may use it for any purpose without license from the Symbian Foundation.
00005 // No warranty for any purpose is expressed or implied by the authors or
00006 // the Symbian Foundation. 
00007 
00008 
00009 #ifndef __MOBILITYENGINE_H__
00010 #define __MOBILITYENGINE_H__
00011 
00012 #include <e32base.h>    
00013 #include <e32std.h>     
00014 #include <CommDbConnPref.h>
00015 #include <es_sock.h>
00016 #include <cdbcols.h>
00017 #include <commdb.h>
00018 #include <cdbtemp.h>
00019 #include <comms-infras/cs_mobility_apiext.h>
00020 
00021 // Forward declarations
00022 class CLogContainer;
00023 class CIAPConnectWaitDialog;
00024 class CIAPConnectProgressNotifier;
00025 class CTextResolver;
00026 
00034 class CMobilityEngine : public CActive, public MMobilityProtocolResp
00035         {
00036         
00037 public: // Construction / Destruction
00038         
00042         static CMobilityEngine* NewL(CLogContainer* aLogView);
00043 
00047         static CMobilityEngine* NewLC(CLogContainer* aLogView);
00048 
00050         ~CMobilityEngine();
00051         
00052 public:
00053         
00055         void ConnectL();
00056         
00058         void Disconnect();
00059         
00061         TBool IsIdle();
00062         
00063 public:  // From MMobilityProtocolResp
00072     void PreferredCarrierAvailable(TAccessPointInfo aOldAPInfo,
00073                                    TAccessPointInfo aNewAPInfo,
00074                                    TBool aIsUpgrade,
00075                                    TBool aIsSeamless);
00076     
00080     void NewCarrierActive(TAccessPointInfo aNewAPInfo, TBool aIsSeamless);
00081     
00085     void Error(TInt aError);    
00086 
00087 private: // More construction
00088         
00090         CMobilityEngine(CLogContainer* aLogView);
00091 
00093         void ConstructL();
00094 
00095 private: // From CActive
00096         
00098         void RunL();
00099 
00101         void DoCancel();
00102 
00104         TInt RunError(TInt aError);
00105 
00106 private:
00107         void HandleNewCarrierActiveL();
00108         void ConnectSocketL();
00109         void AsyncDisconnect();
00110         void LogAddressL(const TSockAddr& aAddr);
00111         TPtrC GetHost() const;
00112         TUint GetPort() const;
00113 
00115         enum TState
00116                 {
00117                 EIdle,
00118                 EStartingConnection,
00119                 EResolvingAddress,
00120                 ESocketConnecting,
00121                 ESocketConnected,
00122                 EChangingCarrier,
00123                 EAsyncDisconnect
00124                 };
00125         TState iState;
00126         TBool iAddrResolved;
00127         TBool iAcceptOnConnect;
00128 
00130         CLogContainer* iLogView;
00131 
00132         TCommDbConnPref iPref;
00133         RConnection iConnection;
00134         RSocketServ iSocketServ;
00135         CTextResolver* iTextResolver;
00136         CActiveCommsMobilityApiExt* iMobility;  
00137 
00138         HBufC* iHostAndPort; // host [:port]
00139         TNameEntry iNameEntry;
00140         RHostResolver iResolver;
00141         RSocket iRoamingSocket;
00142         };
00143 
00144 #endif // MOBILITYENGINE_H

Generated by  doxygen 1.6.2