adaptationlayer/tsy/simatktsy_dll/inc/ber_tlv.h
changeset 5 8ccc39f9d787
parent 0 63b37f68c1ce
equal deleted inserted replaced
4:510c70acdbf6 5:8ccc39f9d787
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: 
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    22 
    22 
    23 //  INCLUDES
    23 //  INCLUDES
    24 #include <e32base.h>        // base class cbase
    24 #include <e32base.h>        // base class cbase
    25 
    25 
    26 
    26 
    27 //  CONSTANTS 
    27 //  CONSTANTS
    28 const TUint8 KTlvLengthStartPosition                            = 0x01;
    28 const TUint8 KTlvLengthStartPosition                            = 0x01;
    29 const TUint8 KTlvDataAreaStartPosition                          = 0x02;
    29 const TUint8 KTlvDataAreaStartPosition                          = 0x02;
    30 const TUint8 KTlvHeaderLength                                   = 0x02;
    30 const TUint8 KTlvHeaderLength                                   = 0x02;
    31 const TUint8 KTwoByteLengthCoding                               = 0x81;
    31 const TUint8 KTwoByteLengthCoding                               = 0x81;
    32 const TUint8 KMccAndMncLength                                   = 0x03;
    32 const TUint8 KMccAndMncLength                                   = 0x03;
   163 
   163 
   164 const TUint8 KTlvAccessTechnologyTag                            = 0x3F;
   164 const TUint8 KTlvAccessTechnologyTag                            = 0x3F;
   165 const TUint8 KTlvESNTag                                         = 0x46;
   165 const TUint8 KTlvESNTag                                         = 0x46;
   166 const TUint8 KTlvNetworkAccessNameTag                           = 0x47;
   166 const TUint8 KTlvNetworkAccessNameTag                           = 0x47;
   167 const TUint8 KTlvPdpContextActivationParametersTag              = 0x52;
   167 const TUint8 KTlvPdpContextActivationParametersTag              = 0x52;
       
   168 const TUint8 KTlvImeisvTag                                      = 0x62;
   168 
   169 
   169 const TUint8 KTlvTimerIdentifierTagCRBitOn                      = 0xA4;
   170 const TUint8 KTlvTimerIdentifierTagCRBitOn                      = 0xA4;
   170 
   171 
   171 const TUint8 KTlvUtranMeasurementQualifierTag                   = 0x69;
   172 const TUint8 KTlvUtranMeasurementQualifierTag                   = 0x69;
   172 //TLV Coding
   173 //TLV Coding
   286 const TUint8 KBackwardMoveInTheProactiveSimSessionRequestedByTheUser    = 0x11;
   287 const TUint8 KBackwardMoveInTheProactiveSimSessionRequestedByTheUser    = 0x11;
   287 const TUint8 KNoResponseFromUser                                        = 0x12;
   288 const TUint8 KNoResponseFromUser                                        = 0x12;
   288 const TUint8 KHelpInformationRequiredByTheUser                          = 0x13;
   289 const TUint8 KHelpInformationRequiredByTheUser                          = 0x13;
   289 const TUint8 KUssdOrSsTransactionTerminatedByTheUser                    = 0x14;
   290 const TUint8 KUssdOrSsTransactionTerminatedByTheUser                    = 0x14;
   290 
   291 
   291 //Results '2X' Indicate To The SIM That It May Be Worth Re-Trying The Command 
   292 //Results '2X' Indicate To The SIM That It May Be Worth Re-Trying The Command
   292 //At A Later Opportunity.
   293 //At A Later Opportunity.
   293 const TUint8 KMeCurrentlyUnableToProcessCommand                         = 0x20;
   294 const TUint8 KMeCurrentlyUnableToProcessCommand                         = 0x20;
   294 const TUint8 KNetworkCurrentlyUnableToProcessCommand                    = 0x21;
   295 const TUint8 KNetworkCurrentlyUnableToProcessCommand                    = 0x21;
   295 const TUint8 KUserDidNotAcceptTheProactiveCommand                       = 0x22;
   296 const TUint8 KUserDidNotAcceptTheProactiveCommand                       = 0x22;
   296 const TUint8 KUserClearedDownCallBeforeConnectionOrNetworkRelease       = 0x23;
   297 const TUint8 KUserClearedDownCallBeforeConnectionOrNetworkRelease       = 0x23;
   297 const TUint8 KActionInContradictionWithTheCurrentTimerState             = 0x24;
   298 const TUint8 KActionInContradictionWithTheCurrentTimerState             = 0x24;
   298 const TUint8 KInteractionWithCallControlBySimTemporaryProblem           = 0x25;
   299 const TUint8 KInteractionWithCallControlBySimTemporaryProblem           = 0x25;
   299 const TUint8 KLaunchBrowserGenericErrorCode                             = 0x26;
   300 const TUint8 KLaunchBrowserGenericErrorCode                             = 0x26;
   300 
   301 
   301 //Results '3X' Indicate That It Is Not Worth The SIM Re-Trying With An 
   302 //Results '3X' Indicate That It Is Not Worth The SIM Re-Trying With An
   302 //Identical Command, As It Will Only Get The Same Response. However, The 
   303 //Identical Command, As It Will Only Get The Same Response. However, The
   303 //Decision To Retry Lies With The SIM Application.
   304 //Decision To Retry Lies With The SIM Application.
   304 const TUint8 KCommandBeyondMeCapabilities                               = 0x30;
   305 const TUint8 KCommandBeyondMeCapabilities                               = 0x30;
   305 const TUint8 KCommandTypeNotUnderstoodByMe                              = 0x31;
   306 const TUint8 KCommandTypeNotUnderstoodByMe                              = 0x31;
   306 const TUint8 KCommandDataNotUnderstoodByMe                              = 0x32;
   307 const TUint8 KCommandDataNotUnderstoodByMe                              = 0x32;
   307 const TUint8 KCommandNumberNotKnownByMe                                 = 0x33;
   308 const TUint8 KCommandNumberNotKnownByMe                                 = 0x33;
   312 const TUint8 KMultiplecardCommandsError                                 = 0x38;
   313 const TUint8 KMultiplecardCommandsError                                 = 0x38;
   313 const TUint8 KSimPermanentProblem                                       = 0x39;
   314 const TUint8 KSimPermanentProblem                                       = 0x39;
   314 const TUint8 KBearerIndependentProtocolError                            = 0x3a;
   315 const TUint8 KBearerIndependentProtocolError                            = 0x3a;
   315 
   316 
   316 //Additional information
   317 //Additional information
   317 //Contents: For the general result "Command performed successfully", some 
   318 //Contents: For the general result "Command performed successfully", some
   318 // proactive commands require additional information in the command result. 
   319 // proactive commands require additional information in the command result.
   319 // This is defined in the subclauses below. For the general results '20', '21', 
   320 // This is defined in the subclauses below. For the general results '20', '21',
   320 // '26', '34', '35', '37', '38' and '39' and '3A', it is mandatory for the ME 
   321 // '26', '34', '35', '37', '38' and '39' and '3A', it is mandatory for the ME
   321 // to provide a specific cause value as additional information, as defined in 
   322 // to provide a specific cause value as additional information, as defined in
   322 // the subclauses below. For the other general results, the ME may optionally 
   323 // the subclauses below. For the other general results, the ME may optionally
   323 // supply additional information. If additional information is not supplied, 
   324 // supply additional information. If additional information is not supplied,
   324 // then the length of the value part of the data object need only contain the 
   325 // then the length of the value part of the data object need only contain the
   325 // general result. See 3GPP TS 11.14 V8.8.0, chapters 12.12.1 - 12.12.11 for 
   326 // general result. See 3GPP TS 11.14 V8.8.0, chapters 12.12.1 - 12.12.11 for
   326 // more details.
   327 // more details.
   327 
   328 
   328 //Additional information for ME problem
   329 //Additional information for ME problem
   329 //Additional information for network problem
   330 //Additional information for network problem
   330 //Additional information for SS problem
   331 //Additional information for SS problem
   389 const TUint8 KSim                                               = 0x81;
   390 const TUint8 KSim                                               = 0x81;
   390 const TUint8 KMe                                                = 0x82;
   391 const TUint8 KMe                                                = 0x82;
   391 const TUint8 KNetwork                                           = 0x83;
   392 const TUint8 KNetwork                                           = 0x83;
   392 
   393 
   393 
   394 
   394 //  DATA TYPES  
   395 //  DATA TYPES
   395 
   396 
   396 // Tlv Specific Data Types
   397 // Tlv Specific Data Types
   397 enum TTlvSpesificDataType
   398 enum TTlvSpesificDataType
   398     {
   399     {
   399     ETLV_TonAndNpi,
   400     ETLV_TonAndNpi,
   495 // CLASS DECLARATION
   496 // CLASS DECLARATION
   496 /**
   497 /**
   497 *  TTlvBase
   498 *  TTlvBase
   498 *  TLV type: Tag Length Value(s)
   499 *  TLV type: Tag Length Value(s)
   499 *  Generic BER-TLV constructor class, can be used to create TLVs
   500 *  Generic BER-TLV constructor class, can be used to create TLVs
   500 *  You do not need to worry about lenghts; Example usage: 
   501 *  You do not need to worry about lenghts; Example usage:
   501 *                  TTlv tlv;
   502 *                  TTlv tlv;
   502 *                  tlv.Begin( KxxBerTag);  <--- top level tag
   503 *                  tlv.Begin( KxxBerTag);  <--- top level tag
   503 *                  tlv.AddTag( KxxxTag )   <--- simple tags
   504 *                  tlv.AddTag( KxxxTag )   <--- simple tags
   504 *                  tlv.AddByte(...)        <--- add values for this tag
   505 *                  tlv.AddByte(...)        <--- add values for this tag
   505 *                  tlv.AddByte(...)
   506 *                  tlv.AddByte(...)
   564         const TDesC8& End();
   565         const TDesC8& End();
   565 
   566 
   566         /**
   567         /**
   567         * Return data, calculated without
   568         * Return data, calculated without
   568         * top level tag.
   569         * top level tag.
   569         * @since Series 60 Series60_2.6 
   570         * @since Series 60 Series60_2.6
   570         * @param None
   571         * @param None
   571         * @return TDesC8& descriptor containing BER-TLV
   572         * @return TDesC8& descriptor containing BER-TLV
   572         */
   573         */
   573         const TDesC8& GetDataWithoutTopLevelTag();
   574         const TDesC8& GetDataWithoutTopLevelTag();
   574 
   575 
   575 
   576 
   576     protected: // Data
   577     protected: // Data
   577     
   578 
   578         TInt        iLenIndex;
   579         TInt        iLenIndex;
   579         TDes8&      iData;
   580         TDes8&      iData;
   580     };
   581     };
   581 
   582 
   582 /**
   583 /**
   614 *  @since Series 60 Series60_2.6
   615 *  @since Series 60 Series60_2.6
   615 */
   616 */
   616 class TTlv : public TTlvBase
   617 class TTlv : public TTlvBase
   617     {
   618     {
   618     public: // Constructor
   619     public: // Constructor
   619     
   620 
   620         /**
   621         /**
   621         * Constructor
   622         * Constructor
   622         * @since Series 60 Series60_2.6
   623         * @since Series 60 Series60_2.6
   623         * @param iBuffer
   624         * @param iBuffer
   624         */    
   625         */
   625         TTlv() : TTlvBase( iBuffer ) {}
   626         TTlv() : TTlvBase( iBuffer ) {}
   626         
   627 
   627         private:    // Data
   628         private:    // Data
   628     
   629 
   629         // TLV must fit in APDU limits (255 bytes)
   630         // TLV must fit in APDU limits (255 bytes)
   630         // therefore the maximum possible TLV size is 255
   631         // therefore the maximum possible TLV size is 255
   631         TBuf8<255>   iBuffer;
   632         TBuf8<255>   iBuffer;
   632     };
   633     };
   633 
   634 
   725             TInt offset = ( KTwoByteLengthCoding == iData[1] ) ? 1 : 0;
   726             TInt offset = ( KTwoByteLengthCoding == iData[1] ) ? 1 : 0;
   726             return iData.Mid( 2+offset, iData[1+offset] );
   727             return iData.Mid( 2+offset, iData[1+offset] );
   727             }
   728             }
   728 
   729 
   729     protected: // Data
   730     protected: // Data
   730         
   731 
   731         // Pointer to Tlv data
   732         // Pointer to Tlv data
   732         TPtrC8 iData;
   733         TPtrC8 iData;
   733     };
   734     };
   734 
   735 
   735 /**
   736 /**
   751 
   752 
   752     public: // New methods
   753     public: // New methods
   753 
   754 
   754         /**
   755         /**
   755         * Find tlv by tag value
   756         * Find tlv by tag value
   756         * @param aTlv 
   757         * @param aTlv
   757         * @param aTlvTagValue TlvTag
   758         * @param aTlvTagValue TlvTag
   758         * @param aItemNbr number of requested Tlv, default is 0
   759         * @param aItemNbr number of requested Tlv, default is 0
   759         * @return TInt: KErrNone or KErrNotFound
   760         * @return TInt: KErrNone or KErrNotFound
   760         */
   761         */
   761         TInt TlvByTagValue(
   762         TInt TlvByTagValue(
   762             CTlv* aTlv,
   763             CTlv* aTlv,
   763             TUint8 aTlvTagValue, 
   764             TUint8 aTlvTagValue,
   764             TInt aItemNbr = 0 );
   765             TInt aItemNbr = 0 );
   765             
   766 
   766         /**
   767         /**
   767         * Find several tlvs by tag value
   768         * Find several tlvs by tag value
   768         * @since Series 60 Series60_2.6
   769         * @since Series 60 Series60_2.6
   769         * @param aSubBlock retruns tlvs
   770         * @param aSubBlock retruns tlvs
   770         * @param aSubBlockId TlvTag
   771         * @param aSubBlockId TlvTag
   771         * @return TInt: KErrNone or KErrNotFound
   772         * @return TInt: KErrNone or KErrNotFound
   772         */
   773         */
   773         TInt TlvByTagValueMulti( CTlv* aTlv, TUint8 aTlvTag );
   774         TInt TlvByTagValueMulti( CTlv* aTlv, TUint8 aTlvTag );
   774         
   775 
   775         /**
   776         /**
   776         * Set ber-tlv from atk_generic_req isi-message.
   777         * Set ber-tlv from atk_generic_req isi-message.
   777         * @since NCP 5.0
   778         * @since NCP 5.0
   778         * @param aIsiMessage ISI message
   779         * @param aIsiMessage ISI message
   779         * @return TInt: KErrNone or KErrNotFound
   780         * @return TInt: KErrNone or KErrNotFound
   806         * @return TUint8: wanted data.
   807         * @return TUint8: wanted data.
   807         */
   808         */
   808          TUint8 GetShortInfo( TTlvSpesificDataType aType );
   809          TUint8 GetShortInfo( TTlvSpesificDataType aType );
   809 
   810 
   810         /**
   811         /**
   811         * Returns the Data defined by aType. Index and length of the 
   812         * Returns the Data defined by aType. Index and length of the
   812         * data depends on data type.
   813         * data depends on data type.
   813         * @since Series 60 Series60_2.6
   814         * @since Series 60 Series60_2.6
   814         * @param TAtkSpesificDataType aType: data type.
   815         * @param TAtkSpesificDataType aType: data type.
   815         * @return TptrC8: pointer to the data.
   816         * @return TptrC8: pointer to the data.
   816         */
   817         */