upnp/upnpstack/controlpointbase/inc/upnpcpbdevicedescription.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2007-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:  Base class - declares device description process.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CUPNPCPBDEVICEDESCRIPTION_H
       
    20 #define C_CUPNPCPBDEVICEDESCRIPTION_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CUpnpDevice;
       
    27 class CUpnpControlPoint;
       
    28 class CUpnpContentHandlersController;
       
    29 class CUpnpCPBDiscovery;
       
    30 class MUpnpCpbHttpMessageController;
       
    31 class CUpnpCpbDeviceRepository;
       
    32 
       
    33 // CONST
       
    34 const TInt KDisscoveryFinished = 0;
       
    35 const TInt KDisscoveryIncorrect = 1;
       
    36 const TInt KDisscoveryInProgress = 2;
       
    37 
       
    38 /**
       
    39  * Class handling discovery process of simple device.
       
    40  * It is checking only services of device. Subdevices are not processed.
       
    41  *
       
    42  * @lib controlpointbase.lib
       
    43  * @since S60 v5.0
       
    44  */
       
    45 NONSHARABLE_CLASS( CUpnpCpbDeviceDescription ) : public CBase
       
    46     {
       
    47     public:
       
    48     /**
       
    49      * Destructor
       
    50      * @since S60 v5.0
       
    51      */
       
    52     virtual ~CUpnpCpbDeviceDescription();
       
    53 
       
    54     /**
       
    55      * Start processing device.
       
    56      *
       
    57      * @since S60 v5.0
       
    58      * @param aDevice Device that should be discovered
       
    59      * @return One of symbian errors or
       
    60      *                 0 - if discovery process is finished correctly
       
    61      *                 1 - if discovery was not finished correctly
       
    62      *                 2 - if discovery is in progress
       
    63      */
       
    64     virtual TInt DiscoverDeviceL( CUpnpDevice* aDevice ) = 0;
       
    65 
       
    66     /**
       
    67      * Function processing service description.
       
    68      *
       
    69      * @since S60 v5.0
       
    70      * @param aMsg Service message
       
    71      * @return One of symbian errors or
       
    72      *                 0 - if discovery process is finished correctly
       
    73      *                 1 - if discovery was not finished correctly
       
    74      *                 2 - if discovery is in progress
       
    75      */
       
    76     virtual TInt ServiceDescriptionL( CUpnpHttpMessage* aMsg ) = 0;
       
    77 
       
    78     /**
       
    79      * Get currently processed device.
       
    80      *
       
    81      * @since S60 v5.0
       
    82      * @return Pointer to processed device
       
    83      */
       
    84     CUpnpDevice* GetTargetDevice();
       
    85 
       
    86     /**
       
    87      * Get currently processed device, if it is inclomplete one.
       
    88      *
       
    89      * @since S60 v5.0
       
    90      * @return Pointer to processed device
       
    91      */
       
    92     virtual CUpnpDevice* GetIncompliteRootDevice() = 0;
       
    93 
       
    94     /**
       
    95      * Set target device as null.
       
    96      *
       
    97      * @since S60 v5.0
       
    98      */
       
    99     virtual void NullTargetDevice();
       
   100 
       
   101     /**
       
   102      * Delete target device.
       
   103      *
       
   104      * @since S60 v5.0
       
   105      */
       
   106     virtual void DeleteTargetDevice();
       
   107 
       
   108     /**
       
   109      * Return incorect uuids
       
   110      *
       
   111      * @since S60 v5.0
       
   112      * @return Uuids pointer
       
   113      */
       
   114     const TPtrC8 FailedUuidsL();
       
   115 
       
   116     /**
       
   117      * Append discovered devices to array
       
   118      *
       
   119      * @since S60 v5.0
       
   120      * @param aArray array where devices should be appended
       
   121      * @param aRemove determines if already discovered devices should be deleted from iAllDevicesInRoot array
       
   122      */
       
   123     virtual void GetDiscoveredDeviceL(
       
   124         RPointerArray<CUpnpDevice>& aArray, TBool aRemove = EFalse ) = 0;
       
   125 
       
   126     /**
       
   127      * Append not discovered (does not match the type) devices to array
       
   128      *
       
   129      * @since S60 v5.0
       
   130      * @param aArray array where devices should be appended
       
   131      * @param aRemove determines if already discovered devices should be deleted from iNotNeededDevices array
       
   132      */
       
   133     virtual void GetUnnededDeviceL(
       
   134         RPointerArray<CUpnpDevice>& aArray, TBool aRemove = EFalse ) = 0;
       
   135 
       
   136     /**
       
   137      * Append discovered but not metching target types devices to array
       
   138      *
       
   139      * @since S60 v5.0
       
   140      * @param aArray array where devices should be appended
       
   141      * @param aRemove determines if already discovered devices should be deleted from iDiscoveredDevices array
       
   142      */
       
   143     virtual void GetUninterestingDeviceL(
       
   144         RPointerArray<CUpnpDevice>& aArray, TBool aRemove = EFalse ) = 0;
       
   145 
       
   146     protected:
       
   147     /**
       
   148      * Constructor
       
   149      * @since S60 v5.0
       
   150      */
       
   151     CUpnpCpbDeviceDescription( MUpnpCpbHttpMessageController& aMessanger,
       
   152                               CUpnpCpbDeviceRepository& aRepository );
       
   153 
       
   154     /**
       
   155      * Second phase constructor
       
   156      * @since S60 v5.0
       
   157      */
       
   158     virtual void ConstructL();
       
   159 
       
   160     /**
       
   161      * Add next uuid to uuid list
       
   162      * @since S60 v5.0
       
   163      * @param aUuid Uuid that should be added
       
   164      */
       
   165     void AddToUuidsL( const TDesC8& aUuid );
       
   166 
       
   167     /**
       
   168      * Get next service that should be discovered
       
   169      * @param aDevice
       
   170      * @return service description url
       
   171      */
       
   172     const TPtrC8 GetNextServiceType( CUpnpDevice* aDevice );
       
   173 
       
   174     protected:
       
   175     // incorrect uuids
       
   176     RBuf8 iUuids;
       
   177     // Current processed root device. NOT OWNED
       
   178     CUpnpDevice* iRootDevice;
       
   179     // Sax parsers for service description
       
   180     CUpnpContentHandlersController* iSaxController;
       
   181     // Current state of discovery engine
       
   182     TInt iResult;
       
   183     // Massenger handling HTTP messages. NOT OWNED
       
   184     MUpnpCpbHttpMessageController& iMessanger;
       
   185     // device repository, not owned
       
   186     CUpnpCpbDeviceRepository& iRepository;
       
   187     };
       
   188 
       
   189 #endif // C_CUPNPCPBDEVICEDESCRIPTION_H