phoneuis/ConnectUtil/inc/CCoUtlActive.h
changeset 0 5f000ab63145
child 9 8871b09be73b
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2003-2004,2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation of connection termination plug-in.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CCOUTLACTIVE_H
       
    21 #define CCOUTLACTIVE_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include    <CCoUtlInterface.h>
       
    25 #include    <etel.h>
       
    26 #include    <etelmm.h>
       
    27 #include    <etelpckt.h>
       
    28 #include    <rconnmon.h>
       
    29 
       
    30 // FORWARD DECLARATION
       
    31 class CAknGlobalConfirmationQuery;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 
       
    35 /**
       
    36 *  CCoUtlInterface implementation.
       
    37 *
       
    38 *  @since 2.6
       
    39 */
       
    40 class CCoUtlActive 
       
    41     : public CActive,
       
    42       public MConnectionMonitorObserver
       
    43     {
       
    44     public:  // Constructors and destructor
       
    45         
       
    46         /**
       
    47         * Constructor.
       
    48         */
       
    49         CCoUtlActive();
       
    50         
       
    51         /**
       
    52         * Destructor.
       
    53         */
       
    54         virtual ~CCoUtlActive();
       
    55 
       
    56     public: // New functions
       
    57 
       
    58         /**
       
    59         * Enumerates state of the operation.
       
    60         */
       
    61         enum TState
       
    62             {
       
    63             EIdle,
       
    64             EStarted,
       
    65             ECheckIfAttached,
       
    66             ECheckIfNetworkModeIII,
       
    67             EStopConnectionsAndDetach,
       
    68             EGetConnectionCount,
       
    69             EGoThroughConnections,
       
    70             EGoThroughConnectionsGetBearer,
       
    71             EGoThroughConnectionsGetStatus,
       
    72             ECheckConnectionCount,
       
    73             ECheckDetachRequired, 
       
    74             EStopConnectionsAndCheckDetachRequired, 
       
    75             EConfirmAllConnectionsTermination,
       
    76             EGetBearerThenNameThenConfirmTermination,
       
    77             EGetNameThenConfirmTermination,
       
    78             EDetach
       
    79             };
       
    80 
       
    81         /**
       
    82         * Returns current state.
       
    83         * @return current state.
       
    84         */
       
    85         TState CurrentState() const;
       
    86 
       
    87         /**
       
    88         * Starts termination.
       
    89         * @param aStatus request to be completed once finished.
       
    90         */
       
    91         void Start( TRequestStatus& aStatus );
       
    92 
       
    93     public: // Functions from base classes
       
    94 
       
    95         /**
       
    96         * From CActive, handles completion of current operation.
       
    97         */
       
    98         virtual void RunL();
       
    99 
       
   100         /**
       
   101         * From CActive, cancels ongoing asynchronous operation.
       
   102         */
       
   103         virtual void DoCancel();
       
   104 
       
   105         /**
       
   106         * From CActive, handles errors from CActive.
       
   107         * @param aError error to be handled.
       
   108         * @return error to be passed to scheduler.
       
   109         */
       
   110         virtual TInt RunError( TInt aError );
       
   111         
       
   112         /**
       
   113         * From MConnectionMonitorObserver, receive notifications.
       
   114         */
       
   115         void EventL( const CConnMonEventBase &aConnMonEvent );
       
   116         
       
   117     private:
       
   118 
       
   119         /**
       
   120         * Gets attach status.
       
   121         */
       
   122         void GetAttachStatusL();
       
   123 
       
   124         /**
       
   125         * Gets network mode.
       
   126         */
       
   127         void GetNetworkModeL();
       
   128 
       
   129         /**
       
   130         * Stop connections and detach.
       
   131         */
       
   132         void StopConnectionsAndDetachL();
       
   133 
       
   134         /**
       
   135         * Gets number of connections.
       
   136         */
       
   137         void GetConnectionCountL();
       
   138 
       
   139         /**
       
   140         * Goes through connections.
       
   141         */
       
   142         void CheckConnectionsL();
       
   143 
       
   144         /**
       
   145         * Goes through connections - get bearer.
       
   146         */
       
   147         void GoThroughConnectionsGetBearerL();
       
   148 
       
   149         /**
       
   150         * Goes through connections - get status.
       
   151         */
       
   152         void GoThroughConnectionsGetStatusL();
       
   153 
       
   154         /**
       
   155         * Gets attach mode - detach if required, 
       
   156         * i.e. attach mode is 'on demand'.
       
   157         */
       
   158         void GetAttachModeAndDetachIfRequiredL();
       
   159         
       
   160         /**
       
   161         * Confirms all connections termination.
       
   162         */
       
   163         void ConfirmAllConnectionsTerminationL();
       
   164 
       
   165         /**
       
   166         * Gets bearer of the connection.
       
   167         */
       
   168         void GetBearerThenNameThenConfirmTerminationL();
       
   169 
       
   170         /**
       
   171         * Gets name of connection.
       
   172         */
       
   173         void GetNameThenConfirmTerminationL();
       
   174 
       
   175         /**
       
   176         * Confirms termination.
       
   177         * @param aAmount amount of connections.
       
   178         */
       
   179         void ConfirmTerminationL( TInt aAmount );
       
   180 
       
   181         /**
       
   182         * Confirms termination.
       
   183         * @param aName name of connection.
       
   184         */
       
   185         void ConfirmTerminationL( const TDesC& aName );
       
   186 
       
   187         /**
       
   188         * Confirms termination.
       
   189         * @param aText text shown in query.
       
   190         */
       
   191         void DoConfirmTerminationL( const TDesC& aText );
       
   192 
       
   193         /**
       
   194         * Stop all connections and detach if required.
       
   195         */
       
   196         void StopAllConnectionsAndDetachIfRequiredL();
       
   197 
       
   198         /**
       
   199         * Stops all connections.
       
   200         * @return error code.
       
   201         */
       
   202         TInt DoStopAllConnectionsL();
       
   203 
       
   204         /**
       
   205         * Detaches from network.
       
   206         */
       
   207         void DetachL();
       
   208 
       
   209         /**
       
   210         * Checks if attached.
       
   211         * @return EFalse if not attached. Otherwise ETrue.
       
   212         */
       
   213         inline TBool IsAttached() const;
       
   214 
       
   215         /**
       
   216         * Checks if current network mode is III.
       
   217         * @return ETrue if operating in network mode III.
       
   218         *         Otherwise EFalse.
       
   219         */
       
   220         inline TBool IsNetworkModeIII() const;
       
   221 
       
   222         /**
       
   223         * Returns ETrue if there are connections.
       
   224         * @return ETrue if there are connections.
       
   225         *         Otherwise EFalse.
       
   226         */
       
   227         inline TBool IsConnections() const;
       
   228 
       
   229         /**
       
   230         * Returns ETrue if bearer is GPRS.
       
   231         * @return ETrue if bearer is GPRS.
       
   232         *         Otherwise EFalse.
       
   233         */
       
   234         inline TBool AcceptConnectionBearer() const;
       
   235 
       
   236         /**
       
   237         * Returns ETrue if connection is active.
       
   238         * @return ETrue if connection is active.
       
   239         *         Otherwise EFalse.
       
   240         */
       
   241         inline TBool IsConnectionActive() const;
       
   242 
       
   243         /**
       
   244         * Returns ETrue if attach mode is 'on demand'.
       
   245         * @return ETrue if attach mode is 'on demand'.
       
   246         *         Otherwise EFalse.
       
   247         */
       
   248         inline TBool IsAttachModeOnDemand() const;
       
   249 
       
   250         /**
       
   251         * Returns ETrue if user confirmed connection termination.
       
   252         * @return ETrue if termination has been confirmed.
       
   253         *         Otherwise EFalse.
       
   254         */
       
   255         inline TBool IsConfirmed() const;
       
   256 
       
   257         /**
       
   258         * Returns telephony server session.
       
   259         * @return ETel session.
       
   260         */
       
   261         inline RTelServer& TelServerL();
       
   262 
       
   263         /**
       
   264         * Returns mobile phone.
       
   265         * @return phone subsession.
       
   266         */
       
   267         inline RMobilePhone& MobilePhoneL();
       
   268 
       
   269         /**
       
   270         * Returns packet service.
       
   271         * @return packet service subsession.
       
   272         */
       
   273         inline RPacketService& PacketServiceL();
       
   274 
       
   275         /**
       
   276         * Returns connection monitor.
       
   277         * @return connection monitor session.
       
   278         */
       
   279         inline RConnectionMonitor& ConnectionMonitorL();
       
   280 
       
   281         /**
       
   282         * Completes client's request with aErrorCode code.
       
   283         * @param aErrorCode error code.
       
   284         */
       
   285         void CompleteRequest( TInt aErrorCode );
       
   286 
       
   287         /**
       
   288         * Go to specified state.
       
   289         * @param aNewState new state.
       
   290         */ 
       
   291         inline void GoToState( TState aNewState );
       
   292 
       
   293         /**
       
   294         * Go to specified state and complete - operation
       
   295         * continues with next RunL call.
       
   296         * @param aNewState new state.
       
   297         * @param aError error code, KErrNone by default.
       
   298         */
       
   299         inline void GoToStateAndComplete( 
       
   300             TState aNewState,
       
   301             TInt aError = KErrNone );
       
   302 
       
   303     private:    // Data
       
   304         
       
   305         // Current state.
       
   306         TState iState;
       
   307 
       
   308         // Packet service status.
       
   309         TInt iServiceStatus;
       
   310 
       
   311         // Packet service current class.
       
   312         RPacketService::TMSClass iCurrentClass;
       
   313 
       
   314         // Packet service max class.
       
   315         RPacketService::TMSClass iMaxClass;
       
   316 
       
   317         // Packet service attach mode.
       
   318         RPacketService::TAttachMode iAttachMode;
       
   319 
       
   320         // Amount of connections.
       
   321         TUint iConnectionCount;
       
   322 
       
   323         // Telephony server session.
       
   324         /***************************************************** 
       
   325         *   Series 60 Customer / ETel 
       
   326         *   Series 60  ETel API 
       
   327         *****************************************************/
       
   328         RTelServer iServer;
       
   329 
       
   330         // Owned mobile phone subsession.
       
   331         /***************************************************** 
       
   332         *   Series 60 Customer / ETel 
       
   333         *   Series 60  ETel API 
       
   334         *****************************************************/
       
   335         RMobilePhone iMobilePhone;
       
   336 
       
   337         // Owned packet service subsession.
       
   338         /***************************************************** 
       
   339         *   Series 60 Customer / ETel 
       
   340         *   Series 60  ETel API 
       
   341         *****************************************************/
       
   342         RPacketService iPacketService;
       
   343 
       
   344         // Owned connection monitor session.
       
   345         RConnectionMonitor iConnectionMonitor;
       
   346 
       
   347         struct TConnectionId
       
   348             {
       
   349             TUint iConnectionId;
       
   350             TUint iSubConnectionId;
       
   351             };
       
   352 
       
   353         // Owned array of connection ids.
       
   354         RArray< TConnectionId > iConnections;
       
   355 
       
   356         // Current index in connections array.
       
   357         TInt iConnectionsIndex;
       
   358         
       
   359         // Connection bearer .
       
   360         TInt iConnectionBearer;
       
   361 
       
   362         // Connection status.
       
   363         TInt iConnectionStatus;
       
   364 
       
   365         // Connection name.
       
   366         TName iConnectionName;
       
   367 
       
   368         // Owned confirmation query.
       
   369         CAknGlobalConfirmationQuery* iConfirmationQuery;
       
   370 
       
   371         // Owned text in confirmation query.
       
   372         HBufC* iConfirmationText;
       
   373 
       
   374         // Ref to request status to be completed. NULL if
       
   375         // operation is not ongoing.
       
   376         TRequestStatus* iRequestStatus;
       
   377 
       
   378         //WCDMA connection status.
       
   379         TInt iWcdmaConnectionStatus;
       
   380 
       
   381     };
       
   382 
       
   383 #endif      // CCOUTLACTIVE_H
       
   384             
       
   385 // End of File