omadm/omadmextensions/adapters/streamingadapter/inc/nsmlstreamingadapter.h
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 *  Name        : nsmldmstreamingadapter.h
       
     3 *  Part of     : nsmldmstreamingadapter
       
     4 *
       
     5 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     6 * All rights reserved.
       
     7 * This component and the accompanying materials are made available
       
     8 * under the terms of "Eclipse Public License v1.0"
       
     9 * which accompanies this distribution, and is available
       
    10 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    11 *
       
    12 * Initial Contributors:
       
    13 * Nokia Corporation - initial contribution.
       
    14 *
       
    15 * Contributors:
       
    16 *
       
    17 * Description:  Implementation of dm adapters
       
    18 * 	This is part of omadmextensions.
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 #ifndef __NSMLDMSTREAMINGADAPTER_H__
       
    24 #define __NSMLDMSTREAMINGADAPTER_H__
       
    25 
       
    26 // INCLUDES
       
    27 #include <e32base.h>
       
    28 #include <smldmadapter.h>
       
    29 #include "nsmldmconstants.h"
       
    30 
       
    31 const TInt KMaxLengthStreamingName = 255;
       
    32 const TInt KMaxLengthToProxy = 255;
       
    33 const TInt KMaxLengthNetInfo = 255;
       
    34 const TInt KMaxLengthTempInfo = 10;
       
    35 
       
    36 const TInt KMinPort = 1024;
       
    37 const TInt KMaxPort = 65535;
       
    38 const TInt KPortDiff = 5;
       
    39 const TUint KNSmlDMStreamingAdapterImplUid = 0x20024311;
       
    40 
       
    41 const TInt KMnMaxBwGPRS = 9050;
       
    42 const TInt KMxMaxBwGPRS = 40200;
       
    43 const TInt KMnSusBwGPRS = 6335;
       
    44 const TInt KMxSusBwGPRS = 28140;
       
    45 
       
    46 const TInt KMnMaxBwEGPRS = 44800;
       
    47 const TInt KMxMaxBwEGPRS = 108800;
       
    48 const TInt KMnSusBwEGPRS = 26880;
       
    49 const TInt KMxSusBwEGPRS = 65280;
       
    50 
       
    51 const TInt KMnMaxBwWCDMA = 64000;
       
    52 const TInt KMxMaxBwWCDMA = 384000;
       
    53 const TInt KMnSusBwWCDMA = 44800;
       
    54 const TInt KMxSusBwWCDMA = 268800;
       
    55 
       
    56 const TInt KMnMaxBwHSDPA = 600000;
       
    57 const TInt KMxMaxBwHSDPA = 3600000;
       
    58 const TInt KMnSusBwHSDPA = 420000;
       
    59 const TInt KMxSusBwHSDPA = 2520000;
       
    60 
       
    61 const TInt KMnMaxBwWLAN = 64000;
       
    62 const TInt KMxMaxBwWLAN = 3000000;
       
    63 const TInt KMnSusBwWLAN = 44800;
       
    64 const TInt KMxSusBwWLAN = 2100000;
       
    65 
       
    66 const TInt KMnMaxBwCDMA = 9050;
       
    67 const TInt KMxMaxBwCDMA = 40200;
       
    68 const TInt KMnSusBwCDMA = 6335;
       
    69 const TInt KMxSusBwCDMA = 28140;
       
    70 
       
    71 const TInt KMnMaxBwCDMA2000 = 9050;
       
    72 const TInt KMxMaxBwCDMA2000 = 40200;
       
    73 const TInt KMnSusBwCDMA2000 = 6335;
       
    74 const TInt KMxSusBwCDMA2000 = 28140;
       
    75 
       
    76 
       
    77 /*
       
    78 const TInt KMnMaxBw = 5000;
       
    79 
       
    80 const TInt KMnMaxBwGPRS = 99995; // <
       
    81 const TInt KMnMaxBw3G = 1920001; // < 
       
    82 const TInt KMnMaxBwEGPRS = 199995; // < 
       
    83 const TInt KMnMaxBwWLAN = 4300001; // <
       
    84 const TInt KMnMaxBwHSDPA = 3999995; // < 
       
    85 const TInt KMnMaxBwCDMA = 99995; // <
       
    86 const TInt KMnMaxBwCDMA2000 = 153601; // < */
       
    87 
       
    88 
       
    89 
       
    90 
       
    91 // MACROS
       
    92 
       
    93 class CMPSettingsModel;
       
    94 
       
    95 // the DDF version must be changed if any changes in DDF structure 
       
    96 // ( built in DDFStructureL() function )
       
    97 _LIT8( KNSmlDMStreamingAdapterDDFVersion, "1.0" ); 
       
    98 
       
    99 _LIT8 (KNSmlURISeparator ,"/");
       
   100 
       
   101 _LIT8( KNSmlDMStreamingAdapterTextPlain, "text/plain" );
       
   102 _LIT8( KNSmlDMStreamingAdapterNodeName, "Streaming" );
       
   103 _LIT8( KNSmlDMStreamingAdapterDescription, "The parent object holding all Streaming Settings" );
       
   104 
       
   105 _LIT8( KNSmlDMStreamingAdapterVal, "Name/To-Proxy/To-NapID/NetInfo/MIN-UDP-PORT/MAX-UDP-PORT" );
       
   106 _LIT8( KNSmlDMStreamingAdapterName, "Name" );
       
   107 _LIT8( KNSmlDMStreamingAdapterNameDescription, "Streaming configuration name" );
       
   108 _LIT8( KNSmlDMStreamingAdapterToProxy, "To-Proxy" );
       
   109 _LIT8( KNSmlDMStreamingAdapterToProxyDescription, "Streaming proxy server ID" );
       
   110 _LIT8( KNSmlDMStreamingAdapterToNapID, "To-NapID" );
       
   111 _LIT8( KNSmlDMStreamingAdapterToNapIDDescription, "The APN that is used for Streaming" );
       
   112 _LIT8( KNSmlDMStreamingAdapterNetInfo, "NetInfo" );
       
   113 _LIT8( KNSmlDMStreamingAdapterNetInfoVal, "GPRS/EGPRS/WCDMA/CDMA/CDMA2000/WLAN/HSDPA" );
       
   114 
       
   115 _LIT8( KNSmlDMStreamingAdapterNetInfoGPRS, "GPRS" );
       
   116 _LIT8( KNSmlDMStreamingAdapterNetInfoEGPRS, "EGPRS" );
       
   117 _LIT8( KNSmlDMStreamingAdapterNetInfoWCDMA, "WCDMA" );
       
   118 _LIT8( KNSmlDMStreamingAdapterNetInfoCDMA2000, "CDMA2000" );
       
   119 _LIT8( KNSmlDMStreamingAdapterNetInfoWLAN, "WLAN" );
       
   120 _LIT8( KNSmlDMStreamingAdapterNetInfoCDMA, "CDMA" );
       
   121 _LIT8( KNSmlDMStreamingAdapterNetInfoHSDPA, "HSDPA" );
       
   122 
       
   123 _LIT8( KNSmlDMStreamingAdapterNetInfoDescription, "The parameter which contains networks information" );
       
   124 _LIT8( KNSmlDMStreamingAdapterMinUdpPort, "MIN-UDP-PORT" );
       
   125 _LIT8( KNSmlDMStreamingAdapterMinUdpPortDescription, "The min port number used for streaming" );
       
   126 _LIT8( KNSmlDMStreamingAdapterMaxUdpPort, "MAX-UDP-PORT" );
       
   127 _LIT8( KNSmlDMStreamingAdapterMaxUdpPortDescription, "The max port number used for streaming" );
       
   128 
       
   129 _LIT8( KCommaSep,",");
       
   130 
       
   131 
       
   132 
       
   133 // CLASS DECLARATION
       
   134 class CNSmlDmStreamingAdapter : public CSmlDmAdapter
       
   135     {
       
   136 public: // constructors and destructor
       
   137     static CNSmlDmStreamingAdapter* NewL(MSmlDmCallback* aDmCallback );
       
   138     static CNSmlDmStreamingAdapter* NewLC(MSmlDmCallback* aDmCallback );
       
   139 
       
   140     virtual ~CNSmlDmStreamingAdapter();
       
   141 
       
   142 //private: ///new functions
       
   143 public: ///new functions
       
   144     
       
   145     void SetNetInfoL(const TDesC8& aObject,const TDesC8 &aDes,TDataBearer aBearer,const TInt aStatusRef,const TInt aMnMaxBw, const TInt aMxMaxBw,const TInt aMnSusBw, const TInt aMxSusBw);
       
   146 		
       
   147     CSmlDmAdapter::TError GetNetInfoL(CBufBase& aObject,TDataBearer aBearer,const TDesC8 &aDes);
       
   148 
       
   149     void SetLeafPropertiesL( MSmlDmDDFObject& aObject, 
       
   150                  const TSmlDmAccessTypes& aAccessTypes, 
       
   151                  const TDesC8& aDescription ) const;
       
   152     CNSmlDmStreamingAdapter(TAny* aEcomArguments);
       
   153     /**
       
   154      * Two-phased constructor.
       
   155      */
       
   156     void ConstructL();
       
   157     CSmlDmAdapter::TError FetchLeafObjectL( const TDesC8& aURI, CBufBase& aObject );
       
   158     
       
   159     void SetMinUDPPortL(const TDesC8& aObject,const TInt aStatusRef);
       
   160     
       
   161     void SetMaxUDPPortL(const TDesC8& aObject,const TInt aStatusRef);
       
   162     
       
   163     void SetDefaultApL(const TDesC8& aObject,const TInt aStatusRef);
       
   164     
       
   165     CSmlDmAdapter::TError GetDefaultApL(CBufBase& aObject);
       
   166     
       
   167 //private: // from base classes
       
   168 public: // from base classes
       
   169     // Adapter interface from CSmlDmAdapter
       
   170     void DDFVersionL( CBufBase& aDDFVersion );
       
   171     void DDFStructureL( MSmlDmDDFObject& aDDF );
       
   172     void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   173                 const TDesC8& aObject, const TDesC8& aType, 
       
   174                 const TInt aStatusRef );
       
   175     void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, TInt aStatusRef ); 
       
   176     void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   177                    const TDesC8& aType, const TInt aResultsRef, 
       
   178                    const TInt aStatusRef ); 
       
   179     void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   180                 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, 
       
   181                 const TInt aResultsRef, const TInt aStatusRef );  
       
   182     void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, 
       
   183                  const TInt aStatusRef );
       
   184     
       
   185     void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   186                 RWriteStream*& aStream, const TDesC8& aType, 
       
   187                 const TInt aStatusRef );
       
   188     void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, 
       
   189                    const TDesC8& aType, const TInt aResultsRef, 
       
   190                    const TInt aStatusRef );
       
   191      
       
   192     void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID,
       
   193                           const TDesC8& aArgument, 
       
   194                           const TDesC8& aType,
       
   195                           const TInt aStatusRef );
       
   196                                   
       
   197     void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID,
       
   198                           RWriteStream*& aStream, 
       
   199                           const TDesC8& aType,
       
   200                           const TInt aStatusRef );
       
   201     
       
   202     void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID,
       
   203                        const TDesC8& aSourceURI, 
       
   204                        const TDesC8& aSourceLUID,
       
   205                        const TDesC8& aType, TInt aStatusRef );
       
   206     void StartAtomicL();
       
   207     void CommitAtomicL();
       
   208     void RollbackAtomicL();
       
   209     TBool StreamingSupport( TInt& aItemSize );
       
   210     void StreamCommittedL();
       
   211     void CompleteOutstandingCmdsL();
       
   212     
       
   213     static void Cleanup( TAny* aAny );
       
   214     
       
   215     /**
       
   216     * Fills the given information to a DDF Object node.
       
   217     * @param aNode The node whose data is filled.
       
   218     * @param aAccTypes The access types of the node.
       
   219     * @param aOccurance Occurance of the node.
       
   220     * @param aScope The scope of the node.
       
   221     * @param aFormat The format of the node's data, i.e. node/chr/bin/...
       
   222     * @param aDescription Informal description of the node.
       
   223     */
       
   224     void FillNodeInfoL( MSmlDmDDFObject& aNode, 
       
   225                         const TSmlDmAccessTypes& aAccTypes, 
       
   226                         MSmlDmDDFObject::TOccurence aOccurrence, 
       
   227                         MSmlDmDDFObject::TScope aScope, 
       
   228                         MSmlDmDDFObject::TDFFormat aFormat,
       
   229                         const TDesC8& aDescription ) const;
       
   230     
       
   231 private:
       
   232     MSmlDmCallback* iDmCallback;
       
   233     
       
   234     CMPSettingsModel* iModel;
       
   235     
       
   236     };
       
   237 
       
   238 #endif // __NSMLDMSTREAMINGADAPTER_H__