epoc32/include/mw/cmdestination.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:  Destination interface class.
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
#ifndef DESTINATION_H
williamr@2
    19
#define DESTINATION_H
williamr@2
    20
williamr@2
    21
// System includes
williamr@2
    22
#include <cmconnectionmethod.h>
williamr@2
    23
#include <cmmanagerdef.h>
williamr@4
    24
#include <e32def.h>
williamr@2
    25
#include <e32base.h>
williamr@2
    26
#include <metadatabase.h>
williamr@2
    27
williamr@2
    28
// FORWARD DECLARATIONS
williamr@2
    29
class CCmManagerImpl;
williamr@2
    30
class CCmDestinationData;
williamr@2
    31
class CGulIcon;
williamr@2
    32
williamr@2
    33
/**
williamr@2
    34
 *  RCmDestination is for setting/getting values of a network destination.
williamr@2
    35
 *
williamr@2
    36
 *  @lib cmmanager.lib
williamr@2
    37
 *  @since S60 v3.2
williamr@2
    38
 */
williamr@2
    39
NONSHARABLE_CLASS(RCmDestination)
williamr@2
    40
    {
williamr@2
    41
    //=====================================================================
williamr@2
    42
    // Constructors/Destructors
williamr@2
    43
    // 
williamr@2
    44
    public:
williamr@2
    45
    
williamr@2
    46
        /** Default constructor. */
williamr@2
    47
        IMPORT_C RCmDestination();
williamr@2
    48
williamr@2
    49
        IMPORT_C ~RCmDestination();
williamr@2
    50
williamr@2
    51
        IMPORT_C RCmDestination(const RCmDestination& aCmDestination);
williamr@2
    52
        
williamr@2
    53
    //=====================================================================
williamr@2
    54
    // API functions
williamr@2
    55
    public:
williamr@2
    56
williamr@2
    57
        /**
williamr@2
    58
        * Close the session.
williamr@2
    59
        *
williamr@2
    60
        * @since S60 3.2
williamr@2
    61
        */
williamr@2
    62
        IMPORT_C void Close();
williamr@2
    63
            
williamr@2
    64
        /**
williamr@2
    65
        * Returns the number of connection methods of the destination
williamr@2
    66
        *
williamr@2
    67
        * @since 3.2
williamr@2
    68
        * @return the number of connection methods belonging to a destination        
williamr@2
    69
        */                 
williamr@2
    70
        IMPORT_C TInt ConnectionMethodCount() const;
williamr@2
    71
        
williamr@2
    72
        /**
williamr@2
    73
        * Returns a reference to the connection method. 
williamr@2
    74
        * The index must be less than the return value of 
williamr@2
    75
        * ConnectionMethodCount().
williamr@2
    76
        *
williamr@2
    77
        * @since 3.2
williamr@2
    78
        * @param anIndex
williamr@2
    79
        * @return a connection method
williamr@2
    80
        */        
williamr@2
    81
        IMPORT_C RCmConnectionMethod ConnectionMethodL( TInt anIndex ) const;
williamr@2
    82
williamr@2
    83
        /**
williamr@2
    84
        * Returns the connection method with the ECmId.
williamr@2
    85
        * Leaves with KErrNotFound if not found.
williamr@2
    86
        * @param aCmId unique id of the requested connection method.
williamr@2
    87
        * @return connection method
williamr@2
    88
        */
williamr@2
    89
        IMPORT_C RCmConnectionMethod ConnectionMethodByIDL( 
williamr@2
    90
                                                        TInt aCmId ) const;
williamr@2
    91
williamr@2
    92
        /**
williamr@2
    93
        * Return the priority of the passed connection method
williamr@2
    94
        *
williamr@2
    95
        * @since 3.2
williamr@2
    96
        * @param aCCMItem connection method
williamr@2
    97
        * @return the priority of the queried connection method 
williamr@2
    98
        */
williamr@2
    99
        IMPORT_C TUint PriorityL(const RCmConnectionMethod& aCCMItem ) const;
williamr@2
   100
        
williamr@2
   101
        //Getting attributes
williamr@2
   102
williamr@2
   103
        /**
williamr@2
   104
        * Returns the destination's Name attribute
williamr@2
   105
        * HBuf ownership is passed to the caller
williamr@2
   106
        *
williamr@2
   107
        * @since 3.2
williamr@2
   108
        * @return HBufC* Passes returned value's ownership to the caller
williamr@2
   109
        */      
williamr@2
   110
        IMPORT_C HBufC* NameLC() const;                        
williamr@2
   111
        
williamr@2
   112
        /**
williamr@2
   113
        * Returns the destination's Id attribute
williamr@2
   114
        *
williamr@2
   115
        * @since 3.2
williamr@2
   116
        * @return the destination's id
williamr@2
   117
        */                    
williamr@2
   118
        IMPORT_C TUint32 Id() const;
williamr@2
   119
        
williamr@2
   120
        /**
williamr@2
   121
        * Returns the destination's ElementId attribute
williamr@2
   122
        *
williamr@2
   123
        * @since 3.2
williamr@2
   124
        * @return the destination's element id        
williamr@2
   125
        */            
williamr@2
   126
        IMPORT_C TUint32 ElementId() const;        
williamr@2
   127
                
williamr@2
   128
        /**
williamr@2
   129
        * Returns the Icon pointer
williamr@2
   130
        * This function leaves if the client does not have a valid UI context
williamr@2
   131
        *
williamr@2
   132
        * @since 3.2
williamr@2
   133
        * @return the destination icon  
williamr@2
   134
        */ 
williamr@2
   135
        IMPORT_C CGulIcon* IconL() const;
williamr@2
   136
williamr@2
   137
        /**
williamr@2
   138
        * Returns the Metadata
williamr@2
   139
        *
williamr@2
   140
        * @since 3.2
williamr@2
   141
        * @param aMetaField the meta data field to query
williamr@2
   142
        * @return the value of the requested field        
williamr@2
   143
        */            
williamr@2
   144
        IMPORT_C TUint32 MetadataL( CMManager::TSnapMetadataField aMetaField ) const;
williamr@2
   145
    
williamr@2
   146
        /**
williamr@2
   147
        * Return the protection level of the destination.
williamr@2
   148
        *
williamr@2
   149
        * @since 3.2              
williamr@2
   150
        * @return protection level of the destination
williamr@2
   151
        */
williamr@2
   152
        IMPORT_C CMManager::TProtectionLevel ProtectionLevel() const;
williamr@2
   153
williamr@2
   154
        /**
williamr@2
   155
        * Returns if there's a connection created with any of the destination's
williamr@2
   156
        * connection method.
williamr@2
   157
        *
williamr@2
   158
        * @since 3.2        
williamr@2
   159
        * @return ETrue if there's a connection with any of the destination's
williamr@2
   160
        * connection method.
williamr@2
   161
        */
williamr@2
   162
        IMPORT_C TBool IsConnectedL() const;
williamr@2
   163
        
williamr@2
   164
        /**
williamr@2
   165
        * Returns whether the destination is hidden or not.
williamr@2
   166
        *
williamr@2
   167
        * @since 3.2
williamr@2
   168
        * @return ETrue if the destination is hidden
williamr@2
   169
        */
williamr@2
   170
        IMPORT_C TBool IsHidden() const;
williamr@2
   171
williamr@2
   172
        /**
williamr@2
   173
        * checks if destinations are the same 
williamr@2
   174
        * 
williamr@2
   175
        * @since S60 3.2
williamr@2
   176
        * @param aDestination the destination being compared
williamr@2
   177
        * @return ETrue if the destinations are the same
williamr@2
   178
        */
williamr@2
   179
        IMPORT_C TBool operator==(const RCmDestination& aDestination ) const;
williamr@2
   180
        
williamr@2
   181
        /**
williamr@2
   182
        * checks if destinations are not the same 
williamr@2
   183
        * 
williamr@2
   184
        * @since S60 3.2
williamr@2
   185
        * @param aDestination the destination being compared
williamr@2
   186
        * @return ETrue if the destinations are different
williamr@2
   187
        */
williamr@2
   188
        IMPORT_C TBool operator!=(const RCmDestination& aDestination ) const;
williamr@2
   189
williamr@2
   190
        /**
williamr@2
   191
        * assignment operator 
williamr@2
   192
        * 
williamr@2
   193
        * @since S60 3.2
williamr@2
   194
        * @param aDestination the destination being compared
williamr@2
   195
        * @return RCmDestination
williamr@2
   196
        */
williamr@2
   197
        IMPORT_C RCmDestination& operator=(const RCmDestination& 
williamr@2
   198
                                                    aCmDestination);
williamr@2
   199
williamr@2
   200
                /**
williamr@2
   201
        * Create a connection method that belongs to this destination.
williamr@2
   202
        * @param aImplementationUid - implementation uid (bearer type) of the 
williamr@2
   203
        * connection method to be created
williamr@2
   204
        * @return newly created connection method
williamr@2
   205
        */
williamr@2
   206
        IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType );
