adaptationlayer/tsy/nokiatsy_dll/inc/cmmnetoperatornamehandler.h
changeset 0 63b37f68c1ce
child 5 8ccc39f9d787
equal deleted inserted replaced
-1:000000000000 0:63b37f68c1ce
       
     1 /*
       
     2 * Copyright (c) 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 the License "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMMNETOPERATORNAMEHANDLER_H
       
    21 #define CMMNETOPERATORNAMEHANDLER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h> // Symbian base types
       
    25 #include <etelmm.h> // Symbian Etel related types
       
    26 #include <ctsy/rmmcustomapi.h>
       
    27 
       
    28 #include "cmmnetmesshandler.h"
       
    29 
       
    30 // CONSTANTS
       
    31 // Max length of Operator Name String (ONS name).
       
    32 const TUint8 KOnsNameMaxLength = 0x19;
       
    33 // Display tag max length.
       
    34 const TUint8 KDisplayTagLength = 30;
       
    35 // Operator code BCD string length.
       
    36 const TUint8 KBCDLength = 3;
       
    37 
       
    38 // MACROS
       
    39     //None
       
    40 
       
    41 // DATA TYPES
       
    42 
       
    43 // Network Operator name type.
       
    44 enum TNetOperatorNameType
       
    45     {
       
    46     ENetNameNotSet = 0,
       
    47     ENetApacName,
       
    48     ENetLatinName,
       
    49     ENetCountryMncName,
       
    50     ENetMccMncName,
       
    51     ENetNitzName,
       
    52     ENetEonsName
       
    53     };
       
    54 
       
    55 // Coding scheme type in NITZ and EONS data.
       
    56 enum TDataCodingSchemeType
       
    57     {
       
    58     EGSMDefaultAlphabetCoding = 0,
       
    59     EUCS2Coding = 16
       
    60     };
       
    61 
       
    62 // FUNCTION PROTOTYPES
       
    63     //None
       
    64 
       
    65 // FORWARD DECLARATIONS
       
    66 class TIsiReceiveC;
       
    67 class TIsiSubBlock;
       
    68 
       
    69 // CLASS DECLARATION
       
    70 
       
    71 /**
       
    72 * Used for creating and sending Operator name handling specific
       
    73 * ISI messages to PhoNet via PhoNetSender. It also receives
       
    74 * Operator name handling specific ISI messages from PhoNetReceiver.
       
    75 */
       
    76 class CMmNetOperatorNameHandler : public CBase
       
    77     {
       
    78     public: // Constructors and destructor
       
    79 
       
    80         /**
       
    81         * Two-phased constructor.
       
    82         * @param aNetMessHandler: Pointer to the NetMessHandler.
       
    83         * @return created message handler object.
       
    84         */
       
    85         static CMmNetOperatorNameHandler* NewL(
       
    86             CMmNetMessHandler* aNetMessHandler );
       
    87 
       
    88         /**
       
    89         * Destructor.
       
    90         */
       
    91         ~CMmNetOperatorNameHandler();
       
    92 
       
    93     public: // Functions
       
    94 
       
    95         /**
       
    96         * Breaks a NET_NITZ_NAME_IND ISI-message.
       
    97         * @param TIsiReceiveC& aIsiMessage: Received ISI message.
       
    98         * @return None.
       
    99         */
       
   100         void NetNitzNameInd( const TIsiReceiveC& aIsiMessage );
       
   101 
       
   102         /**
       
   103         * Gets correct Operator name according priority order.
       
   104         * @param aCampedInHplmn is camped in HPLMN.
       
   105         * @param aNetworkType is Network type.
       
   106         * @param aOperatorCode is Operator Code in BCD format.
       
   107         * @param aLocationArea is current Location Area Code.
       
   108         * @param aNetworkName includes network data.
       
   109         */
       
   110         void GetOperatorName(
       
   111             TBool aCampedInHplmn,
       
   112             TUint8 aNetworkType,
       
   113             const TDesC8& aOperatorCode,
       
   114             const RMobilePhone::TMobilePhoneLocationAreaV1& aLocationArea,
       
   115             RMobilePhone::TMobilePhoneNetworkInfoV5& aNetworkName );
       
   116 
       
   117         /**
       
   118         * Handles NET_MODEM_AVAILABLE_GET_RESP ISI-message success case.
       
   119         * @param TIsiReceiveC& aIsiMessage: Received ISI message.
       
   120         * @return None.
       
   121         */
       
   122         void HandleManualSearchSuccessCaseL( const TIsiReceiveC& aIsiMessage );
       
   123 
       
   124         /**
       
   125         * Gets correct Operator names in manual search.
       
   126         */
       
   127         void GetManualSearchOperatorNameL();
       
   128 
       
   129         /**
       
   130         * Creates Product Profile request to read INFO_PP_EONS_FEAT bit.
       
   131         */
       
   132         void InfoPpReadReq();
       
   133 
       
   134         /**
       
   135         * Breaks a INFO_PP_READ_RESP ISI-message.
       
   136         * @param TIsiReceiveC& aIsiMessage: Received ISI message.
       
   137         * @return None.
       
   138         */
       
   139         void InfoPpReadResp( const TIsiReceiveC& aIsiMessage );
       
   140 
       
   141         /**
       
   142         * Creates a SIM_OPERATOR_REQ ISI message with service type
       
   143         * SIM_ST_READ_PNN and sends it to phonet.
       
   144         * Used to read the PLMN Network Name from EFpnn on (U)SIM.
       
   145         * @param aPnnIdentifier is identifier of the record to be read.
       
   146         */
       
   147         void SimOperatorReqReadPnn( TUint8 aPnnIdentifier );
       
   148 
       
   149         /**
       
   150         * Breaks a SIM_OPERATOR_RESP ISI message with service type
       
   151         * SIM_ST_READ_PNN.
       
   152         * @param const TIsiReceiveC& aIsiMessage: The received ISI message.
       
   153         */
       
   154         void SimOperatorRespReadPnnL( const TIsiReceiveC& aIsiMessage );
       
   155 
       
   156         /**
       
   157         * Creates a PERM_PM_RECORD_WRITE_REQ ISI message and sends
       
   158         * it to phonet.
       
   159         * Used to Write record for PMM.
       
   160         */
       
   161         void PermPmRecordWriteReq();
       
   162 
       
   163         /**
       
   164         * Breaks a PERM_PM_RECORD_WRITE_RESP ISI message.
       
   165         * @param const TIsiReceiveC& aIsiMessage: The received ISI message.
       
   166         */
       
   167         void PermPmRecordWriteResp( const TIsiReceiveC& aIsiMessage );
       
   168 
       
   169         /**
       
   170         * Creates a PERM_PM_RECORD_READ_REQ ISI message and sends
       
   171         * it to phonet.
       
   172         * Used to read record for PMM.
       
   173         */
       
   174         void PermPmRecordReadReq();
       
   175 
       
   176         /**
       
   177         * Breaks a PERM_PM_RECORD_READ_RESP ISI message.
       
   178         * @param const TIsiReceiveC& aIsiMessage: The received ISI message.
       
   179         */
       
   180         void PermPmRecordReadResp( const TIsiReceiveC& aIsiMessage );
       
   181 
       
   182         /**
       
   183         * PNN record identifier value.
       
   184         * @return PNN record identifier value.
       
   185         */
       
   186         TInt GetPnnRecordIdentifierValue();
       
   187 
       
   188     private: // Constructors and destructor
       
   189 
       
   190         /**
       
   191         * 2nd phase constructor
       
   192         */
       
   193         void ConstructL();
       
   194 
       
   195     private: // Functions
       
   196 
       
   197         /**
       
   198         * Convert data field to operator name string according to coding scheme.
       
   199         * @param aNameType is name type to be converted.
       
   200         * @param aMCC is Country code.
       
   201         * @param aNameData is operator name data.
       
   202         * @param aOperatorName is converted operator name.
       
   203         * @return None.
       
   204         */
       
   205         void ConvertOperatorName(
       
   206             TNetOperatorNameType aNameType,
       
   207             TUint aMCC,
       
   208             TPtrC8& aNameData,
       
   209             TDes& aOperatorName );
       
   210 
       
   211         /**
       
   212         * Handles ONS and Hard coded names in priority.
       
   213         * @param aNetworkType is current network type.
       
   214         * @param aHardCodedNameType is hard coded name type.
       
   215         * @param aDisplayTag is hard coded operator name.
       
   216         * @param aNetworkName includes network data.
       
   217         * @return None.
       
   218         */
       
   219         void HandleOnsAndHardCodedName(
       
   220             TUint8 aNetworkType,
       
   221             TInt aHardCodedNameType,
       
   222             const TDes& aDisplayTag,
       
   223             RMobilePhone::TMobilePhoneNetworkInfoV5& aNetworkName );
       
   224 
       
   225         /**
       
   226         * Find out possible PNN record number with PP bit INFO_PP_EONS_FEAT
       
   227         * value when registered in HPLMN.
       
   228         * @param aOperatorCodeData is Operator Code data in BCD format.
       
   229         * @param aLacData is Location Area Code data.
       
   230         * @return possible PNN record number.
       
   231         */
       
   232         TInt HandlePnnRecordWithPPbitValueInHplmn(
       
   233             const TDesC8& aOperatorCodeData,
       
   234             const TUint& aLacData );
       
   235 
       
   236         /**
       
   237         * Go through OPL rule records and find out matching record if exist.
       
   238         * @param aOperatorCode is Operator Code in BCD format.
       
   239         * @param aLac is Location Area Code.
       
   240         * @return possible PNN record number.
       
   241         */
       
   242         TInt OplRulesChecker(
       
   243             const TDesC8& aOperatorCode,
       
   244             TUint aLac );
       
   245 
       
   246         /**
       
   247         * Checks one OPL rule record against received Operator Code
       
   248         * in BCD format and LAC value.
       
   249         * @param aIndex is OPL record index.
       
   250         * @param aOperCode is Operator Code in BCD format.
       
   251         * @param aLAC is Location Area Code.
       
   252         * @return None.
       
   253         */
       
   254         void OplRuleRecordChecker(
       
   255             TUint8 aIndex,
       
   256             const TDesC8& aOperCode,
       
   257             TUint aLac );
       
   258 
       
   259         /**
       
   260         * Check BCD char against rule to find out is that matching
       
   261         * with OPL list.
       
   262         * @param aOperCodeChar is character from one BCD byte.
       
   263         * @param aPlmnListChar is character from OPL list BCD byte.
       
   264         * @return success/failure value.
       
   265         */
       
   266         TInt BCDCharChecker(
       
   267              TUint8 aOperCodeChar,
       
   268              TUint8 aPlmnListChar );
       
   269 
       
   270         /**
       
   271         * Copy EONS Long and Short names if exist.
       
   272         * @param aNetworkData is Network data.
       
   273         * @return None.
       
   274         */
       
   275         void CopyEonsName(
       
   276             RMobilePhone::TMobilePhoneNetworkInfoV5& aNetworkData );
       
   277 
       
   278         /**
       
   279         * Check NITZ name data to current MCC/MNC values and update
       
   280         * name if match.
       
   281         * @param aMCC is current Mobile Country Code.
       
   282         * @param aMNC is current Mobile Network Code.
       
   283         * @param aNetworkData is Network data.
       
   284         * @return None.
       
   285         */
       
   286         void NitzNameChecker(
       
   287             TUint aMCC,
       
   288             TUint aMNC,
       
   289             RMobilePhone::TMobilePhoneNetworkInfoV5& aNetworkData );
       
   290 
       
   291         /**
       
   292         * Compare NITZ name to stored values in PMM.
       
   293         */
       
   294         void CompareNitzNameToPmmValues();
       
   295 
       
   296         /**
       
   297         * Converts 7-bit packed string to 8-bit format.
       
   298         * @param aNumberOf7BitChars is number of 7-bit characters.
       
   299         * @param aString is 7-bit packed source string.
       
   300         * @param aOutput is converted to 8-bit string.
       
   301         * @return None.
       
   302         */
       
   303         void Packed7to8Format(
       
   304             TUint8 aNumberOf7BitChars,
       
   305             const TDesC8& aString,
       
   306             TDes8& aOutput );
       
   307 
       
   308         /**
       
   309         * Browse a text in Unicode format, and for some specific characters
       
   310         * replace with the correct byte value.
       
   311         * @param aOutput unicode 16-bit format string.
       
   312         * @param aInput input 8-bit string.
       
   313         * @return None.
       
   314         */
       
   315         void ConvertGsm7ToUnicode16(
       
   316             TDes16& aOutput,
       
   317             const TDesC8& aInput );
       
   318 
       
   319         /**
       
   320         * Completes IPC EMobilePhoneGetDetectedNetworksV2Phase1.
       
   321         */
       
   322         void CompleteMobilePhoneGetDetectedNetworksV2Phase1L();
       
   323 
       
   324     protected: // Constructors and destructor
       
   325 
       
   326         /**
       
   327         * C++ default constructor.
       
   328         */
       
   329         CMmNetOperatorNameHandler();
       
   330 
       
   331     protected: // Functions
       
   332 
       
   333     private: // Enumerations, data types.
       
   334 
       
   335         // Used for storing EONS or NITZ name data.
       
   336         struct TOperatorNameData
       
   337             {
       
   338             // Mobile Country Code.
       
   339             TUint iMCC;
       
   340             // Mobile Network Code.
       
   341             TUint iMNC;
       
   342             // Long Name.
       
   343             RMobilePhone::TMobilePhoneNetworkLongName iLongName;
       
   344             // Short Name.
       
   345             RMobilePhone::TMobilePhoneNetworkShortName iShortName;
       
   346             // PNN identifier.
       
   347             TUint8 iPNNIdentifier;
       
   348             };
       
   349 
       
   350         // Operator PLMN List struct.
       
   351         struct TOperatorPLMNList
       
   352             {
       
   353             // Operator Code in BCD string format.
       
   354             TBuf8<KBCDLength> iOperCodeBCD;
       
   355             // Location Area Code, upper limit.
       
   356             TUint iLACUpperLimit;
       
   357             // Location Area Code, lower limit.
       
   358             TUint iLACLowerLimit;
       
   359             // Identifier of operator name to be displayed.
       
   360             TUint8 iPNNIdentifier;
       
   361             };
       
   362 
       
   363         // Manual search data list struct.
       
   364         struct TManualSearchDataList
       
   365             {
       
   366             // Mobile Country Code.
       
   367             TUint iMCC;
       
   368             // Mobile Network Code.
       
   369             TUint iMNC;
       
   370             // Network Type.
       
   371             TUint8 iNetworkType;
       
   372             // Location Area Code.
       
   373             TUint iLocationAreaCode;
       
   374             // Operator Code.
       
   375             TBuf8<KBCDLength> iOperatorCode;
       
   376             };
       
   377 
       
   378     public: // Data
       
   379 
       
   380     private: // Data
       
   381 
       
   382         // Pointer to the NetMessHandler.
       
   383         CMmNetMessHandler* iNetMessHandler;
       
   384 
       
   385         // Storing Location Area data for later use.
       
   386         RMobilePhone::TMobilePhoneLocationAreaV1 iLocationAreaData;
       
   387         // Storing Network data for later use.
       
   388         RMobilePhone::TMobilePhoneNetworkInfoV5 iNetworkData;
       
   389 
       
   390         // NET_NITZ_NAME_IND details need to be stored for later use.
       
   391         TOperatorNameData iNitzName;
       
   392 
       
   393         // EONS name details need to be stored for later use.
       
   394         TOperatorNameData iEonsName;
       
   395 
       
   396         // NITZ Name data stored to PMM.
       
   397         TOperatorNameData iNitzNamePmm;
       
   398 
       
   399         // Custom operator name info data.
       
   400         RMmCustomAPI::TOperatorNameInfo iOperNameInfo;
       
   401 
       
   402         // Value of the Product Profile bit INFO_PP_EONS_FEAT.
       
   403         TUint8 iInfoPpEonsFeatValue;
       
   404 
       
   405         // Buffer for Operator Name String (ONS name).
       
   406         TBuf<KOnsNameMaxLength> iOperatorNameString;
       
   407 
       
   408         // Operator PLMN list available.
       
   409         TBool iOplListAvailable;
       
   410 
       
   411         // OPL Rules read.
       
   412         TBool iOplRulesRead;
       
   413 
       
   414         // OPL Rule match.
       
   415         TBool iOplRuleMatch;
       
   416 
       
   417         // This is ETrue when SimOperatorReqReadPnn request
       
   418         // is sended from GetOperatorName function.
       
   419         TBool iFromGetOperatorName;
       
   420 
       
   421         // This is ETrue when SimOperatorReqReadPnn request
       
   422         // is sended from GetManualSearchOperatorName function.
       
   423         TBool iFromGetManualSearchOperatorName;
       
   424 
       
   425         // Index value of network in manual search network list.
       
   426         TUint8 iManualSearchIndexValue;
       
   427 
       
   428         // Operator PLMN List entry array.
       
   429         RArray<TOperatorPLMNList> iOperatorPlmnListTable;
       
   430 
       
   431         // Manual search Network List array.
       
   432         RArray<RMobilePhone::TMobilePhoneNetworkInfoV5> iManualSearchNetworkList;
       
   433 
       
   434         // Manual search data list array.
       
   435         RArray<TManualSearchDataList> iManualSearchDataList;
       
   436 
       
   437     protected: // Data
       
   438 
       
   439     };
       
   440 
       
   441 #endif // CMMNETOPERATORNAMEHANDLER_H
       
   442 
       
   443 // End of File