upnpharvester/common/cmlibrary/src/cmmediaserverfull.cpp
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2006-2007 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:      Capsulating Media servers
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <s32mem.h>
       
    26 
       
    27 #include "cmmediaserverfull.h"
       
    28 #include "msdebug.h"
       
    29 
       
    30 
       
    31 // ======== LOCAL FUNCTIONS ========
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // NewL
       
    35 // ---------------------------------------------------------------------------
       
    36 //
       
    37 EXPORT_C CCmMediaServerFull* CCmMediaServerFull::NewL()
       
    38     {
       
    39     CCmMediaServerFull* self = CCmMediaServerFull::NewLC();
       
    40     CleanupStack::Pop( self );
       
    41     return self;
       
    42     }
       
    43 
       
    44 // ---------------------------------------------------------------------------
       
    45 // NewLC
       
    46 // ---------------------------------------------------------------------------
       
    47 //
       
    48 EXPORT_C CCmMediaServerFull* CCmMediaServerFull::NewLC()
       
    49     {
       
    50     CCmMediaServerFull* self = new ( ELeave ) CCmMediaServerFull();
       
    51     CleanupStack::PushL( self );
       
    52     self->ConstructL();
       
    53     return self;
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // Destructor
       
    58 // ---------------------------------------------------------------------------
       
    59 //
       
    60 EXPORT_C CCmMediaServerFull::~CCmMediaServerFull()
       
    61     {
       
    62     delete iName;
       
    63     iVisibleDate = NULL;
       
    64     }
       
    65 
       
    66 // ---------------------------------------------------------------------------
       
    67 // Returns name of the media server
       
    68 // ---------------------------------------------------------------------------
       
    69 //
       
    70 EXPORT_C TPtrC8 CCmMediaServerFull::MediaServerName() const
       
    71     {
       
    72     return *iName;
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // Sets media server name
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 EXPORT_C void CCmMediaServerFull::SetMediaServerNameL( const TDesC8& aName )
       
    80     {
       
    81     delete iName;
       
    82     iName = NULL;
       
    83     iName = aName.AllocL();
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // Returns visible date of the media server
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 EXPORT_C TTime CCmMediaServerFull::VisibleDate() const
       
    91     {
       
    92     return iVisibleDate;
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // Sets visible date of the media server
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 EXPORT_C void CCmMediaServerFull::SetVisibleDate( TTime aTime )
       
   100     {
       
   101     iVisibleDate = aTime;
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // Gets is active status of the media server
       
   106 // ---------------------------------------------------------------------------
       
   107 //
       
   108 EXPORT_C TUint8 CCmMediaServerFull::IsActive() const
       
   109     {
       
   110     return iIsActive;
       
   111     }
       
   112 
       
   113 // ---------------------------------------------------------------------------
       
   114 // Sets is active status of the media server
       
   115 // ---------------------------------------------------------------------------
       
   116 //
       
   117 EXPORT_C void CCmMediaServerFull::SetIsActive( TUint8 aIsActive )
       
   118     {
       
   119     iIsActive = aIsActive;
       
   120     }
       
   121 
       
   122 // ---------------------------------------------------------------------------
       
   123 // Sets copy capability info
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 EXPORT_C TBool CCmMediaServerFull::CopyCapability() const
       
   127     {
       
   128     return iCopyCapability;
       
   129     }
       
   130 
       
   131 // ---------------------------------------------------------------------------
       
   132 // Gets copy capability info
       
   133 // ---------------------------------------------------------------------------
       
   134 //
       
   135 EXPORT_C void CCmMediaServerFull::SetCopyCapability( TBool aCopyCapability )
       
   136     {
       
   137     iCopyCapability = aCopyCapability;
       
   138     }
       
   139 
       
   140 
       
   141 // ---------------------------------------------------------------------------
       
   142 // Sets server status ( used for store )
       
   143 // ---------------------------------------------------------------------------
       
   144 //
       
   145 EXPORT_C void CCmMediaServerFull::SetStoreUsage( TBool aUsed )
       
   146     {
       
   147     iStoreServer = aUsed;
       
   148     }
       
   149 
       
   150 // ---------------------------------------------------------------------------
       
   151 // Gets server status ( store usage )
       
   152 // ---------------------------------------------------------------------------
       
   153 //
       
   154 EXPORT_C TBool CCmMediaServerFull::StoreUsage()
       
   155     {    
       
   156     return iStoreServer;
       
   157     }  
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // Sets server status ( used for fill )
       
   161 // ---------------------------------------------------------------------------
       
   162 //
       
   163 EXPORT_C void CCmMediaServerFull::SetFillUsage( TBool aUsed )
       
   164     {
       
   165     iFillServer = aUsed;
       
   166     }        
       
   167 
       
   168 // ---------------------------------------------------------------------------
       
   169 // Gets server status ( fill usage )
       
   170 // ---------------------------------------------------------------------------
       
   171 //
       
   172 EXPORT_C TBool CCmMediaServerFull::FillUsage()
       
   173     {    
       
   174     return iFillServer;
       
   175     }    
       
   176 
       
   177 // ---------------------------------------------------------------------------
       
   178 // CCmFillRule::ExternalizeL
       
   179 // ---------------------------------------------------------------------------
       
   180 //
       
   181 EXPORT_C void CCmMediaServerFull::ExternalizeL( RWriteStream& aStream ) const
       
   182     {
       
   183     CCmMediaServer::ExternalizeL(aStream);
       
   184     aStream.WriteInt32L( iName->Length() );
       
   185     if ( iName )
       
   186         {
       
   187         aStream << *iName;
       
   188         }
       
   189     else
       
   190         {
       
   191         aStream << KNullDesC8();
       
   192         }    
       
   193     aStream << iVisibleDate.Int64();
       
   194     aStream.WriteInt8L( iIsActive );
       
   195     aStream.WriteInt8L( iCopyCapability );
       
   196     aStream.WriteInt8L( iFillServer );
       
   197     aStream.WriteInt8L( iStoreServer );
       
   198     }
       
   199 
       
   200 // ---------------------------------------------------------------------------
       
   201 // CCmFillRule::InternalizeL
       
   202 // ---------------------------------------------------------------------------
       
   203 //
       
   204 EXPORT_C void CCmMediaServerFull::InternalizeL( RReadStream& aStream )
       
   205     {
       
   206     CCmMediaServer::InternalizeL(aStream);
       
   207     if ( iName )
       
   208         {
       
   209         delete iName;
       
   210         iName = NULL;
       
   211         }
       
   212     TInt bufLength = aStream.ReadInt32L();
       
   213     iName = HBufC8::NewL( aStream, bufLength );    
       
   214     TInt64 tempTime;
       
   215     aStream >> tempTime;
       
   216     iVisibleDate = tempTime;
       
   217     iIsActive = aStream.ReadInt8L();
       
   218     iCopyCapability = aStream.ReadInt8L();
       
   219     iFillServer = aStream.ReadInt8L();
       
   220     iStoreServer = aStream.ReadInt8L();
       
   221     }
       
   222 
       
   223 
       
   224 // End of file