cbs/CbsServer/ServerInc/CCbsRecNetworkListener.h
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2003-2008 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:  This file contains the header file of the CCbsRecNetworkListener class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef     CCBSRECNETWORKLISTENER_H
       
    20 #define     CCBSRECNETWORKLISTENER_H
       
    21 
       
    22 // FORWARD DECLARATIONS
       
    23 class RMobilePhone;
       
    24 
       
    25 //  CLASS DECLARATION
       
    26 
       
    27 /**
       
    28 *   CCbsRecNetworkListener is used to keep CbsServer up to date 
       
    29 *   with the current network information. This information
       
    30 *   is used to assemble multipaged CB messages.
       
    31 *
       
    32 *   This is an active object which receives notifications from EPOC Telephony Server
       
    33 *   when the current network information changes. A request for 
       
    34 *   new network information is constantly held active at EPOC Telephony Server,
       
    35 *   first requested at the time of construction of CCbsRecNetworkListener.
       
    36 *
       
    37 *   Network information can be retrieved from CCbsRecNetworkListener
       
    38 *   with GetCurrentNetworkInfo().
       
    39 */
       
    40 class CCbsRecNetworkListener : public CActive
       
    41     {
       
    42     public:     // New functions
       
    43 
       
    44         /**
       
    45         *   Creates an instance of the class.
       
    46         *
       
    47         *   @param  aPhone              Open phone session.
       
    48         *   @return                     A pointer to the created instance.
       
    49         */        
       
    50         static CCbsRecNetworkListener* NewL( RMobilePhone& aPhone );
       
    51 
       
    52         /**
       
    53         *   Destructor.
       
    54         */
       
    55         ~CCbsRecNetworkListener();
       
    56 
       
    57         /**
       
    58         *   Fetches the current networking info. 
       
    59         *
       
    60         *   Returns KErrNotFound, if the current network info hasn't been
       
    61         *   received yet. Otherwise KErrNone is returned.
       
    62         *
       
    63         *   @param  aNetworkInfo        Return: current network information.
       
    64         *   @param  aArea               Return: current area information
       
    65         *   @return                     Result code
       
    66         */        
       
    67         TInt GetCurrentNetworkInfo( 
       
    68             RMobilePhone::TMobilePhoneNetworkInfoV1& aNetworkInfo,
       
    69             RMobilePhone::TMobilePhoneLocationAreaV1& aArea );
       
    70 
       
    71     private:    // From CActive
       
    72         /**
       
    73         *   Called whenever EPOC Telephony Server notifies this object of the presence
       
    74         *   of updated network information.
       
    75         */
       
    76         void RunL();
       
    77 
       
    78         /**
       
    79         *   Called whenever the listener has been requested to cancel.
       
    80         */
       
    81         void DoCancel();
       
    82 
       
    83     private:    // new functions
       
    84 
       
    85         /**
       
    86         *   Default constructor.
       
    87         *
       
    88         *   @param  aPhone  Reference to phone object
       
    89         */
       
    90         CCbsRecNetworkListener( RMobilePhone& aPhone );
       
    91 
       
    92         /**
       
    93         *   Finalizes the construction.
       
    94         */
       
    95         void ConstructL();
       
    96 
       
    97         /**
       
    98         *   Requests getting current network from EPOC Telephony Server.
       
    99         *
       
   100         *   Called when CCbsRecNetworkListener is constructed.
       
   101         */
       
   102         void IssueGetCurrentNwRequest();
       
   103 
       
   104         /**
       
   105         *   Requests notification of network registration state change from 
       
   106         *   EPOC Telephony Server.
       
   107         */
       
   108         void IssueNotifyNwRegChangeRequest();
       
   109 
       
   110         /**
       
   111         *   Requests notification of network state change from EPOC Telephony Server.
       
   112         */
       
   113         void IssueNotifyNwChangeRequest();
       
   114 
       
   115         /**
       
   116         *   When the current request is GetCurrentNetwork, handle the return result
       
   117         */
       
   118         void HandleGetCurrentNetworkResult();
       
   119 
       
   120         /**
       
   121         *   When the current request is NotifyNetworkRegistrationStatusChange, 
       
   122         *   handle the return result
       
   123         */
       
   124         void HandleNotifyNetworkRegistrationStatusChangeResult();
       
   125 
       
   126         /**
       
   127         *   When the current request is NotifyCurrentNetworkChange, 
       
   128         *   handle the return result
       
   129         */
       
   130         void HandleNotifyCurrentNetworkChangeResult();
       
   131 
       
   132         // Prohibited copy constructor
       
   133         CCbsRecNetworkListener( const RMobilePhone& );
       
   134 
       
   135         // Prohibited assignment operator
       
   136         CCbsRecNetworkListener& operator=( const RMobilePhone& );
       
   137 
       
   138     private:    // Data
       
   139         // ETrue, if iNetworkInfo contains current network information
       
   140         TBool iNetworkInfoRetrieved;
       
   141 
       
   142         // Phone instance
       
   143         RMobilePhone& iPhone;
       
   144 
       
   145         // Current network information data
       
   146         RMobilePhone::TMobilePhoneNetworkInfoV1 iNetworkInfo;
       
   147 
       
   148         // Current network information package        
       
   149         RMobilePhone::TMobilePhoneNetworkInfoV1Pckg iNetworkInfoPckg;
       
   150 
       
   151         // Current area information
       
   152         RMobilePhone::TMobilePhoneLocationAreaV1 iArea;
       
   153 
       
   154         // Status info
       
   155         TBool iGetCurrentNetworkActive;
       
   156 
       
   157         // Status of notification of network registration state change
       
   158         TBool iNotifyNwRegChange;
       
   159 
       
   160         // Network registration information
       
   161         RMobilePhone::TMobilePhoneRegistrationStatus iRegistration;
       
   162     };
       
   163 
       
   164 #endif      //  CCBSRECNETWORKLISTENER_H   
       
   165             
       
   166 // End of File
       
   167 
       
   168