upnpavcontroller/upnpavcontrollerserver/inc/upnpavdeviceextended.h
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:      a device data class used internally in AVC server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 #ifndef C_UPNPAVDEVICEEXTENDED_H_
       
    24 #define C_UPNPAVDEVICEEXTENDED_H_
       
    25 
       
    26 // Include files
       
    27 #include <e32base.h>
       
    28 #include "upnpavdevice.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CUpnpDlnaProtocolInfo;
       
    32 class CUpnpItem;
       
    33 
       
    34 /**
       
    35  * Extended UPnP device. Contains protocolinfo and a reference count for
       
    36  * subscibe actions.
       
    37  *
       
    38  */
       
    39 class CUpnpAVDeviceExtended: public CUpnpAVDevice
       
    40     {
       
    41  
       
    42 public:
       
    43 
       
    44     enum TDLNADeviceType
       
    45         {
       
    46         EUPnP = 0,
       
    47         EDMR,
       
    48         EDMP,
       
    49         EDMS
       
    50         }; 
       
    51  
       
    52 public:
       
    53 
       
    54     /**
       
    55      * Static 1st phase constructor
       
    56      * 
       
    57      * @param aDevice base device
       
    58      * @return new instance
       
    59      */    
       
    60     static CUpnpAVDeviceExtended* NewL( const CUpnpAVDevice& aDevice );
       
    61 
       
    62     /**
       
    63      * Static 1st phase constructor
       
    64      * 
       
    65      * @param aDevice base device
       
    66      * @return new instance
       
    67      */    
       
    68     static CUpnpAVDeviceExtended* NewL(
       
    69         const CUpnpAVDeviceExtended& aDevice );
       
    70 
       
    71     /**
       
    72      * Static 1st phase constructor
       
    73      *
       
    74      * @return new timer instance
       
    75      */    
       
    76     static CUpnpAVDeviceExtended* NewL();
       
    77 
       
    78     /**
       
    79      * Destructor
       
    80      */    
       
    81     virtual ~CUpnpAVDeviceExtended();
       
    82     
       
    83 private:
       
    84 
       
    85     /**
       
    86      * Private constructor
       
    87      */
       
    88     CUpnpAVDeviceExtended();
       
    89 
       
    90     /**
       
    91      * 2nd phase constructor
       
    92      */    
       
    93     void ConstructL();
       
    94     
       
    95 
       
    96 public: // New functions
       
    97 
       
    98     /**
       
    99      * Sets sink protocolinfo
       
   100      * 
       
   101      * @param aProtocolInfo sink protocolinfo
       
   102      */    
       
   103     void SetSinkProtocolInfoL( const TDesC8& aProtocolInfo );
       
   104     
       
   105     /**
       
   106      * Returns devices sink protocolinfos as an array
       
   107      * 
       
   108      * @return array of protocolinfos
       
   109      */    
       
   110     const RPointerArray<CUpnpDlnaProtocolInfo>&
       
   111         SinkProtocolInfo() const;
       
   112     
       
   113     /**
       
   114      * Sets source protocolinfo
       
   115      * 
       
   116      * @param aProtocolInfo source protocolinfo
       
   117      */    
       
   118     void SetSourceProtocolInfoL( const TDesC8& aProtocolInfo );
       
   119     
       
   120     /**
       
   121      * Returns devices source protocolinfos as an array
       
   122      * 
       
   123      * @return array of protocolinfos
       
   124      */    
       
   125     const RPointerArray<CUpnpDlnaProtocolInfo>&
       
   126         SourceProtocolInfo() const;
       
   127     
       
   128     /**
       
   129      * Increases devices subscription count
       
   130      * 
       
   131      * @return subscription count
       
   132      */    
       
   133     TInt IncreaseSubscriptionCount();
       
   134     
       
   135     /**
       
   136      * Decreases devices subscription count
       
   137      * 
       
   138      * @return subscription count
       
   139      */    
       
   140     TInt DecreaseSubscriptionCount();
       
   141     
       
   142     /**
       
   143      * Returns subscription count
       
   144      * 
       
   145      * @return subscription count
       
   146      */    
       
   147     TInt SubscriptionCount() const;
       
   148     
       
   149     /**
       
   150      * Sets device capabilities
       
   151      * 
       
   152      * @param aListOfMimeTypes
       
   153      */    
       
   154     void SetCapabilitiesBySupportedMimeTypesL(
       
   155         const TDesC8& aListOfMimeTypes );
       
   156         
       
   157     /**
       
   158      * Sets if the device is a local device (S60 Media Server)
       
   159      * 
       
   160      * @param aLocal
       
   161      */    
       
   162     void SetLocal( TBool aLocal );
       
   163     
       
   164     /**
       
   165      * Return if the device is local
       
   166      * 
       
   167      * @return ETrue if the device is local
       
   168      */    
       
   169     TBool Local() const;
       
   170     
       
   171     /**
       
   172      * Matches protocolinfo and return ETrue if it matches
       
   173      * 
       
   174      * @param aProtocolInfo objects protocolinfo
       
   175      * @return ETrue if it matches
       
   176      */    
       
   177     TBool MatchSinkProtocolInfo( const TDesC8& aInfo ) const;
       
   178     
       
   179     /**
       
   180      * Validates transfer
       
   181      * 
       
   182      * @param aProtocolInfo objects protocolinfo
       
   183      * @return ETrue if it matches
       
   184      */    
       
   185     TBool ValidateTransfer( const TDesC8& aInfo ) const;
       
   186         
       
   187     /**
       
   188      * Sets sink protocolinfo
       
   189      * 
       
   190      * @param aProtocolInfo
       
   191      */    
       
   192     const TDesC8& FindFirstMatchingInSinkL(
       
   193         const CUpnpItem& aItem ) const;
       
   194 
       
   195     /**
       
   196      * Matches objectclass to protocolInfo
       
   197      * 
       
   198      * @param aObjectClass
       
   199      * @param aProtocolInfo
       
   200      */    
       
   201     TBool MatchType( const TDesC8& aObjectClass, const TDesC8&
       
   202         aProtocolInfo ) const;
       
   203     
       
   204     /**
       
   205      * Sets if the device supports audio upload
       
   206      * 
       
   207      * @param aAudioUpload
       
   208      */    
       
   209     void SetAudioUpload( TBool aAudioUpload );
       
   210     
       
   211     /**
       
   212      * Return if the device supports audio upload
       
   213      * 
       
   214      * @return ETrue if the device supports audio upload
       
   215      */    
       
   216     TBool AudioUpload() const;
       
   217     
       
   218     /**
       
   219      * Sets if the device supports image upload
       
   220      * 
       
   221      * @param aImageUpload
       
   222      */    
       
   223     void SetImageUpload( TBool aImageUpload );
       
   224     
       
   225     /**
       
   226      * Return if the device supports image upload
       
   227      * 
       
   228      * @return ETrue if the device supports image upload
       
   229      */    
       
   230     TBool ImageUpload() const;
       
   231     
       
   232     /**
       
   233      * Sets if the device supports video upload
       
   234      * 
       
   235      * @param aVideoUpload
       
   236      */    
       
   237     void SetVideoUpload( TBool aVideoUpload );
       
   238     
       
   239     /**
       
   240      * Return if the device supports video upload
       
   241      * 
       
   242      * @return ETrue if the device supports video upload
       
   243      */    
       
   244     TBool VideoUpload() const;    
       
   245 
       
   246     /**
       
   247      * Sets if the device supports CreateChildContainer
       
   248      * 
       
   249      * @param aCreateChildContainer
       
   250      */    
       
   251     void SetCreateChildContainer( TBool aCreateChildContainer );
       
   252     
       
   253     /**
       
   254      * Return if the device supports video upload
       
   255      * 
       
   256      * @return ETrue if the device supports video upload
       
   257      */    
       
   258     TBool CreateChildContainer() const;
       
   259     
       
   260     /**
       
   261      * Sets if the device supports DestroyObject
       
   262      * 
       
   263      * @param aDestroyObject
       
   264      */    
       
   265     void SetDestroyObject( TBool aDestroyObject );
       
   266     
       
   267     /**
       
   268      * Return if the device supports DestroyObject
       
   269      * 
       
   270      * @return ETrue if the device is local
       
   271      */    
       
   272     TBool DestroyObject() const;
       
   273     
       
   274     /**
       
   275      * Sets if the protocolInfo has been received
       
   276      * 
       
   277      * @param aPInfoReceived
       
   278      */    
       
   279     void SetPInfoReceived( TBool aPInfoReceived );
       
   280     
       
   281      /**
       
   282      * Return if the device has received protocolInfo
       
   283      * 
       
   284      * @return ETrue if the device has received protocolInfo
       
   285      */    
       
   286    TBool PInfoReceived() const;
       
   287    
       
   288    void SetDLNADeviceType( TDLNADeviceType aDeviceType );
       
   289    
       
   290    TDLNADeviceType DLNADeviceType() const;
       
   291     
       
   292 private:
       
   293     
       
   294     /**
       
   295      * Sets source protocolinfo
       
   296      * 
       
   297      * @param aProtocolInfo source protocolinfo
       
   298      */    
       
   299     void SetSourceProtocolInfoL(
       
   300         const RPointerArray<CUpnpDlnaProtocolInfo>& aProtocolInfo );
       
   301     
       
   302     /**
       
   303      * Sets sink protocolinfo
       
   304      * 
       
   305      * @param aProtocolInfo sink protocolinfo
       
   306      */    
       
   307     void SetSinkProtocolInfoL(
       
   308         const RPointerArray<CUpnpDlnaProtocolInfo>& aProtocolInfo );
       
   309         
       
   310     /**
       
   311      * Parses descriptor to a delimeter
       
   312      * 
       
   313      * @param aLexer lexer representing a descriptor
       
   314      * @param aDelimeter delimeter character
       
   315      */    
       
   316     void ParseToDelimeter( TLex8& aLex, TChar aDelimeter );
       
   317     
       
   318     /**
       
   319      * Judge character to be able remove 
       
   320      * 
       
   321      * @param aCharacter is a character
       
   322      * @return ETrue if the character can be removed
       
   323      */    
       
   324     TBool IsIllegalCharacter( TChar aCharacter ) const;   
       
   325     
       
   326     /**
       
   327      * Parses descriptor perhaps have illegal characters
       
   328      * 
       
   329      * @param aPtr representing a descriptor
       
   330      * @return a new hbufc8 buffer 
       
   331      */    
       
   332     HBufC8* RemoveIllegalCharactersL( const TDesC8& aPtr ) const;
       
   333     
       
   334     TBool MatchSourceProfileId( const TDesC8& aInfo ) const;
       
   335 
       
   336     TBool MatchSinkProfileId( const TDesC8& aInfo ) const;
       
   337     
       
   338     TBool MatchSinkMime( const TDesC8& aInfo ) const;
       
   339        
       
   340 private:
       
   341     
       
   342     RPointerArray<CUpnpDlnaProtocolInfo> iSourceProtocolInfo;
       
   343     
       
   344     RPointerArray<CUpnpDlnaProtocolInfo> iSinkProtocolInfo;
       
   345     
       
   346     TInt iSubscriptionCount;
       
   347     
       
   348     TBool iLocal;
       
   349     
       
   350     TBool iAudioUpload;
       
   351     
       
   352     TBool iImageUpload;
       
   353     
       
   354     TBool iVideoUpload;
       
   355     
       
   356     TBool iCreateChildContainer;
       
   357     
       
   358     TBool iDestroyObject;
       
   359     
       
   360     TBool iPInfoReceived;
       
   361     
       
   362     TDLNADeviceType iDLNADeviceType;
       
   363     };
       
   364 
       
   365 
       
   366 #endif // C_UPNPAVDEVICEEXTENDED_H_