localconnectivityservice/locod/inc/locodservice.h
author hgs
Fri, 15 Oct 2010 15:05:57 +0800
changeset 54 4dc88a4ac6f4
parent 29 3ae5cb0b4c02
permissions -rw-r--r--
201041_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     1
/*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     3
* All rights reserved.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     8
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
     9
* Initial Contributors:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    11
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    12
* Contributors:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    13
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    14
* Description:  A service which constains a service plugin and its status.
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    15
*
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    16
*/
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    17
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    18
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    19
#ifndef C_LOCODSERVICE_H
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    20
#define C_LOCODSERVICE_H
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    21
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    22
#include <e32base.h>
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    23
#include <startupdomainpskeys.h>
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    24
#include <locodbearerpluginobserver.h>
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    25
#include <locodservicepluginobserver.h>
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    26
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    27
class CLocodServicePlugin;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    28
class TLocodServiceRequest;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    29
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    30
/**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    31
 *  Specific service that is managed by locod
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    32
 *   Locod creates all service and add it to 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    33
 *   a an array
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    34
 *  @ euser.lib
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    35
 *  @since S60 3.2
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    36
 */        
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    37
class CLocodService : public CBase
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    38
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    39
public:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    40
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    41
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    42
     *  Factory function
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    43
     * @since S60 3.2
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    44
     * @param aPlugin  the sevice plug ins that will be managed (for example DUN, obex)
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    45
     * @return an instance of CLocodService
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    46
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    47
    static CLocodService* NewL(CLocodServicePlugin& aPlugin);
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    48
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    49
    ~CLocodService();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    50
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    51
    CLocodServicePlugin& Plugin();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    52
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    53
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    54
     *  Called to manage service when the bearer status has been changed
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    55
     * @since S60 3.2
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    56
     * @param aBearer  the bearer whose status has been changed
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    57
     * @param aStatus  status of the bearer connected, disconnected or on or off
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    58
     * @return  TInt
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    59
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    60
    TInt ManageService(TLocodBearer aBearer, 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    61
        TBool aStatus); 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    62
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    63
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    64
     *  Called when the service has been managed by service plug ins
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    65
     * @since S60 3.2
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    66
     * @param aBearer  the bearer whose service has been managed
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    67
     * @param aStatus  status of the bearer connected, disconnected or on or off
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    68
     * @param err   error code that may occured during managing the service
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    69
     * @return  TInt
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    70
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    71
    void ManageServiceCompleted(TLocodBearer aBearer, 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    72
        TBool aStatus,
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    73
        TInt err); 
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    74
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    75
    /**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    76
     *  Check if there are any service pending
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    77
     * @since S60 3.2
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    78
     * @return  TBool if there are service pending
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    79
     */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    80
    TBool HasServiceToManage() const;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    81
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    82
private:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    83
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    84
    CLocodService(CLocodServicePlugin& aPlugin);
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    85
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    86
    void ConstructL();
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    87
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    88
private:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    89
    // the service plugin, owned
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    90
    CLocodServicePlugin* iPlugin;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    91
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    92
    // The latest status of this service plugin
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    93
    TInt iServiceStatus;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    94
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    95
    // Queue of ManageService request
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    96
    RArray<TLocodServiceRequest> iRequests;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    97
    };
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    98
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
    99
/**
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   100
 * A ManageService request
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   101
 */
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   102
class TLocodServiceRequest
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   103
    {
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   104
public:
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   105
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   106
    TLocodServiceRequest(TLocodBearer aBearer, TBool aStatus);
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   107
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   108
    // The bearer whose status has changed
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   109
    TLocodBearer iBearer;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   110
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   111
    // The new bearer status
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   112
    TBool iStatus;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   113
    
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   114
    // The request status
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   115
    TBool iRequesting;
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   116
    };
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   117
3ae5cb0b4c02 201025_07
hgs
parents:
diff changeset
   118
#endif // C_LOCODSERVICE_H