williamr@2
   207
williamr@2
   208
        /*
williamr@2
   209
        * Adds an existing connection method to a destination
williamr@2
   210
        * @param aConnectionMethod Connection method to be added
williamr@2
   211
        * @return index in the Connection Method list
williamr@2
   212
        */
williamr@2
   213
        IMPORT_C TInt AddConnectionMethodL( RCmConnectionMethod aConnectionMethod );            
williamr@2
   214
williamr@2
   215
        /*
williamr@2
   216
        * Embeds an existing destination into this destination.
williamr@2
   217
        * @param RCmDestination - Destination to be embedded
williamr@2
   218
        * @return TInt - index in the Connection Method list
williamr@2
   219
        */
williamr@2
   220
        IMPORT_C TInt AddEmbeddedDestinationL( const RCmDestination& aDestination );     
williamr@2
   221
williamr@2
   222
        /**
williamr@2
   223
        * Remove a connection method from a destination and delete it
williamr@2
   224
        * on update. 
williamr@2
   225
        * Exception: conenction method is not deleted  if it's referenced 
williamr@2
   226
        * from any other destination.
williamr@2
   227
        * @param aConnectionMethod the connection method to be deleted.
williamr@2
   228
        */
williamr@2
   229
        IMPORT_C void DeleteConnectionMethodL( RCmConnectionMethod& aConnectionMethod );
