cbsref/telephonyrefplugins/atltsy/atcommand/generic/inc/tsyconfg.h
changeset 44 8b72faa1200f
equal deleted inserted replaced
39:2473f5e227f9 44:8b72faa1200f
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file tsconfig.h
       
    15 // This contains CTsyConfig which manage to get the modem settings from CommDB.
       
    16 // 
       
    17 
       
    18 #ifndef __TSYCONFG_H
       
    19 #define __TSYCONFG_H
       
    20 
       
    21 // system include
       
    22 #include <e32base.h>
       
    23 #include <d32comm.h>
       
    24 #include <etelmm.h>
       
    25 #include <commsdattypesv1_1.h>
       
    26 
       
    27 // use name space
       
    28 using namespace CommsDat;
       
    29 
       
    30 enum TConfigType
       
    31 	{
       
    32 	EConfigTypePreInit,
       
    33 	EConfigTypeInit,
       
    34 	EConfigTypeConnect,
       
    35 	EConfigTypeHangUp,
       
    36 	EConfigTypeFull,
       
    37 	EConfigTypeQuickInit,
       
    38 	EConfigTypeDDBugWorkAroundStart,
       
    39 	EConfigTypeDDBugWorkAroundEnd
       
    40 	};
       
    41 
       
    42 /** 
       
    43  * CTsyConfig Class
       
    44  * Creating the class will load the current modem settings.
       
    45  * They may be refreshed by calling ReloadSettings.
       
    46  * The ModemName, PortDriverName, CommPortName and String functions 
       
    47  * will return descriptors to the relevant settings taken from 
       
    48  * the current modem's settings.
       
    49  * The CommConfig function will return a reference to the Configuration 
       
    50  * structure in the current modem's settings. 
       
    51  * All file closing, tidying and memory deallocation should be done 
       
    52  * in the ~CTsyConfig destructor.
       
    53  */
       
    54 class CTsyConfig : public CBase
       
    55 	{
       
    56 public:
       
    57 	/**
       
    58 	 * Factory function.
       
    59 	 * 
       
    60 	 * @return A newly created CTsyConfig Object
       
    61 	 */
       
    62 	static CTsyConfig* NewL();
       
    63 	
       
    64 	/**
       
    65 	 * Virtual destructor
       
    66 	 * 
       
    67 	 */
       
    68 	~CTsyConfig();
       
    69     
       
    70 	/**
       
    71 	 * Set current table view.
       
    72 	 * Try to get current table view by 10 times.
       
    73 	 */
       
    74 	void SetCurrentTableViewL();
       
    75 	
       
    76 	/**
       
    77 	 * Get the field value by the name from modem Bearer record table in commdb.
       
    78 	 * 
       
    79 	 * @param aStringTag The field name
       
    80 	 * @param aString The field value
       
    81 	 */
       
    82 	TInt ConfigModemStringL(const TDesC& aStringTag, TDes8& aString);
       
    83 	
       
    84 	/**
       
    85 	 * Get the field value by the name from modem Bearer record table in commdb.
       
    86 	 * 
       
    87 	 * @param aStringTag The field name
       
    88 	 * @param aString The field value
       
    89 	 */
       
    90 	TInt ConfigModemStringL(const TDesC& aStringTag, TDes16& aString);
       
    91 	
       
    92 	/**
       
    93 	 * Gets the port config settings and masks out appropriate handshaking settings
       
    94 	 * according to whether state is about to initialise, just connected or about to hang up
       
    95 	 */ 
       
    96 	TInt PortConfig(TCommConfig& aConfigPckg, TConfigType aConfigType);
       
    97 	
       
    98 	/**
       
    99 	 * Stores the Speaker Preferences settings internally. These settings are stored on construction
       
   100 	 * of the CTsyConfig object.
       
   101 	 * @param aSpeakerSetting Speaker Preference setting
       
   102 	 */
       
   103 	void GetSpeakerSettingPref(RCall::TMonitorSpeakerControl& aSpeakerSetting);
       
   104 	
       
   105 	/**
       
   106 	 * Stores the Speaker Volume Preferences settings internally. These settings are stored on construction
       
   107 	 * of the CTsyConfig object.
       
   108 	 * @param aSpeakerVolume Speaker Volume setting
       
   109 	 */
       
   110 	void GetSpeakerVolumePref(RCall::TMonitorSpeakerVolume& aSpeakerVolume);
       
   111 	
       
   112 	/**
       
   113 	 * Stores the Dial Tone Preferences settings internally. These settings are stored on construction
       
   114 	 * of the CTsyConfig object.
       
   115 	 * @param aWaitForDialTonePref Wait for Dial Tone Preference setting
       
   116 	 */
       
   117 	void GetWaitForDialTonePref(RCall::TWaitForDialTone& aWaitForDialTonePref);
       
   118 	
       
   119 	/**
       
   120 	 * Opens a handle to CCommsDatabase	and positions the view on the default modem specified 
       
   121 	 * in the current Connected Modem record.
       
   122 	 * Note that the TSY does not keep the handle to the CCommsDatabase opened all the time, 
       
   123 	 * therefore this method is used to open the handle only when needed. The methods using 
       
   124 	 * this method are also responsible for calling ResetCurrentTableViews() to close the
       
   125 	 * handle to the CCommsDatabase and to clean up the table views.
       
   126 	 */
       
   127 	void GetCurrentTableViewsL();
       
   128 	
       
   129 	/**
       
   130 	 * Gets some commonly used settings from the Location and Modem Table Views and stores them
       
   131 	 * internally as these are not likely to change. 
       
   132 	 * If some of these settings are not found in the table view then a predefined default values are
       
   133 	 * used.
       
   134 	 */
       
   135 	void GetLocationModemSettingsL();
       
   136 	
       
   137 	/**
       
   138 	 * Closes the handle to CCommsDatabase and clears the view on the default modem specified 
       
   139 	 * in the current Connected Modem record. This method needs to be called after 
       
   140 	 * GetCurrentTableViewsL().
       
   141 	 */
       
   142 	void ResetCurrentTableViews();
       
   143 private:
       
   144 	/**
       
   145 	 * Constructor 
       
   146 	 */
       
   147 	CTsyConfig();
       
   148 	
       
   149 	/**
       
   150 	 * 2nd constructor
       
   151 	 * 
       
   152 	 */
       
   153 	void ConstructL();
       
   154 	
       
   155 	/*
       
   156 	 * Scan through the table for records containing Phonetsy.tsy
       
   157 	 * Stop at the first instance of such a record and return the id
       
   158 	 * 
       
   159 	 * @param aBearerId The Bearer ID in modem bearer table
       
   160 	 */
       
   161  	void GetModemBearerIdL(TUint32& aBearerId);  	
       
   162  	/*
       
   163  	 * Scan through the table for records containing MM.TSY
       
   164  	 * Stop at the first instance of such a record and return the id
       
   165  	 *
       
   166  	 * @param aBearerId The Bearer ID in modem bearer table
       
   167  	 * @param aLocationId 
       
   168  	 */
       
   169  	void GetLocationIdL(const TUint32& aBearerId, TUint32& aLocationId); 
       
   170 
       
   171 private:
       
   172 	/**
       
   173 	 * Store the modem configuration for connecting with AT Modem
       
   174 	 * 
       
   175 	 */
       
   176 	TCommConfigV01 iConfig;
       
   177 	
       
   178 	/**
       
   179 	 * The CommDB session
       
   180 	 * 
       
   181 	 * Own
       
   182 	 */
       
   183 	CMDBSession* iDbSession;
       
   184 	
       
   185 	/**
       
   186 	 * Store the IAP number for the selected modem
       
   187 	 * 
       
   188 	 */
       
   189 	TUint32 iModemBearer;
       
   190 	
       
   191 	/**
       
   192 	 * Location ID
       
   193 	 * 
       
   194 	 */
       
   195 	TUint32 iLocationId;
       
   196 	
       
   197 	/**
       
   198 	 * An integer value that indicates the time to pause after using the dial-ot code
       
   199 	 * 
       
   200 	 */
       
   201 	TInt iInterval;
       
   202 	
       
   203 	/**
       
   204 	 * Monitor speaker control setting flags
       
   205 	 * 
       
   206 	 */
       
   207 	RCall::TMonitorSpeakerControl iSpeakerSetting;
       
   208 	
       
   209 	/**
       
   210 	 * Monitor speaker volume control setting flags
       
   211 	 * 
       
   212 	 */
       
   213 	RCall::TMonitorSpeakerVolume iSpeakerVolume;
       
   214 	
       
   215 	/**
       
   216 	 * Wait for dial tone flags
       
   217 	 * 
       
   218 	 */
       
   219 	RCall::TWaitForDialTone iWaitForDialTonePref;
       
   220 	};
       
   221 
       
   222 #endif