williamr@2
   230
williamr@2
   231
        /**
williamr@2
   232
        * Remove connection method from the destination
williamr@2
   233
        * @param aConnectionMethod connection method to be removed
williamr@2
   234
        */
williamr@2
   235
        IMPORT_C void RemoveConnectionMethodL( RCmConnectionMethod aConnectionMethod );
williamr@2
   236
williamr@2
   237
williamr@2
   238
        /**
williamr@2
   239
        * Set the connection method's priority based on the passed index.
williamr@2
   240
        * @param aCCMItem the connection method item
williamr@2
   241
        * @param aIndex the new priority of the connection method in the 
williamr@2
   242
        * destination
williamr@2
   243
        */
williamr@2
   244
        IMPORT_C void ModifyPriorityL( RCmConnectionMethod& aCCMItem, 
williamr@2
   245
                                       TUint aIndex );
williamr@2
   246
williamr@2
   247
        /**
williamr@2
   248
        * Set the destination's name
williamr@2
   249
        * @param aDestinationName new name of the destination
williamr@2
   250
        */
williamr@2
   251
        IMPORT_C void SetNameL( const TDesC& aName );
williamr@2
   252
williamr@2
   253
        /**
williamr@2
   254
        * Set the destination's icon index.
williamr@2
   255
        * This fucton leaves if the client does not have a valid UI context
williamr@2
   256
        * @param aIconIndex new icon index of the destination
williamr@2
   257
        */
williamr@2
   258
        IMPORT_C void SetIconL( TUint32 anIndex );
williamr@2
   259
williamr@2
   260
        /**
williamr@2
   261
        * Set the Metadata
williamr@2
   262
        * @param aMetaField field to be modified
williamr@2
   263
        * @param aValue value to be set
williamr@2
   264
        */            
williamr@2
   265
        IMPORT_C void SetMetadataL( CMManager::TSnapMetadataField aMetaField, 
williamr@2
   266
                                    TUint32 aValue );
williamr@2
   267
williamr@2
   268
        /**
williamr@2
   269
        * Set the protection level of the destination.
williamr@2
   270
        * @param aProtLevel new protection level 
williamr@2
   271
        */
williamr@2
   272
        IMPORT_C void SetProtectionL( CMManager::TProtectionLevel aProtLevel );
williamr@2
   273
williamr@2
   274
        /**
williamr@2
   275
        * Set if the destination is hidden or not.
williamr@2
   276
        * @param aHidden - ETrue if destination is hidden
williamr@2
   277
        */
williamr@2
   278
        IMPORT_C void SetHiddenL( TBool aHidden );         
williamr@2
   279
williamr@2
   280
        /**
williamr@2
   281
        * Update all values of the destination and its connection method.
williamr@2
   282
        * Nothing if stored, if update leaves due to any reason.
williamr@2
   283
        */
williamr@2
   284
        IMPORT_C void UpdateL();               
williamr@2
   285
williamr@2
   286
        /**
williamr@2
   287
        * Delete destination and its connection methods from CommsDat.
williamr@2
   288
        * Connection methods that belong to other destination, too, are
williamr@2
   289
        * not deleted.
williamr@2
   290
        */
williamr@2
   291
        IMPORT_C void DeleteLD();
williamr@2
   292
williamr@2
   293
        /**
williamr@2
   294
        * Create a connection method with given id that belongs to this destination.
williamr@2
   295
        * @param aImplementationUid - implementation uid (bearer type) of the 
williamr@2
   296
        * connection method to be created
williamr@2
   297
        * @return newly created connection method or leaves with
williamr@2
   298
        * KErrAlreadyExists if there exists CM with the same Id.
williamr@2
   299
        */
williamr@2
   300
        IMPORT_C RCmConnectionMethod CreateConnectionMethodL( TUint32 aBearerType,
williamr@2
   301
                                                              TUint32 aConnMethId );
williamr@2
   302
williamr@2
   303
williamr@2
   304
    //=======================================================================
williamr@2
   305
    // Member variables
williamr@2
   306
    //
williamr@2
   307
    private: 
williamr@2
   308
        
williamr@2
   309
        /**
williamr@2
   310
         * the implementation class
williamr@2
   311
         */
williamr@2
   312
        CCmDestinationData* iDestinatonData;
williamr@2
   313
williamr@2
   314
    private:
williamr@2
   315
    
williamr@2
   316
        friend class RCmManager;
williamr@2
   317
        friend class RCmConnectionMethod;
williamr@2
   318
    };
williamr@2
   319
    
williamr@2
   320
williamr@2
   321
#endif // DESTINATION_H